libinstpatch-1.0.0/0000777000175000017500000000000011461404255011203 500000000000000libinstpatch-1.0.0/NEWS0000644000175000017500000000010511456655763011632 00000000000000 2003-10-03: NEWS FLASH! libInstPatch gets its own CVS repository :) libinstpatch-1.0.0/tests/0000777000175000017500000000000011461404256012346 500000000000000libinstpatch-1.0.0/tests/Makefile.in0000644000175000017500000004643311461360570014341 00000000000000# Makefile.in generated by automake 1.11 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@ TESTS = sample_test$(EXEEXT) sample_list_test$(EXEEXT) check_PROGRAMS = sample_test$(EXEEXT) sample_list_test$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/python.m4 \ $(top_srcdir)/acinclude.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)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_sample_list_test_OBJECTS = sample_list_test.$(OBJEXT) sample_list_test_OBJECTS = $(am_sample_list_test_OBJECTS) sample_list_test_DEPENDENCIES = \ $(top_srcdir)/libinstpatch/libinstpatch-1.0.la am_sample_test_OBJECTS = sample_test.$(OBJEXT) sample_test_OBJECTS = $(am_sample_test_OBJECTS) sample_test_DEPENDENCIES = \ $(top_srcdir)/libinstpatch/libinstpatch-1.0.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) 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 = $(sample_list_test_SOURCES) $(sample_test_SOURCES) DIST_SOURCES = $(sample_list_test_SOURCES) $(sample_test_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ IPATCH_BINARY_AGE = @IPATCH_BINARY_AGE@ IPATCH_INTERFACE_AGE = @IPATCH_INTERFACE_AGE@ IPATCH_VERSION = @IPATCH_VERSION@ IPATCH_VERSION_MAJOR = @IPATCH_VERSION_MAJOR@ IPATCH_VERSION_MICRO = @IPATCH_VERSION_MICRO@ IPATCH_VERSION_MINOR = @IPATCH_VERSION_MINOR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ 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@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ PYGTK_CODEGEN_DIR = @PYGTK_CODEGEN_DIR@ PYGTK_LIBS = @PYGTK_LIBS@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ SNDFILE_LIBS = @SNDFILE_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ 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@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ 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@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ sample_test_SOURCES = sample_test.c sample_test_LDADD = $(top_srcdir)/libinstpatch/libinstpatch-1.0.la sample_list_test_SOURCES = sample_list_test.c sample_list_test_LDADD = $(top_srcdir)/libinstpatch/libinstpatch-1.0.la INCLUDES = -I$(top_srcdir) @GOBJECT_CFLAGS@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(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 tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list sample_list_test$(EXEEXT): $(sample_list_test_OBJECTS) $(sample_list_test_DEPENDENCIES) @rm -f sample_list_test$(EXEEXT) $(LINK) $(sample_list_test_OBJECTS) $(sample_list_test_LDADD) $(LIBS) sample_test$(EXEEXT): $(sample_test_OBJECTS) $(sample_test_DEPENDENCIES) @rm -f sample_test$(EXEEXT) $(LINK) $(sample_test_OBJECTS) $(sample_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample_list_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample_test.Po@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-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: 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-checkPROGRAMS clean-generic clean-libtool \ 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-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: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir 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-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 # 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: libinstpatch-1.0.0/tests/sample_test.c0000644000175000017500000001556411461332136014756 00000000000000/* * sample_test.c - Sample audio conversion tests * * Tests every combination of audio format conversions (484 combinations). * This is done by creating a double audio format triangle waveform and then * for each transformation format pair, converting this waveform to the * first format, then the second, then back to double again and comparing * against the original. * * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * 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., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA or point your web browser to http://www.gnu.org. */ #include #define DEFAULT_AUDIO_SIZE (32 * 1024) /* default test waveform size in samples */ #define WAVEFORM_PERIOD 1684 /* something to exercise LSB bytes too */ #define MAX_DIFF_ALLOWED 0.016 /* maximum difference allowed */ #define WAVEFORM_QUARTER (WAVEFORM_PERIOD / 4) /* all available sample format combinations */ int testformats[] = { IPATCH_SAMPLE_8BIT, IPATCH_SAMPLE_16BIT, IPATCH_SAMPLE_24BIT, IPATCH_SAMPLE_32BIT, IPATCH_SAMPLE_FLOAT, IPATCH_SAMPLE_DOUBLE, IPATCH_SAMPLE_REAL24BIT, IPATCH_SAMPLE_8BIT | IPATCH_SAMPLE_UNSIGNED, IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_UNSIGNED, IPATCH_SAMPLE_24BIT | IPATCH_SAMPLE_UNSIGNED, IPATCH_SAMPLE_32BIT | IPATCH_SAMPLE_UNSIGNED, IPATCH_SAMPLE_REAL24BIT | IPATCH_SAMPLE_UNSIGNED, IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_BENDIAN, IPATCH_SAMPLE_24BIT | IPATCH_SAMPLE_BENDIAN, IPATCH_SAMPLE_32BIT | IPATCH_SAMPLE_BENDIAN, IPATCH_SAMPLE_FLOAT | IPATCH_SAMPLE_BENDIAN, IPATCH_SAMPLE_DOUBLE | IPATCH_SAMPLE_BENDIAN, IPATCH_SAMPLE_REAL24BIT | IPATCH_SAMPLE_BENDIAN, IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_UNSIGNED | IPATCH_SAMPLE_BENDIAN, IPATCH_SAMPLE_24BIT | IPATCH_SAMPLE_UNSIGNED | IPATCH_SAMPLE_BENDIAN, IPATCH_SAMPLE_32BIT | IPATCH_SAMPLE_UNSIGNED | IPATCH_SAMPLE_BENDIAN, IPATCH_SAMPLE_REAL24BIT | IPATCH_SAMPLE_UNSIGNED | IPATCH_SAMPLE_BENDIAN }; #define SAMPLE_FORMAT_COUNT G_N_ELEMENTS (testformats) static int test_size = DEFAULT_AUDIO_SIZE; static gboolean verbose = FALSE; static GOptionEntry entries[] = { { "size", 's', 0, G_OPTION_ARG_INT, &test_size, "Size of test waveform in samples (default=32768)", NULL }, { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL }, { NULL } }; int main (int argc, char *argv[]) { IpatchSampleTransform *trans; gpointer srctrans, desttrans; double *dwave, *fintrans; guint periodpos; int srcform, destform; int isrc, idest; double d, maxdiff; int i, maxindex, failcount = 0; GError *error = NULL; GOptionContext *context; context = g_option_context_new ("- test libInstPatch sample format conversions"); g_option_context_add_main_entries (context, entries, "sample_test"); if (!g_option_context_parse (context, &argc, &argv, &error)) { printf ("Failed to parse command line arguments: %s\n", ipatch_gerror_message (error)); return 1; } g_option_context_free (context); ipatch_init (); dwave = g_new (double, test_size); /* allocate audio buffer (double format) */ srctrans = g_malloc (8 * test_size); /* source format transform buf */ desttrans = g_malloc (8 * test_size); /* destination format transform buf */ fintrans = g_malloc (8 * test_size); /* final transform buf */ /* create sample transform object and allocate its buffer */ trans = ipatch_sample_transform_new (0, 0, 0); ipatch_sample_transform_alloc_size (trans, 32 * 1024); /* generate triangle waveform */ for (i = 0; i < test_size; i++) { periodpos = i % WAVEFORM_PERIOD; if (periodpos <= WAVEFORM_QUARTER) dwave[i] = periodpos / (double)WAVEFORM_QUARTER; else if (periodpos <= WAVEFORM_QUARTER * 3) dwave[i] = -((periodpos - WAVEFORM_QUARTER) / (double)WAVEFORM_QUARTER - 1.0); else dwave[i] = (periodpos - WAVEFORM_QUARTER * 3) / (double)WAVEFORM_QUARTER - 1.0; } /* Convert between all possible format pairs using the following steps: * - Convert double to first format of format pair * - Convert from first format to second format * - Convert second format back to double * - Calculate maximum sample difference between new double audio and original */ for (isrc = 0; isrc < SAMPLE_FORMAT_COUNT; isrc++) { srcform = testformats[isrc]; for (idest = 0; idest < SAMPLE_FORMAT_COUNT; idest++) { destform = testformats[idest]; /* convert double waveform to source format */ ipatch_sample_transform_set_formats (trans, IPATCH_SAMPLE_DOUBLE | IPATCH_SAMPLE_ENDIAN_HOST, srcform, IPATCH_SAMPLE_UNITY_CHANNEL_MAP); ipatch_sample_transform_convert (trans, dwave, srctrans, test_size); /* convert source format to destination format */ ipatch_sample_transform_set_formats (trans, srcform, destform, IPATCH_SAMPLE_UNITY_CHANNEL_MAP); ipatch_sample_transform_convert (trans, srctrans, desttrans, test_size); /* convert destination format to final double output */ ipatch_sample_transform_set_formats (trans, destform, IPATCH_SAMPLE_DOUBLE | IPATCH_SAMPLE_ENDIAN_HOST, IPATCH_SAMPLE_UNITY_CHANNEL_MAP); ipatch_sample_transform_convert (trans, desttrans, fintrans, test_size); /* compare final waveform against original */ for (i = 0, maxdiff = 0.0, maxindex = 0; i < test_size; i++) { d = dwave[i] - fintrans[i]; if (d < 0.0) d = -d; if (d > maxdiff) { maxdiff = d; maxindex = i; } } if (verbose) printf ("Convert format %03x to %03x%s: maxdiff=%0.6f, sample=%d\n", srcform, destform, maxdiff > MAX_DIFF_ALLOWED ? " FAILED" : "", maxdiff, maxindex); if (maxdiff > MAX_DIFF_ALLOWED) { if (!verbose) printf ("Convert format %03x to %03x FAILED: maxdiff=%0.6f, sample=%d\n", srcform, destform, maxdiff, maxindex); failcount++; } } } ipatch_sample_transform_free (trans); g_free (dwave); g_free (srctrans); g_free (desttrans); g_free (fintrans); if (failcount > 0) { printf ("%d of %d format conversions FAILED\n", failcount, SAMPLE_FORMAT_COUNT * SAMPLE_FORMAT_COUNT); return 1; } printf ("All %d sample format conversions PASSED\n", SAMPLE_FORMAT_COUNT * SAMPLE_FORMAT_COUNT); return 0; } libinstpatch-1.0.0/tests/sample_list_test.c0000644000175000017500000001502111461332142015772 00000000000000/* * sample_list_test.c - Tests sample edit lists and virtual sample store * * - Creates double stereo format test waveform with triangle wave in left * channel and sine wave in right channel * - Re-constructs both channels using 2 sample lists using various list * operations * - Creates virtual sample store using double stereo format with left * and right sample lists * - Duplicates virtual sample store to a double stereo format store * - Compares final duplicated store to original waveform and makes sure its * the same * * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * 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., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA or point your web browser to http://www.gnu.org. */ #include #include #define DEFAULT_AUDIO_SIZE (32 * 1024) /* default test waveform size in samples */ #define WAVEFORM_PERIOD 1684 /* something to exercise LSB bytes too */ #define MAX_DIFF_ALLOWED 0.0 /* maximum difference allowed */ #define WAVEFORM_QUARTER (WAVEFORM_PERIOD / 4) static int test_size = DEFAULT_AUDIO_SIZE; static gboolean verbose = FALSE; static GOptionEntry entries[] = { { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL }, { NULL } }; int main (int argc, char *argv[]) { IpatchSampleStore *store, *vstore, *finstore; IpatchSampleList *rlist, *llist; IpatchSampleData *data, *vdata; double *dwave, *findata; guint periodpos; double d, maxdiff; int i, maxindex; GError *error = NULL; GOptionContext *context; int test_size_q; context = g_option_context_new ("- test libInstPatch sample edit list functions"); g_option_context_add_main_entries (context, entries, "sample_list_test"); if (!g_option_context_parse (context, &argc, &argv, &error)) { printf ("Failed to parse command line arguments: %s\n", ipatch_gerror_message (error)); return 1; } g_option_context_free (context); test_size_q = test_size / 4; /* test size quarter */ ipatch_init (); /* allocate audio buffer (double format stereo) */ dwave = g_new (double, test_size * 2); /* ++ alloc */ /* generate triangle waveform for left channel and sine wave for right */ for (i = 0; i < test_size * 2; i += 2) { periodpos = i % WAVEFORM_PERIOD; if (periodpos <= WAVEFORM_QUARTER) dwave[i] = periodpos / (double)WAVEFORM_QUARTER; else if (periodpos <= WAVEFORM_QUARTER * 3) dwave[i] = -((periodpos - WAVEFORM_QUARTER) / (double)WAVEFORM_QUARTER - 1.0); else dwave[i] = (periodpos - WAVEFORM_QUARTER * 3) / (double)WAVEFORM_QUARTER - 1.0; dwave[i + 1] = sin ((periodpos / (double)WAVEFORM_PERIOD) * G_PI * 2.0); } data = ipatch_sample_data_new (test_size); /* ++ ref */ /* ++ ref - create sample store object for original waveform */ store = ipatch_sample_store_new (IPATCH_TYPE_SAMPLE_STORE_RAM, data, "format", IPATCH_SAMPLE_DOUBLE | IPATCH_SAMPLE_STEREO | IPATCH_SAMPLE_ENDIAN_HOST, "location", dwave, "active", TRUE, NULL); rlist = ipatch_sample_list_new (); /* re-construct right channel in a very inefficient way ;) */ ipatch_sample_list_prepend (rlist, store, test_size_q * 2, test_size_q, IPATCH_SAMPLE_LIST_CHAN_RIGHT); ipatch_sample_list_prepend (rlist, store, 0, test_size_q, IPATCH_SAMPLE_LIST_CHAN_RIGHT); ipatch_sample_list_insert_index (rlist, 1, store, test_size_q, test_size_q, IPATCH_SAMPLE_LIST_CHAN_RIGHT); ipatch_sample_list_append (rlist, store, test_size_q * 3, test_size_q, IPATCH_SAMPLE_LIST_CHAN_RIGHT); /* cut a segment out which overlaps segments and then re-insert the cut seg */ ipatch_sample_list_cut (rlist, test_size_q + test_size_q / 2, test_size_q); ipatch_sample_list_insert (rlist, test_size_q + test_size_q / 2, store, test_size_q + test_size_q / 2, test_size_q, IPATCH_SAMPLE_LIST_CHAN_RIGHT); llist = ipatch_sample_list_new (); /* have fun with left channel too */ ipatch_sample_list_append (llist, store, 0, test_size, IPATCH_SAMPLE_LIST_CHAN_LEFT); ipatch_sample_list_cut (llist, test_size_q, test_size_q); ipatch_sample_list_insert (llist, test_size_q, store, test_size_q, test_size_q, IPATCH_SAMPLE_LIST_CHAN_LEFT); vdata = ipatch_sample_data_new (test_size); /* ++ ref */ /* ++ ref - create virtual store from left and right sample lists */ vstore = ipatch_sample_store_new (IPATCH_TYPE_SAMPLE_STORE_VIRTUAL, vdata, "format", IPATCH_SAMPLE_DOUBLE | IPATCH_SAMPLE_STEREO | IPATCH_SAMPLE_ENDIAN_HOST, NULL); ipatch_sample_store_virtual_set_list (vstore, 0, llist); ipatch_sample_store_virtual_set_list (vstore, 1, rlist); ipatch_sample_store_activate (vstore); /* ++ ref - Duplicate store to render final waveform */ finstore = ipatch_sample_store_duplicate (vstore, IPATCH_TYPE_SAMPLE_STORE_RAM, IPATCH_SAMPLE_DOUBLE | IPATCH_SAMPLE_STEREO | IPATCH_SAMPLE_ENDIAN_HOST, &error); if (!finstore) { printf ("Failed to create new duplicate sample store: %s", ipatch_gerror_message (error)); return 1; } findata = ipatch_sample_store_RAM_get_location (finstore); /* compare final waveform against original */ for (i = 0, maxdiff = 0.0, maxindex = 0; i < test_size * 2; i++) { d = dwave[i] - findata[i]; if (d < 0.0) d = -d; if (d > maxdiff) { maxdiff = d; maxindex = i; } } /* free up objects and data (for memcheck) */ g_object_unref (data); g_object_unref (vdata); g_object_unref (store); g_object_unref (vstore); g_object_unref (finstore); g_free (dwave); if (maxdiff > MAX_DIFF_ALLOWED) { printf ("Sample list test failed: maxdiff=%0.16f index=%d\n", maxdiff, maxindex); return 1; } if (verbose) printf ("Sample list test passed: maxdiff=%0.16f index=%d\n", maxdiff, maxindex); else printf ("Sample list and virtual sample store test passed\n"); return 0; } libinstpatch-1.0.0/tests/Makefile.am0000644000175000017500000000063211456655762014335 00000000000000## Process this file with automake to produce Makefile.in TESTS = sample_test sample_list_test check_PROGRAMS = sample_test sample_list_test sample_test_SOURCES = sample_test.c sample_test_LDADD = $(top_srcdir)/libinstpatch/libinstpatch-1.0.la sample_list_test_SOURCES = sample_list_test.c sample_list_test_LDADD = $(top_srcdir)/libinstpatch/libinstpatch-1.0.la INCLUDES = -I$(top_srcdir) @GOBJECT_CFLAGS@ libinstpatch-1.0.0/ChangeLog0000644000175000017500000014324411456655763012721 000000000000002008-12-14 Josh Green * libinstpatch/IpatchContainer.c: Updated unpickler callback. * libinstpatch/IpatchPickler.c (ipatch_pickler_default_object_encode_func): Added missing parameter in call to ipatch_pickler_encode_property(). * libinstpatch/IpatchRange.c: Updated unpickler callback. * libinstpatch/IpatchUnpickler.h: Removed some stuff which was causing conflicts with the rest of the pickle headers. Code not yet complete. 2008-12-07 Josh Green * libinstpatch/IpatchPickle.h: Now using IpatchUnpickler (not yet complete). * libinstpatch/IpatchPickler.c: Added create_element parameter to indicate if a surrounding should be created for functions ipatch_pickler_encode_object() ipatch_pickler_encode_property() and ipatch_pickler_encode_property_by_name(). * libinstpatch/IpatchUnpickler.[ch]: New files. Initial unpickler, not yet complete. 2008-08-19 Josh Green * configure.ac: Bumped required glib/gobject version to 2.10. * libinstpatch/IpatchRange.c: Added GValue comparison function. * libinstpatch/IpatchSF2Gen.c (ipatch_sf2_gen_range_intersect): Fixed bug in return value statement. * libinstpatch/IpatchSF2Preset.c: Now doing proper IpatchItem notifies for bank and percussion flag. * libinstpatch/IpatchStrArray.c: New string array boxed type. * libinstpatch/IpatchTypeProp.c: Removed compatibility code with older versions of glib/gobject. * libinstpatch/misc.c: Removed compatibility code with older versions of glib/gobject. * python/ipatch.defs: Updates to Python binding. 2008-03-30 Josh Green * Lots of documentation updates: removed file descriptions from .c files, added gtk-doc file descriptions to .h files and updated Copyright to 1999-2008. * Updated many depricated uses of gobject functions g_value_set_string_take_ownership and g_value_set_boxed_take_ownership. * autogen.sh: Now calling gtkdocize. * configure.ac: GTK_DOC_CHECK is now 1.9. * IpatchConverter.c (ipatch_converter_log_printf): New function to do printf style logging to converter log. * IpatchItem.c (ipatch_item_set_property_override): Added a hack to GObject property set override to handle interface properties, renamed ipatch_item_get_ancestor_type to ipatch_item_get_ancestor_by_type and ipatch_item_peek_ancestor_type to ipatch_item_peek_ancestor_by_type * IpatchSF2Mod.c (ipatch_sf2_mod_list_duplicate): Now reverses the duplicated modulator list, instead of leaving it backwards from original. * IpatchSF2VoiceCache.c (ipatch_sf2_voice_copy): New function to copy a voice structure. * IpatchSF2Writer.c (sfont_write_pgens): Fixed crash bug in relation to switchover to global zone generators now in preset object. Thanks to Frédéric Fournier for pointing this out. * IpatchVBank.[ch]: New virtual bank object. * IpatchVBankInst.[ch]: New virtual bank instrument object. * IpatchVBankRegion.[ch]: New virtual bank region object. * IpatchSF2VoiceCache_VBank.[ch]: New virtual bank SF2 synthesis objects. * python/ipatch.defs: Updated Python binding. 2007-12-15 Josh Green * libinstpatch/IpatchParamProp.h: Added IPATCH_PARAM_NO_SAVE flag to indicate that an object property should not be saved to XML for the object's state. * libinstpatch/IpatchPickle.[ch]: Now contains only the pickle XML encoder/decoder function registration system. * libinstpatch/IpatchPickler.[ch]: New object instance which handles encoding objects/properties/values to XML. * libinstpatch/IpatchContainer.c: Added XML pickle encoder handler for container object types. * libinstpatch/IpatchBase.c: Marked some properties with IPATCH_PARAM_NO_SAVE. * libinstpatch/IpatchItem.c: Marked some properties with IPATCH_PARAM_NO_SAVE. * libinstpatch/IpatchRange.c: Added XML pickle encoder/decoder handlers for IpatchRange boxed type. 2007-11-26 Josh Green * docs/reference/libinstpatch-docs.sgml: Added IpatchSF2GenItem page to API reference index. * libinstpatch/IpatchSF2Gen.[ch]: Split IpatchSF2GenItem interface into separate files. * libinstpatch/IpatchSF2GenItem.[ch]: New home of IpatchSF2GenItem interface. * libinstpatch/IpatchSF2Mod.[ch]: Split IpatchSF2ModItem interface into separate files. * libinstpatch/IpatchSF2ModItem.[ch]: New home of IpatchSF2ModItem interface. * python/ipatch.defs: Fixed declaration of interfaces (IpatchSF2GenItem, IpatchSF2ModItem and IpatchSample) and other updates. 2007-05-10 Josh Green * libinstpatch/IpatchCram.h: Removed format specification from header, its now in an OpenOffice document in the trunk/media folder. * libinstpatch/IpatchTypeProp.c: Fixed bugs with GType related type properties "virtual-parent-type", "virtual-child-type" and "link-type". GType is defined as a gulong, which on 32 bit systems is the same size as a guint (what these properties were previously), on some 64 bit systems though, a gulong is 64 bits while a guint is 32, causing crashes when a corrupted GType lookup attempt is made. Added conditional for using new GType GParamSpecs in 2.10.0, with fallback to gulong. Thanks to Henry Kroll for reporting this. * libinstpatch/ipatch_priv.h: Added GTYPE_PARAM_SUPPORT macro to test for presence of GType param properties. 2007-05-09 Josh Green * libinstpatch/IpatchCramDecoder.[ch]: Added WavPack decoding support. * libinstpatch/IpatchCramEncoder.c: Fixed some bugs with encoder in regards to WavPack. Starting to add segment grouping and save as binary support, but not yet done. 2007-05-03 Josh Green * Switched license of libInstPatch to LGPL 2.1 and updated license text in all source files accordingly. Also updated copyright year. * python/ipatch.override: Added override for next_file() method of IpatchCramDecoder so that the decoder can be used fully in python. * libinstpatch/IpatchCramEncoder.c: Added WavPack support. All FLAC related properties are now prefixed with "flac-". (ipatch_cram_encoder_audio_params_new): Now takes an encoder instance so that the audio encoder type can be initialized from the "default-audio-encoder" property. * README: Updated README. * utils/cram.c: Added WavPack support with switch to choose between FLAC or WavPack. FLAC is still the default, since there is not yet decoding support for WavPack, and there may be other changes before the format is finalized. * libwavpack: Built in WavPack from WavPack 4.40.0. 2007-04-20 Josh Green * configure.ac: Added --disable-python configure option. 2007-04-19 Josh Green * utils/cram.c: Fixed -t test mode, NULL I/O functions were being assigned to the IpatchFile object but the file was not set to "open". Thanks to Dominique Würtz for reporting this problem. 2007-04-18 Josh Green * libinstpatch/misc.c: Removed BUILD_CRAM #ifdef, since CRAM is now always built and that define is no more, which was breaking CRAM converters (including cram utility). Thanks to Dominique Würtz for reporting that there was a problem with cram. 2007-04-06 Josh Green * libinstpatch/IpatchSample.[ch]: Added get_data and set_data methods to the IpatchSample interface for getting and setting sample data as an IpatchSampleData object. New functions ipatch_sample_get_data() ipatch_sample_set_data(), and ipatch_sample_has_data(). * libinstpatch/IpatchSF2Sample.c: Implimented new IpatchSample get_data and set_data methods. 2007-03-21 Josh Green * libinstpatch/IpatchPaste.c: Added ipatch_paste_get_add_list() function to retrieve the list of added paste objects. 2007-03-01 Josh Green * libinstpatch/sample.c: Added verification of channel and channel routing fields to ipatch_sample_format_verify(), fixed bug in ipatch_sample_get_transform_funcs() related to stereo to mono right channel audio conversion. * libinstpatch/ipatch_priv.h: Changed IPATCH_SAMPLE_TRANS_BUFFER_SIZE to 32k instead of 64k (a bit large) and now using for IpatchSampleTransform pool. * libinstpatch/IpatchSampleData.c: Changed ipatch_sample_data_new() to take the size of the sample data object as a parameter. * libinstpatch/IpatchSampleStoreVirtual.c: Changed functions to take IpatchSampleStore pointer instead, to be consistent with other store types. * libinstpatch/IpatchSampleTransform.c: Now using IPATCH_SAMPLE_TRANS_BUFFER_SIZE in ipatch_priv.h for sizes of transforms in pool. * libinstpatch/IpatchSampleStore.c: Added new ipatch_sample_store_new() for added convenience. Converted ipatch_sample_store_copy() to using sample transform pool. * libinstpatch/IpatchSampleList.c: Bug fixes in ipatch_sample_list_render() including a crasher and channel routing related bugs. Added ipatch_sample_list_dump() function for debugging. * libinstpatch/IpatchSampleList.h: Added IPATCH_SAMPLE_LIST_ITEM_GET_CHAN_ROUTE macro for getting channel routing from a sample list item. * libinstpatch/acinclude.m4: Added IPATCH_DEBUG config.h variable for building/including other debug code during compile time. * configure.ac: New sub dir tests/. * Makefile.am: New sub dir tests/. * tests/sample_test.c: Sample audio transform tests. * tests/sample_list_test.c: Sample edit list test. 2007-02-26 Josh Green * libinstpatch/sample.h: Increased the sample width field of the sample format integer to 4 bits to allow for 8 new backwards compatible widths/formats in the future, also increased channel field to 3 bits for future surround sound support (up to 8 channels), * libinstpatch/sample.c: Many many many bug fixes in regards to sample transform functions, thanks to the in progress test suit, modified ipatch_sample_get_transform_funcs() to not allocate but instead store to a caller supplied array with maximum length. * libinstpatch/IpatchSampleList.[ch]: New sample segment lists for doing sample edits, non-destructively. Not yet tested. * libinstpatch/IpatchSampleStoreVirtual.[ch]: Modified to use new IpatchSampleList structure. Not yet tested. * libinstpatch/IpatchSampleTransform.[ch]: Added sample transform pool functionality for fast retrieval of a sample transform object for temporary use without the over head of object creation, transform object should now be fixed in regards to changing format, removed ipatch_sample_transform_set_buffers() since we now enforce that buffers are allocated together to make format changes possible, modified ipatch_sample_transform_convert() to allow source and destination buffers to be specified of any size added ipatch_sample_transform_convert_single() with old style 1 call per buffer conversion. * libinstpatch/IpatchSampleStore.c: Modified ipatch_sample_store_transform_read() and ipatch_sample_store_transform_write() to take an optional buffer parameter which allows for reading/writing of larger sizes than the max frames of the transform object. * libinstpatch/IpatchAudioFile.c: Fixed bugs in regards to floating point audio and 24 bit and added transformations for real 24 bit 3 byte audio and new function ipatch_audio_file_new(). 2007-02-15 Josh Green * Modified build to include version in version sensitive files so that future major versions can be installed in parellel. * libinstpatch/IpatchState*.[ch]: Migrated from libswami, not yet being used, but will be the bases of undo sub system. * libinstpatch/IpatchSF2Preset.c: Removed ipatch_sf2_preset_has_global_zone() since IpatchSF2Preset is now the global zone. * libinstpatch/IpatchPickle.[ch]: XML <> Object pickling, not yet done and inactive. * libinstpatch/IpatchSF2Sample.c: Sample property flags are now being set on which ones affect synthesis and which ones should be real time, also added a sf2voice-update-func to handle real time effect changes. * libinstpatch/IpatchSF2VoiceCache_SF2.c: Removed disabled and outdated realtime generator effect code. Replacing with new generic system. * libinstpatch/misc.c: Removed "sort-children" type flag from all types except preset related ones. * libinstpatch/IpatchSF2VoiceCache.c: Added new ipatch_sf2_voice_cache_update() function for the new real time voice cache update functionality and a sf2voice-update-func type property to register handler functions to specific types. * TODO.tasks: Anjuta-2.1 tasks file for use with Anjuta dev, rocks! * libinstpatch.anjuta: Anjuta-2.1 project file. 2007-01-14 Josh Green * zlib is now required (no longer optional) so CRAM support is always available. Easier than trying to remove CRAM from Pythong binding and builtin_enums. Besides, zlib is rather standard. * acinclude.m4: Modified some of the builtin automake functions so that they don't produce the "underquoted definition" warnings. AM_PATH_ZLIB was defining a main() function with AC_TRY_COMPILE which it already does, causing a nested function which was failing on OSX. 2006-12-28 Josh Green * libinstpatch/IpatchContainer.c: Reverting change of type swap in ipatch_container_get_children() which was not a good idea. 2006-12-22 Josh Green * All IpatchItem "title" property notifies of all items now send at least the new value and sometimes also the old value (when convenient). * Most ipatch_item_changed() calls removed as it is now down automatically through the property notify system. * libinstpatch/IpatchItem.c: Removed item property hook function and replaced with more powerful item property notify system in IpatchItemProp.c, ipatch_item_changed() now implicitly called when an IpatchItem property notify occurs (IPATCH_PARAM_NO_SAVE_CHANGE property flag can be used to indicate that property is not part of saveable state), performance improved, and now doing notify for IpatchBase "changed" property. * libinstpatch/IpatchDLS2Param_tables.c: New file - Initial table data for DLS parameters, not yet completed. * libinstpatch/IpatchItemProp.c: New file - Item property notify system moved from Swami to libinstpatch and improved. * libinstpatch/IpatchContainer_notify.c: New file - Container add/remove notify system moved from Swami to libinstpatch and improved. * libinstpatch/IpatchSF2Inst.c: Converted to using IpatchSF2GenItem and IpatchSF2ModItem interfaces, global zones generators integrated into Instrument (no more global zones). * libinstpatch/IpatchSF2IZone.c: Converted to using IpatchSF2GenItem interface, title notify now depends on linked item title. * libinstpatch/IpatchUnit_generic.c: Wasn't setting unit ID field of built in types (fixed), some other changes to the labels and descriptions of built in unit types, all float types changed to double (for her pleasure). * libinstpatch/IpatchSF2Preset.c: Global preset zones now integrated into presets (no more global zones), using new generator item interface. * libinstpatch/IpatchSF2Gen.c: Added generator item interface for items implementing generator properties (IpatchSF2Inst, IpatchSF2IZone, IpatchSF2Preset, IpatchSF2PZone). Some rename of generator property names to more appropriate ones ("key-range" -> "note-range", "root-note-override" -> "root-note", etc?), other cleanup/reorg. * libinstpatch/IpatchUnit_SF2.c: Some renaming of functions, changes to unit labels and descriptions, re-added tenth percent unit, using doubles instead of floats. * libinstpatch/IpatchGigRegion.c: Renamed property "key-range" to "note-range". * libinstpatch/IpatchUnit_DLS.c: More changes like to other unit files. * libinstpatch/IpatchParamProp.h: Added IPATCH_PARAM_NO_SAVE_CHANGE property flag to indicate if a property should cause ipatch_item_changed() to be called (modifies saveable state). * libinstpatch/IpatchSF2PZone.c: Similar changes as with instrument zones. * libinstpatch/IpatchDLS2Region.c: Rename of key-range to note-range. * libinstpatch/IpatchSF2Gen_tables.c: Update of descriptions and labels and renames. * libinstpatch/IpatchSF2VoiceCache_SF2.c: Updated for new global generator changes. * libinstpatch/IpatchSF2Mod.c: New moderator interface. * libinstpatch/IpatchContainer.c: Add/remove notify system, fixed bug in ipatch_container_get_children() with child type checking. * Lots of other minor/major changes that I don't feel like writing about.. Too long without a commit! Sheeesh! 2006-08-31 Josh Green * libinstpatch/IpatchSF2Reader.c: Improper use of ipatch_riff_read_chunk_verify() introduced a bug with recent changes to that function (causing non 24 bit SoundFont files to fail to load). Now enforcing that a SMPL chunk exists, pretty useless without one. 2006-08-29 Josh Green * libinstpatch/IpatchCramDecoder.c: Fixed bug which caused decoder to fail when attempt was made to decode stereo non-split audio. * utils/cram.c: Fixed bug with -p switch (was actually set as --qlp-coeff-search instead of --path), -q, --quiet now doing what it is supposed to do. 2006-08-29 Josh Green A stripped down version of FLAC is now included with libInstPatch to allow for customizations and to prevent breakage from new changes in official FLAC encoder/decoder. * libinstpatch/sample.c (ipatch_sample_format_bit_width): New function for getting the effective bit width of a sample format. * libinstpatch/IpatchRiffParser.c (ipatch_riff_read_chunk_verify): A new error IPATCH_RIFF_ERROR_UNEXPECTED_CHUNK_END was added which is returned if current LIST chunk ends. Previously no error info was being set. * libinstpatch/IpatchSF2File.c: Addition of sample24-pos property and related fields for 24 bit SoundFont support. * libinstpatch/IpatchCramEncoder.c: Changed to use included FLAC, added sample split support (for 24 bit SoundFonts), renamed ipatch_cram_encoder_declare_flac_audio to ipatch_cram_encoder_declare_audio and now passing parameters as a structure which can be allocated with ipatch_cram_encoder_audio_params_new, remove unneeded convert_audio_format_interleave, CRAM read version is getting set correctly if new features are used (such as sample splits), removed metadata hacks (no longer required with included FLAC). * libinstpatch/IpatchCramDecoder.c: Changed to use included FLAC, added sample split support, removed metadata hacks (no longer required with included FLAC). * libinstpatch/IpatchSampleData.c: The flag IPATCH_SAMPLE_DATA_FIND_QUALITY can now be used to search for highest quality sample within a IpatchSampleData object. * libinstpatch/IpatchDLS2Region.c: Adding effect parameter support (not yet completed). * libinstpatch/IpatchTypeProp.c: Renamed ipatch_type_register_func and ipatch_type_get_func to ipatch_type_register_dynamic_func and ipatch_type_get_dynamic_func respectively. * libinstpatch/IpatchSampleStoreSplit24.[ch]: Added for SoundFont 24 support. * libinstpatch/IpatchSF2Reader.c: Added SoundFont 24 bit support. * libinstpatch/util.c (ipatch_util_file_size): New convenience utility function for getting a file size. * libinstpatch/IpatchCram_SF2.c: Added SoundFont 24 bit support, unfortunately due to expected issues with FLAC it results in rather poor performance :( * libinstpatch/IpatchCramDecoderConverter.c: Added proper error detection for ipatch_cram_decoder_next_file in convert method. * libinstpatch/IpatchDLSReader.c: DLS 8 bit audio is now properly set as unsigned. * libinstpatch/IpatchSF2.c: Added "samples-24bit" property which indicates that sample data should be stored as 24 bit. * libinstpatch/IpatchSF2Writer.c: SoundFont 24 bit support. * libinstpatch/IpatchCram.h: Revision 3 of the specification adds sample split support and clarifies some other things in the format documentation. 2006-07-22 Josh Green * IpatchAudioFile type was not being wraped as a python object causing crash with create_sf2.py. * Updated create_sf2.py to use new converter functions. 2006-06-18 Josh Green * libinstpatch/IpatchDLS2Sample.c: Changed init types of enum and flags GValues for IpatchItem property notifies to specific types. * libinstpatch/IpatchGigRegion.c: IpatchRange was incorrectly being freed using g_free. * libinstpatch/IpatchSF2VoiceCache_SF2.c: Fixed bugs in preset and instrument converters, including a GSlice related crash bug and modulator leaks. Also now more resiliant to duplicate global zones. * libinstpatch/IpatchPaste.c: Added ipatch_paste_object_add_duplicate() function. Default paste handler now supports pasting to virtual containers. 2006-05-08 Josh Green * Renamed all functions with *_ref_* in the name to *_get_* and removed _ref from the end of any function names. This was decided to simplify the auto Python binding generation which does not care about reference counting. * IpatchSF2VoiceCache converters now expect a voice cache object to be supplied, rather than creating it in the conversion function. This allows for parameters to be set on the voice cache prior to conversion. * libinstpatch/IpatchVirtualContainer (IPATCH_VIRTUAL_CONTAINER_CREATE): Added childtype field to specify the child types contained by a virtual container. (IpatchVirtualContainerConformFunc): Function type used for "virtual-child-conform-func" type property for making a child conform to a virtual container parent's criteria. * libinstpatch/IpatchSampleData.c (ipatch_sample_data_get_blank): Now setting sample data to zero for blank sample (bug). * libinstpatch/IpatchTypeProp.c: Added "virtual-child-type" property for specifying what type of children a virtual container stores and "virtual-child-conform-func" as explained above. * libinstpatch/IpatchSF2Mod.c: IpatchSF2ModList is now a boxed type for use as a object property. Added functions ipatch_sf2_mod_list_get_type, ipatch_sf2_mod_list_free, ipatch_sf2_mod_list_insert, ipatch_sf2_mod_list_remove, and ipatch_sf2_mod_list_change. Added modulator property support to objects for which it makes sense. * libinstpatch/misc.c: Added "virtual-child-conform-func" functions for percussion/melodic virtual container branches. * libinstpatch/IpatchSF2.c: find_unused_locale method now properly handles searching for free percussion MIDI locale. * libinstpatch/IpatchDLS2.c: find_unused_locale method now properly handles searching for free percussion MIDI locale, fixed bug in ipatch_dls2_make_unique_name which caused unique counter to be overwritten. * Documentation updates for renames. 2006-04-15 Josh Green * Moved ac_python_devel.m4 to m4/python.m4. * builtin_enums.[ch] and marshals.[ch] now auto generated. * gtk-doc documentation updates. * libinstpatch/IpatchSF2VoiceCache_SF2.c: Fixed crash bug in IpatchSF2Sample -> IpatchSF2VoiceCache converter, added voice cache item declaration in IpatchSF2Inst -> IpatchSF2VoiceCache converter. 2006-04-12 Josh Green * libinstpatch/IpatchParamProp.h: Added IPATCH_PARAM_SYNTH and IPATCH_PARAM_SYNTH_REALTIME GParamSpec flags. * libinstpatch/IpatchRange.[ch] (ipatch_range_new): Added low and high parameters. * libinstpatch/IpatchSF2Gen.h: Some renaming of SoundFont generator defines (and property names), generator table is now defined const. * IpatchSF2VoiceCache.c: Added item_func which gets called with all items for which a voice cache depends on (for synthesis updates). (ipatch_sf2_voice_cache_select): Fixed bug that caused not all voice indexes to be used (was counting all voices instead of only matched voices). * IpatchSF2Zone.c: Now setting IPATCH_PARAM_SYNTH and IPATCH_PARAM_SYNTH_REALTIME for zone parameters. * IpatchSF2Zone.h: Fixed generator array macros. * python/ipatch.override: Created an iterator type for IpatchList, IpatchRange can be treated like a sequence and added low and high methods. * python/ipatch-types.defs: New file added to override and declare some types (boxed types, etc). * python/ipatch.defs: No longer auto generated. 2006-03-15 Josh Green * Updated gtk-doc build files and API docs are now disabled by default. * Removed all GMemChunk usage and replaced with GSlice (fallback to malloc if GSlice not available). * Removed PREALLOC defines for objects since it was kinda messy and not really necessary. * libinstpatch/IpatchSF2.c (ipatch_sf2_item_copy): Updated to ignore link_func since no objects are external from the SoundFont itself, fixed bugs where object references weren't being replaced. * libinstpatch/IpatchSF2VoiceCache.[ch]: Added a default_loop_type field which gets used for object types which have no looping mode defined (such as IpatchSF2Sample objects). * libinstpatch/IpatchSampleStoreVirtual.c: Now allows for stereo pairing of mono samples, still need to add stereo->mono conversions. 2006-03-09 Josh Green * libinstpatch/sample.c: Floating point is now -1.0 to 1.0. * libinstpatch/IpatchItem.c (ipatch_item_prop_notify_by_name): Debug macros weren't allowing old_value or new_value to be NULL. 2006-03-03 Josh Green * libinstpatch/IpatchConverter.c: Added IPATCH_CONVERTER_FLAG_SRC_DERIVED flag to ipatch_register_converter_map and changed priority field to flags field. Added ipatch_converter_set_link_funcs(). * libinstpatch/IpatchPaste.c: Added ipatch_paste_object_add_convert() for easily converting an object during a paste operation. * libinstpatch/IpatchVirtualContainer.h: IPATCH_VIRTUAL_CONTAINER_CREATE macro to assist in creating new virtual container types. 2006-01-20 Josh Green IpatchItem copy method changed to use a callback function for fixing up object links and return code removed (copies should not fail), all IpatchItem derived types updated to use this new method. * libinstpatch/IpatchDLS2Region.h: Started adding region properties. * libinstpatch/IpatchItem.[ch]: IpatchItem "copy" method now uses a callback function to fixup external links and return value and GError removed (should not fail), many new functions added for copying and duplicating items (replacement hash, link func, deep duplication), functions added for getting unique properties for an item and testing for conflicts. * libinstpatch/IpatchPaste.[ch]: Overhauled and sweet! :) There is now a paste instance which paste operations can be added to. All items to be pasted are duplicated, conflicts can be detected all at once, items can be changed in place, the paste operations are not executed until finalized. 2005-11-25 Josh Green IpatchConverter system modified to accept a range of types to match for source and destination, many convenience functions added for converting directly between 2 objects or an object and a type. Existing converters updated to use new system. 2005-11-05 Josh Green IpatchItem property notifies now only occur once, after the property is set. The previous value is passed as an argument to the notify. Insane amount of changes on property notifies, still some work to do. Some duplicate properties removed (like "sample" for instrument zones, "link-item" now used where appropriate). Removed "title" type property and made it an IpatchItem property. Some fixes to sample converters to get things to work right for sample exporting. Added ipatch_convert_objects and ipatch_convert_object_to_type functions for added convenience. Bug fixes in GigaSampler writer/reader and sub regions. IpatchItem now has some other defined properties too. Added a "float-digits" parameter property. So much other crap its scary! :) 2005-09-18 Josh Green Applied Win32 build patch from Keishi Suenaga. 2005-09-17 Josh Green Converted all IpatchItem "describe" methods to "title" type properties. Lots of other changes which I don't feel like describing today :) libinstpatch/IpatchItem.c: Removed "describe" method and functions, now replaced by "title" type property, changed implimentations throughout. libinstpatch/IpatchSample.c: Added some IpatchSample interface helper functions for use by IpatchSampleData based interfaces. New loop_types field of IpatchSampleIface to describe what loop types an interface supports. Updated all IpatchSample interfaces. libinstpatch/IpatchDLSReader.c: Fixed an allocation bug with IpatchDLS2SampleInfo in IpatchGigSubRegion objects which was causing crashes. libinstpatch/IpatchGig.c: Added virtual container child types. libinstpatch/IpatchTypeProp.c: Added a "link-item" property libinstpatch/IpatchSF2.c: Bug fix with virtual child list. 2005-08-26 Josh Green Updates to python binding. Created a IpatchContainer.add () method, fixed a bunch of bugs with mis-named constructor types (made it impossible to instantiate many types). Attempted to create a binding for the IpatchRange boxed type. libinstpatch/IpatchAudioFile.c: Fixed an endian related bug (virtual format must be set, otherwise it defaults to the host endian order), less Nazi loop handling, if a conversion is required (non multiple of 8 bit width) then convert to native endian also. libinstpatch/IpatchDLSReader.c: Fixed another endian related bug that was causing DLS and Gig files to fail on big endian machines. libinstpatch/IpatchSF2IZone.c: Fixed some property related bugs. libinstpatch/IpatchSF2PZone.c: Fixed some more property bugs. libinstpatch/IpatchSF2VoiceCache.c (ipatch_sf2_voice_cache_select): Fixed a crash bug when no voices have been added to the cache. libinstpatch/IpatchSF2Zone.c: Added ipatch_sf2_zone_set_key_range and ipatch_sf2_zone_set_velocity_range. libinstpatch/IpatchSampleData.c: Added ipatch_sample_data_ref_primary_store. libinstpatch/IpatchSampleStore.c (ipatch_sample_store_copy): Now allow source sample store to be smaller than destination. IpatchVirtualContainer_types.c: Added Gig virtual container types back in. libinstpatch/misc.c: Initializing Gig virtual container types. 2005-08-24 Josh Green libinstpatch/IpatchSF2VoiceCache_DLS.h: Forgot to add defines for the DLS2Region voice synthesis converter. 2005-08-23 Josh Green autogen.sh: Now checks to see if binaries exist, runs libtoolize and outputs an error message if any commands fail. configure.ac: PKG_CHECK_MODULES is done for pygtk if pygobject not found (for pygtk versions that don't install a pygobject pkg-config file). libinstpatch/IpatchSF2VoiceCache_DLS.c: Added basic DLS2Inst SF2 voice cache synthesis. 2005-08-22 Josh Green configure.ac: PYGTK now uses pygobject-2.0 instead which removes GTK dependency for Python binding. libinstpatch/IpatchSF2VoiceCache_Gig.c: Added IpatchGigSample voice cache synthesis converter. libinstpatch/IpatchSF2VoiceCache_DLS.[ch]: New files, with a IpatchDLS2Sample voice cache synthesis converter. 2005-08-17 Josh Green Virtual container types added for DLS2, SF2, SF2Sample and Gig. Virtual containers are used for grouping items in a user friendly manner, for example: DLS2 objects have Melodic, Percussion and Sample virtual types which would contain Melodic Instruments, Percussion Instruments and Samples respectively in a user interface. libinstpatch/IpatchContainer.c: Added ipatch_container_get_virtual_types which will retrieve a list of virtual container types (grouping for user interfaces). libinstpatch/IpatchCramDecoderConverter: Added "strip-paths" property which will strip all path components from extracted files. libinstpatch/IpatchCramFile.c: Fixed bug in IpatchCramFile identification method which caused CRAM files to not be identified. libinstpatch/IpatchDLS2Inst.c: Added "percussion" property, and percussion flag no longer stored in Bank. libinstpatch/IpatchDLSReader.c: Heavily modified Gig loading code to account for the fact that IpatchGigRegion is no longer inherited from IpatchDLS2Region. libinstpatch/IpatchDLSWriter.c: Heavily modified Gig writing code to account for the fact that IpatchGigRegion is no longer inherited from IpatchDLS2Region. libinstpatch/IpatchGig.c: Now returns IpatchGigInst and IpatchGigSample as child types (overrides IpatchDLS2). libinstpatch/IpatchGigEffects.c: Added ipatch_gig_effects_init to initialize a Gig effects structure. libinstpatch/IpatchGigRegion.c: No longer inhereted from IpatchDLS2Region, so some code is now duplicated. Also dimensions and sub regions now are now objects. Renamed ipatch_gig_region_add_dimension to ipatch_gig_region_new_dimension. libinstpatch/IpatchItem.c: Added mutex inheritence so that a child item can inherit its parent's mutex, thereby saving space and simplifying locking. Currently used for IpatchGigSubRegion and IpatchGigDimension child objects of IpatchGigRegion. libinstpatch/IpatchIter.c: Added array iterator type, split iterator private access macros into GET and SET variants for all iterator types. libinstpatch/IpatchParamProp.c: Added a "unit-type" parameter property to specifiy what units (IpatchUnits.[ch]) a parameter uses. libinstpatch/IpatchSF2Gen.c: Fixed a 64 bit constant bug with generator add mask that was affecting ipatch_sf2_gen_array_offset and causing incorrect results of generator sumation (velocity/key ranges were being added and other valid generators were not!). libinstpatch/IpatchSF2Preset.c: Added "percussion" property. libinstpatch/IpatchSF2Zone.c: Generator "unit-type" parameter properties are now being set. libinstpatch/IpatchTypeProp.[ch]: Added dynamic type property functions which get called when retrieving a type property and handles returning the value. Added "category", "virtual-parent-type", and "sort-children" type properties. Added some default type categories. Added ipatch_type_object_get, ipatch_type_object_get_valist, ipatch_type_object_get_property, and ipatch_type_register_func. libinstpatch/misc.c: Type properties like "name", "blurb", "category", "virtual-parent-type" and "sort-children" now set for built in types. libinstpatch/libinstpatch.h.in: Added G_BEGIN_DECLS and G_END_DECLS, probably should add to every header file though. 2005-06-24 Josh Green Improved finalization for many object types. SF2Voices replaced with IpatchSF2VoiceCache. libinstpatch/IpatchAudioFile.c (ipatch_audio_file_open): Added support for reading and writing loop and instrument info. libinstpatch/IpatchBase.c: Removed ipatch_base_save which has been superceded by IpatchConverter system, added ipatch_base_find_item_by_midi_locale_ref for finding a child item by MIDI locale. libinstpatch/IpatchContainer.c: Added ipatch_container_remove_all and now using it at container finalization. libinstpatch/IpatchGigEffects.c: Unknown info now loaded and preserved. libinstpatch/IpatchSF2VoiceCache.c: Some bug fixes and improvements. libinstpatch/IpatchSF2VoiceCache_SF2.c: Now working. libinstpatch/IpatchSF2VoiceCache_Gig.c: Also working :) 2005-05-06 Josh Green Moved IPATCH_SF2_DEFAULT_NAME to IPATCH_BASE_DEFAULT_NAME. Default name now set for DLS and GigaSampler files. Added "name" and "blurb" IpatchTypeProp properties for defining user friendly name and descriptions for GTypes and defined for SF2, DLS2 and Gig types. 2005-05-02 Josh Green Added IpatchGigSample, IpatchIfaceProp (interface properties), IpatchParamProp (GParamSpec properties) and IpatchTypeProp (GType properties). Copyright message updated in all files and changed GPL license text to only allow use of version 2 (in case of future license corruptions). GigaSampler saving is working now and many improvements in DLS/Gig loader as well. Added software and comment fields to CRAM header and bumped format version to 2. Added properties to IpatchCramDecoder. IpatchCramDecoderConverter now passes property requests to IpatchCramDecoder. Added a get_size method to IpatchFile and ipatch_file_get_size() function to use it. Added a ipatch_file_buf_memset() function, ipatch_file_buf_zero is now just a macro using this function. Bug fixes in item_copy methods for DLS/Gigasampler. Unknown GigaSampler fields are now preserved. Improved cram utility statistics and added flag to set comment and a file list mode. 2004-12-14 Josh Green Lots of changes to sample related property names and loop types. Lots of other property changes in regards to new IpatchParam extended properties - max string lengths, unique tagging, etc. Many objects now have IpatchSample interfaces. * libinstpatch/IpatchSample.[ch]: New - basic sample interface which is now implemented by IpatchDLS2Region, IpatchDLS2Sample, IpatchSF2IZone, IpatchSF2Sample, IpatchSampleData and IpatchSampleFile. * libinstpatch/IpatchUnit_generic.[ch]: New - generic unit definitions and functions moved out of IpatchUnit.[ch]. * libinstpatch/IpatchItem.[ch]: Added a pre_prop_notify_hook which gets called before an IpatchItem property changes, and the symantics of prop_notify_hook have now been changed so it is called after the property has changed. * libinstpatch/IpatchParam.[ch]: Added functions for adding extended properties to GParamSpec types and created some standard properties "string-max-length" to specify max length of strings and "unique-group-id" for specifying a group of properties that define a unique key - an example is Bank:Preset numbers, IPATCH_PARAM_UNIQUE flag added to indicate unique properties. * libinstpatch/IpatchSampleTransform.c: Max frames that can be converted at a time with an IpatchSampleTransform can now be retrieved and other changes. 2004-11-19 Josh Green * libinstpatch/IpatchDLS2Sample.c (ipatch_dls2_sample_find_store_ref): Added sample format parameter. * libinstpatch/IpatchSF2Sample.c (ipatch_sf2_sample_find_store_ref): Added sample format parameter. * libinstpatch/IpatchSampleData (ipatch_sample_data_find_store_ref): Added format parameter and IPATCH_SAMPLE_DATA_FIND_EXACT_FORMAT flag. * libinstpatch/IpatchSampleStore.c (ipatch_sample_store_duplicate): Added sample format parameter. * libinstpatch/sample.c: Fixed bugs in sample endian swapping functions (swap16/32/64). 2004-11-08 Josh Green Documentation updates. Container child_types method changed. * configure.ac: PyGtk codegen dir now fetched with pkg-config. * python/Makefile.am: PyGtk codegen dir now fetched with pkg-config. * libinstpatch/IpatchContainer.c: Removed n_children fields from ipatch_container_get_child_types, ipatch_container_type_get_child_types and class method. 2004-11-07 Josh Green * ac_python_devel.m4: AC_PYTHON_DEVEL for detecting python support. * configure.ac: Updated to use AC_PYTHON_DEVEL in ac_python_devel.m4. * libinstpatch/IpatchConvert_Gig.c: Added Gig file load converter. * libinstpatch/IpatchDLS2Region.c: Regions now use IpatchRange type for velocity and note range. * libinstpatch/IpatchDLSReader.c: Fixed bug with stereo sample sizes, no more debug spew for unknown chunks. * libinstpatch/IpatchSampleFile.c: "channels" property changed to integer type and updated for new sample format channels value. * libinstpatch/IpatchSampleStore.c: "channels" property changed to integer type and updated for new sample format channels value. * libinstpatch/IpatchSampleTransform.c: Updated for new sample format channels value. * libinstpatch/sample.c: Fixed bug with stereo to mono convert functions, updated for new sample format channels value. * libinstpatch/sample.h: Values for sample format channels changed to the number of channels - 1 and a new field added for channel routing. * python/Makefile.am: Updated to use new defines from AC_PYTHON_DEVEL. 2004-10-28 Josh Green "-ref" was removed from all object properties with this naming convention since GValue already references returned objects. 2004-09-16 Josh Green Release: 1.0.0beta-20040917 * examples/create_sf2.py: Updated for latest API changes and to match functionality of C equivelent create_sf2.c. 2004-09-16 Josh Green * examples/create_sf2.c: Updated SoundFont creation example to also create Instruments and Presets for the added samples. * libinstpatch/IpatchSF2Inst.c (ipatch_sf2_inst_create_zone): Killed the return value for ultra convenience (unref not needed). * libinstpatch/IpatchSF2Preset.c (ipatch_sf2_preset_create_zone): Killed the return value for ultra convenience (unref not needed). 2004-09-15 Josh Green Documentation updates. * libinstpatch/IpatchAudioFile.c: Bug fixes. * libinstpatch/IpatchConvert_SF2.c: Improved IpatchSampleFile to IpatchSF2Sample conversion. * libinstpatch/IpatchConverter.[ch]: Renamed ipatch_lookup_converter to ipatch_find_converter and added find flag fields to parameters. * libinstpatch/IpatchSampleData.h: Renamed IpatchSampleStoreFindFlags to IpatchSampleDataFindFlags. * libinstpatch/IpatchSF2Writer.c: Samples now written with "untitled%d" string if it has no name, also fixes crash bug. * libinstpatch/IpatchSampleTransform.c: Bug fixes and new function ipatch_sample_transform_free_buffers. * examples/create_sf2.py: New Python example for creating a SoundFont from sample files. * examples/create_sf2.c: New C example for creating a SoundFont from sample files. 2004-09-01 Josh Green Documentation updates. * libinstpatch/sample.[ch]: Re-worked sample format integer to describe complete sample format (width/type, sign, endian, channels). Moved sample format related functions to sample.c and created conversion functions for converting between any supported format with a routine to create an array of function pointers required for a conversion. * libinstpatch/IpatchSampleTransform.[ch]: A new sample format conversion object. * libinstpatch/IpatchSampleStoreVirtual.[ch]: The beginnings of a virtual sample store, which will support simple edit lists and format conversions. * libinstpatch/IpatchConverter_priv.h: Some private macros for more easily defining IpatchConverter types. * libinstpatch/IpatchAudioFile.h: Removed virtual file support, since we are handling format conversion internally. Added a method for getting a list of supported save file types. Re-wrote sections of open method to use native audio format since virtual IpatchSampleFile support has been ditched. * libinstpatch/IpatchConvert_DLS2.c: Now using helper macros to simplify creation of converter types. Added a IpatchSampleFile to IpatchDLS2Sample converter. Updated init routine for ipatch_register_converter changes. * libinstpatch/IpatchConvert_SF2.c: Added a IpatchSampleFile to IpatchSF2Sample converter. Updated init routine for ipatch_register_converter changes. Now using converter helper macros in IpatchConverter_priv.h. * libinstpatch/IpatchConverter.c: Added fields for expected source and destination item counts to converter registration system and updated the ipatch_register_converter function and changed/renamed ipatch_lookup_converter_type to ipatch_lookup_converter_info to handle this additional information. Updated verify routine to check items based on the item count and type information if the verify method is NULL. * libinstpatch/IpatchDLSReader.c: Updated for new sample format system. * libinstpatch/IpatchDLSWriter.c: Updated to use new sample conversion system. * libinstpatch/IpatchSF2Reader.c: Updated for new sample format system. * libinstpatch/IpatchSF2Writer.c: Updated to use new sample conversion system. * libinstpatch/IpatchSampleData.[ch]: Updated for new sample format system. * libinstpatch/IpatchSampleFile.[ch]: Removed virtual sample format parameters (we now do this internally). Updated for new sample format system. * libinstpatch/IpatchSampleStore.[ch]: Updated for new sample format system. Added convenience functions for converting audio format to/from sample stores. 2004-07-16 Josh Green * libinstpatch/IpatchConvert_SF2.c: Fixed bug in verify method template macro. * libinstpatch/IpatchConverter.c: Added a function to lookup source and destination conversion types for a given converter type. * python/ipatchmodule.c: Added #define NO_IMPORT_PYGOBJECT since it fixes build on MAC OS X related to duplicate symbols. Not real sure what this define is for though. 2004-07-15 Josh Green Fixed bug in IpatchSF2Reader.c that affected big endian machines (Mac OS X in particular). 2004-07-14 Josh Green Renamed Cram* to IpatchCram* to fix python binding and just to integrate the beast. Renamed IpatchSF2Loader to IpatchSF2Reader and IpatchDLSLoader to IpatchDLSReader. Created converters for loading/saving SoundFont and DLS files. Ditched libsndfile support in favor of requiring libaudiofile and added IpatchSampleFile support for libaudiofile with virtual format conversion for files and IpatchSampleStore objects! Renamed IpatchSampleStoreFormat to IpatchSampleFormat and moved it to misc.h. Documentation updates. * libinstpatch/IpatchConverter.c: Lookups for registered handlers now looks for derived types as well and finds the best match. Also added an init() method for converters that want to intialize parameters based on input/output objects. * libinstpatch/IpatchFile.c: Removed load_object method in favor of IpatchConverter system. * libinstpatch/IpatchSampleFile.c: Cleaned up sample format and virtual sample format parameters. 2004-07-06 Josh Green Mucking around with gettext stuff. Hopefully everything is set up right now (what a pain!). 2004-07-06 Josh Green Build updates to intl and po gettext stuff. * libinstpatch/IpatchConverter.c: Documentation updates. * libinstpatch/IpatchRange.c: Now setting value_type field of GParamSpec to IPATCH_TYPE_RANGE (what a GBoxed type should do). * libinstpatch/misc.h: Bug fix to G_HAVE_GNUC_VARARGS version of ipatch_code_error macro. 2004-07-03 Josh Green Release: 1.0.0beta-20040703 Documentation updates (looking pretty sweet). 2004-07-02 Josh Green Dude, I have been bad about the ChangeLog updates! FlacPak is now Cram and the format has been re-written to be extendable (thanks to EBML) and support multiple files in an archive with paths. The IpatchConverter is now being used for the Cram decoder/encoder to convert between IpatchFile and CramFile types. The cram command line utility is working but needs some work in relation to progress and statistic output. 2004-01-25 Josh Green Renamed ipatch_sf2_write to ipatch_sf2_writer_save and swapped IpatchSF2File and IpatchSF2 parameters in ipatch_sf2_writer_new. Both changes made to get Python binding to work correctly. 2004-01-21 Josh Green Removed include of convert.h, which no longer exists, from libinstpatch.h.in. Changed python/Makefile.am to not be broken in regards to generating defs. 2004-01-18 Josh Green Removed IpatchConvert from build until its working, fixed a bug that made zone generator properties unusable, also changed python binding Makefile to generate the defs file if it doesn't already exist. 2003-12-13 Josh Green Lots of bug fixes to SoundFont writer (was pretty much unusable, gotta test those things :) 2003-12-11 Josh Green Removed old object conversion interface and created new IpatchConverter object and conversion registry. Some bug fixes to SoundFont FlacPak encoder handler. 2003-12-03 Josh Green Many bug fixes with FlacPak including a problem with MD5 function name clashes with FLAC causing memory leaks, fixes to compressing or decompressing multiple files, improved statistic functionality with FlacPakEncoder, better text output from flacpak utility and some bugs with the SoundFont FlacPak handler. 2003-12-01 Josh Green FlacPak is on the scene (libinstpatch/FlacPak*), dynamically generating libinstpatch.h since FlacPak is optional, split IpatchFileBuf stuff into separate C file, many bug fixes to IpatchFile routines, made many IpatchDLSLoader routines public (still needs some work), added a flacpak command line program to utils/. 2003-10-03 Josh Green Lots of things have changed, finally getting around to importing this lot into CVS. 2003-08-29 Josh Green libInstPatch is now its own package, check Swami changelog for earlier history. libinstpatch-1.0.0/config.guess0000755000175000017500000013226411456655763013467 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2009-04-27' # This file 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., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd | genuineintel) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: libinstpatch-1.0.0/acinclude.m40000644000175000017500000000542511456655763013336 00000000000000dnl - Macros for configure script dnl Summary print function dnl dnl FEATURE_SUMMARY(FEATURE-NAME, FEATURE-TEST, FAILURE-NOTE) AC_DEFUN([FEATURE_SUMMARY], [ if test [$2]; then _SUMMARY_ENABLED="$_SUMMARY_ENABLED$1\n" else _SUMMARY_DISABLED="$_SUMMARY_DISABLED$1\n" ifelse([$3], , :, _SUMMARY_DISABLED="$_SUMMARY_DISABLED\t** Note: $3\n") fi ]) dnl Ripped from pygtk dnl a macro to check for ability to create python extensions dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) dnl function also defines PYTHON_INCLUDES AC_DEFUN([AM_CHECK_PYTHON_HEADERS], [AC_REQUIRE([AM_PATH_PYTHON]) AC_MSG_CHECKING(for headers required to compile python extensions) dnl deduce PYTHON_INCLUDES py_prefix=`$PYTHON -c "import sys; print sys.prefix"` py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" if test "$py_prefix" != "$py_exec_prefix"; then PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" fi AC_SUBST(PYTHON_INCLUDES) dnl check if the headers exist: save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" AC_TRY_CPP([#include ],dnl [AC_MSG_RESULT(yes) $1],dnl [AC_MSG_RESULT(no) $2]) CPPFLAGS="$save_CPPFLAGS" ]) dnl Configure Paths for zlib (Josh Green 2003-11-22) dnl dnl AM_PATH_ZLIB([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for zlib, and define ZLIB_CFLAGS and dnl ZLIB_LIBS as appropriate. dnl enables arguments --with-zlib-prefix= AC_DEFUN([AM_PATH_ZLIB], [dnl Save the original CFLAGS, and LIBS save_CFLAGS="$CFLAGS" save_LIBS="$LIBS" zlib_found=yes dnl dnl Setup configure options dnl AC_ARG_WITH(zlib-prefix, [ --with-zlib-prefix=PATH Path where zlib is (optional)], [zlib_prefix="$withval"], [zlib_prefix=""]) AC_MSG_CHECKING(for zlib) dnl Add zlib to the LIBS path ZLIB_LIBS="-lz" if test "${zlib_prefix}" != "" ; then ZLIB_LIBS="-L${zlib_prefix}/lib $ZLIB_LIBS" ZLIB_CFLAGS="-I${zlib_prefix}/include" else ZLIB_CFLAGS="" fi LIBS="$ZLIB_LIBS $LIBS" CFLAGS="$ZLIB_CFLAGS $CFLAGS" AC_TRY_COMPILE([ #include #include ], [ #ifndef deflateInit return (1); #else return (0); #endif ], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) zlib_found=no] ) CFLAGS="$save_CFLAGS" LIBS="$save_LIBS" if test "x$zlib_found" = "xyes" ; then ifelse([$1], , :, [$1]) else ZLIB_CFLAGS="" ZLIB_LIBS="" ifelse([$2], , :, [$2]) fi dnl That should be it. Now just export out symbols: AC_SUBST(ZLIB_CFLAGS) AC_SUBST(ZLIB_LIBS) ]) AC_DEFUN([AC_DEBUGGING], [ AC_ARG_ENABLE(debug, [ --enable-debug enable debugging compiler options], enable_debug=$enableval, enable_debug="no") if test "$enable_debug" = "yes" ; then AC_DEFINE(IPATCH_DEBUG, 1, [Define to enable debugging]) CFLAGS="-g -O0" fi ]) libinstpatch-1.0.0/docs/0000777000175000017500000000000011461404254012132 500000000000000libinstpatch-1.0.0/docs/reference/0000777000175000017500000000000011461404255014071 500000000000000libinstpatch-1.0.0/docs/reference/libinstpatch-sections.txt0000644000175000017500000014427111461404255021070 00000000000000
sample IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS IPATCH_SAMPLE_FORMAT_MASK IPATCH_SAMPLE_FORMAT_BITCOUNT IPATCH_SAMPLE_WIDTH_MASK IPATCH_SAMPLE_CHANNEL_MASK IPATCH_SAMPLE_SIGN_MASK IPATCH_SAMPLE_ENDIAN_MASK IPATCH_SAMPLE_WIDTH_SHIFT IPATCH_SAMPLE_CHANNEL_SHIFT IPATCH_SAMPLE_SIGN_SHIFT IPATCH_SAMPLE_ENDIAN_SHIFT IpatchSampleWidth IpatchSampleChannel IpatchSampleChannelType IPATCH_SAMPLE_MAX_CHANNELS IpatchSampleSign IpatchSampleEndian IPATCH_SAMPLE_ENDIAN_HOST IPATCH_SAMPLE_FORMAT_GET_WIDTH IPATCH_SAMPLE_FORMAT_GET_CHANNELS IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT IPATCH_SAMPLE_FORMAT_IS_SIGNED IPATCH_SAMPLE_FORMAT_IS_UNSIGNED IPATCH_SAMPLE_FORMAT_IS_LENDIAN IPATCH_SAMPLE_FORMAT_IS_BENDIAN ipatch_sample_format_size ipatch_sample_format_width IPATCH_SAMPLE_MAP_CHANNEL IPATCH_SAMPLE_MAP_GET_CHANNEL IPATCH_SAMPLE_UNITY_CHANNEL_MAP ipatch_sample_format_bit_width ipatch_sample_format_verify ipatch_sample_format_transform_verify ipatch_sample_get_transform_funcs IPATCH_SAMPLE_FORMAT_IS_FLOATING
IpatchSampleStoreSwap IpatchSampleStoreSwap IpatchSampleStoreSwap IPATCH_SAMPLE_STORE_SWAP_UNUSED_FLAG_SHIFT ipatch_sample_store_swap_new ipatch_sample_store_swap_get_unused_size IPATCH_SAMPLE_STORE_SWAP IPATCH_IS_SAMPLE_STORE_SWAP IPATCH_TYPE_SAMPLE_STORE_SWAP ipatch_sample_store_swap_get_type IPATCH_SAMPLE_STORE_SWAP_CLASS IPATCH_IS_SAMPLE_STORE_SWAP_CLASS
IpatchSampleStoreSndFile IpatchSampleStoreSndFile IpatchSampleStoreSndFile IPATCH_SAMPLE_STORE_SND_FILE_UNUSED_FLAG_SHIFT ipatch_sample_store_snd_file_new ipatch_sample_store_snd_file_init_read ipatch_sample_store_snd_file_init_write IPATCH_SAMPLE_STORE_SND_FILE IPATCH_IS_SAMPLE_STORE_SND_FILE IPATCH_TYPE_SAMPLE_STORE_SND_FILE ipatch_sample_store_snd_file_get_type IPATCH_SAMPLE_STORE_SND_FILE_CLASS IPATCH_IS_SAMPLE_STORE_SND_FILE_CLASS
IpatchGigInst IpatchGigInstParams IpatchGigInst IpatchGigInst ipatch_gig_inst_new ipatch_gig_inst_first ipatch_gig_inst_next IPATCH_GIG_INST IPATCH_IS_GIG_INST IPATCH_TYPE_GIG_INST ipatch_gig_inst_get_type IPATCH_GIG_INST_CLASS IPATCH_IS_GIG_INST_CLASS IPATCH_GIG_INST_GET_CLASS
IpatchPaste IpatchPaste IpatchPaste IpatchPasteChoice IpatchPasteTestFunc IpatchPasteExecFunc IpatchPastePriority IPATCH_PASTE_FLAGS_PRIORITY_MASK ipatch_register_paste_handler ipatch_is_paste_possible ipatch_simple_paste ipatch_paste_new ipatch_paste_objects ipatch_paste_resolve ipatch_paste_finish ipatch_paste_get_add_list ipatch_paste_object_add ipatch_paste_object_add_duplicate ipatch_paste_object_add_duplicate_deep ipatch_paste_object_add_convert ipatch_paste_object_link ipatch_paste_default_test_func ipatch_paste_default_exec_func IPATCH_PASTE IPATCH_IS_PASTE IPATCH_TYPE_PASTE ipatch_paste_get_type IPATCH_PASTE_CLASS IPATCH_IS_PASTE_CLASS IPATCH_PASTE_GET_CLASS
IpatchVBankInst IpatchVBankInst IpatchVBankInst IPATCH_VBANK_INST_NAME_SIZE ipatch_vbank_inst_new ipatch_vbank_inst_get_regions ipatch_vbank_inst_first ipatch_vbank_inst_next ipatch_vbank_inst_new_region ipatch_vbank_inst_set_midi_locale ipatch_vbank_inst_get_midi_locale ipatch_vbank_inst_compare IPATCH_VBANK_INST IPATCH_IS_VBANK_INST IPATCH_TYPE_VBANK_INST ipatch_vbank_inst_get_type IPATCH_VBANK_INST_CLASS IPATCH_IS_VBANK_INST_CLASS IPATCH_VBANK_INST_GET_CLASS
IpatchGig IpatchGig IpatchGig IPATCH_GIG_DEFAULT_SAMPLE_GROUP_NAME ipatch_gig_new IPATCH_GIG IPATCH_IS_GIG IPATCH_TYPE_GIG ipatch_gig_get_type IPATCH_GIG_CLASS IPATCH_IS_GIG_CLASS IPATCH_GIG_GET_CLASS
IpatchVBankRegion IpatchVBankRegion IpatchVBankRegion IpatchVBankRegionNoteRangeMode IpatchVBankRegionRootNoteMode ipatch_vbank_region_new ipatch_vbank_region_first ipatch_vbank_region_next ipatch_vbank_region_set_id_props ipatch_vbank_region_get_id_props IPATCH_VBANK_REGION IPATCH_IS_VBANK_REGION IPATCH_TYPE_VBANK_REGION ipatch_vbank_region_get_type IPATCH_VBANK_REGION_CLASS IPATCH_IS_VBANK_REGION_CLASS IPATCH_VBANK_REGION_GET_CLASS
IpatchDLS2Sample IpatchDLS2SampleInfo IpatchDLS2Sample IpatchDLS2Sample IPATCH_DLS2_SAMPLE_INFO_INIT IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID IPATCH_DLS2_SAMPLE_INFO_PROPERTY_COUNT IpatchDLS2SampleFlags IPATCH_DLS2_SAMPLE_LOOP_MASK IPATCH_DLS2_SAMPLE_FLAGS_MASK ipatch_dls2_sample_new ipatch_dls2_sample_first ipatch_dls2_sample_next ipatch_dls2_sample_set_data ipatch_dls2_sample_get_data ipatch_dls2_sample_peek_data ipatch_dls2_sample_set_blank ipatch_dls2_sample_info_new ipatch_dls2_sample_info_free ipatch_dls2_sample_info_duplicate ipatch_dls2_sample_info_init ipatch_dls2_sample_info_install_class_properties ipatch_dls2_sample_info_is_property_id_valid ipatch_dls2_sample_info_set_property ipatch_dls2_sample_info_get_property ipatch_dls2_sample_info_notify_changes IPATCH_DLS2_SAMPLE IPATCH_IS_DLS2_SAMPLE IPATCH_TYPE_DLS2_SAMPLE ipatch_dls2_sample_get_type IPATCH_DLS2_SAMPLE_CLASS IPATCH_IS_DLS2_SAMPLE_CLASS IPATCH_DLS2_SAMPLE_GET_CLASS
IpatchState IpatchState IpatchState ipatch_state_new ipatch_state_begin_group ipatch_state_end_group ipatch_state_set_active_group ipatch_state_get_active_group ipatch_state_record_item ipatch_state_record ipatch_state_retract ipatch_state_undo ipatch_state_redo IPATCH_STATE IPATCH_IS_STATE IPATCH_TYPE_STATE ipatch_state_get_type IPATCH_STATE_CLASS IPATCH_IS_STATE_CLASS IPATCH_STATE_GET_CLASS
IpatchVBank IPATCH_VBANK_INFO_COUNT IpatchVBank IpatchVBank IPATCH_VBANK_PARSER_VERSION ipatch_vbank_new ipatch_vbank_get_insts ipatch_vbank_find_inst ipatch_vbank_make_unique_name IPATCH_VBANK IPATCH_IS_VBANK IPATCH_TYPE_VBANK ipatch_vbank_get_type IPATCH_VBANK_CLASS IPATCH_IS_VBANK_CLASS IPATCH_VBANK_GET_CLASS
IpatchStateGroup IpatchStateGroupFlags IpatchStateGroup IpatchStateGroup IPATCH_STATE_GROUP IPATCH_IS_STATE_GROUP IPATCH_TYPE_STATE_GROUP ipatch_state_group_get_type IPATCH_STATE_GROUP_CLASS IPATCH_IS_STATE_GROUP_CLASS IPATCH_STATE_GROUP_GET_CLASS
IpatchSF2Zone IpatchSF2Zone IpatchSF2Zone IPATCH_SF2_ZONE_UNUSED_FLAG_SHIFT IPATCH_SF2_ZONE_GEN_AMT IPATCH_SF2_ZONE_GEN_TEST_FLAG IPATCH_SF2_ZONE_GEN_SET_FLAG IPATCH_SF2_ZONE_GEN_CLEAR_FLAG ipatch_sf2_zone_first ipatch_sf2_zone_next ipatch_sf2_zone_set_link_item ipatch_sf2_zone_set_link_item_no_notify ipatch_sf2_zone_get_link_item ipatch_sf2_zone_peek_link_item IPATCH_SF2_ZONE IPATCH_IS_SF2_ZONE IPATCH_TYPE_SF2_ZONE ipatch_sf2_zone_get_type IPATCH_SF2_ZONE_CLASS IPATCH_IS_SF2_ZONE_CLASS IPATCH_SF2_ZONE_GET_CLASS
IpatchConverterSF2VoiceCache IpatchConverterSF2VoiceCache IpatchConverterSF2VoiceCache IPATCH_CONVERTER_SF2_VOICE_CACHE IPATCH_IS_CONVERTER_SF2_VOICE_CACHE IPATCH_TYPE_CONVERTER_SF2_VOICE_CACHE ipatch_converter_sf2_voice_cache_get_type IPATCH_CONVERTER_SF2_VOICE_CACHE_CLASS IPATCH_IS_CONVERTER_SF2_VOICE_CACHE_CLASS
IpatchSF2 IpatchSF2 IpatchSF2 IpatchSF2Flags IPATCH_SF2_UNUSED_FLAG_SHIFT IpatchSF2InfoType IPATCH_SF2_INFO_COUNT IPATCH_SF2_DEFAULT_ENGINE ipatch_sf2_new ipatch_sf2_get_presets ipatch_sf2_get_insts ipatch_sf2_get_samples ipatch_sf2_set_file ipatch_sf2_get_file ipatch_sf2_get_info ipatch_sf2_set_info ipatch_sf2_get_info_array ipatch_sf2_free_info_array ipatch_sf2_info_id_is_valid ipatch_sf2_get_info_max_size ipatch_sf2_find_preset ipatch_sf2_find_inst ipatch_sf2_find_sample ipatch_sf2_get_zone_references ipatch_sf2_make_unique_name IPATCH_SF2 IPATCH_IS_SF2 IPATCH_TYPE_SF2 ipatch_sf2_get_type IPATCH_SF2_CLASS IPATCH_IS_SF2_CLASS IPATCH_SF2_GET_CLASS
IpatchGigDimension IpatchGigDimensionType IPATCH_GIG_DIMENSION_TYPE_MAX IpatchGigDimension IpatchGigDimension ipatch_gig_dimension_new ipatch_gig_dimension_first ipatch_gig_dimension_next IPATCH_GIG_DIMENSION IPATCH_IS_GIG_DIMENSION IPATCH_TYPE_GIG_DIMENSION ipatch_gig_dimension_get_type IPATCH_GIG_DIMENSION_CLASS IPATCH_IS_GIG_DIMENSION_CLASS IPATCH_GIG_DIMENSION_GET_CLASS
IpatchSF2Preset IpatchSF2Preset IpatchSF2Preset ipatch_sf2_preset_new ipatch_sf2_preset_get_zones ipatch_sf2_preset_first ipatch_sf2_preset_next ipatch_sf2_preset_new_zone ipatch_sf2_preset_set_name ipatch_sf2_preset_get_name ipatch_sf2_preset_set_midi_locale ipatch_sf2_preset_get_midi_locale ipatch_sf2_preset_compare IPATCH_SF2_PRESET IPATCH_IS_SF2_PRESET IPATCH_TYPE_SF2_PRESET ipatch_sf2_preset_get_type IPATCH_SF2_PRESET_CLASS IPATCH_IS_SF2_PRESET_CLASS IPATCH_SF2_PRESET_GET_CLASS
IpatchSndFile IPATCH_TYPE_SND_FILE_FORMAT IPATCH_TYPE_SND_FILE_SUB_FORMAT IpatchSndFileEndian IPATCH_SND_FILE_DEFAULT_FORMAT IPATCH_SND_FILE_DEFAULT_SUB_FORMAT IPATCH_SND_FILE_DEFAULT_ENDIAN IpatchSndFile IpatchSndFile ipatch_snd_file_new ipatch_snd_file_format_get_type ipatch_snd_file_sub_format_get_type ipatch_snd_file_format_get_sub_formats ipatch_snd_file_sample_format_to_sub_format IPATCH_SND_FILE IPATCH_IS_SND_FILE IPATCH_TYPE_SND_FILE ipatch_snd_file_get_type IPATCH_SND_FILE_CLASS IPATCH_IS_SND_FILE_CLASS IPATCH_SND_FILE_GET_CLASS
IpatchSF2Writer IpatchSF2Writer IpatchSF2Writer ipatch_sf2_writer_new ipatch_sf2_writer_set_patch ipatch_sf2_writer_set_file_handle ipatch_sf2_writer_save ipatch_sf2_write_phdr ipatch_sf2_write_ihdr ipatch_sf2_write_shdr ipatch_sf2_write_bag ipatch_sf2_write_mod ipatch_sf2_write_gen IPATCH_SF2_WRITER IPATCH_IS_SF2_WRITER IPATCH_TYPE_SF2_WRITER ipatch_sf2_writer_get_type IPATCH_SF2_WRITER_CLASS IPATCH_IS_SF2_WRITER_CLASS
IpatchGigSample IpatchGigSample IpatchGigSample ipatch_gig_sample_new ipatch_gig_sample_first ipatch_gig_sample_next IPATCH_GIG_SAMPLE IPATCH_IS_GIG_SAMPLE IPATCH_TYPE_GIG_SAMPLE ipatch_gig_sample_get_type IPATCH_GIG_SAMPLE_CLASS IPATCH_IS_GIG_SAMPLE_CLASS IPATCH_GIG_SAMPLE_GET_CLASS
IpatchConverter IpatchConverter IpatchConverter IpatchConverterLogType IPATCH_CONVERTER_LOG_TYPE_MASK IPATCH_CONVERTER_LOG_MSG_ALLOC IPATCH_CONVERTER_INPUT IPATCH_CONVERTER_OUTPUT IpatchConverterCount IpatchConverterFlags IpatchConverterPriority ipatch_convert_objects ipatch_convert_object_to_type ipatch_convert_object_to_type_multi ipatch_convert_object_to_type_multi_set ipatch_create_converter ipatch_register_converter_map ipatch_find_converter ipatch_lookup_converter_info ipatch_converter_add_input ipatch_converter_add_output ipatch_converter_add_inputs ipatch_converter_add_outputs ipatch_converter_get_input ipatch_converter_get_output ipatch_converter_get_inputs ipatch_converter_get_outputs ipatch_converter_verify ipatch_converter_init ipatch_converter_convert ipatch_converter_reset ipatch_converter_get_notes ipatch_converter_log ipatch_converter_log_printf ipatch_converter_log_next ipatch_converter_set_link_funcs IPATCH_CONVERTER IPATCH_IS_CONVERTER IPATCH_TYPE_CONVERTER ipatch_converter_get_type IPATCH_CONVERTER_CLASS IPATCH_IS_CONVERTER_CLASS IPATCH_CONVERTER_GET_CLASS
IpatchSF2File IpatchSF2Phdr IpatchSF2Ihdr IpatchSF2Shdr IpatchSF2Bag IpatchSF2File IpatchSF2File IPATCH_SFONT_FOURCC_SFBK IPATCH_SFONT_FOURCC_INFO IPATCH_SFONT_FOURCC_SDTA IPATCH_SFONT_FOURCC_PDTA IPATCH_SFONT_FOURCC_SMPL IPATCH_SFONT_FOURCC_SM24 IPATCH_SFONT_FOURCC_PHDR IPATCH_SFONT_FOURCC_PBAG IPATCH_SFONT_FOURCC_PMOD IPATCH_SFONT_FOURCC_PGEN IPATCH_SFONT_FOURCC_INST IPATCH_SFONT_FOURCC_IBAG IPATCH_SFONT_FOURCC_IMOD IPATCH_SFONT_FOURCC_IGEN IPATCH_SFONT_FOURCC_SHDR IPATCH_SFONT_FOURCC_IFIL IPATCH_SFONT_FOURCC_ISNG IPATCH_SFONT_FOURCC_INAM IPATCH_SFONT_FOURCC_IROM IPATCH_SFONT_FOURCC_IVER IPATCH_SFONT_FOURCC_ICRD IPATCH_SFONT_FOURCC_IENG IPATCH_SFONT_FOURCC_IPRD IPATCH_SFONT_FOURCC_ICOP IPATCH_SFONT_FOURCC_ICMT IPATCH_SFONT_FOURCC_ISFT IPATCH_SFONT_VERSION_SIZE IPATCH_SFONT_PHDR_SIZE IPATCH_SFONT_INST_SIZE IPATCH_SFONT_SHDR_SIZE IPATCH_SFONT_BAG_SIZE IPATCH_SFONT_MOD_SIZE IPATCH_SFONT_GEN_SIZE IPATCH_SFONT_NAME_SIZE IpatchSF2FileSampleType ipatch_sf2_file_new ipatch_sf2_file_set_sample_pos ipatch_sf2_file_get_sample_pos ipatch_sf2_file_set_sample_size ipatch_sf2_file_get_sample_size ipatch_sf2_file_set_sample24_pos ipatch_sf2_file_get_sample24_pos IPATCH_SF2_FILE IPATCH_IS_SF2_FILE IPATCH_TYPE_SF2_FILE ipatch_sf2_file_get_type IPATCH_SF2_FILE_CLASS IPATCH_IS_SF2_FILE_CLASS IPATCH_SF2_FILE_GET_CLASS
IpatchGigSubRegion IpatchGigSubRegion IpatchGigSubRegion IpatchGigSubRegionFlags IPATCH_GIG_SUB_REGION_UNUSED_FLAG_SHIFT ipatch_gig_sub_region_new ipatch_gig_sub_region_first ipatch_gig_sub_region_next ipatch_gig_sub_region_get_sample ipatch_gig_sub_region_set_sample IPATCH_GIG_SUB_REGION IPATCH_IS_GIG_SUB_REGION IPATCH_TYPE_GIG_SUB_REGION ipatch_gig_sub_region_get_type IPATCH_GIG_SUB_REGION_CLASS IPATCH_IS_GIG_SUB_REGION_CLASS IPATCH_GIG_SUB_REGION_GET_CLASS
IpatchSF2Sample IpatchSF2Sample IpatchSF2Sample IpatchSF2SampleChannel IPATCH_SF2_SAMPLE_RATE_MIN IPATCH_SF2_SAMPLE_RATE_MAX IPATCH_SF2_SAMPLE_LENGTH_MIN IPATCH_SF2_SAMPLE_FLAG_ROM IPATCH_SAMPLE_UNUSED_FLAG_SHIFT ipatch_sf2_sample_new ipatch_sf2_sample_first ipatch_sf2_sample_next ipatch_sf2_sample_set_name ipatch_sf2_sample_get_name ipatch_sf2_sample_set_data ipatch_sf2_sample_get_data ipatch_sf2_sample_peek_data ipatch_sf2_sample_set_linked ipatch_sf2_sample_get_linked ipatch_sf2_sample_peek_linked ipatch_sf2_sample_set_blank IPATCH_SF2_SAMPLE IPATCH_IS_SF2_SAMPLE IPATCH_TYPE_SF2_SAMPLE ipatch_sf2_sample_get_type IPATCH_SF2_SAMPLE_CLASS IPATCH_IS_SF2_SAMPLE_CLASS IPATCH_SF2_SAMPLE_GET_CLASS
IpatchSF2Reader IpatchSF2Reader IpatchSF2Reader ipatch_sf2_reader_new ipatch_sf2_reader_set_file_handle ipatch_sf2_reader_load ipatch_sf2_load_phdr ipatch_sf2_load_ihdr ipatch_sf2_load_shdr ipatch_sf2_load_bag ipatch_sf2_load_mod ipatch_sf2_load_gen IPATCH_SF2_READER IPATCH_IS_SF2_READER IPATCH_TYPE_SF2_READER ipatch_sf2_reader_get_type IPATCH_SF2_READER_CLASS IPATCH_IS_SF2_READER_CLASS
IpatchSF2IZone IpatchSF2IZone IpatchSF2IZone IPATCH_SF2_IZONE_UNUSED_FLAG_SHIFT ipatch_sf2_izone_new ipatch_sf2_izone_first ipatch_sf2_izone_next ipatch_sf2_izone_set_sample ipatch_sf2_izone_get_sample ipatch_sf2_izone_get_stereo_link IPATCH_SF2_IZONE IPATCH_IS_SF2_IZONE IPATCH_TYPE_SF2_IZONE ipatch_sf2_izone_get_type IPATCH_SF2_IZONE_CLASS IPATCH_IS_SF2_IZONE_CLASS IPATCH_SF2_IZONE_GET_CLASS
IpatchSampleStoreCache IpatchSampleStoreCache IpatchSampleStoreCache ipatch_sample_store_cache_get_location ipatch_sample_store_cache_get_channel_map ipatch_sample_store_cache_get_open_count IPATCH_SAMPLE_STORE_CACHE_UNUSED_FLAG_SHIFT ipatch_sample_store_cache_new ipatch_sample_store_cache_open ipatch_sample_store_cache_close IPATCH_SAMPLE_STORE_CACHE IPATCH_IS_SAMPLE_STORE_CACHE IPATCH_TYPE_SAMPLE_STORE_CACHE ipatch_sample_store_cache_get_type IPATCH_SAMPLE_STORE_CACHE_CLASS IPATCH_IS_SAMPLE_STORE_CACHE_CLASS
IpatchDLSWriter IpatchDLSWriter IpatchDLSWriter ipatch_dls_writer_new ipatch_dls_writer_set_patch ipatch_dls_writer_set_file_handle ipatch_dls_writer_save IPATCH_DLS_WRITER IPATCH_IS_DLS_WRITER IPATCH_TYPE_DLS_WRITER ipatch_dls_writer_get_type IPATCH_DLS_WRITER_CLASS IPATCH_IS_DLS_WRITER_CLASS
IpatchItem IpatchItemCopyLinkFunc IpatchItem IpatchItem IpatchItemFlags IPATCH_ITEM_UNUSED_FLAG_SHIFT IPATCH_ITEM_WLOCK IPATCH_ITEM_WUNLOCK IPATCH_ITEM_RLOCK IPATCH_ITEM_RUNLOCK IPATCH_ITEM_PROP_NOTIFY_SET_EVENT IpatchItemPropCallback IpatchItemPropDisconnect IPATCH_ITEM_COPY_LINK_FUNC ipatch_item_pspec_title ipatch_item_set_parent ipatch_item_unparent ipatch_item_get_parent ipatch_item_peek_parent ipatch_item_get_base ipatch_item_peek_base ipatch_item_get_ancestor_by_type ipatch_item_peek_ancestor_by_type ipatch_item_remove ipatch_item_changed ipatch_item_get_property_fast ipatch_item_copy ipatch_item_copy_link_func ipatch_item_copy_replace ipatch_item_duplicate ipatch_item_duplicate_link_func ipatch_item_duplicate_replace ipatch_item_duplicate_deep ipatch_item_copy_link_func_deep ipatch_item_copy_link_func_hash ipatch_item_type_can_conflict ipatch_item_type_get_unique_specs ipatch_item_get_unique_props ipatch_item_test_conflict ipatch_item_set_atomic ipatch_item_get_atomic ipatch_item_first ipatch_item_next ipatch_item_prop_notify ipatch_item_prop_notify_by_name ipatch_item_prop_connect ipatch_item_prop_connect_by_name ipatch_item_prop_disconnect ipatch_item_prop_disconnect_matched ipatch_item_prop_disconnect_by_name IPATCH_ITEM IPATCH_IS_ITEM IPATCH_TYPE_ITEM ipatch_item_get_type IPATCH_ITEM_CLASS IPATCH_IS_ITEM_CLASS IPATCH_ITEM_GET_CLASS
IpatchDLS2 IpatchDLS2 IpatchDLS2 IpatchDLS2Flags IPATCH_DLS2_UNUSED_FLAG_SHIFT ipatch_dls2_new ipatch_dls2_get_insts ipatch_dls2_get_samples ipatch_dls2_set_file ipatch_dls2_get_file ipatch_dls2_get_info ipatch_dls2_set_info ipatch_dls2_make_unique_name ipatch_dls2_find_inst ipatch_dls2_find_sample ipatch_dls2_get_region_references IPATCH_DLS2 IPATCH_IS_DLS2 IPATCH_TYPE_DLS2 ipatch_dls2_get_type IPATCH_DLS2_CLASS IPATCH_IS_DLS2_CLASS IPATCH_DLS2_GET_CLASS
IpatchStateItem IpatchStateItemType IpatchStateItemFlags IPATCH_STATE_ITEM_UNUSED_FLAG_SHIFT IpatchStateItem IpatchStateItem ipatch_state_item_restore ipatch_state_item_depend ipatch_state_item_conflict ipatch_state_item_describe IPATCH_STATE_ITEM IPATCH_IS_STATE_ITEM IPATCH_TYPE_STATE_ITEM ipatch_state_item_get_type IPATCH_STATE_ITEM_CLASS IPATCH_IS_STATE_ITEM_CLASS IPATCH_STATE_ITEM_GET_CLASS
IpatchSF2Inst IpatchSF2Inst IpatchSF2Inst ipatch_sf2_inst_new ipatch_sf2_inst_get_zones ipatch_sf2_inst_first ipatch_sf2_inst_next ipatch_sf2_inst_new_zone ipatch_sf2_inst_set_name ipatch_sf2_inst_get_name IPATCH_SF2_INST IPATCH_IS_SF2_INST IPATCH_TYPE_SF2_INST ipatch_sf2_inst_get_type IPATCH_SF2_INST_CLASS IPATCH_IS_SF2_INST_CLASS IPATCH_SF2_INST_GET_CLASS
IpatchSampleStoreRom IpatchSampleStoreRom IpatchSampleStoreRom ipatch_sample_store_rom_new IPATCH_SAMPLE_STORE_ROM IPATCH_IS_SAMPLE_STORE_ROM IPATCH_TYPE_SAMPLE_STORE_ROM ipatch_sample_store_rom_get_type IPATCH_SAMPLE_STORE_ROM_CLASS IPATCH_IS_SAMPLE_STORE_ROM_CLASS
IpatchBase IpatchBaseFlags IPATCH_BASE_UNUSED_FLAG_SHIFT IpatchBase IpatchBase IPATCH_BASE_DEFAULT_NAME ipatch_base_set_file ipatch_base_get_file ipatch_base_set_file_name ipatch_base_get_file_name ipatch_base_find_unused_midi_locale ipatch_base_find_item_by_midi_locale IPATCH_BASE IPATCH_IS_BASE IPATCH_TYPE_BASE ipatch_base_get_type IPATCH_BASE_CLASS IPATCH_IS_BASE_CLASS IPATCH_BASE_GET_CLASS
IpatchSF2ModItem IpatchSF2ModItem IpatchSF2ModItemIface ipatch_sf2_mod_item_add ipatch_sf2_mod_item_get_mods ipatch_sf2_mod_item_set_mods ipatch_sf2_mod_item_insert ipatch_sf2_mod_item_remove ipatch_sf2_mod_item_change ipatch_sf2_mod_item_count IPATCH_SF2_MOD_ITEM IPATCH_IS_SF2_MOD_ITEM IPATCH_TYPE_SF2_MOD_ITEM ipatch_sf2_mod_item_get_type IPATCH_SF2_MOD_ITEM_CLASS IPATCH_SF2_MOD_ITEM_GET_IFACE
IpatchDLS2Inst IpatchDLS2Inst IpatchDLS2Inst IPATCH_DLS2_INST_BANK_MAX IpatchDLS2InstFlags IPATCH_DLS2_INST_UNUSED_FLAG_SHIFT ipatch_dls2_inst_new ipatch_dls2_inst_get_regions ipatch_dls2_inst_first ipatch_dls2_inst_next ipatch_dls2_inst_get_info ipatch_dls2_inst_set_info ipatch_dls2_inst_set_midi_locale ipatch_dls2_inst_get_midi_locale ipatch_dls2_inst_compare ipatch_dls2_inst_get_conns ipatch_dls2_inst_set_conn ipatch_dls2_inst_unset_conn ipatch_dls2_inst_unset_all_conns ipatch_dls2_inst_conn_count IPATCH_DLS2_INST IPATCH_IS_DLS2_INST IPATCH_TYPE_DLS2_INST ipatch_dls2_inst_get_type IPATCH_DLS2_INST_CLASS IPATCH_IS_DLS2_INST_CLASS IPATCH_DLS2_INST_GET_CLASS
IpatchFile IpatchFileIOFuncs IpatchFileHandle IpatchFile IpatchFile IpatchFileFlags IpatchFileIdentifyOrder IPATCH_FILE_UNUSED_FLAG_SHIFT IPATCH_FILE_NEED_SWAP IPATCH_FILE_BIG_ENDIAN IPATCH_FILE_SWAP16 IPATCH_FILE_SWAP32 IPATCH_FILE_SWAP64 IPATCH_IS_FILE_HANDLE ipatch_file_new ipatch_file_set_name ipatch_file_get_name ipatch_file_open ipatch_file_assign_fd ipatch_file_assign_io_channel ipatch_file_get_io_channel ipatch_file_get_fd ipatch_file_close ipatch_file_get_position ipatch_file_update_position ipatch_file_read ipatch_file_read_eof ipatch_file_write ipatch_file_skip ipatch_file_seek ipatch_file_seek_eof ipatch_file_get_size ipatch_file_identify ipatch_file_identify_by_ext ipatch_file_identify_open ipatch_file_set_little_endian ipatch_file_set_big_endian ipatch_file_read_u8 ipatch_file_read_u16 ipatch_file_read_u32 ipatch_file_read_u64 ipatch_file_read_s8 ipatch_file_read_s16 ipatch_file_read_s32 ipatch_file_read_s64 ipatch_file_write_u8 ipatch_file_write_u16 ipatch_file_write_u32 ipatch_file_write_u64 ipatch_file_write_s8 ipatch_file_write_s16 ipatch_file_write_s32 ipatch_file_write_s64 ipatch_file_buf_load ipatch_file_buf_read ipatch_file_buf_write ipatch_file_buf_zero ipatch_file_buf_memset ipatch_file_buf_commit ipatch_file_buf_skip ipatch_file_buf_seek ipatch_file_buf_read_u8 ipatch_file_buf_read_u16 ipatch_file_buf_read_u32 ipatch_file_buf_read_u64 ipatch_file_buf_read_s8 ipatch_file_buf_read_s16 ipatch_file_buf_read_s32 ipatch_file_buf_read_s64 ipatch_file_buf_write_u8 ipatch_file_buf_write_u16 ipatch_file_buf_write_u32 ipatch_file_buf_write_u64 ipatch_file_buf_write_s8 ipatch_file_buf_write_s16 ipatch_file_buf_write_s32 ipatch_file_buf_write_s64 ipatch_file_set_iofuncs_static ipatch_file_set_iofuncs ipatch_file_get_iofuncs ipatch_file_set_iofuncs_null ipatch_file_default_open_method ipatch_file_default_close_method ipatch_file_default_read_method ipatch_file_default_write_method ipatch_file_default_seek_method ipatch_file_default_getfd_method ipatch_file_default_get_size_method IPATCH_FILE IPATCH_IS_FILE IPATCH_TYPE_FILE ipatch_file_get_type IPATCH_FILE_CLASS IPATCH_IS_FILE_CLASS IPATCH_FILE_GET_CLASS
IpatchContainer IpatchContainerCallback IpatchContainerDisconnect IpatchContainer IpatchContainer IPATCH_CONTAINER_UNUSED_FLAG_SHIFT IPATCH_CONTAINER_ERRMSG_INVALID_CHILD_2 ipatch_container_get_children ipatch_container_get_child_types ipatch_container_get_virtual_types ipatch_container_type_get_child_types ipatch_container_insert ipatch_container_append ipatch_container_add ipatch_container_prepend ipatch_container_remove ipatch_container_remove_all ipatch_container_count ipatch_container_make_unique ipatch_container_add_unique ipatch_container_init_iter ipatch_container_insert_iter ipatch_container_remove_iter ipatch_container_add_notify ipatch_container_remove_notify ipatch_container_add_connect ipatch_container_remove_connect ipatch_container_add_disconnect ipatch_container_add_disconnect_matched ipatch_container_remove_disconnect ipatch_container_remove_disconnect_matched IPATCH_CONTAINER IPATCH_IS_CONTAINER IPATCH_TYPE_CONTAINER ipatch_container_get_type IPATCH_CONTAINER_CLASS IPATCH_IS_CONTAINER_CLASS IPATCH_CONTAINER_GET_CLASS
IpatchDLSFile IpatchDLSFile IpatchDLSFile IPATCH_DLS_FOURCC_DLS IPATCH_DLS_FOURCC_COLH IPATCH_DLS_FOURCC_WVPL IPATCH_DLS_FOURCC_DWPL IPATCH_DLS_FOURCC_PTBL IPATCH_DLS_FOURCC_PATH IPATCH_DLS_FOURCC_WAVE IPATCH_DLS_FOURCC_LINS IPATCH_DLS_FOURCC_INS IPATCH_DLS_FOURCC_INSH IPATCH_DLS_FOURCC_LRGN IPATCH_DLS_FOURCC_RGN IPATCH_DLS_FOURCC_RGNH IPATCH_DLS_FOURCC_LART IPATCH_DLS_FOURCC_ART1 IPATCH_DLS_FOURCC_WLNK IPATCH_DLS_FOURCC_WSMP IPATCH_DLS_FOURCC_VERS IPATCH_DLS_FOURCC_RGN2 IPATCH_DLS_FOURCC_LAR2 IPATCH_DLS_FOURCC_ART2 IPATCH_DLS_FOURCC_CDL IPATCH_DLS_FOURCC_DLID IPATCH_DLS_FOURCC_INFO IPATCH_DLS_FOURCC_FMT IPATCH_DLS_FOURCC_DATA IPATCH_DLS_FOURCC_IARL IPATCH_DLS_FOURCC_IART IPATCH_DLS_FOURCC_ICMS IPATCH_DLS_FOURCC_ICMT IPATCH_DLS_FOURCC_ICOP IPATCH_DLS_FOURCC_ICRD IPATCH_DLS_FOURCC_IENG IPATCH_DLS_FOURCC_IGNR IPATCH_DLS_FOURCC_IKEY IPATCH_DLS_FOURCC_IMED IPATCH_DLS_FOURCC_INAM IPATCH_DLS_FOURCC_IPRD IPATCH_DLS_FOURCC_ISBJ IPATCH_DLS_FOURCC_ISFT IPATCH_DLS_FOURCC_ISRC IPATCH_DLS_FOURCC_ISRF IPATCH_DLS_FOURCC_ITCH IPATCH_DLS_VERS_SIZE IPATCH_DLS_INSH_SIZE IPATCH_DLS_RGNH_SIZE IPATCH_DLS_RGNH_LAYER_SIZE IPATCH_DLS_WLNK_SIZE IPATCH_DLS_WSMP_HEADER_SIZE IPATCH_DLS_WSMP_LOOP_SIZE IPATCH_DLS_ART_HEADER_SIZE IPATCH_DLS_CONN_SIZE IPATCH_DLS_PTBL_HEADER_SIZE IPATCH_DLS_POOLCUE_SIZE IPATCH_DLS_WAVE_FMT_SIZE IPATCH_DLS_DLID_SIZE IPATCH_DLS_INSH_BANK_MASK IPATCH_DLS_INSH_BANK_PERCUSSION IPATCH_DLS_RGNH_OPTION_SELF_NON_EXCLUSIVE IPATCH_DLS_WLNK_PHASE_MASTER IPATCH_DLS_WLNK_MULTI_CHANNEL IPATCH_DLS_WSMP_NO_TRUNCATION IPATCH_DLS_WSMP_NO_COMPRESSION IPATCH_DLS_WSMP_LOOP_FORWARD IPATCH_DLS_WSMP_LOOP_RELEASE ipatch_dls_file_new IPATCH_DLS_FILE IPATCH_IS_DLS_FILE IPATCH_TYPE_DLS_FILE ipatch_dls_file_get_type IPATCH_DLS_FILE_CLASS IPATCH_IS_DLS_FILE_CLASS IPATCH_DLS_FILE_GET_CLASS
IpatchSampleStoreSplit24 IpatchSampleStoreSplit24 IpatchSampleStoreSplit24 ipatch_sample_store_split24_new IPATCH_SAMPLE_STORE_SPLIT24 IPATCH_IS_SAMPLE_STORE_SPLIT24 IPATCH_TYPE_SAMPLE_STORE_SPLIT24 ipatch_sample_store_split24_get_type IPATCH_SAMPLE_STORE_SPLIT24_CLASS IPATCH_IS_SAMPLE_STORE_SPLIT24_CLASS
IpatchSF2VoiceCache IpatchSF2Voice IpatchSF2VoiceUpdate IpatchSF2VoiceSelInfo IpatchSF2VoiceCacheItemFunc IpatchSF2VoiceCache IpatchSF2VoiceCache IpatchSF2VoiceCacheUpdateHandler IpatchSF2VoiceSelType IPATCH_SF2_VOICE_CACHE_MAX_SEL_VALUES IPATCH_SF2_VOICE_SEL_WILDCARD ipatch_sf2_voice_cache_declare_item IPATCH_SF2_VOICE_CACHE_GET_VOICE ipatch_sf2_voice_cache_new ipatch_sf2_voice_cache_set_default_mods ipatch_sf2_voice_cache_add_voice ipatch_sf2_voice_cache_set_voice_range ipatch_sf2_voice_set_sample_data ipatch_sf2_voice_cache_sample_data ipatch_sf2_voice_copy ipatch_sf2_voice_cache_optimize ipatch_sf2_voice_cache_select ipatch_sf2_voice_cache_update IPATCH_SF2_VOICE_CACHE IPATCH_IS_SF2_VOICE_CACHE IPATCH_TYPE_SF2_VOICE_CACHE ipatch_sf2_voice_cache_get_type IPATCH_SF2_VOICE_CACHE_CLASS IPATCH_IS_SF2_VOICE_CACHE_CLASS
IpatchDLS2Region IpatchDLS2ParamArray IpatchDLS2Param IpatchDLS2Region IpatchDLS2Region IpatchDLS2RegionChannelType IPATCH_DLS2_REGION_CHANNEL_MONO IpatchDLS2RegionFlags IPATCH_DLS2_REGION_FLAG_MASK IPATCH_DLS2_REGION_UNUSED_FLAG_SHIFT ipatch_dls2_region_new ipatch_dls2_region_first ipatch_dls2_region_next ipatch_dls2_region_get_info ipatch_dls2_region_set_info ipatch_dls2_region_set_sample ipatch_dls2_region_get_sample ipatch_dls2_region_peek_sample ipatch_dls2_region_set_note_range ipatch_dls2_region_set_velocity_range ipatch_dls2_region_in_range ipatch_dls2_region_set_param ipatch_dls2_region_set_param_array ipatch_dls2_region_get_conns ipatch_dls2_region_set_conn ipatch_dls2_region_unset_conn ipatch_dls2_region_unset_all_conns ipatch_dls2_region_conn_count ipatch_dls2_region_channel_map_stereo IPATCH_DLS2_REGION IPATCH_IS_DLS2_REGION IPATCH_TYPE_DLS2_REGION ipatch_dls2_region_get_type IPATCH_DLS2_REGION_CLASS IPATCH_IS_DLS2_REGION_CLASS IPATCH_DLS2_REGION_GET_CLASS
IpatchVirtualContainer IPATCH_VIRTUAL_CONTAINER_CREATE IpatchVirtualContainer IpatchVirtualContainer IpatchVirtualContainerConformFunc IPATCH_VIRTUAL_CONTAINER IPATCH_IS_VIRTUAL_CONTAINER IPATCH_TYPE_VIRTUAL_CONTAINER ipatch_virtual_container_get_type IPATCH_VIRTUAL_CONTAINER_CLASS
IpatchSample IpatchSample IpatchSampleIface IpatchSampleHandle IpatchSampleHandleOpenFunc IpatchSampleHandleCloseFunc IpatchSampleHandleReadFunc IpatchSampleHandleWriteFunc IpatchSampleLoopType IPATCH_SAMPLE_FORMAT_DEFAULT IPATCH_SAMPLE_RATE_MIN IPATCH_SAMPLE_RATE_MAX IPATCH_SAMPLE_RATE_DEFAULT IPATCH_SAMPLE_ROOT_NOTE_DEFAULT IPATCH_SAMPLE_LOOP_TYPE_TERM IPATCH_SAMPLE_HANDLE_FORMAT ipatch_sample_get_loop_types ipatch_sample_type_get_loop_types ipatch_sample_set_format ipatch_sample_get_format ipatch_sample_set_size ipatch_sample_get_size ipatch_sample_get_frame_size ipatch_sample_get_sample_data ipatch_sample_set_sample_data ipatch_sample_read ipatch_sample_write ipatch_sample_read_transform ipatch_sample_write_transform ipatch_sample_copy ipatch_sample_save_to_file ipatch_sample_handle_open ipatch_sample_handle_close ipatch_sample_handle_get_transform ipatch_sample_handle_set_transform ipatch_sample_handle_get_format ipatch_sample_handle_get_frame_size ipatch_sample_handle_get_max_frames ipatch_sample_handle_read ipatch_sample_handle_write ipatch_sample_handle_cascade_open ipatch_sample_install_property ipatch_sample_install_property_readonly ipatch_sample_new_property_param_spec IPATCH_SAMPLE IPATCH_IS_SAMPLE IPATCH_TYPE_SAMPLE ipatch_sample_get_type IPATCH_SAMPLE_CLASS IPATCH_SAMPLE_GET_IFACE
IpatchSampleStoreFile IpatchSampleStoreFile IpatchSampleStoreFile IPATCH_SAMPLE_STORE_FILE_UNUSED_FLAG_SHIFT ipatch_sample_store_file_new IPATCH_SAMPLE_STORE_FILE IPATCH_IS_SAMPLE_STORE_FILE IPATCH_TYPE_SAMPLE_STORE_FILE ipatch_sample_store_file_get_type IPATCH_SAMPLE_STORE_FILE_CLASS IPATCH_IS_SAMPLE_STORE_FILE_CLASS
IpatchList IpatchList IpatchList ipatch_list_new ipatch_list_duplicate ipatch_list_init_iter IPATCH_LIST IPATCH_IS_LIST IPATCH_TYPE_LIST ipatch_list_get_type IPATCH_LIST_CLASS IPATCH_IS_LIST_CLASS
IpatchSampleStore IpatchSampleStore IpatchSampleStore IPATCH_SAMPLE_STORE_FORMAT_SHIFT ipatch_sample_store_get_format ipatch_sample_store_get_size ipatch_sample_store_get_rate ipatch_sample_store_get_size_bytes IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT ipatch_sample_store_first ipatch_sample_store_next IPATCH_SAMPLE_STORE IPATCH_IS_SAMPLE_STORE IPATCH_TYPE_SAMPLE_STORE ipatch_sample_store_get_type IPATCH_SAMPLE_STORE_CLASS IPATCH_IS_SAMPLE_STORE_CLASS IPATCH_SAMPLE_STORE_GET_CLASS
IpatchSF2PZone IpatchSF2PZone IpatchSF2PZone ipatch_sf2_pzone_new ipatch_sf2_pzone_first ipatch_sf2_pzone_next ipatch_sf2_pzone_set_inst ipatch_sf2_pzone_get_inst IPATCH_SF2_PZONE IPATCH_IS_SF2_PZONE IPATCH_TYPE_SF2_PZONE ipatch_sf2_pzone_get_type IPATCH_SF2_PZONE_CLASS IPATCH_IS_SF2_PZONE_CLASS IPATCH_SF2_PZONE_GET_CLASS
IpatchSampleStoreVirtual IpatchSampleStoreVirtual IpatchSampleStoreVirtual ipatch_sample_store_virtual_new ipatch_sample_store_virtual_get_list ipatch_sample_store_virtual_set_list IPATCH_SAMPLE_STORE_VIRTUAL IPATCH_IS_SAMPLE_STORE_VIRTUAL IPATCH_TYPE_SAMPLE_STORE_VIRTUAL ipatch_sample_store_virtual_get_type IPATCH_SAMPLE_STORE_VIRTUAL_CLASS IPATCH_IS_SAMPLE_STORE_VIRTUAL_CLASS
IpatchRiff IpatchRiffChunk IpatchRiffStatus IpatchRiffMode IpatchRiff IpatchRiff IPATCH_RIFF_NEED_SWAP IPATCH_RIFF_BIG_ENDIAN IpatchRiffChunkType IPATCH_RIFF_ERROR IpatchRiffError IPATCH_FOURCC IPATCH_FOURCC_RIFF IPATCH_FOURCC_RIFX IPATCH_FOURCC_LIST IPATCH_RIFF_HEADER_SIZE IPATCH_RIFF_FOURCC_SIZE IPATCH_RIFF_LIST_HEADER_SIZE IPATCH_RIFF_WAVE_FMT_PCM IPATCH_RIFF_WAVE_FMT_FLOAT ipatch_riff_error_quark ipatch_riff_new ipatch_riff_set_file_handle ipatch_riff_get_file_handle ipatch_riff_get_chunk_level ipatch_riff_get_chunk_array ipatch_riff_get_chunk ipatch_riff_get_total_size ipatch_riff_get_position ipatch_riff_push_state ipatch_riff_pop_state ipatch_riff_start_read ipatch_riff_start_read_chunk ipatch_riff_read_chunk_verify ipatch_riff_read_chunk ipatch_riff_write_list_chunk ipatch_riff_write_sub_chunk ipatch_riff_write_chunk ipatch_riff_end_chunk ipatch_riff_close_chunk ipatch_riff_skip_chunk ipatch_riff_skip_chunks ipatch_riff_get_error ipatch_riff_message_detail IPATCH_RIFF IPATCH_IS_RIFF IPATCH_TYPE_RIFF ipatch_riff_get_type IPATCH_RIFF_CLASS IPATCH_IS_RIFF_CLASS
IpatchVirtualContainer_types IPATCH_TYPE_VIRTUAL_DLS2_PERCUSSION IPATCH_IS_VIRTUAL_DLS2_PERCUSSION IPATCH_TYPE_VIRTUAL_DLS2_SAMPLES IPATCH_IS_VIRTUAL_DLS2_SAMPLES IPATCH_TYPE_VIRTUAL_GIG_MELODIC IPATCH_IS_VIRTUAL_GIG_MELODIC IPATCH_TYPE_VIRTUAL_GIG_PERCUSSION IPATCH_IS_VIRTUAL_GIG_PERCUSSION IPATCH_TYPE_VIRTUAL_GIG_SAMPLES IPATCH_IS_VIRTUAL_GIG_SAMPLES IPATCH_TYPE_VIRTUAL_SF2_INST IPATCH_IS_VIRTUAL_SF2_INST IPATCH_TYPE_VIRTUAL_SF2_MELODIC IPATCH_IS_VIRTUAL_SF2_MELODIC IPATCH_TYPE_VIRTUAL_SF2_PERCUSSION IPATCH_IS_VIRTUAL_SF2_PERCUSSION IPATCH_TYPE_VIRTUAL_SF2_SAMPLES IPATCH_IS_VIRTUAL_SF2_SAMPLES IPATCH_TYPE_VIRTUAL_SF2_ROM IPATCH_IS_VIRTUAL_SF2_ROM ipatch_virtual_dls2_percussion_get_type ipatch_virtual_dls2_samples_get_type ipatch_virtual_gig_melodic_get_type ipatch_virtual_gig_percussion_get_type ipatch_virtual_gig_samples_get_type ipatch_virtual_sf2_inst_get_type ipatch_virtual_sf2_melodic_get_type ipatch_virtual_sf2_percussion_get_type ipatch_virtual_sf2_samples_get_type ipatch_virtual_sf2_rom_get_type IPATCH_IS_VIRTUAL_DLS2_MELODIC IPATCH_TYPE_VIRTUAL_DLS2_MELODIC ipatch_virtual_dls2_melodic_get_type
IpatchSF2GenItem IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID IPATCH_SF2_GEN_ITEM_FIRST_PROP_USER_ID IpatchSF2GenItem IpatchSF2GenItemIface ipatch_sf2_gen_item_get_amount ipatch_sf2_gen_item_set_amount ipatch_sf2_gen_item_set_gen_flag ipatch_sf2_gen_item_count_set ipatch_sf2_gen_item_copy_all ipatch_sf2_gen_item_copy_set ipatch_sf2_gen_item_set_note_range ipatch_sf2_gen_item_set_velocity_range ipatch_sf2_gen_item_in_range ipatch_sf2_gen_item_intersect_test ipatch_sf2_gen_item_class_get_pspec ipatch_sf2_gen_item_class_get_pspec_set ipatch_sf2_gen_item_iface_install_properties ipatch_sf2_gen_item_iface_set_property ipatch_sf2_gen_item_iface_get_property IPATCH_SF2_GEN_ITEM IPATCH_IS_SF2_GEN_ITEM IPATCH_TYPE_SF2_GEN_ITEM ipatch_sf2_gen_item_get_type IPATCH_SF2_GEN_ITEM_CLASS IPATCH_SF2_GEN_ITEM_GET_IFACE
IpatchSampleData IpatchSampleData IpatchSampleData IPATCH_SAMPLE_DATA_UNUSED_FLAG_SHIFT ipatch_get_sample_data_list ipatch_sample_data_new ipatch_sample_data_add ipatch_sample_data_remove ipatch_sample_data_replace_native_sample ipatch_sample_data_get_samples ipatch_sample_data_get_size ipatch_sample_data_get_native_sample ipatch_sample_data_get_native_format ipatch_sample_data_open_native_sample ipatch_sample_data_get_cache_sample ipatch_sample_data_lookup_cache_sample ipatch_sample_data_open_cache_sample ipatch_sample_cache_clean ipatch_sample_data_get_blank IPATCH_SAMPLE_DATA IPATCH_IS_SAMPLE_DATA IPATCH_TYPE_SAMPLE_DATA ipatch_sample_data_get_type IPATCH_SAMPLE_DATA_CLASS IPATCH_IS_SAMPLE_DATA_CLASS IPATCH_SAMPLE_DATA_GET_CLASS
IpatchState_types IPATCH_TYPE_STATE_ITEM_REMOVE IPATCH_STATE_ITEM_REMOVE IPATCH_STATE_ITEM_REMOVE_CLASS IPATCH_IS_STATE_ITEM_REMOVE IPATCH_IS_STATE_ITEM_REMOVE_CLASS IPATCH_STATE_ITEM_REMOVE_GET_CLASS IPATCH_TYPE_STATE_ITEM_CHANGE IPATCH_STATE_ITEM_CHANGE IPATCH_STATE_ITEM_CHANGE_CLASS IPATCH_IS_STATE_ITEM_CHANGE IPATCH_IS_STATE_ITEM_CHANGE_CLASS IPATCH_STATE_ITEM_CHANGE_GET_CLASS IpatchStateItemAdd IpatchStateItemAdd IpatchStateItemRemove IpatchStateItemRemove IpatchStateItemChange IpatchStateItemChange ipatch_state_item_remove_get_type ipatch_state_item_change_get_type IPATCH_STATE_ITEM_ADD IPATCH_IS_STATE_ITEM_ADD IPATCH_TYPE_STATE_ITEM_ADD ipatch_state_item_add_get_type IPATCH_STATE_ITEM_ADD_CLASS IPATCH_IS_STATE_ITEM_ADD_CLASS IPATCH_STATE_ITEM_ADD_GET_CLASS
IpatchRange IpatchRange IpatchParamSpecRange IPATCH_TYPE_RANGE IPATCH_VALUE_HOLDS_RANGE IPATCH_RANGE_SET_VALUES IPATCH_RANGE_SET_NULL ipatch_range_new ipatch_range_copy ipatch_range_free ipatch_value_set_range ipatch_value_set_static_range ipatch_value_get_range IPATCH_TYPE_PARAM_RANGE ipatch_param_spec_range_get_type ipatch_param_spec_range IPATCH_PARAM_SPEC_RANGE IPATCH_IS_PARAM_SPEC_RANGE ipatch_range_get_type
IpatchDLSReader IPATCH_DLS_READER_ERROR IpatchDLSReaderError IpatchDLSReader IpatchDLSReader ipatch_dls_reader_new ipatch_dls_reader_load ipatch_dls_reader_start ipatch_dls_reader_set_pool_table ipatch_dls_reader_fixup ipatch_dls_reader_load_level_0 ipatch_dls_reader_load_inst_list ipatch_dls_reader_load_region_list ipatch_gig_reader_load_region_list ipatch_dls_reader_load_art_list ipatch_dls_reader_load_wave_pool ipatch_gig_reader_load_sub_regions ipatch_gig_reader_load_inst_lart ipatch_dls_load_info ipatch_dls_load_region_header ipatch_gig_load_region_header ipatch_dls_load_wave_link ipatch_dls_load_sample_info ipatch_dls_load_connection ipatch_dls_load_sample_format ipatch_dls_load_pool_table ipatch_dls_load_dlid ipatch_gig_load_sample_info ipatch_gig_load_dimension_info ipatch_gig_load_dimension_names ipatch_gig_load_group_names IPATCH_DLS_READER IPATCH_IS_DLS_READER IPATCH_TYPE_DLS_READER ipatch_dls_reader_get_type IPATCH_DLS_READER_CLASS IPATCH_IS_DLS_READER_CLASS
IpatchSampleStoreRam IpatchSampleStoreRam IpatchSampleStoreRam IpatchSampleStoreRamFlags IPATCH_SAMPLE_STORE_RAM_UNUSED_FLAG_SHIFT ipatch_sample_store_ram_new ipatch_sample_store_ram_get_blank IPATCH_SAMPLE_STORE_RAM IPATCH_IS_SAMPLE_STORE_RAM IPATCH_TYPE_SAMPLE_STORE_RAM ipatch_sample_store_ram_get_type IPATCH_SAMPLE_STORE_RAM_CLASS IPATCH_IS_SAMPLE_STORE_RAM_CLASS
IpatchGigRegion IpatchGigRegion IpatchGigRegion IpatchGigRegionFlags IPATCH_GIG_REGION_FLAG_MASK IPATCH_GIG_REGION_UNUSED_FLAG_SHIFT ipatch_gig_region_new ipatch_gig_region_first ipatch_gig_region_next ipatch_gig_region_set_note_range ipatch_gig_region_set_velocity_range ipatch_gig_region_new_dimension ipatch_gig_region_remove_dimension IPATCH_GIG_REGION IPATCH_IS_GIG_REGION IPATCH_TYPE_GIG_REGION ipatch_gig_region_get_type IPATCH_GIG_REGION_CLASS IPATCH_IS_GIG_REGION_CLASS IPATCH_GIG_REGION_GET_CLASS
IpatchGigFile IpatchGigFile IpatchGigFile IPATCH_GIG_FOURCC_3PRG IPATCH_GIG_FOURCC_3EWL IPATCH_GIG_FOURCC_3DNL IPATCH_GIG_FOURCC_3GNL IPATCH_GIG_FOURCC_3GRI IPATCH_GIG_FOURCC_SMPL IPATCH_GIG_FOURCC_3DDP IPATCH_GIG_FOURCC_3EWA IPATCH_GIG_FOURCC_3EWG IPATCH_GIG_FOURCC_3GIX IPATCH_GIG_FOURCC_3GNM IPATCH_GIG_FOURCC_3LNK IPATCH_GIG_FOURCC_EINF IPATCH_GIG_SMPL_SIZE IPATCH_GIG_3DDP_SIZE IPATCH_GIG_3EWA_SIZE IPATCH_GIG_3EWG_SIZE IPATCH_GIG_3GIX_SIZE IPATCH_GIG_3GNM_SIZE IPATCH_GIG_3LNK_SIZE IPATCH_GIG_ITEM_INAM_SIZE IPATCH_GIG_MOST_INFO_SIZE IPATCH_GIG_IARL_INFO_SIZE IPATCH_GIG_ICMT_INFO_SIZE IPATCH_GIG_INST_ISFT_VAL ipatch_gig_file_new IPATCH_GIG_FILE IPATCH_IS_GIG_FILE IPATCH_TYPE_GIG_FILE ipatch_gig_file_get_type IPATCH_GIG_FILE_CLASS IPATCH_IS_GIG_FILE_CLASS IPATCH_GIG_FILE_GET_CLASS
md5 ipatch_md5_init ipatch_md5_update ipatch_md5_final
version IPATCH_VERSION IPATCH_VERSION_MAJOR IPATCH_VERSION_MINOR IPATCH_VERSION_MICRO ipatch_version
IpatchSF2Mod IpatchSF2Mod IpatchSF2ModList IPATCH_TYPE_SF2_MOD IPATCH_TYPE_SF2_MOD_LIST IPATCH_SF2_MOD_ARE_IDENTICAL IPATCH_SF2_MOD_ARE_IDENTICAL_AMOUNT IpatchSF2ModFieldMasks IpatchSF2ModFieldShifts IpatchSF2ModControl IpatchSF2ModControlPalette IpatchSF2ModDirection IpatchSF2ModPolarity IpatchSF2ModType IpatchSF2ModTransform IpatchSF2ModFlags ipatch_sf2_mod_get_type ipatch_sf2_mod_list_get_type ipatch_sf2_mod_new ipatch_sf2_mod_free ipatch_sf2_mod_duplicate ipatch_sf2_mod_list_duplicate ipatch_sf2_mod_list_override ipatch_sf2_mod_list_boxed_free ipatch_sf2_mod_list_insert ipatch_sf2_mod_list_remove ipatch_sf2_mod_list_change ipatch_sf2_mod_list_offset ipatch_sf2_mod_list_free ipatch_sf2_mod_list_get_default
IpatchTypeProp IpatchSplitsType IpatchTypePropGetFunc ipatch_type_install_property ipatch_type_find_property ipatch_type_list_properties ipatch_type_find_types_with_property ipatch_type_set ipatch_type_set_valist ipatch_type_set_property ipatch_type_get ipatch_type_get_valist ipatch_type_get_property ipatch_type_object_get ipatch_type_object_get_valist ipatch_type_object_get_property ipatch_type_set_dynamic_func ipatch_type_get_dynamic_func
util ipatch_util_value_bool_true ipatch_util_value_bool_false IPATCH_UTIL_VALUE_BOOL ipatch_util_value_hash ipatch_util_value_array_hash ipatch_util_file_size
IpatchSampleTransform IpatchSampleTransform IpatchSampleTransformFunc ipatch_sample_transform_new ipatch_sample_transform_free ipatch_sample_transform_init ipatch_sample_transform_pool_acquire ipatch_sample_transform_pool_release ipatch_sample_transform_set_formats ipatch_sample_transform_alloc ipatch_sample_transform_alloc_size ipatch_sample_transform_free_buffers ipatch_sample_transform_set_buffers_size ipatch_sample_transform_get_buffers ipatch_sample_transform_get_frame_sizes ipatch_sample_transform_get_max_frames ipatch_sample_transform_convert ipatch_sample_transform_convert_single
IpatchUnit IpatchUnitInfo IpatchUnitFlags IpatchValueTransform IpatchUnitType IPATCH_UNIT_TYPE_FIRST_DYNAMIC_ID IpatchUnitClassType ipatch_unit_info_new ipatch_unit_info_free ipatch_unit_register ipatch_unit_lookup ipatch_unit_lookup_by_name ipatch_unit_class_register_map ipatch_unit_class_lookup_map ipatch_unit_conversion_register ipatch_unit_conversion_lookup ipatch_unit_convert ipatch_unit_user_class_convert
IpatchXml IpatchXmlNode IpatchXmlAttr ipatch_xml_new_node ipatch_xml_new_node_strv ipatch_xml_get_data ipatch_xml_set_data ipatch_xml_set_data_full ipatch_xml_steal_data ipatch_xml_get_qdata ipatch_xml_set_qdata ipatch_xml_set_qdata_full ipatch_xml_steal_qdata ipatch_xml_destroy ipatch_xml_copy ipatch_xml_set_name ipatch_xml_set_value ipatch_xml_set_value_printf ipatch_xml_take_name ipatch_xml_take_value ipatch_xml_get_name ipatch_xml_test_name ipatch_xml_get_value ipatch_xml_dup_value ipatch_xml_test_value ipatch_xml_set_attribute ipatch_xml_set_attributes ipatch_xml_get_attribute ipatch_xml_test_attribute ipatch_xml_find_child ipatch_xml_find_by_path ipatch_xml_to_str ipatch_xml_save_to_file ipatch_xml_from_str ipatch_xml_load_from_file ipatch_xml_node_new ipatch_xml_node_free ipatch_xml_node_duplicate ipatch_xml_attr_new ipatch_xml_attr_free ipatch_xml_attr_duplicate
IpatchParamProp IPATCH_PARAM_USER_SHIFT ipatch_param_install_property ipatch_param_find_property ipatch_param_list_properties ipatch_param_set ipatch_param_set_valist ipatch_param_set_property ipatch_param_get ipatch_param_get_valist ipatch_param_get_property
IpatchXmlObject IpatchXmlEncodeFunc IpatchXmlDecodeFunc ipatch_xml_register_handler ipatch_xml_lookup_handler ipatch_xml_lookup_handler_by_prop_name ipatch_xml_encode_object ipatch_xml_encode_property ipatch_xml_encode_property_by_name ipatch_xml_encode_value ipatch_xml_decode_object ipatch_xml_decode_property ipatch_xml_decode_property_by_name ipatch_xml_decode_value ipatch_xml_default_encode_object_func ipatch_xml_default_encode_property_func ipatch_xml_default_encode_value_func ipatch_xml_default_decode_object_func ipatch_xml_default_decode_property_func ipatch_xml_default_decode_value_func
IpatchUnit_SF2 ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch ipatch_unit_sf2_abs_pitch_to_hertz ipatch_unit_hertz_to_sf2_abs_pitch ipatch_unit_sf2_ofs_pitch_to_multiplier ipatch_unit_multiplier_to_sf2_ofs_pitch ipatch_unit_sf2_abs_time_to_dls_abs_time ipatch_unit_dls_abs_time_to_sf2_abs_time ipatch_unit_sf2_abs_time_to_seconds ipatch_unit_seconds_to_sf2_abs_time ipatch_unit_sf2_ofs_time_to_multiplier ipatch_unit_multiplier_to_sf2_ofs_time ipatch_unit_centibels_to_dls_gain ipatch_unit_dls_gain_to_centibels ipatch_unit_centibels_to_decibels ipatch_unit_decibels_to_centibels ipatch_unit_tenth_percent_to_percent ipatch_unit_percent_to_tenth_percent
IpatchUnit_generic ipatch_unit_hertz_to_cents ipatch_unit_cents_to_hertz
IpatchUnit_DLS IPATCH_UNIT_DLS_ABS_TIME_0SECS ipatch_unit_dls_class_convert ipatch_unit_dls_percent_to_percent ipatch_unit_percent_to_dls_percent ipatch_unit_dls_gain_to_decibels ipatch_unit_decibels_to_dls_gain ipatch_unit_dls_abs_time_to_seconds ipatch_unit_seconds_to_dls_abs_time ipatch_unit_dls_rel_time_to_time_cents ipatch_unit_time_cents_to_dls_rel_time ipatch_unit_dls_abs_pitch_to_hertz ipatch_unit_hertz_to_dls_abs_pitch ipatch_unit_dls_rel_pitch_to_cents ipatch_unit_cents_to_dls_rel_pitch
misc IPATCH_ERROR IpatchError ipatch_code_error ipatch_application_name ipatch_init ipatch_set_application_name ipatch_error_quark ipatch_gerror_message ipatch_strconcat_num ipatch_dump_object
IpatchGigEffects IpatchGigEffects IpatchGigFilterType IpatchGigControlType ipatch_gig_parse_effects ipatch_gig_store_effects ipatch_gig_effects_init ipatch_gig_effects_to_gen_array ipatch_gig_to_sf2_timecents ipatch_gig_volsust_to_sf2_centibels
IpatchDLS2Conn IpatchDLS2Conn IpatchDLS2ConnInfo IPATCH_TYPE_DLS2_CONN IPATCH_DLS2_CONN_ARE_IDENTICAL IpatchDLS2ConnSrcType IpatchDLS2ConnDestType IPATCH_DLS2_CONN_OUTPUT_TRANS_NONE IpatchDLS2ConnTransformType IpatchDLS2ConnPolarityType IpatchDLS2ConnTransformMasks IpatchDLS2ConnTransformShifts ipatch_dls2_conn_get_type ipatch_dls2_conn_new ipatch_dls2_conn_free ipatch_dls2_conn_duplicate ipatch_dls2_conn_list_set ipatch_dls2_conn_list_unset ipatch_dls2_conn_list_duplicate ipatch_dls2_conn_list_duplicate_fast ipatch_dls2_conn_list_free
IpatchSampleList IpatchSampleList IpatchSampleListItem IPATCH_TYPE_SAMPLE_LIST ipatch_sample_list_get_type ipatch_sample_list_new ipatch_sample_list_free ipatch_sample_list_duplicate ipatch_sample_list_item_new ipatch_sample_list_item_new_init ipatch_sample_list_item_free ipatch_sample_list_item_duplicate ipatch_sample_list_append ipatch_sample_list_prepend ipatch_sample_list_insert_index ipatch_sample_list_insert ipatch_sample_list_cut ipatch_sample_list_render
IpatchIter IpatchIter IpatchIterMethods IPATCH_TYPE_ITER ipatch_iter_get_type ipatch_iter_alloc ipatch_iter_free ipatch_iter_duplicate ipatch_iter_get ipatch_iter_next ipatch_iter_first ipatch_iter_last ipatch_iter_index ipatch_iter_insert ipatch_iter_remove ipatch_iter_count IPATCH_ITER_GSLIST_GET_LIST IPATCH_ITER_GSLIST_GET_POS IPATCH_ITER_GSLIST_SET_LIST IPATCH_ITER_GSLIST_SET_POS ipatch_iter_GSList_init ipatch_iter_GSList_get ipatch_iter_GSList_next ipatch_iter_GSList_first ipatch_iter_GSList_last ipatch_iter_GSList_index ipatch_iter_GSList_insert ipatch_iter_GSList_remove ipatch_iter_GSList_count IPATCH_ITER_GLIST_GET_LIST IPATCH_ITER_GLIST_GET_POS IPATCH_ITER_GLIST_SET_LIST IPATCH_ITER_GLIST_SET_POS ipatch_iter_GList_init ipatch_iter_GList_get ipatch_iter_GList_next ipatch_iter_GList_first ipatch_iter_GList_last ipatch_iter_GList_index ipatch_iter_GList_insert ipatch_iter_GList_remove ipatch_iter_GList_count IPATCH_ITER_ARRAY_GET_ARRAY IPATCH_ITER_ARRAY_GET_SIZE IPATCH_ITER_ARRAY_GET_POS IPATCH_ITER_ARRAY_SET_ARRAY IPATCH_ITER_ARRAY_SET_SIZE IPATCH_ITER_ARRAY_SET_POS ipatch_iter_array_init ipatch_iter_array_get ipatch_iter_array_next ipatch_iter_array_first ipatch_iter_array_last ipatch_iter_array_index ipatch_iter_array_insert ipatch_iter_array_remove ipatch_iter_array_count
IpatchSF2Gen IPATCH_SF2_GEN_COUNT IpatchSF2GenArray IpatchSF2GenInfo IPATCH_TYPE_SF2_GEN_ARRAY IpatchSF2GenPropsType IPATCH_SF2_GEN_PROPS_GLOBAL_FLAG IPATCH_SF2_GEN_PROPS_MASK IpatchSF2GenAmount IpatchSF2Gen IPATCH_SF2_GENID_SET IPATCH_SF2_GEN_ARRAY_TEST_FLAG IPATCH_SF2_GEN_ARRAY_SET_FLAG IPATCH_SF2_GEN_ARRAY_CLEAR_FLAG IpatchSF2GenType IpatchSF2GenSampleModes ipatch_sf2_gen_ofs_array ipatch_sf2_gen_abs_array ipatch_sf2_gen_ofs_valid_mask ipatch_sf2_gen_abs_valid_mask ipatch_sf2_gen_add_mask ipatch_sf2_gen_is_valid ipatch_sf2_gen_array_get_type ipatch_sf2_gen_array_new ipatch_sf2_gen_array_free ipatch_sf2_gen_array_duplicate ipatch_sf2_gen_array_init ipatch_sf2_gen_array_offset ipatch_sf2_gen_array_intersect_test ipatch_sf2_gen_array_count_set ipatch_sf2_gen_amount_to_value ipatch_sf2_gen_default_value ipatch_sf2_gen_offset ipatch_sf2_gen_clamp ipatch_sf2_gen_range_intersect ipatch_sf2_gen_range_intersect_test ipatch_sf2_gen_get_prop_name
IpatchDLS2Info IpatchDLS2Info IpatchDLS2InfoBag IpatchDLS2InfoType ipatch_dls2_info_get ipatch_dls2_info_peek ipatch_dls2_info_set ipatch_dls2_info_free ipatch_dls2_info_duplicate ipatch_dls2_info_is_defined ipatch_dls2_info_install_class_properties ipatch_dls2_info_set_property ipatch_dls2_info_get_property ipatch_dls2_info_notify ipatch_dls2_info_bag_new ipatch_dls2_info_bag_free
libinstpatch-1.0.0/docs/reference/Makefile.in0000644000175000017500000005010411461362230016046 00000000000000# Makefile.in generated by automake 1.11 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@ # -*- mode: makefile -*- #################################### # Everything below here is generic # #################################### 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@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/gtk-doc.make subdir = docs/reference ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/python.m4 \ $(top_srcdir)/acinclude.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)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ IPATCH_BINARY_AGE = @IPATCH_BINARY_AGE@ IPATCH_INTERFACE_AGE = @IPATCH_INTERFACE_AGE@ IPATCH_VERSION = @IPATCH_VERSION@ IPATCH_VERSION_MAJOR = @IPATCH_VERSION_MAJOR@ IPATCH_VERSION_MICRO = @IPATCH_VERSION_MICRO@ IPATCH_VERSION_MINOR = @IPATCH_VERSION_MINOR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ 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@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ PYGTK_CODEGEN_DIR = @PYGTK_CODEGEN_DIR@ PYGTK_LIBS = @PYGTK_LIBS@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ SNDFILE_LIBS = @SNDFILE_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ 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@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ 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@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # We require automake 1.6 at least. AUTOMAKE_OPTIONS = 1.6 # This is a blank Makefile.am for using gtk-doc. # Copy this to your project's API docs directory and modify the variables to # suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples # of using the various options. # The name of the module DOC_MODULE = libinstpatch # The top-level SGML file. You can change this if you want to. DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.sgml # The directory containing the source code. Relative to $(srcdir). # gtk-doc will search all .c & .h files beneath here for inline comments # documenting the functions and macros. DOC_SOURCE_DIR = $(top_srcdir)/libinstpatch # Extra options to pass to gtkdoc-scangobj. Not normally needed. SCANGOBJ_OPTIONS = --type-init-func="ipatch_init ()" # Extra options to supply to gtkdoc-scan. # e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" SCAN_OPTIONS = # Extra options to supply to gtkdoc-mkdb. # e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml MKDB_OPTIONS = --sgml-mode --output-format=xml # Extra options to supply to gtkdoc-mktmpl # e.g. MKTMPL_OPTIONS=--only-section-tmpl MKTMPL_OPTIONS = # Extra options to supply to gtkdoc-fixref. Not normally needed. # e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html FIXXREF_OPTIONS = # Used for dependencies. The docs will be rebuilt if any of these change. # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c HFILE_GLOB = $(top_srcdir)/libinstpatch/*.h CFILE_GLOB = $(top_srcdir)/libinstpatch/*.c # Header files to ignore when scanning. IGNORE_HFILES = \ IpatchConvert_Gig.h \ IpatchConvert_SF2.h \ IpatchConvert_DLS2.h \ IpatchConverter_priv.h \ IpatchSF2VoiceCache_DLS.h \ IpatchSF2VoiceCache_Gig.h \ IpatchSF2VoiceCache_SF2.h \ IpatchSF2VoiceCache_VBank.h \ builtin_enums.h \ config.h \ i18n.h \ ipatch_priv.h \ libinstpatch.h \ marshals.h # Images to copy into HTML directory. # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png HTML_IMAGES = # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). # e.g. content_files=running.sgml building.sgml changes-2.0.sgml content_files = # SGML files where gtk-doc abbrevations (#GtkWidget) are expanded # These files must be listed here *and* in content_files # e.g. expand_content_files=running.sgml expand_content_files = # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. # Only needed if you are using gtkdoc-scangobj to dynamically query widget # signals and properties. # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) INCLUDES = -I$(top_srcdir) @GOBJECT_CFLAGS@ @SNDFILE_CFLAGS@ GTKDOC_LIBS = @GOBJECT_LIBS@ @SNDFILE_LIBS@ \ $(top_srcdir)/libinstpatch/libinstpatch-1.0.la @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_RUN = sh -c @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_RUN = $(LIBTOOL) --mode=execute # We set GPATH here; this gives us semantics for GNU make # which are more like other make's VPATH, when it comes to # whether a source that is a target of one rule is then # searched for in VPATH/GPATH. # GPATH = $(srcdir) TARGET_DIR = $(HTML_DIR)/$(DOC_MODULE) # This includes the standard gtk-doc make rules, copied by gtkdocize. # Other files to distribute # e.g. EXTRA_DIST += version.xml.in EXTRA_DIST = $(content_files) $(HTML_IMAGES) $(DOC_MAIN_SGML_FILE) \ $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt DOC_STAMPS = scan-build.stamp sgml-build.stamp html-build.stamp \ $(srcdir)/sgml.stamp $(srcdir)/html.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ $(DOC_MODULE).hierarchy \ $(DOC_MODULE).interfaces \ $(DOC_MODULE).prerequisites \ $(DOC_MODULE).signals REPORT_FILES = \ $(DOC_MODULE)-undocumented.txt \ $(DOC_MODULE)-undeclared.txt \ $(DOC_MODULE)-unused.txt CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/gtk-doc.make $(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 docs/reference/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docs/reference/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile all-local installdirs: 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-local dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-data-local install-dvi: install-dvi-am install-dvi-am: install-exec-am: 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 -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-local .MAKE: install-am install-strip .PHONY: all all-am all-local check check-am clean clean-generic \ clean-libtool clean-local dist-hook distclean \ distclean-generic distclean-libtool distclean-local distdir \ dvi dvi-am html html-am info info-am install install-am \ install-data install-data-am install-data-local install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic \ maintainer-clean-local mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-local @ENABLE_GTK_DOC_TRUE@all-local: html-build.stamp @ENABLE_GTK_DOC_FALSE@all-local: docs: html-build.stamp $(REPORT_FILES): sgml-build.stamp #### scan #### scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) @echo 'gtk-doc: Scanning header files' @-chmod -R u+w $(srcdir) cd $(srcdir) && \ gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ else \ cd $(srcdir) ; \ for i in $(SCANOBJ_FILES) ; do \ test -f $$i || touch $$i ; \ done \ fi touch scan-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp @true #### xml #### sgml-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) @echo 'gtk-doc: Building XML' @-chmod -R u+w $(srcdir) cd $(srcdir) && \ gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS) touch sgml-build.stamp sgml.stamp: sgml-build.stamp @true #### html #### html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) @echo 'gtk-doc: Building HTML' @-chmod -R u+w $(srcdir) rm -rf $(srcdir)/html mkdir $(srcdir)/html mkhtml_options=""; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ if test "$(?)" = "0"; then \ mkhtml_options=--path="$(srcdir)"; \ fi cd $(srcdir)/html && gtkdoc-mkhtml $(mkhtml_options) $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) @echo 'gtk-doc: Fixing cross-references' cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) touch html-build.stamp ############## clean-local: rm -f *~ *.bak rm -rf .libs distclean-local: cd $(srcdir) && \ rm -rf xml $(REPORT_FILES) \ $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt maintainer-clean-local: clean cd $(srcdir) && rm -rf html install-data-local: installfiles=`echo $(srcdir)/html/*`; \ if test "$$installfiles" = '$(srcdir)/html/*'; \ then echo '-- Nothing to install' ; \ else \ if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ else \ installdir="$(DESTDIR)$(TARGET_DIR)"; \ fi; \ $(mkinstalldirs) $${installdir} ; \ for i in $$installfiles; do \ echo '-- Installing '$$i ; \ $(INSTALL_DATA) $$i $${installdir}; \ done; \ if test -n "$(DOC_MODULE_VERSION)"; then \ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ mv -f $${installdir}/$(DOC_MODULE).devhelp \ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \ fi; \ ! which gtkdoc-rebase >/dev/null 2>&1 || \ gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir} ; \ fi uninstall-local: if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ else \ installdir="$(DESTDIR)$(TARGET_DIR)"; \ fi; \ rm -rf $${installdir} # # Require gtk-doc when making dist # @ENABLE_GTK_DOC_TRUE@dist-check-gtkdoc: @ENABLE_GTK_DOC_FALSE@dist-check-gtkdoc: @ENABLE_GTK_DOC_FALSE@ @echo "*** gtk-doc must be installed and enabled in order to make dist" @ENABLE_GTK_DOC_FALSE@ @false dist-hook: dist-check-gtkdoc dist-hook-local mkdir $(distdir)/html cp $(srcdir)/html/* $(distdir)/html -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/ -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/ cd $(distdir) && rm -f $(DISTCLEANFILES) ! which gtkdoc-rebase >/dev/null 2>&1 || \ gtkdoc-rebase --online --relative --html-dir=$(distdir)/html .PHONY : dist-hook-local docs # 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: libinstpatch-1.0.0/docs/reference/libinstpatch-docs.sgml0000644000175000017500000001166011461367407020316 00000000000000 ]> libinstpatch Reference Manual For libinstpatch 1.0.0. The latest version of this documentation can be found on-line at http://swami.sourceforge.net/api/libinstpatch/. Base objects and functions Utility objects and functions Sample data objects and functions DLS patches SoundFont patches GigaSampler patches Virtual banks Object Hierarchy API Index libinstpatch-1.0.0/docs/reference/libinstpatch-overrides.txt0000644000175000017500000000000011461353076021224 00000000000000libinstpatch-1.0.0/docs/reference/Makefile.am0000644000175000017500000000601211461362215016037 00000000000000## Process this file with automake to produce Makefile.in # We require automake 1.6 at least. AUTOMAKE_OPTIONS = 1.6 # This is a blank Makefile.am for using gtk-doc. # Copy this to your project's API docs directory and modify the variables to # suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples # of using the various options. # The name of the module DOC_MODULE=libinstpatch # The top-level SGML file. You can change this if you want to. DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml # The directory containing the source code. Relative to $(srcdir). # gtk-doc will search all .c & .h files beneath here for inline comments # documenting the functions and macros. DOC_SOURCE_DIR=$(top_srcdir)/libinstpatch # Extra options to pass to gtkdoc-scangobj. Not normally needed. SCANGOBJ_OPTIONS=--type-init-func="ipatch_init ()" # Extra options to supply to gtkdoc-scan. # e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" SCAN_OPTIONS= # Extra options to supply to gtkdoc-mkdb. # e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml MKDB_OPTIONS=--sgml-mode --output-format=xml # Extra options to supply to gtkdoc-mktmpl # e.g. MKTMPL_OPTIONS=--only-section-tmpl MKTMPL_OPTIONS= # Extra options to supply to gtkdoc-fixref. Not normally needed. # e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html FIXXREF_OPTIONS= # Used for dependencies. The docs will be rebuilt if any of these change. # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c HFILE_GLOB=$(top_srcdir)/libinstpatch/*.h CFILE_GLOB=$(top_srcdir)/libinstpatch/*.c # Header files to ignore when scanning. IGNORE_HFILES= \ IpatchConvert_Gig.h \ IpatchConvert_SF2.h \ IpatchConvert_DLS2.h \ IpatchConverter_priv.h \ IpatchSF2VoiceCache_DLS.h \ IpatchSF2VoiceCache_Gig.h \ IpatchSF2VoiceCache_SF2.h \ IpatchSF2VoiceCache_VBank.h \ builtin_enums.h \ config.h \ i18n.h \ ipatch_priv.h \ libinstpatch.h \ marshals.h # Images to copy into HTML directory. # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png HTML_IMAGES= # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). # e.g. content_files=running.sgml building.sgml changes-2.0.sgml content_files= # SGML files where gtk-doc abbrevations (#GtkWidget) are expanded # These files must be listed here *and* in content_files # e.g. expand_content_files=running.sgml expand_content_files= # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. # Only needed if you are using gtkdoc-scangobj to dynamically query widget # signals and properties. # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) INCLUDES = -I$(top_srcdir) @GOBJECT_CFLAGS@ @SNDFILE_CFLAGS@ GTKDOC_LIBS = @GOBJECT_LIBS@ @SNDFILE_LIBS@ \ $(top_srcdir)/libinstpatch/libinstpatch-1.0.la # This includes the standard gtk-doc make rules, copied by gtkdocize. include $(top_srcdir)/gtk-doc.make # Other files to distribute # e.g. EXTRA_DIST += version.xml.in EXTRA_DIST += libinstpatch-1.0.0/docs/reference/html/0000777000175000017500000000000011461404256015036 500000000000000libinstpatch-1.0.0/docs/reference/html/style.css0000644000175000017500000000460111461404255016624 00000000000000.synopsis, .classsynopsis { background: #eeeeee; border: solid 1px #aaaaaa; padding: 0.5em; } .programlisting { background: #eeeeff; border: solid 1px #aaaaff; padding: 0.5em; } .variablelist { padding: 4px; margin-left: 3em; } .variablelist td:first-child { vertical-align: top; } /* this is needed so that the local anchors are displayed below the naviagtion */ @media screen { sup a.footnote { position: relative; top: 0em ! important; } div.refnamediv a[name], div.refsect1 a[name] { position: relative; top: -4.5em; } table.navigation#top { background: #ffeeee; border: solid 1px #ffaaaa; margin-top: 0; margin-bottom: 0; position: fixed; top: 0; left: 0; height: 2em; z-index: 1; } .navigation a { color: #770000; } .navigation a:visited { color: #550000; } td.shortcuts { color: #770000; font-size: 80%; white-space: nowrap; } div.refentry, div.chapter, div.reference, div.part, div.book, div.glossary, div.sect1, div.appendix, div.preface { position: relative; top: 3em; z-index: 0; } div.glossary, div.index { position: relative; top: 2em; z-index: 0; } div.refnamediv { margin-top: 2em; } body { padding-bottom: 20em; } } @media print { table.navigation { visibility: collapse; display: none; } div.titlepage table.navigation { visibility: visible; display: table; background: #ffeeee; border: solid 1px #ffaaaa; margin-top: 0; margin-bottom: 0; top: 0; left: 0; height: 2em; } } .navigation .title { font-size: 200%; } div.gallery-float { float: left; padding: 10px; } div.gallery-float img { border-style: none; } div.gallery-spacer { clear: both; } a { text-decoration: none; } a:hover { text-decoration: underline; color: #FF0000; } div.table table { border-collapse: collapse; border-spacing: 0px; border-style: solid; border-color: #777777; border-width: 1px; } div.table table td, div.table table th { border-style: solid; border-color: #777777; border-width: 1px; padding: 3px; vertical-align: top; } div.table table th { background-color: #eeeeee; } hr { color: #777777; background: #777777; border: 0; height: 1px; clear: both; } .footer { padding-top: 3.5em; color: #777777; text-align: center; font-size: 80%; } libinstpatch-1.0.0/docs/reference/html/IpatchGigFile.html0000644000175000017500000003277711461404255020316 00000000000000 IpatchGigFile

IpatchGigFile

IpatchGigFile — GigaSampler file object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchFile
               +----IpatchDLSFile
                     +----IpatchGigFile

Description

File type for GigaSampler files.

Details

IpatchGigFile

typedef struct _IpatchGigFile IpatchGigFile;

IPATCH_GIG_FOURCC_3PRG

#define IPATCH_GIG_FOURCC_3PRG  IPATCH_FOURCC ('3','p','r','g')

IPATCH_GIG_FOURCC_3EWL

#define IPATCH_GIG_FOURCC_3EWL  IPATCH_FOURCC ('3','e','w','l')

IPATCH_GIG_FOURCC_3DNL

#define IPATCH_GIG_FOURCC_3DNL  IPATCH_FOURCC ('3','d','n','l')

IPATCH_GIG_FOURCC_3GNL

#define IPATCH_GIG_FOURCC_3GNL  IPATCH_FOURCC ('3','g','n','l')

IPATCH_GIG_FOURCC_3GRI

#define IPATCH_GIG_FOURCC_3GRI  IPATCH_FOURCC ('3','g','r','i')

IPATCH_GIG_FOURCC_SMPL

#define IPATCH_GIG_FOURCC_SMPL  IPATCH_FOURCC ('s','m','p','l')

IPATCH_GIG_FOURCC_3DDP

#define IPATCH_GIG_FOURCC_3DDP  IPATCH_FOURCC ('3','d','d','p')

IPATCH_GIG_FOURCC_3EWA

#define IPATCH_GIG_FOURCC_3EWA  IPATCH_FOURCC ('3','e','w','a')

IPATCH_GIG_FOURCC_3EWG

#define IPATCH_GIG_FOURCC_3EWG  IPATCH_FOURCC ('3','e','w','g')

IPATCH_GIG_FOURCC_3GIX

#define IPATCH_GIG_FOURCC_3GIX  IPATCH_FOURCC ('3','g','i','x')

IPATCH_GIG_FOURCC_3GNM

#define IPATCH_GIG_FOURCC_3GNM  IPATCH_FOURCC ('3','g','n','m')

IPATCH_GIG_FOURCC_3LNK

#define IPATCH_GIG_FOURCC_3LNK  IPATCH_FOURCC ('3','l','n','k')

IPATCH_GIG_FOURCC_EINF

#define IPATCH_GIG_FOURCC_EINF  IPATCH_FOURCC ('e','i','n','f')

IPATCH_GIG_SMPL_SIZE

#define IPATCH_GIG_SMPL_SIZE  60

IPATCH_GIG_3DDP_SIZE

#define IPATCH_GIG_3DDP_SIZE  10

IPATCH_GIG_3EWA_SIZE

#define IPATCH_GIG_3EWA_SIZE 140

IPATCH_GIG_3EWG_SIZE

#define IPATCH_GIG_3EWG_SIZE  12

IPATCH_GIG_3GIX_SIZE

#define IPATCH_GIG_3GIX_SIZE   4

IPATCH_GIG_3GNM_SIZE

#define IPATCH_GIG_3GNM_SIZE  64

IPATCH_GIG_3LNK_SIZE

#define IPATCH_GIG_3LNK_SIZE 172

IPATCH_GIG_ITEM_INAM_SIZE

#define IPATCH_GIG_ITEM_INAM_SIZE 64

IPATCH_GIG_MOST_INFO_SIZE

#define IPATCH_GIG_MOST_INFO_SIZE 128 /* size of all chunks except 2 below */

IPATCH_GIG_IARL_INFO_SIZE

#define IPATCH_GIG_IARL_INFO_SIZE 256 /* this one is padded with spaces ' ' */

IPATCH_GIG_ICMT_INFO_SIZE

#define IPATCH_GIG_ICMT_INFO_SIZE 1024

IPATCH_GIG_INST_ISFT_VAL

#define IPATCH_GIG_INST_ISFT_VAL "Endless Wave"

ipatch_gig_file_new ()

IpatchGigFile *     ipatch_gig_file_new                 (void);

Create a new GigaSampler file object.

Returns :

New GigaSampler file object with a reference count of 1. Caller owns the reference and removing it will destroy the item.
libinstpatch-1.0.0/docs/reference/html/libinstpatch-md5.html0000644000175000017500000001353511461404255021015 00000000000000 md5

md5

md5 — MD5 hashing functions

Stability Level

Stable, unless otherwise indicated

Synopsis

void                ipatch_md5_init                     (IpatchMD5 *ctx);
void                ipatch_md5_update                   (IpatchMD5 *ctx,
                                                         guint8 const *buf,
                                                         unsigned  len);
void                ipatch_md5_final                    (IpatchMD5 *ctx,
                                                         guint8 digest[16]);

Description

Details

ipatch_md5_init ()

void                ipatch_md5_init                     (IpatchMD5 *ctx);

Start MD5 accumulation. Set bit count to 0 and buffer to mysterious initialization constants.

ctx :

MD5 context

ipatch_md5_update ()

void                ipatch_md5_update                   (IpatchMD5 *ctx,
                                                         guint8 const *buf,
                                                         unsigned  len);

ipatch_md5_final ()

void                ipatch_md5_final                    (IpatchMD5 *ctx,
                                                         guint8 digest[16]);

Final wrapup - pad to 64-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first)

ctx :

MD5 context

digest :

Buffer to store 16 byte MD5 digest into
libinstpatch-1.0.0/docs/reference/html/IpatchDLS2.html0000644000175000017500000010443411461404255017502 00000000000000 IpatchDLS2

IpatchDLS2

IpatchDLS2 — DLS version 2 instrument file object

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchDLS2;
enum                IpatchDLS2Flags;
#define             IPATCH_DLS2_UNUSED_FLAG_SHIFT
IpatchDLS2 *        ipatch_dls2_new                     (void);
#define             ipatch_dls2_get_insts               (dls)
#define             ipatch_dls2_get_samples             (dls)
void                ipatch_dls2_set_file                (IpatchDLS2 *dls,
                                                         IpatchDLSFile *file);
IpatchDLSFile *     ipatch_dls2_get_file                (IpatchDLS2 *dls);
char *              ipatch_dls2_get_info                (IpatchDLS2 *dls,
                                                         guint32 fourcc);
void                ipatch_dls2_set_info                (IpatchDLS2 *dls,
                                                         guint32 fourcc,
                                                         const char *val);
char *              ipatch_dls2_make_unique_name        (IpatchDLS2 *dls,
                                                         GType child_type,
                                                         const char *name,
                                                         const IpatchItem *exclude);
IpatchDLS2Inst *    ipatch_dls2_find_inst               (IpatchDLS2 *dls,
                                                         const char *name,
                                                         int bank,
                                                         int program,
                                                         const IpatchDLS2Inst *exclude);
IpatchDLS2Sample *  ipatch_dls2_find_sample             (IpatchDLS2 *dls,
                                                         const char *name,
                                                         const IpatchDLS2Sample *exclude);
IpatchList *        ipatch_dls2_get_region_references   (IpatchDLS2Sample *sample);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchBase
                     +----IpatchDLS2
                           +----IpatchGig

Properties

  "archive-location"         gchar*                : Read / Write
  "artist"                   gchar*                : Read / Write
  "comment"                  gchar*                : Read / Write
  "commissioned"             gchar*                : Read / Write
  "copyright"                gchar*                : Read / Write
  "date"                     gchar*                : Read / Write
  "engineer"                 gchar*                : Read / Write
  "genre"                    gchar*                : Read / Write
  "keywords"                 gchar*                : Read / Write
  "medium"                   gchar*                : Read / Write
  "name"                     gchar*                : Read / Write
  "product"                  gchar*                : Read / Write
  "software"                 gchar*                : Read / Write
  "source"                   gchar*                : Read / Write
  "source-form"              gchar*                : Read / Write
  "subject"                  gchar*                : Read / Write
  "technician"               gchar*                : Read / Write
  "version"                  gchar*                : Read / Write

Description

Object type for DLS version 2 format instruments.

Details

IpatchDLS2

typedef struct {
  IpatchBase parent_instance;

  /* NOTE: This is not the DLS version! Optional descriptive stamp version */
  guint32 ms_version; /* most significant 32 bits of 64 bit version */
  guint32 ls_version; /* least significant 32 bits of 64 bit version */

  IpatchDLS2Info *info;		/* info strings */
  GSList *insts;		/* list of #IpatchDLS2Inst objects */
  GSList *samples;		/* list of #IpatchDLS2Sample objects */

  guint8 *dlid;	/* 16 bytes or NULL - globally unique ID (indicates changes) */
} IpatchDLS2;

enum IpatchDLS2Flags

typedef enum
{
  /* set if the ms_version/ls_version values are valid */
  IPATCH_DLS2_VERSION_SET = 1 << IPATCH_BASE_UNUSED_FLAG_SHIFT
} IpatchDLS2Flags;

IPATCH_DLS2_UNUSED_FLAG_SHIFT

#define IPATCH_DLS2_UNUSED_FLAG_SHIFT (IPATCH_BASE_UNUSED_FLAG_SHIFT + 4)

ipatch_dls2_new ()

IpatchDLS2 *        ipatch_dls2_new                     (void);

Create a new DLS base object.

Returns :

New DLS base object with a reference count of 1. Caller owns the reference and removing it will destroy the item.

ipatch_dls2_get_insts()

#define             ipatch_dls2_get_insts(dls)

ipatch_dls2_get_samples()

#define             ipatch_dls2_get_samples(dls)

ipatch_dls2_set_file ()

void                ipatch_dls2_set_file                (IpatchDLS2 *dls,
                                                         IpatchDLSFile *file);

Sets the file object of a DLS object. DLS files are kept open for sample data that references the file. This function sets a DLS object's authoritive file. A convenience function, as ipatch_base_set_file() does the same thing (albeit without more specific type casting).

dls :

DLS to set file object of

file :

File object to use with the DLS object

ipatch_dls2_get_file ()

IpatchDLSFile *     ipatch_dls2_get_file                (IpatchDLS2 *dls);

Gets the file object of a DLS. The returned DLS file object's reference count has been incremented. The caller owns the reference and is responsible for removing it with g_object_unref. A convenience function as ipatch_base_get_file() does the same thing (albeit without more specific type casting).

dls :

DLS object to get file object of

Returns :

The DLS file object or NULL if dls is not open. Remember to unref the file object with g_object_unref() when done with it.

ipatch_dls2_get_info ()

char *              ipatch_dls2_get_info                (IpatchDLS2 *dls,
                                                         guint32 fourcc);

Get a DLS info string by FOURCC integer ID (integer representation of a 4 character RIFF chunk ID, see IpatchRiff).

dls :

DLS to get info from

fourcc :

FOURCC integer id of INFO to get

Returns :

New allocated info string value or NULL if no info with the given fourcc ID. String should be freed when finished with it.

ipatch_dls2_set_info ()

void                ipatch_dls2_set_info                (IpatchDLS2 *dls,
                                                         guint32 fourcc,
                                                         const char *val);

Sets an INFO value in a DLS object.

Emits changed signal on DLS object.

dls :

DLS to set info of

fourcc :

FOURCC integer ID of INFO to set

val :

Value to set info to or NULL to unset (clear) info.

ipatch_dls2_make_unique_name ()

char *              ipatch_dls2_make_unique_name        (IpatchDLS2 *dls,
                                                         GType child_type,
                                                         const char *name,
                                                         const IpatchItem *exclude);

Generates a unique name for the given child_type in dls. The name parameter is used as a base and is modified, by appending a number, to make it unique (if necessary). The exclude parameter is used to exclude an existing dls child item from the search.

MT-Note: To ensure that an item is actually unique before being added to a DLS object, ipatch_container_add_unique() should be used.

dls :

DLS object

child_type :

A child type of dls to search for a unique name in

name :

An initial name to use or NULL

exclude :

An item to exclude from search or NULL

Returns :

A new unique name which should be freed when finished with it.

ipatch_dls2_find_inst ()

IpatchDLS2Inst *    ipatch_dls2_find_inst               (IpatchDLS2 *dls,
                                                         const char *name,
                                                         int bank,
                                                         int program,
                                                         const IpatchDLS2Inst *exclude);

Find a instrument by name or bank:program MIDI numbers. If instrument name and bank:program are specified then match for either condition. If a instrument is found its reference count is incremented before it is returned. The caller is responsible for removing the reference with g_object_unref() when finished with it.

dls :

DLS object to search in

name :

Name of instrument to find or NULL to match any name

bank :

MIDI bank number of instrument to search for or -1 to not search by MIDI bank:program numbers

program :

MIDI program number of instrument to search for, only used if bank is 0-128

exclude :

A instrument to exclude from the search or NULL

Returns :

The matching instrument or NULL if not found. Remember to unref the item when finished with it.

ipatch_dls2_find_sample ()

IpatchDLS2Sample *  ipatch_dls2_find_sample             (IpatchDLS2 *dls,
                                                         const char *name,
                                                         const IpatchDLS2Sample *exclude);

Find a sample by name in a SoundFont. If a sample is found its reference count is incremented before it is returned. The caller is responsible for removing the reference with g_object_unref() when finished with it.

dls :

SoundFont to search in

name :

Name of sample to find

exclude :

A sample to exclude from the search or NULL

Returns :

The matching sample or NULL if not found. Remember to unref the item when finished with it.

ipatch_dls2_get_region_references ()

IpatchList *        ipatch_dls2_get_region_references   (IpatchDLS2Sample *sample);

Get list of regions referencing an IpatchDLS2Sample.

sample :

Sample to locate referencing regions of.

Returns :

New item list containing IpatchDLS2Region objects that refer to sample. The returned list has a reference count of 1 which the caller owns, unreference it when done.

Property Details

The "archive-location" property

  "archive-location"         gchar*                : Read / Write

Location where subject is archived.

Default value: NULL


The "artist" property

  "artist"                   gchar*                : Read / Write

Original artist.

Default value: NULL


The "comment" property

  "comment"                  gchar*                : Read / Write

Comments.

Default value: NULL


The "commissioned" property

  "commissioned"             gchar*                : Read / Write

Who commissioned the material.

Default value: NULL


The "copyright" property

  "copyright"                gchar*                : Read / Write

Copyright.

Default value: NULL


The "date" property

  "date"                     gchar*                : Read / Write

Creation date (YYYY-MM-DD).

Default value: NULL


The "engineer" property

  "engineer"                 gchar*                : Read / Write

Engineers separated by "; ".

Default value: NULL


The "genre" property

  "genre"                    gchar*                : Read / Write

Genre.

Default value: NULL


The "keywords" property

  "keywords"                 gchar*                : Read / Write

Keywords (separated by "; ").

Default value: NULL


The "medium" property

  "medium"                   gchar*                : Read / Write

Original medium of the material (record, CD, etc).

Default value: NULL


The "name" property

  "name"                     gchar*                : Read / Write

Name.

Default value: "untitled"


The "product" property

  "product"                  gchar*                : Read / Write

Product intended for.

Default value: NULL


The "software" property

  "software"                 gchar*                : Read / Write

Editor software used.

Default value: NULL


The "source" property

  "source"                   gchar*                : Read / Write

Source of the original material.

Default value: NULL


The "source-form" property

  "source-form"              gchar*                : Read / Write

Original source that was digitized.

Default value: NULL


The "subject" property

  "subject"                  gchar*                : Read / Write

Subject of the material.

Default value: NULL


The "technician" property

  "technician"               gchar*                : Read / Write

Technician who sampled the material.

Default value: NULL


The "version" property

  "version"                  gchar*                : Read / Write

File version "n.n.n.n".

Default value: NULL

libinstpatch-1.0.0/docs/reference/html/IpatchConverter.html0000644000175000017500000017162211461404255020750 00000000000000 IpatchConverter

IpatchConverter

IpatchConverter — Base class for object conversion handlers

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchConverter;
enum                IpatchConverterLogType;
#define             IPATCH_CONVERTER_LOG_TYPE_MASK
#define             IPATCH_CONVERTER_LOG_MSG_ALLOC
#define             IPATCH_CONVERTER_INPUT              (converter)
#define             IPATCH_CONVERTER_OUTPUT             (converter)
enum                IpatchConverterCount;
enum                IpatchConverterFlags;
enum                IpatchConverterPriority;
gboolean            ipatch_convert_objects              (GObject *input,
                                                         GObject *output,
                                                         GError **err);
GObject *           ipatch_convert_object_to_type       (GObject *object,
                                                         GType type,
                                                         GError **err);
IpatchList *        ipatch_convert_object_to_type_multi (GObject *object,
                                                         GType type,
                                                         GError **err);
IpatchList *        ipatch_convert_object_to_type_multi_set
                                                        (GObject *object,
                                                         GType type,
                                                         GError **err,
                                                         const char *first_property_name,
                                                         ...);
IpatchConverter *   ipatch_create_converter             (GType src_type,
                                                         GType dest_type);
void                ipatch_register_converter_map       (GType conv_type,
                                                         guint flags,
                                                         GType src_type,
                                                         GType src_match,
                                                         gint8 src_count,
                                                         GType dest_type,
                                                         GType dest_match,
                                                         gint8 dest_count);
GType               ipatch_find_converter               (GType src_type,
                                                         GType dest_type);
IpatchConverterInfo * ipatch_lookup_converter_info      (GType conv_type,
                                                         GType src_type,
                                                         GType dest_type);
void                ipatch_converter_add_input          (IpatchConverter *converter,
                                                         GObject *object);
void                ipatch_converter_add_output         (IpatchConverter *converter,
                                                         GObject *object);
void                ipatch_converter_add_inputs         (IpatchConverter *converter,
                                                         GList *objects);
void                ipatch_converter_add_outputs        (IpatchConverter *converter,
                                                         GList *objects);
GObject *           ipatch_converter_get_input          (IpatchConverter *converter);
GObject *           ipatch_converter_get_output         (IpatchConverter *converter);
IpatchList *        ipatch_converter_get_inputs         (IpatchConverter *converter);
IpatchList *        ipatch_converter_get_outputs        (IpatchConverter *converter);
gboolean            ipatch_converter_verify             (IpatchConverter *converter,
                                                         char **failmsg);
void                ipatch_converter_init               (IpatchConverter *converter);
gboolean            ipatch_converter_convert            (IpatchConverter *converter,
                                                         GError **err);
void                ipatch_converter_reset              (IpatchConverter *converter);
char *              ipatch_converter_get_notes          (IpatchConverter *converter);
void                ipatch_converter_log                (IpatchConverter *converter,
                                                         GObject *item,
                                                         int type,
                                                         char *msg);
void                ipatch_converter_log_printf         (IpatchConverter *converter,
                                                         GObject *item,
                                                         int type,
                                                         const char *fmt,
                                                         ...);
gboolean            ipatch_converter_log_next           (IpatchConverter *converter,
                                                         gpointer *pos,
                                                         GObject **item,
                                                         int *type,
                                                         char **msg);
void                ipatch_converter_set_link_funcs     (IpatchConverter *converter,
                                                         IpatchConverterLinkLookupFunc *link_lookup,
                                                         IpatchConverterLinkNotifyFunc *link_notify);

Object Hierarchy

  GObject
   +----IpatchConverter
         +----IpatchConverterSF2VoiceCache

Properties

  "progress"                 gfloat                : Read / Write

Description

A base abstract type for object conversion handlers.

Details

IpatchConverter

typedef struct _IpatchConverter IpatchConverter;

enum IpatchConverterLogType

typedef enum
{
  IPATCH_CONVERTER_LOG_RATING,	/* log a rating update */
  IPATCH_CONVERTER_LOG_INFO,	/* informational only */
  IPATCH_CONVERTER_LOG_WARN,	/* warning */
  IPATCH_CONVERTER_LOG_CRITICAL, /* critical (but non fatal) message */
  IPATCH_CONVERTER_LOG_FATAL	/* fatal error */
} IpatchConverterLogType;

IPATCH_CONVERTER_LOG_TYPE_MASK

#define IPATCH_CONVERTER_LOG_TYPE_MASK   0x0F

IPATCH_CONVERTER_LOG_MSG_ALLOC

#define IPATCH_CONVERTER_LOG_MSG_ALLOC 0x80

IPATCH_CONVERTER_INPUT()

#define             IPATCH_CONVERTER_INPUT(converter)

IPATCH_CONVERTER_OUTPUT()

#define             IPATCH_CONVERTER_OUTPUT(converter)

enum IpatchConverterCount

typedef enum
{
  IPATCH_CONVERTER_COUNT_ONE_OR_MORE  = -1,	/* 1 or more objects */
  IPATCH_CONVERTER_COUNT_ZERO_OR_MORE = -2	/* 0 or more objects */
} IpatchConverterCount;

enum IpatchConverterFlags

typedef enum
{
  IPATCH_CONVERTER_FLAG_SRC_DERIVED = 1 << 8    /* match source derived types */
} IpatchConverterFlags;

enum IpatchConverterPriority

typedef enum
{
  /* 0 value is an alias for IPATCH_CONVERTER_PRIORITY_DEFAULT */

  IPATCH_CONVERTER_PRIORITY_LOWEST  = 1,
  IPATCH_CONVERTER_PRIORITY_LOW     = 25,
  IPATCH_CONVERTER_PRIORITY_DEFAULT = 50,
  IPATCH_CONVERTER_PRIORITY_HIGH    = 75,
  IPATCH_CONVERTER_PRIORITY_HIGHEST = 100
} IpatchConverterPriority;

ipatch_convert_objects ()

gboolean            ipatch_convert_objects              (GObject *input,
                                                         GObject *output,
                                                         GError **err);

A convenience function for converting from one object to another. This function will only work for converters which take exactly one input and output object.

input :

Input object

output :

Output object

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set)

ipatch_convert_object_to_type ()

GObject *           ipatch_convert_object_to_type       (GObject *object,
                                                         GType type,
                                                         GError **err);

A convenience function to convert an object to another object of a given type. This function will only work for converters which require 1 input and one or zero outputs. The output object is created as needed and returned.

object :

Object to convert from

type :

Type of object to convert to

err :

Location to store error info or NULL to ignore

Returns :

The output object or NULL on error (in which case err may be set). The returned object has a refcount of 1 which the caller owns.

ipatch_convert_object_to_type_multi ()

IpatchList *        ipatch_convert_object_to_type_multi (GObject *object,
                                                         GType type,
                                                         GError **err);

A convenience function to convert an object to one or more objects of a given type. This function will work for converters which require 1 input and any number of outputs.

object :

Object to convert from

type :

Type of object to convert to

err :

Location to store error info or NULL to ignore

Returns :

List of output objects or NULL on error (in which case err may be set). The returned object list has a refcount of 1 which the caller owns.

ipatch_convert_object_to_type_multi_set ()

IpatchList *        ipatch_convert_object_to_type_multi_set
                                                        (GObject *object,
                                                         GType type,
                                                         GError **err,
                                                         const char *first_property_name,
                                                         ...);

A convenience function to convert an object to one or more objects of a given type. This function will work for converters which require 1 input and any number of outputs. Like ipatch_convert_object_to_type_multi() but allows for properties of the converter to be assigned.

object :

Object to convert from

type :

Type of object to convert to

err :

Location to store error info or NULL to ignore

first_property_name :

Name of first property to assign or NULL

... :

First property value followed by property name/value pairs (as per g_object_set()) to assign to the resulting converter, terminated with a NULL property name.

Returns :

List of output objects or NULL on error (in which case err may be set). The returned object list has a refcount of 1 which the caller owns.

ipatch_create_converter ()

IpatchConverter *   ipatch_create_converter             (GType src_type,
                                                         GType dest_type);

Create a converter object for converting an object of type src_type to dest_type. A convenience function, since one could use ipatch_find_converter() and create an instance of the returned type. See ipatch_find_converter() for more details.

src_type :

GObject derived source type

dest_type :

GObject derived destination type

Returns :

The new converter object with a reference count of 1 which the caller owns, or NULL if there is no matching conversion handler type.

ipatch_register_converter_map ()

void                ipatch_register_converter_map       (GType conv_type,
                                                         guint flags,
                                                         GType src_type,
                                                         GType src_match,
                                                         gint8 src_count,
                                                         GType dest_type,
                                                         GType dest_match,
                                                         gint8 dest_count);

Registers a IpatchConverter handler to convert objects of src_type to dest_type.

conv_type :

IpatchConverter derived GType of conversion handler

flags :

IpatchConverterFlags logically ORed with a priority (number from 0 to 100, 0 will use the default). IpatchConverterPriority defines some common priorities. Used for overriding other converters for specific types. If IPATCH_CONVERTER_FLAG_SRC_DERIVED is specified then types which are derived (children) of src_type will also match.

src_type :

Type for source object (GObject derived type or interface type).

src_match :

The furthest parent type of src_type to match (all types in between are also matched, 0 to match only src_type).

src_count :

Required number of source items (can also be an IpatchConverterCount value)

dest_type :

Type for destination object (GObject derived type or interface type).

dest_match :

The furthest parent type of dest_type to match (all types in between are also matched, 0 to match only dest_type).

dest_count :

Required number of destination items (can also be an IpatchConverterCount value). This value can be 0 in the case where no objects should be supplied, but will be instead assigned after conversion.

ipatch_find_converter ()

GType               ipatch_find_converter               (GType src_type,
                                                         GType dest_type);

Lookup a conversion handler type for a given src_type to dest_type conversion. In some cases there may be multiple conversion handlers for the given types, this function only returns the highest priority type. To get a list of all available converters use ipatch_find_converters().

src_type :

GObject derived source type

dest_type :

GObject derived destination type

Returns :

An IpatchConverter derived GType of the matching conversion handler or 0 if no matches.

ipatch_lookup_converter_info ()

IpatchConverterInfo * ipatch_lookup_converter_info      (GType conv_type,
                                                         GType src_type,
                                                         GType dest_type);

Lookup converter map info.

conv_type :

IpatchConverter derived GType to lookup info on (or 0 for wildcard)

src_type :

Source type of conversion map to lookup (or 0 for default map)

dest_type :

Destination type of conversion map (0 if src_type is 0)

Returns :

Converter info structure or NULL if no match. The returned pointer is internal and should not be modified or freed.

ipatch_converter_add_input ()

void                ipatch_converter_add_input          (IpatchConverter *converter,
                                                         GObject *object);

Add an input object to a converter object.

converter :

Converter instance

object :

Object to add

ipatch_converter_add_output ()

void                ipatch_converter_add_output         (IpatchConverter *converter,
                                                         GObject *object);

Add an output object to a converter object.

converter :

Converter instance

object :

Object to add

ipatch_converter_add_inputs ()

void                ipatch_converter_add_inputs         (IpatchConverter *converter,
                                                         GList *objects);

Add a list of input objects to a converter object.

converter :

Converter instance

objects :

List of objects to add

ipatch_converter_add_outputs ()

void                ipatch_converter_add_outputs        (IpatchConverter *converter,
                                                         GList *objects);

Add a list of output objects to a converter object.

converter :

Converter instance

objects :

List of objects to add

ipatch_converter_get_input ()

GObject *           ipatch_converter_get_input          (IpatchConverter *converter);

Get a single input object from a converter.

converter :

Converter instance

Returns :

The first input object from a converter or NULL if no input objects. The caller owns a reference to the returned object.

ipatch_converter_get_output ()

GObject *           ipatch_converter_get_output         (IpatchConverter *converter);

Get a single output object from a converter.

converter :

Converter instance

Returns :

The first output object from a converter or NULL if no output objects. The caller owns a reference to the returned object.

ipatch_converter_get_inputs ()

IpatchList *        ipatch_converter_get_inputs         (IpatchConverter *converter);

Get a list of input objects from a converter.

converter :

Converter instance

Returns :

A newly created input object list from a converter or NULL if no input objects. The caller owns a reference to the returned list.

ipatch_converter_get_outputs ()

IpatchList *        ipatch_converter_get_outputs        (IpatchConverter *converter);

Get a list of output objects from a converter.

converter :

Converter instance

Returns :

A newly created output object list from a converter or NULL if no output objects. The caller owns a reference to the returned list.

ipatch_converter_verify ()

gboolean            ipatch_converter_verify             (IpatchConverter *converter,
                                                         char **failmsg);

Verifies the settings of a converter object. This is automatically called before a conversion is done, so it doesn't usually need to be explicitly called.

converter :

Converter object

failmsg :

Location to store a failure message if converter fails verification. The stored message should be freed when no longer needed.

Returns :

TRUE if converter passed verification, FALSE otherwise in which case an error message may be stored in failmsg. Remember to free the message when finished with it.

ipatch_converter_init ()

void                ipatch_converter_init               (IpatchConverter *converter);

Allows a converter type to initialize its parameters based on its input and/or output objects. This function should be called after setting the input and output objects, but before setting object parameters or converting. Calling this function is not required, but certain converters will work more intuitively if it is (an example is an audio sample saver converter which could initialize the output sample file object format based on the input sample object format).

NOTE: Verification of converter parameters is not done by this routine so converter types implementing an init method are responsible for their own verification.

converter :

Converter object

ipatch_converter_convert ()

gboolean            ipatch_converter_convert            (IpatchConverter *converter,
                                                         GError **err);

Runs the conversion method of a converter object. The converter object's conversion paramters are first verified before the conversion is run.

converter :

Converter object

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise

ipatch_converter_reset ()

void                ipatch_converter_reset              (IpatchConverter *converter);

Reset a converter object so it can be re-used.

converter :

Converter object

ipatch_converter_get_notes ()

char *              ipatch_converter_get_notes          (IpatchConverter *converter);

Get notes about a conversion implementation. These notes could include things such as information about any loss of information in the conversion that may occur, etc.

converter :

Converter object

Returns :

Newly allocated and possibly multi-line notes and comments about a given conversion or NULL if no notes. Meant for display to the user. This string should be freed when no longer needed.

ipatch_converter_log ()

void                ipatch_converter_log                (IpatchConverter *converter,
                                                         GObject *item,
                                                         int type,
                                                         char *msg);

Logs an entry to a converter log. Usually only used by converter object handlers.

converter :

Converter object

item :

Item the log entry pertains to or NULL if not item specific

type :

IpatchConverterLogType and other flags

msg :

Message of the log. If message is dynamically allocated then the IPATCH_CONVERTER_LOG_MSG_ALLOC flag should be set in type

ipatch_converter_log_printf ()

void                ipatch_converter_log_printf         (IpatchConverter *converter,
                                                         GObject *item,
                                                         int type,
                                                         const char *fmt,
                                                         ...);

Logs a printf style message to a converter log. Usually only used by converter object handlers. The IPATCH_CONVERTER_LOG_MSG_ALLOC flag is automatically set on the log entry, since it is dynamically allocated.

converter :

Converter object

item :

Item the log entry pertains to or NULL if not item specific

type :

IpatchConverterLogType and other flags

fmt :

Printf format style string

... :

Arguments to fmt message string

ipatch_converter_log_next ()

gboolean            ipatch_converter_log_next           (IpatchConverter *converter,
                                                         gpointer *pos,
                                                         GObject **item,
                                                         int *type,
                                                         char **msg);

Get the first or next log entry from a converter object.

converter :

Converter object

pos :

Opaque current position in log, should be NULL on first call to this function to return first log item (oldest item)

item :

Location to store item of the log entry or NULL, no reference is added so the item is only guarenteed to exist for as long as the converter does

type :

Location to store the type parameter of the log entry or NULL

msg :

Location to store the message of the log entry or NULL, message is internal and should not be messed with and is only guarenteed for the lifetime of the converter

Returns :

TRUE if an entry was returned, FALSE if no more entries in which case item, type and msg are all undefined.

ipatch_converter_set_link_funcs ()

void                ipatch_converter_set_link_funcs     (IpatchConverter *converter,
                                                         IpatchConverterLinkLookupFunc *link_lookup,
                                                         IpatchConverterLinkNotifyFunc *link_notify);

This function allows for object link interception by the user of an IpatchConverter instance. The callback functions are used by conversion processes which create objects linking other external objects which need to be converted. For each link object needing conversion link_lookup will be called. If link_lookup returns a valid pointer it is used as the converted link object, if NULL is returned then the link will be converted and link_notify will be called with the new converted item. An example usage of this feature is the IpatchPaste system, which does object conversions and substitutes already converted objects (a conversion pool).

converter :

Converter object

link_lookup :

Set the link lookup callback function

link_notify :

Set the link notify callback function

Property Details

The "progress" property

  "progress"                 gfloat                : Read / Write

Conversion progress.

Allowed values: [0,1]

Default value: 0

libinstpatch-1.0.0/docs/reference/html/IpatchConverterSF2VoiceCache.html0000644000175000017500000001121311461404255023162 00000000000000 IpatchConverterSF2VoiceCache

IpatchConverterSF2VoiceCache

IpatchConverterSF2VoiceCache — Base object type used for IpatchSF2Voice cache converters

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchConverter
         +----IpatchConverterSF2VoiceCache

Description

Defines a base type which other IpatchSF2Voice converter types are derived from. Defines some properties like "solo-item" for solo-ing a sub component of an instrument.

Details

IpatchConverterSF2VoiceCache

typedef struct _IpatchConverterSF2VoiceCache IpatchConverterSF2VoiceCache;
libinstpatch-1.0.0/docs/reference/html/ch05.html0000644000175000017500000001114411461404255016377 00000000000000 SoundFont patches

SoundFont patches

IpatchSF2 — SoundFont instrument file object
IpatchSF2File — SoundFont file object
IpatchSF2Reader — SoundFont file reader
IpatchSF2Writer — SoundFont writer object
IpatchSF2Preset — SoundFont preset object
IpatchSF2Inst — SoundFont instrument object
IpatchSF2Zone — Abstract base class for SoundFont zones
IpatchSF2Gen — SoundFont generator functions and definitions
IpatchSF2GenItem — SoundFont generator item interface
IpatchSF2Mod — SoundFont modulators
IpatchSF2ModItem — SoundFont modulator item interface
IpatchSF2PZone — SoundFont preset zone object
IpatchSF2IZone — SoundFont instrument zone object
IpatchSF2Sample — SoundFont audio sample
IpatchUnit_SF2 — Unit types and conversions for SoundFont
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchTypeProp.html0000644000175000017500000007716211461404255023251 00000000000000 IpatchTypeProp

IpatchTypeProp

IpatchTypeProp — GObject style properties for GTypes

Stability Level

Stable, unless otherwise indicated

Synopsis

enum                IpatchSplitsType;
void                (*IpatchTypePropGetFunc)            (GType type,
                                                         GParamSpec *spec,
                                                         GValue *value,
                                                         GObject *object);
void                ipatch_type_install_property        (GParamSpec *prop_spec);
GParamSpec *        ipatch_type_find_property           (const char *name);
GParamSpec **       ipatch_type_list_properties         (guint *n_properties);
GType *             ipatch_type_find_types_with_property
                                                        (const char *name,
                                                         const GValue *value,
                                                         guint *n_types);
void                ipatch_type_set                     (GType type,
                                                         const char *first_property_name,
                                                         ...);
void                ipatch_type_set_valist              (GType type,
                                                         const char *first_property_name,
                                                         va_list args);
void                ipatch_type_set_property            (GType type,
                                                         const char *property_name,
                                                         const GValue *value);
void                ipatch_type_get                     (GType type,
                                                         const char *first_property_name,
                                                         ...);
void                ipatch_type_get_valist              (GType type,
                                                         const char *first_property_name,
                                                         va_list args);
void                ipatch_type_get_property            (GType type,
                                                         const char *property_name,
                                                         GValue *value);
void                ipatch_type_object_get              (GObject *object,
                                                         const char *first_property_name,
                                                         ...);
void                ipatch_type_object_get_valist       (GObject *object,
                                                         const char *first_property_name,
                                                         va_list args);
void                ipatch_type_object_get_property     (GObject *object,
                                                         const char *property_name,
                                                         GValue *value);
void                ipatch_type_set_dynamic_func        (GType type,
                                                         const char *property_name,
                                                         IpatchTypePropGetFunc func);
IpatchTypePropGetFunc  ipatch_type_get_dynamic_func     (GType type,
                                                         const char *property_name);

Description

Provides a registry system for adding GObject style properties to GTypes. This is used to describe certain properties of different objects, such as "category".

Details

enum IpatchSplitsType

typedef enum
{
  IPATCH_SPLITS_NONE,			/* type does not have splits */
  IPATCH_SPLITS_NORMAL,			/* normal splits */
  IPATCH_SPLITS_NO_OVERLAP		/* splits do not overlap */
} IpatchSplitsType;

IpatchTypePropGetFunc ()

void                (*IpatchTypePropGetFunc)            (GType type,
                                                         GParamSpec *spec,
                                                         GValue *value,
                                                         GObject *object);

A function type used for active type property callbacks. Allows for dynamic type properties that can return values depending on an object's state.

type :

The GType of the type property

spec :

The parameter specification

value :

Initialized value to store the type prop value in

object :

Object instance (might be NULL)

ipatch_type_install_property ()

void                ipatch_type_install_property        (GParamSpec *prop_spec);

Install a new GType property which can be used to associate arbitrary information to GTypes.

prop_spec :

Specification for the new GType property. Ownership of the GParamSpec is taken over by this function. The name field of the GParamSpec should be a static string and is used as the property's ID.

ipatch_type_find_property ()

GParamSpec *        ipatch_type_find_property           (const char *name);

Lookup a GType property by name.

name :

Name of GType property

Returns :

The matching GParamSpec or NULL if not found. The GParamSpec is internal and should NOT be modified or freed.

ipatch_type_list_properties ()

GParamSpec **       ipatch_type_list_properties         (guint *n_properties);

Get a list of all registered GType properties.

n_properties :

Output: Length of returned array

Returns :

An array of GParamSpecs which should be freed when finished.

ipatch_type_find_types_with_property ()

GType *             ipatch_type_find_types_with_property
                                                        (const char *name,
                                                         const GValue *value,
                                                         guint *n_types);

Get an array of types which have the given type property assigned and match value (optional, NULL matches any value).

name :

Name of type property

value :

Optional value to match to type property values (NULL to match any value)

n_types :

Location to store count of types in returned array or NULL to ignore

Returns :

Newly allocated 0 terminated array of types which have the named property set or NULL if type property not found.

ipatch_type_set ()

void                ipatch_type_set                     (GType type,
                                                         const char *first_property_name,
                                                         ...);

Set GType properties. GType properties are used to associate arbitrary information with GTypes.

type :

GType to set properties of

first_property_name :

Name of first property to set

... :

Value of first property to set and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_type_set_valist ()

void                ipatch_type_set_valist              (GType type,
                                                         const char *first_property_name,
                                                         va_list args);

Like ipatch_type_set() but uses a va_list.

type :

GType to set properties of

first_property_name :

Name of first property to set

args :

Value of first property to set and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_type_set_property ()

void                ipatch_type_set_property            (GType type,
                                                         const char *property_name,
                                                         const GValue *value);

Set a single property of a GType.

type :

GType to set property of

property_name :

Name of property to set

value :

Value to set the the property to. The value's type must be the same as the GType property's type.

ipatch_type_get ()

void                ipatch_type_get                     (GType type,
                                                         const char *first_property_name,
                                                         ...);

Get GType property values.

type :

GType to get properties from

first_property_name :

Name of first property to get

... :

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_type_get_valist ()

void                ipatch_type_get_valist              (GType type,
                                                         const char *first_property_name,
                                                         va_list args);

Like ipatch_type_get() but uses a va_list.

type :

GType to get properties from

first_property_name :

Name of first property to get

args :

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_type_get_property ()

void                ipatch_type_get_property            (GType type,
                                                         const char *property_name,
                                                         GValue *value);

Get a single property from a GType.

type :

GType to get property from

property_name :

Name of property to get

value :

An initialized value to store the property value in. The value's type must be a type that the property can be transformed to.

ipatch_type_object_get ()

void                ipatch_type_object_get              (GObject *object,
                                                         const char *first_property_name,
                                                         ...);

Get GType property values. Like ipatch_type_get() but takes an object instance which can be used by any registered dynamic type property functions.

object :

Object instance to get type property from

first_property_name :

Name of first property to get

... :

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_type_object_get_valist ()

void                ipatch_type_object_get_valist       (GObject *object,
                                                         const char *first_property_name,
                                                         va_list args);

ipatch_type_object_get_property ()

void                ipatch_type_object_get_property     (GObject *object,
                                                         const char *property_name,
                                                         GValue *value);

Get a single type property from an object instance.

object :

Object instance to get type property from

property_name :

Name of property to get

value :

An initialized value to store the property value in. The value's type must be a type that the property can be transformed to.

ipatch_type_set_dynamic_func ()

void                ipatch_type_set_dynamic_func        (GType type,
                                                         const char *property_name,
                                                         IpatchTypePropGetFunc func);

Registers a callback function for dynamically getting the value of a type property.

Example: A dynamic property is created for SoundFont presets to return a different "virtual-parent-type" depending on if its a percussion or melodic preset (determined from a preset's bank number).

type :

GType of the type property

property_name :

Name of a previously registered type property

func :

Callback function used for getting values for this type property

ipatch_type_get_dynamic_func ()

IpatchTypePropGetFunc  ipatch_type_get_dynamic_func     (GType type,
                                                         const char *property_name);

Get a the dynamic function registered for a given type and property_name with ipatch_type_set_dynamic_func(). Also can be used as an indicator of whether a type property is dynamic or not.

type :

GType of the type property

property_name :

Name of a previously registered type property

Returns :

Pointer to the registered function or NULL if no function registered (not a dynamic type property).
libinstpatch-1.0.0/docs/reference/html/object-tree.html0000644000175000017500000001512611461404255020047 00000000000000 Object Hierarchy libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchUnit-SF2.html0000644000175000017500000005344111461404255022770 00000000000000 IpatchUnit_SF2

IpatchUnit_SF2

IpatchUnit_SF2 — Unit types and conversions for SoundFont

Stability Level

Stable, unless otherwise indicated

Synopsis

int                 ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch
                                                        (int sf2_abs_pitch);
int                 ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch
                                                        (int dls_abs_pitch);
double              ipatch_unit_sf2_abs_pitch_to_hertz  (int sf2_abs_pitch);
int                 ipatch_unit_hertz_to_sf2_abs_pitch  (double hz);
double              ipatch_unit_sf2_ofs_pitch_to_multiplier
                                                        (int sf2_ofs_pitch);
int                 ipatch_unit_multiplier_to_sf2_ofs_pitch
                                                        (double multiplier);
int                 ipatch_unit_sf2_abs_time_to_dls_abs_time
                                                        (int sf2_abs_time);
int                 ipatch_unit_dls_abs_time_to_sf2_abs_time
                                                        (int dls_abs_time);
double              ipatch_unit_sf2_abs_time_to_seconds (int sf2_abs_time);
int                 ipatch_unit_seconds_to_sf2_abs_time (double sec);
double              ipatch_unit_sf2_ofs_time_to_multiplier
                                                        (int sf2_ofs_time);
int                 ipatch_unit_multiplier_to_sf2_ofs_time
                                                        (double multiplier);
int                 ipatch_unit_centibels_to_dls_gain   (int centibel);
int                 ipatch_unit_dls_gain_to_centibels   (int dls_gain);
double              ipatch_unit_centibels_to_decibels   (int cb);
int                 ipatch_unit_decibels_to_centibels   (double db);
double              ipatch_unit_tenth_percent_to_percent
                                                        (int tenth_percent);
int                 ipatch_unit_percent_to_tenth_percent
                                                        (double percent);

Description

Details

ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch ()

int                 ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch
                                                        (int sf2_abs_pitch);

Converts a value from SF2 absolute pitch to DLS absolute pitch.

sf2_abs_pitch = 1200 * log2(f/8.176) f = 8.176 * 2^(sf2_abs_pitch/1200)

dls_abs_pitch = (1200 * log2(f/440) + 6900) * 65536 f = 440 * 2^((dls_abs_pitch / 65536 - 6900) / 1200)

sf2_abs_pitch :

Value in SF2 absolute pitch

Returns :

Value converted to DLS absolute pitch

ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch ()

int                 ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch
                                                        (int dls_abs_pitch);

Converts a value from DLS absolute pitch to SF2 absolute pitch. See ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch()

dls_abs_pitch :

Value in DLS absolute pitch

Returns :

Value converted to SF2 absolute pitch

ipatch_unit_sf2_abs_pitch_to_hertz ()

double              ipatch_unit_sf2_abs_pitch_to_hertz  (int sf2_abs_pitch);

Convert SoundFont absolute pitch to frequency in Hertz.

sf2_abs_pitch :

Value in SoundFont absolute pitch

Returns :

Value in Hertz (cycles per second)

ipatch_unit_hertz_to_sf2_abs_pitch ()

int                 ipatch_unit_hertz_to_sf2_abs_pitch  (double hz);

Convert frequency in Hertz to SoundFont absolute pitch.

hz :

Hertz (cycles per second) value

Returns :

Converted value in SoundFont absolute pitch.

ipatch_unit_sf2_ofs_pitch_to_multiplier ()

double              ipatch_unit_sf2_ofs_pitch_to_multiplier
                                                        (int sf2_ofs_pitch);

Convert SoundFont offset pitch (cents) to multiplier factor.

sf2_ofs_pitch :

Value in SoundFont offset pitch

Returns :

Multiplier factor

ipatch_unit_multiplier_to_sf2_ofs_pitch ()

int                 ipatch_unit_multiplier_to_sf2_ofs_pitch
                                                        (double multiplier);

Convert multiplier factor to SoundFont offset pitch (cents).

multiplier :

Multiplier factor

Returns :

Converted value in SoundFont offset pitch (cents).

ipatch_unit_sf2_abs_time_to_dls_abs_time ()

int                 ipatch_unit_sf2_abs_time_to_dls_abs_time
                                                        (int sf2_abs_time);

Convert a value from SF2 absolute time to DLS absolute time.

sf2_abs_time = 1200 * log2 (seconds) seconds = 2^(sf2_abs_time / 1200)

dls_abs_time = 1200 * log2 (seconds) * 65536 seconds = 2^(dls_abs_time / (1200 * 65536))

sf2_abs_time :

Value in SF2 absolute time (timecents)

Returns :

Value converted to DLS absolute time.

ipatch_unit_dls_abs_time_to_sf2_abs_time ()

int                 ipatch_unit_dls_abs_time_to_sf2_abs_time
                                                        (int dls_abs_time);

Convert a value from DLS absolute time to SF2 absolute time. See ipatch_unit_sf2_abs_time_to_dls_abs_time()

dls_abs_time :

Value in DLS absolute time

Returns :

Value converted to SF2 absolute time

ipatch_unit_sf2_abs_time_to_seconds ()

double              ipatch_unit_sf2_abs_time_to_seconds (int sf2_abs_time);

Convert a value from SoundFont absolute time (timecents) to seconds.

sf2_abs_time :

Value in SoundFont absolute time

Returns :

Value in seconds

ipatch_unit_seconds_to_sf2_abs_time ()

int                 ipatch_unit_seconds_to_sf2_abs_time (double sec);

Convert value from seconds to SoundFont absolute time (timecents).

sec :

Value in seconds

Returns :

Value in SoundFont absolute time

ipatch_unit_sf2_ofs_time_to_multiplier ()

double              ipatch_unit_sf2_ofs_time_to_multiplier
                                                        (int sf2_ofs_time);

Convert a value from SoundFont offset time (timecents) to a multiplier.

sf2_ofs_time :

Value in SoundFont offset time (timecents)

Returns :

Multiplier factor

ipatch_unit_multiplier_to_sf2_ofs_time ()

int                 ipatch_unit_multiplier_to_sf2_ofs_time
                                                        (double multiplier);

Convert value from a multiplier to SoundFont offset time (timecents).

multiplier :

Multiplier factor

Returns :

Value in SoundFont offset time (timecents)

ipatch_unit_centibels_to_dls_gain ()

int                 ipatch_unit_centibels_to_dls_gain   (int centibel);

Convert a value from centibels to DLS gain (1/655360th of a dB).

V = target amplitude, v = original amplitude centibel = 200 * log10 (v / V) dls_gain = 200 * 65536 * log10 (V / v)

centibel :

Value in centibels (10th of a Decibel)

Returns :

Value converted to DLS gain

ipatch_unit_dls_gain_to_centibels ()

int                 ipatch_unit_dls_gain_to_centibels   (int dls_gain);

Convert a value from DLS gain to centibels.

dls_gain :

Value in DLS gain (1/655360th of a dB)

Returns :

Value converted to centibels.

ipatch_unit_centibels_to_decibels ()

double              ipatch_unit_centibels_to_decibels   (int cb);

Convert a value from Centibels to Decibels.

cb :

Value in Centibels (10th of a Decibel)

Returns :

Value in Decibels

ipatch_unit_decibels_to_centibels ()

int                 ipatch_unit_decibels_to_centibels   (double db);

Convert Decibels to Centibels (10ths of a dB)

db :

Value in Decibels

Returns :

Converted value in Centibels (10ths of a Decibel)

ipatch_unit_tenth_percent_to_percent ()

double              ipatch_unit_tenth_percent_to_percent
                                                        (int tenth_percent);

Convert a value from 10ths of a Percent to Percent.

tenth_percent :

Value in 10ths of a Percent (Percent * 10)

Returns :

Value in Percent

ipatch_unit_percent_to_tenth_percent ()

int                 ipatch_unit_percent_to_tenth_percent
                                                        (double percent);

Convert Percent to 10ths of a Percent (Percent * 10)

percent :

Value in Percent

Returns :

Converted value in 10ths of a Percent
libinstpatch-1.0.0/docs/reference/html/IpatchSF2Preset.html0000644000175000017500000021664211461404255020560 00000000000000 IpatchSF2Preset

IpatchSF2Preset

IpatchSF2Preset — SoundFont preset object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchSF2Preset

Implemented Interfaces

IpatchSF2Preset implements IpatchSF2GenItemIface and IpatchSF2ModItemIface.

Properties

  "attenuation"              gint                  : Read / Write
  "attenuation-set"          gboolean              : Read / Write
  "bank"                     gint                  : Read / Write
  "chorus"                   gint                  : Read / Write
  "chorus-set"               gboolean              : Read / Write
  "coarse-tune"              gint                  : Read / Write
  "coarse-tune-set"          gboolean              : Read / Write
  "filter-cutoff"            gint                  : Read / Write
  "filter-cutoff-set"        gboolean              : Read / Write
  "filter-q"                 gint                  : Read / Write
  "filter-q-set"             gboolean              : Read / Write
  "fine-tune-override"       gint                  : Read / Write
  "fine-tune-override-set"   gboolean              : Read / Write
  "genre"                    guint                 : Read / Write
  "library"                  guint                 : Read / Write
  "mod-env-attack"           gint                  : Read / Write
  "mod-env-attack-set"       gboolean              : Read / Write
  "mod-env-decay"            gint                  : Read / Write
  "mod-env-decay-set"        gboolean              : Read / Write
  "mod-env-delay"            gint                  : Read / Write
  "mod-env-delay-set"        gboolean              : Read / Write
  "mod-env-hold"             gint                  : Read / Write
  "mod-env-hold-set"         gboolean              : Read / Write
  "mod-env-release"          gint                  : Read / Write
  "mod-env-release-set"      gboolean              : Read / Write
  "mod-env-sustain"          gint                  : Read / Write
  "mod-env-sustain-set"      gboolean              : Read / Write
  "mod-env-to-filter-cutoff" gint                  : Read / Write
  "mod-env-to-filter-cutoff-set" gboolean              : Read / Write
  "mod-env-to-pitch"         gint                  : Read / Write
  "mod-env-to-pitch-set"     gboolean              : Read / Write
  "mod-lfo-delay"            gint                  : Read / Write
  "mod-lfo-delay-set"        gboolean              : Read / Write
  "mod-lfo-freq"             gint                  : Read / Write
  "mod-lfo-freq-set"         gboolean              : Read / Write
  "mod-lfo-to-filter-cutoff" gint                  : Read / Write
  "mod-lfo-to-filter-cutoff-set" gboolean              : Read / Write
  "mod-lfo-to-pitch"         gint                  : Read / Write
  "mod-lfo-to-pitch-set"     gboolean              : Read / Write
  "mod-lfo-to-volume"        gint                  : Read / Write
  "mod-lfo-to-volume-set"    gboolean              : Read / Write
  "morphology"               guint                 : Read / Write
  "name"                     gchar*                : Read / Write
  "note-range"               IpatchRange*          : Read / Write
  "note-range-set"           gboolean              : Read / Write
  "note-to-mod-env-decay"    gint                  : Read / Write
  "note-to-mod-env-decay-set" gboolean              : Read / Write
  "note-to-mod-env-hold"     gint                  : Read / Write
  "note-to-mod-env-hold-set" gboolean              : Read / Write
  "note-to-vol-env-decay"    gint                  : Read / Write
  "note-to-vol-env-decay-set" gboolean              : Read / Write
  "note-to-vol-env-hold"     gint                  : Read / Write
  "note-to-vol-env-hold-set" gboolean              : Read / Write
  "pan"                      gint                  : Read / Write
  "pan-set"                  gboolean              : Read / Write
  "percussion"               gboolean              : Read / Write
  "program"                  gint                  : Read / Write
  "reverb"                   gint                  : Read / Write
  "reverb-set"               gboolean              : Read / Write
  "scale-tune"               gint                  : Read / Write
  "scale-tune-set"           gboolean              : Read / Write
  "velocity-range"           IpatchRange*          : Read / Write
  "velocity-range-set"       gboolean              : Read / Write
  "vib-lfo-delay"            gint                  : Read / Write
  "vib-lfo-delay-set"        gboolean              : Read / Write
  "vib-lfo-freq"             gint                  : Read / Write
  "vib-lfo-freq-set"         gboolean              : Read / Write
  "vib-lfo-to-pitch"         gint                  : Read / Write
  "vib-lfo-to-pitch-set"     gboolean              : Read / Write
  "vol-env-attack"           gint                  : Read / Write
  "vol-env-attack-set"       gboolean              : Read / Write
  "vol-env-decay"            gint                  : Read / Write
  "vol-env-decay-set"        gboolean              : Read / Write
  "vol-env-delay"            gint                  : Read / Write
  "vol-env-delay-set"        gboolean              : Read / Write
  "vol-env-hold"             gint                  : Read / Write
  "vol-env-hold-set"         gboolean              : Read / Write
  "vol-env-release"          gint                  : Read / Write
  "vol-env-release-set"      gboolean              : Read / Write
  "vol-env-sustain"          gint                  : Read / Write
  "vol-env-sustain-set"      gboolean              : Read / Write

Description

SoundFont presets are children of IpatchSF2 objects and define individual instruments mapped to MIDI bank/program numbers.

Details

IpatchSF2Preset

typedef struct _IpatchSF2Preset IpatchSF2Preset;

ipatch_sf2_preset_new ()

IpatchSF2Preset *   ipatch_sf2_preset_new               (void);

Create a new SoundFont preset object.

Returns :

New SoundFont preset with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_sf2_preset_get_zones()

#define             ipatch_sf2_preset_get_zones(preset)

ipatch_sf2_preset_first ()

IpatchSF2Preset *   ipatch_sf2_preset_first             (IpatchIter *iter);

Gets the first item in a preset iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchSF2Preset items

Returns :

The first preset in iter or NULL if empty.

ipatch_sf2_preset_next ()

IpatchSF2Preset *   ipatch_sf2_preset_next              (IpatchIter *iter);

Gets the next item in a preset iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchSF2Preset items

Returns :

The next preset in iter or NULL if at the end of the list.

ipatch_sf2_preset_new_zone ()

void                ipatch_sf2_preset_new_zone          (IpatchSF2Preset *preset,
                                                         IpatchSF2Inst *inst);

A convenience function for quickly creating a new preset zone, adding it to preset and setting the zone's referenced instrument to inst.

preset :

SoundFont preset

inst :

Referenced instrument for new zone

ipatch_sf2_preset_set_name ()

void                ipatch_sf2_preset_set_name          (IpatchSF2Preset *preset,
                                                         const char *name);

Sets the name of a SoundFont preset.

preset :

Preset to set name of

name :

Value to set name to

ipatch_sf2_preset_get_name ()

char *              ipatch_sf2_preset_get_name          (IpatchSF2Preset *preset);

Gets the name of a SoundFont preset.

preset :

Preset to get name of

Returns :

Name of preset or NULL if not set. String value should be freed when finished with it.

ipatch_sf2_preset_set_midi_locale ()

void                ipatch_sf2_preset_set_midi_locale   (IpatchSF2Preset *preset,
                                                         int bank,
                                                         int program);

Sets the MIDI locale of a preset (bank and program numbers).

preset :

Preset to set MIDI locale of

bank :

MIDI bank number to assign to preset

program :

MIDI program number to assign to preset

ipatch_sf2_preset_get_midi_locale ()

void                ipatch_sf2_preset_get_midi_locale   (IpatchSF2Preset *preset,
                                                         int *bank,
                                                         int *program);

Gets the MIDI locale of a SoundFont preset (bank and program numbers).

preset :

Preset to get MIDI locale from

bank :

Location to store preset's MIDI bank number or NULL

program :

Location to store preset's MIDI program number or NULL

ipatch_sf2_preset_compare ()

int                 ipatch_sf2_preset_compare           (const IpatchSF2Preset *p1,
                                                         const IpatchSF2Preset *p2);

Preset comparison function for sorting. Compare two presets by their MIDI bank:program numbers. Note that this function is compatible with GCompareFunc and can therefore be used with g_list_sort, etc.

p1 :

First preset in comparison

p2 :

Second preset in comparison

Returns :

Comparison result that is less than, equal to, or greater than zero if p1 is found, respectively, to be less than, to match, or be greater than p2.

Property Details

The "attenuation" property

  "attenuation"              gint                  : Read / Write

Volume attenuation.

Allowed values: [-1440,1440]

Default value: 0


The "attenuation-set" property

  "attenuation-set"          gboolean              : Read / Write

Default value: FALSE


The "bank" property

  "bank"                     gint                  : Read / Write

MIDI bank number.

Allowed values: [0,128]

Default value: 0


The "chorus" property

  "chorus"                   gint                  : Read / Write

Chorus.

Allowed values: [-1000,1000]

Default value: 0


The "chorus-set" property

  "chorus-set"               gboolean              : Read / Write

Default value: FALSE


The "coarse-tune" property

  "coarse-tune"              gint                  : Read / Write

Coarse Tune.

Allowed values: [-240,240]

Default value: 0


The "coarse-tune-set" property

  "coarse-tune-set"          gboolean              : Read / Write

Default value: FALSE


The "filter-cutoff" property

  "filter-cutoff"            gint                  : Read / Write

Low pass filter cutoff frequency.

Allowed values: [-12000,12000]

Default value: 0


The "filter-cutoff-set" property

  "filter-cutoff-set"        gboolean              : Read / Write

Default value: FALSE


The "filter-q" property

  "filter-q"                 gint                  : Read / Write

Low pass filter Q factor.

Allowed values: [-960,960]

Default value: 0


The "filter-q-set" property

  "filter-q-set"             gboolean              : Read / Write

Default value: FALSE


The "fine-tune-override" property

  "fine-tune-override"       gint                  : Read / Write

Fine Tune.

Allowed values: [-198,198]

Default value: 0


The "fine-tune-override-set" property

  "fine-tune-override-set"   gboolean              : Read / Write

Default value: FALSE


The "genre" property

  "genre"                    guint                 : Read / Write

Genre category.

Default value: 0


The "library" property

  "library"                  guint                 : Read / Write

Library category.

Default value: 0


The "mod-env-attack" property

  "mod-env-attack"           gint                  : Read / Write

Modulation envelope attack.

Allowed values: [-20000,20000]

Default value: 0


The "mod-env-attack-set" property

  "mod-env-attack-set"       gboolean              : Read / Write

Default value: FALSE


The "mod-env-decay" property

  "mod-env-decay"            gint                  : Read / Write

Modulation envelope decay.

Allowed values: [-20000,20000]

Default value: 0


The "mod-env-decay-set" property

  "mod-env-decay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-env-delay" property

  "mod-env-delay"            gint                  : Read / Write

Modulation envelope delay.

Allowed values: [-17000,17000]

Default value: 0


The "mod-env-delay-set" property

  "mod-env-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-env-hold" property

  "mod-env-hold"             gint                  : Read / Write

Modulation envelope hold.

Allowed values: [-17000,17000]

Default value: 0


The "mod-env-hold-set" property

  "mod-env-hold-set"         gboolean              : Read / Write

Default value: FALSE


The "mod-env-release" property

  "mod-env-release"          gint                  : Read / Write

Modulation envelope release.

Allowed values: [-20000,20000]

Default value: 0


The "mod-env-release-set" property

  "mod-env-release-set"      gboolean              : Read / Write

Default value: FALSE


The "mod-env-sustain" property

  "mod-env-sustain"          gint                  : Read / Write

Modulation envelope sustain.

Allowed values: [-1000,1000]

Default value: 0


The "mod-env-sustain-set" property

  "mod-env-sustain-set"      gboolean              : Read / Write

Default value: FALSE


The "mod-env-to-filter-cutoff" property

  "mod-env-to-filter-cutoff" gint                  : Read / Write

Modulation envelope to filter cutoff.

Allowed values: [-24000,24000]

Default value: 0


The "mod-env-to-filter-cutoff-set" property

  "mod-env-to-filter-cutoff-set" gboolean              : Read / Write

Default value: FALSE


The "mod-env-to-pitch" property

  "mod-env-to-pitch"         gint                  : Read / Write

Modulation envelope to pitch.

Allowed values: [-24000,24000]

Default value: 0


The "mod-env-to-pitch-set" property

  "mod-env-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-delay" property

  "mod-lfo-delay"            gint                  : Read / Write

Modulation oscillator delay.

Allowed values: [-17000,17000]

Default value: 0


The "mod-lfo-delay-set" property

  "mod-lfo-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-freq" property

  "mod-lfo-freq"             gint                  : Read / Write

Modulation oscillator frequency.

Allowed values: [-20500,20500]

Default value: 0


The "mod-lfo-freq-set" property

  "mod-lfo-freq-set"         gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-filter-cutoff" property

  "mod-lfo-to-filter-cutoff" gint                  : Read / Write

Modulation oscillator to filter cutoff.

Allowed values: [-24000,24000]

Default value: 0


The "mod-lfo-to-filter-cutoff-set" property

  "mod-lfo-to-filter-cutoff-set" gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-pitch" property

  "mod-lfo-to-pitch"         gint                  : Read / Write

Modulation oscillator to pitch.

Allowed values: [-24000,24000]

Default value: 0


The "mod-lfo-to-pitch-set" property

  "mod-lfo-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-volume" property

  "mod-lfo-to-volume"        gint                  : Read / Write

Modulation oscillator to volume.

Allowed values: [-1920,1920]

Default value: 0


The "mod-lfo-to-volume-set" property

  "mod-lfo-to-volume-set"    gboolean              : Read / Write

Default value: FALSE


The "morphology" property

  "morphology"               guint                 : Read / Write

Morphology category.

Default value: 0


The "name" property

  "name"                     gchar*                : Read / Write

Name.

Default value: NULL


The "note-range" property

  "note-range"               IpatchRange*          : Read / Write

Note Range.


The "note-range-set" property

  "note-range-set"           gboolean              : Read / Write

Default value: FALSE


The "note-to-mod-env-decay" property

  "note-to-mod-env-decay"    gint                  : Read / Write

MIDI note to modulation envelope decay.

Allowed values: [-2400,2400]

Default value: 0


The "note-to-mod-env-decay-set" property

  "note-to-mod-env-decay-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-mod-env-hold" property

  "note-to-mod-env-hold"     gint                  : Read / Write

MIDI note to modulation envelope hold.

Allowed values: [-2400,2400]

Default value: 0


The "note-to-mod-env-hold-set" property

  "note-to-mod-env-hold-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-vol-env-decay" property

  "note-to-vol-env-decay"    gint                  : Read / Write

MIDI note to volume envelope decay.

Allowed values: [-2400,2400]

Default value: 0


The "note-to-vol-env-decay-set" property

  "note-to-vol-env-decay-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-vol-env-hold" property

  "note-to-vol-env-hold"     gint                  : Read / Write

MIDI note to volume envelope hold.

Allowed values: [-2400,2400]

Default value: 0


The "note-to-vol-env-hold-set" property

  "note-to-vol-env-hold-set" gboolean              : Read / Write

Default value: FALSE


The "pan" property

  "pan"                      gint                  : Read / Write

Panning.

Allowed values: [-1000,1000]

Default value: 0


The "pan-set" property

  "pan-set"                  gboolean              : Read / Write

Default value: FALSE


The "percussion" property

  "percussion"               gboolean              : Read / Write

Percussion preset?.

Default value: FALSE


The "program" property

  "program"                  gint                  : Read / Write

MIDI program number.

Allowed values: [0,127]

Default value: 0


The "reverb" property

  "reverb"                   gint                  : Read / Write

Reverb.

Allowed values: [-1000,1000]

Default value: 0


The "reverb-set" property

  "reverb-set"               gboolean              : Read / Write

Default value: FALSE


The "scale-tune" property

  "scale-tune"               gint                  : Read / Write

Scale Tune.

Allowed values: [-1200,1200]

Default value: 0


The "scale-tune-set" property

  "scale-tune-set"           gboolean              : Read / Write

Default value: FALSE


The "velocity-range" property

  "velocity-range"           IpatchRange*          : Read / Write

Velocity Range.


The "velocity-range-set" property

  "velocity-range-set"       gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-delay" property

  "vib-lfo-delay"            gint                  : Read / Write

Vibrato oscillator delay.

Allowed values: [-17000,17000]

Default value: 0


The "vib-lfo-delay-set" property

  "vib-lfo-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-freq" property

  "vib-lfo-freq"             gint                  : Read / Write

Vibrato oscillator frequency.

Allowed values: [-20500,20500]

Default value: 0


The "vib-lfo-freq-set" property

  "vib-lfo-freq-set"         gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-to-pitch" property

  "vib-lfo-to-pitch"         gint                  : Read / Write

Vibrato oscillator to pitch.

Allowed values: [-24000,24000]

Default value: 0


The "vib-lfo-to-pitch-set" property

  "vib-lfo-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "vol-env-attack" property

  "vol-env-attack"           gint                  : Read / Write

Volume envelope attack.

Allowed values: [-20000,20000]

Default value: 0


The "vol-env-attack-set" property

  "vol-env-attack-set"       gboolean              : Read / Write

Default value: FALSE


The "vol-env-decay" property

  "vol-env-decay"            gint                  : Read / Write

Volume envelope decay.

Allowed values: [-20000,20000]

Default value: 0


The "vol-env-decay-set" property

  "vol-env-decay-set"        gboolean              : Read / Write

Default value: FALSE


The "vol-env-delay" property

  "vol-env-delay"            gint                  : Read / Write

Volume envelope delay.

Allowed values: [-17000,17000]

Default value: 0


The "vol-env-delay-set" property

  "vol-env-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "vol-env-hold" property

  "vol-env-hold"             gint                  : Read / Write

Volume envelope hold.

Allowed values: [-17000,17000]

Default value: 0


The "vol-env-hold-set" property

  "vol-env-hold-set"         gboolean              : Read / Write

Default value: FALSE


The "vol-env-release" property

  "vol-env-release"          gint                  : Read / Write

Volume envelope release.

Allowed values: [-20000,20000]

Default value: 0


The "vol-env-release-set" property

  "vol-env-release-set"      gboolean              : Read / Write

Default value: FALSE


The "vol-env-sustain" property

  "vol-env-sustain"          gint                  : Read / Write

Volume envelope sustain.

Allowed values: [-1440,1440]

Default value: 0


The "vol-env-sustain-set" property

  "vol-env-sustain-set"      gboolean              : Read / Write

Default value: FALSE

See Also

#IpatchSF2
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchUnit.html0000644000175000017500000007107411461404255022402 00000000000000 IpatchUnit

IpatchUnit

IpatchUnit — Unit conversion system

Stability Level

Stable, unless otherwise indicated

Description

System for registering unit types and conversion functions.

Details

IpatchUnitInfo

typedef struct {
  guint16 id;			/* unit type ID */
  guint8 digits;	   	/* significant digits to display to user */
  guint8 flags;			/* IpatchUnitFlags */
  GType value_type;		/* unit value type */
  char *name;			/* name identifier (constant) */
  char *label;			/* unit label (translated) */
  char *descr;			/* unit description (translated) */
} IpatchUnitInfo;

enum IpatchUnitFlags

typedef enum
{
  IPATCH_UNIT_LOGARITHMIC = 1 << 0, /* unit is logarithmic */
  IPATCH_UNIT_USER = 1 << 1	/* a user friendly unit type */
} IpatchUnitFlags;

IpatchValueTransform ()

void                (*IpatchValueTransform)             (const GValue *src,
                                                         GValue *dest);

Transform from one value to another. The src and dest values have already been initialized to specific types and the transform function should convert/process them as necessary.

src :

Source value to transform from

dest :

Destination value to transform to

enum IpatchUnitType

typedef enum
{
  IPATCH_UNIT_TYPE_NONE = 0,	/* a NULL value */
  IPATCH_UNIT_TYPE_INT = 1,
  IPATCH_UNIT_TYPE_UINT = 2,
  IPATCH_UNIT_TYPE_RANGE = 3,
  IPATCH_UNIT_TYPE_DECIBELS = 4,
  IPATCH_UNIT_TYPE_PERCENT = 5,
  IPATCH_UNIT_TYPE_SEMITONES = 6,
  IPATCH_UNIT_TYPE_CENTS = 7,
  IPATCH_UNIT_TYPE_TIME_CENTS = 8,
  IPATCH_UNIT_TYPE_SAMPLE_RATE = 9,
  IPATCH_UNIT_TYPE_SAMPLES = 10,
  IPATCH_UNIT_TYPE_HERTZ = 11,
  IPATCH_UNIT_TYPE_SECONDS = 12,
  IPATCH_UNIT_TYPE_MULTIPLIER = 13,

  /* 128 - 159 reserved for IpatchUnit_DLS.h */
  IPATCH_UNIT_TYPE_DLS_GAIN = 128,
  IPATCH_UNIT_TYPE_DLS_ABS_TIME = 129,
  IPATCH_UNIT_TYPE_DLS_REL_TIME = 130,
  IPATCH_UNIT_TYPE_DLS_ABS_PITCH = 131,
  IPATCH_UNIT_TYPE_DLS_REL_PITCH = 132,
  IPATCH_UNIT_TYPE_DLS_PERCENT = 133,

  /* 160 - 169 reserved for IpatchUnit_SF2.h */
  IPATCH_UNIT_TYPE_SF2_ABS_PITCH = 160,
  IPATCH_UNIT_TYPE_SF2_OFS_PITCH = 161,
  IPATCH_UNIT_TYPE_SF2_ABS_TIME = 162,
  IPATCH_UNIT_TYPE_SF2_OFS_TIME = 163,
  IPATCH_UNIT_TYPE_CENTIBELS = 164,
  IPATCH_UNIT_TYPE_32K_SAMPLES = 165,
  IPATCH_UNIT_TYPE_TENTH_PERCENT = 166
} IpatchUnitType;

IPATCH_UNIT_TYPE_FIRST_DYNAMIC_ID

#define IPATCH_UNIT_TYPE_FIRST_DYNAMIC_ID	1024

enum IpatchUnitClassType

typedef enum
{
  IPATCH_UNIT_CLASS_NONE,	/* a NULL value */
  IPATCH_UNIT_CLASS_USER,   /* "user" conversion class (for humans) */
  IPATCH_UNIT_CLASS_DLS,	/* DLS (native patch type) class */
  IPATCH_UNIT_CLASS_COUNT   /* NOT A VALID CLASS - count of classes */
} IpatchUnitClassType;

ipatch_unit_info_new ()

IpatchUnitInfo *    ipatch_unit_info_new                (void);

Allocate a unit info structure for registering unit types with ipatch_unit_register(). Using this function should minimize API changes if additional fields are added to IpatchUnitInfo. Free the returned structure with ipatch_unit_free() when finished registering unit types.

Returns :

The newly allocated unit info structure.

ipatch_unit_info_free ()

void                ipatch_unit_info_free               (IpatchUnitInfo *info);

Free a unit info structure that was created with ipatch_unit_info_new().

info :

Unit info to free

ipatch_unit_register ()

guint16             ipatch_unit_register                (const IpatchUnitInfo *info);

Add a new unit type to the unit registry. Note that the info structure is shallow copied, so strings should be constant or guaranteed to not be freed. If the id field is already set (non-zero) in info, then it is used (should be 0 for dynamic unit types). If the label field of the info structure is NULL then it is set to the i18n translated string for name. Unit types can not be un-registered. Unit IDs of dynamic (non built-in types) should not be relied apon to always be the same between program executions.

info :

Unit info (shallow copied)

Returns :

New unit ID

ipatch_unit_lookup ()

IpatchUnitInfo *    ipatch_unit_lookup                  (guint16 id);

Looks up unit info by ID.

id :

Unit ID

Returns :

Unit info structure with id or NULL if not found, returned structure is internal and should not be modified or freed

ipatch_unit_lookup_by_name ()

IpatchUnitInfo *    ipatch_unit_lookup_by_name          (const char *name);

Looks up unit info by name.

name :

Unit name identifier

Returns :

Unit info structure with name or NULL if not found, returned structure is internal and should not be modified or freed

ipatch_unit_class_register_map ()

void                ipatch_unit_class_register_map      (guint16 class_type,
                                                         guint16 src_units,
                                                         guint16 dest_units);

Register a unit class mapping. Unit class types define domains of conversion, an example is the "user" unit class (IPATCH_UNIT_CLASS_USER) which is used to convert values to units digestable by a human. A conversion class is essentially a mapping between unit types, which can then be used to lookup conversion functions.

class_type :

Class type (see IpatchUnitClassType)

src_units :

Source unit type of mapping

dest_units :

Destination unit type for this map

ipatch_unit_class_lookup_map ()

IpatchUnitInfo *    ipatch_unit_class_lookup_map        (guint16 class_type,
                                                         guint16 src_units);

Lookup a unit class mapping (see ipatch_unit_class_register_map()).

class_type :

Class type (see IpatchUnitClassType)

src_units :

Source unit type of mapping to lookup

Returns :

Pointer to destination unit info structure, or NULL if not found.

ipatch_unit_conversion_register ()

void                ipatch_unit_conversion_register     (guint16 src_units,
                                                         guint16 dest_units,
                                                         IpatchValueTransform func);

Register a parameter unit conversion function.

src_units :

Source unit type

dest_units :

Destination unit type

func :

Conversion function handler or NULL for unity conversion (the value type will be converted but not the actual value, example: float -> int).

ipatch_unit_conversion_lookup ()

IpatchValueTransform  ipatch_unit_conversion_lookup     (guint16 src_units,
                                                         guint16 dest_units,
                                                         gboolean *set);

Lookup a conversion function by source and destination unit types.

src_units :

Source unit type

dest_units :

Destination unit type

set :

Location to store a boolean value indicating if the conversion is set, to differentiate between a NULL conversion function and an invalid conversion. Can be NULL in which case this parameter is ignored.

Returns :

Conversion function pointer or NULL if a unity conversion or no matching handlers (use set to determine which).

ipatch_unit_convert ()

gboolean            ipatch_unit_convert                 (guint16 src_units,
                                                         guint16 dest_units,
                                                         const GValue *src_val,
                                                         GValue *dest_val);

Convert a value from one unit type to another.

src_units :

Source unit type ID

dest_units :

Destination unit type ID

src_val :

Source value (type should be compatible with the source unit's value type)

dest_val :

Destination value (value should be initialized to a type that is compatible with the destination unit's value type)

Returns :

TRUE if value was successfully converted, FALSE otherwise (the only reasons for failure are invalid function parameters, no conversion function for the given unit types, or incompatible GValue types in conversion, therefore the return value can be safely ignored if the caller is sure the parameters and types are OK).

ipatch_unit_user_class_convert ()

double              ipatch_unit_user_class_convert      (guint16 src_units,
                                                         const GValue *src_val);

Converts a value to "user" units. User units are unit types that are adequate for human consumption. The IPATCH_UNIT_CLASS_USER map is used to lookup the corresponding user type to convert to. Not all unit types have an associated user type or the src_units type can itself be a user type; in either of these cases the src_val is converted as is (possibly converted from another value type to double).

src_units :

Source unit type ID

src_val :

Source value (type should be compatible with the source unit's value type)

Returns :

The value converted to user units.
libinstpatch-1.0.0/docs/reference/html/IpatchSF2File.html0000644000175000017500000007663111461404255020177 00000000000000 IpatchSF2File

IpatchSF2File

IpatchSF2File — SoundFont file object

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchSF2Phdr;
                    IpatchSF2Ihdr;
                    IpatchSF2Shdr;
                    IpatchSF2Bag;
                    IpatchSF2File;
#define             IPATCH_SFONT_FOURCC_SFBK
#define             IPATCH_SFONT_FOURCC_INFO
#define             IPATCH_SFONT_FOURCC_SDTA
#define             IPATCH_SFONT_FOURCC_PDTA
#define             IPATCH_SFONT_FOURCC_SMPL
#define             IPATCH_SFONT_FOURCC_SM24
#define             IPATCH_SFONT_FOURCC_PHDR
#define             IPATCH_SFONT_FOURCC_PBAG
#define             IPATCH_SFONT_FOURCC_PMOD
#define             IPATCH_SFONT_FOURCC_PGEN
#define             IPATCH_SFONT_FOURCC_INST
#define             IPATCH_SFONT_FOURCC_IBAG
#define             IPATCH_SFONT_FOURCC_IMOD
#define             IPATCH_SFONT_FOURCC_IGEN
#define             IPATCH_SFONT_FOURCC_SHDR
#define             IPATCH_SFONT_FOURCC_IFIL
#define             IPATCH_SFONT_FOURCC_ISNG
#define             IPATCH_SFONT_FOURCC_INAM
#define             IPATCH_SFONT_FOURCC_IROM
#define             IPATCH_SFONT_FOURCC_IVER
#define             IPATCH_SFONT_FOURCC_ICRD
#define             IPATCH_SFONT_FOURCC_IENG
#define             IPATCH_SFONT_FOURCC_IPRD
#define             IPATCH_SFONT_FOURCC_ICOP
#define             IPATCH_SFONT_FOURCC_ICMT
#define             IPATCH_SFONT_FOURCC_ISFT
#define             IPATCH_SFONT_VERSION_SIZE
#define             IPATCH_SFONT_PHDR_SIZE
#define             IPATCH_SFONT_INST_SIZE
#define             IPATCH_SFONT_SHDR_SIZE
#define             IPATCH_SFONT_BAG_SIZE
#define             IPATCH_SFONT_MOD_SIZE
#define             IPATCH_SFONT_GEN_SIZE
#define             IPATCH_SFONT_NAME_SIZE
enum                IpatchSF2FileSampleType;
IpatchSF2File *     ipatch_sf2_file_new                 (void);
void                ipatch_sf2_file_set_sample_pos      (IpatchSF2File *file,
                                                         guint sample_pos);
guint               ipatch_sf2_file_get_sample_pos      (IpatchSF2File *file);
void                ipatch_sf2_file_set_sample_size     (IpatchSF2File *file,
                                                         guint sample_size);
guint               ipatch_sf2_file_get_sample_size     (IpatchSF2File *file);
void                ipatch_sf2_file_set_sample24_pos    (IpatchSF2File *file,
                                                         guint sample24_pos);
guint               ipatch_sf2_file_get_sample24_pos    (IpatchSF2File *file);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchFile
               +----IpatchSF2File

Properties

  "sample-pos"               guint                 : Read / Write
  "sample-size"              guint                 : Read / Write
  "sample24-pos"             guint                 : Read / Write

Description

A IpatchFile object type specifically for SoundFont files.

Details

IpatchSF2Phdr

typedef struct {
  char name[20];		/* preset name */
  guint16 program;		/* MIDI program number */
  guint16 bank;			/* MIDI bank number */
  guint16 bag_index;	      /* index into preset bag (#IPFileBag) */
  guint32 library;		/* Not used (preserved) */
  guint32 genre;		/* Not used (preserved) */
  guint32 morphology;		/* Not used (preserved) */
} IpatchSF2Phdr;

IpatchSF2Ihdr

typedef struct {
  char name[20];		/* name of instrument */
  guint16 bag_index;		/* instrument bag index (#IPFileBag) */
} IpatchSF2Ihdr;

IpatchSF2Shdr

typedef struct {
  char name[20];		/* sample name */
  guint32 start;		/* offset to start of sample */
  guint32 end;			/* offset to end of sample */
  guint32 loop_start;		/* offset to start of loop */
  guint32 loop_end;		/* offset to end of loop */
  guint32 rate;			/* sample rate recorded at */
  guint8 root_note;		/* root midi note number */
  gint8 fine_tune;		/* pitch correction in cents */
  guint16 link_index;	  /* linked sample index for stereo samples */
  guint16 type;	       /* type of sample (see IpatchSF2SampleFlags) */
} IpatchSF2Shdr;

IpatchSF2Bag

typedef struct {
  guint16 mod_index;		/* index into modulator list */
  guint16 gen_index;		/* index into generator list */
} IpatchSF2Bag;

IpatchSF2File

typedef struct _IpatchSF2File IpatchSF2File;

IPATCH_SFONT_FOURCC_SFBK

#define IPATCH_SFONT_FOURCC_SFBK  IPATCH_FOURCC ('s','f','b','k')

IPATCH_SFONT_FOURCC_INFO

#define IPATCH_SFONT_FOURCC_INFO  IPATCH_FOURCC ('I','N','F','O')

IPATCH_SFONT_FOURCC_SDTA

#define IPATCH_SFONT_FOURCC_SDTA  IPATCH_FOURCC ('s','d','t','a')

IPATCH_SFONT_FOURCC_PDTA

#define IPATCH_SFONT_FOURCC_PDTA  IPATCH_FOURCC ('p','d','t','a')

IPATCH_SFONT_FOURCC_SMPL

#define IPATCH_SFONT_FOURCC_SMPL  IPATCH_FOURCC ('s','m','p','l')

IPATCH_SFONT_FOURCC_SM24

#define IPATCH_SFONT_FOURCC_SM24  IPATCH_FOURCC ('s','m','2','4')

IPATCH_SFONT_FOURCC_PHDR

#define IPATCH_SFONT_FOURCC_PHDR  IPATCH_FOURCC ('p','h','d','r')

IPATCH_SFONT_FOURCC_PBAG

#define IPATCH_SFONT_FOURCC_PBAG  IPATCH_FOURCC ('p','b','a','g')

IPATCH_SFONT_FOURCC_PMOD

#define IPATCH_SFONT_FOURCC_PMOD  IPATCH_FOURCC ('p','m','o','d')

IPATCH_SFONT_FOURCC_PGEN

#define IPATCH_SFONT_FOURCC_PGEN  IPATCH_FOURCC ('p','g','e','n')

IPATCH_SFONT_FOURCC_INST

#define IPATCH_SFONT_FOURCC_INST  IPATCH_FOURCC ('i','n','s','t')

IPATCH_SFONT_FOURCC_IBAG

#define IPATCH_SFONT_FOURCC_IBAG  IPATCH_FOURCC ('i','b','a','g')

IPATCH_SFONT_FOURCC_IMOD

#define IPATCH_SFONT_FOURCC_IMOD  IPATCH_FOURCC ('i','m','o','d')

IPATCH_SFONT_FOURCC_IGEN

#define IPATCH_SFONT_FOURCC_IGEN  IPATCH_FOURCC ('i','g','e','n')

IPATCH_SFONT_FOURCC_SHDR

#define IPATCH_SFONT_FOURCC_SHDR  IPATCH_FOURCC ('s','h','d','r')

IPATCH_SFONT_FOURCC_IFIL

#define IPATCH_SFONT_FOURCC_IFIL  IPATCH_FOURCC ('i','f','i','l')

IPATCH_SFONT_FOURCC_ISNG

#define IPATCH_SFONT_FOURCC_ISNG  IPATCH_FOURCC ('i','s','n','g')

IPATCH_SFONT_FOURCC_INAM

#define IPATCH_SFONT_FOURCC_INAM  IPATCH_FOURCC ('I','N','A','M')

IPATCH_SFONT_FOURCC_IROM

#define IPATCH_SFONT_FOURCC_IROM  IPATCH_FOURCC ('i','r','o','m')

IPATCH_SFONT_FOURCC_IVER

#define IPATCH_SFONT_FOURCC_IVER  IPATCH_FOURCC ('i','v','e','r')

IPATCH_SFONT_FOURCC_ICRD

#define IPATCH_SFONT_FOURCC_ICRD  IPATCH_FOURCC ('I','C','R','D')

IPATCH_SFONT_FOURCC_IENG

#define IPATCH_SFONT_FOURCC_IENG  IPATCH_FOURCC ('I','E','N','G')

IPATCH_SFONT_FOURCC_IPRD

#define IPATCH_SFONT_FOURCC_IPRD  IPATCH_FOURCC ('I','P','R','D')

IPATCH_SFONT_FOURCC_ICOP

#define IPATCH_SFONT_FOURCC_ICOP  IPATCH_FOURCC ('I','C','O','P')

IPATCH_SFONT_FOURCC_ICMT

#define IPATCH_SFONT_FOURCC_ICMT  IPATCH_FOURCC ('I','C','M','T')

IPATCH_SFONT_FOURCC_ISFT

#define IPATCH_SFONT_FOURCC_ISFT  IPATCH_FOURCC ('I','S','F','T')

IPATCH_SFONT_VERSION_SIZE

#define IPATCH_SFONT_VERSION_SIZE 4 /* file version info size */

IPATCH_SFONT_PHDR_SIZE

#define IPATCH_SFONT_PHDR_SIZE 38  /* file preset header size */

IPATCH_SFONT_INST_SIZE

#define IPATCH_SFONT_INST_SIZE 22  /* file instrument header size */

IPATCH_SFONT_SHDR_SIZE

#define IPATCH_SFONT_SHDR_SIZE 46  /* file sample header size */

IPATCH_SFONT_BAG_SIZE

#define IPATCH_SFONT_BAG_SIZE  4   /* file bag (zone) size */

IPATCH_SFONT_MOD_SIZE

#define IPATCH_SFONT_MOD_SIZE  10  /* file modulator size */

IPATCH_SFONT_GEN_SIZE

#define IPATCH_SFONT_GEN_SIZE  4   /* file generator size */

IPATCH_SFONT_NAME_SIZE

#define IPATCH_SFONT_NAME_SIZE 20  /* name string size (Preset/Inst/Sample) */

enum IpatchSF2FileSampleType

typedef enum
{
  IPATCH_SF2_FILE_SAMPLE_TYPE_MONO      = 1 << 0,
  IPATCH_SF2_FILE_SAMPLE_TYPE_RIGHT     = 1 << 1,
  IPATCH_SF2_FILE_SAMPLE_TYPE_LEFT      = 1 << 2,
  IPATCH_SF2_FILE_SAMPLE_TYPE_LINKED    = 1 << 3,
  IPATCH_SF2_FILE_SAMPLE_TYPE_ROM       = 1 << 15
} IpatchSF2FileSampleType;

SoundFont file sample channel mode

IPATCH_SF2_FILE_SAMPLE_TYPE_MONO

Mono channel

IPATCH_SF2_FILE_SAMPLE_TYPE_RIGHT

Right channel of a stereo pair

IPATCH_SF2_FILE_SAMPLE_TYPE_LEFT

Left channel of a stereo pair

IPATCH_SF2_FILE_SAMPLE_TYPE_LINKED

Linked list of samples (not yet used)

IPATCH_SF2_FILE_SAMPLE_TYPE_ROM

A ROM sample

ipatch_sf2_file_new ()

IpatchSF2File *     ipatch_sf2_file_new                 (void);

Create a new SoundFont file object.

Returns :

New SoundFont file object (derived from IpatchFile) with a reference count of 1. Caller owns the reference and removing it will destroy the item.

ipatch_sf2_file_set_sample_pos ()

void                ipatch_sf2_file_set_sample_pos      (IpatchSF2File *file,
                                                         guint sample_pos);

Sets the position of the sample data chunk in a SoundFont file object.

file :

SoundFont file object to set position of sample chunk

sample_pos :

Position in the SoundFont file of the first sample of the sample data chunk, in bytes

ipatch_sf2_file_get_sample_pos ()

guint               ipatch_sf2_file_get_sample_pos      (IpatchSF2File *file);

Gets the position of the sample data chunk in a SoundFont file object.

file :

SoundFont file object to get position of sample chunk from

Returns :

Position in the SoundFont file of the first sample of the sample data chunk, in bytes

ipatch_sf2_file_set_sample_size ()

void                ipatch_sf2_file_set_sample_size     (IpatchSF2File *file,
                                                         guint sample_size);

Sets the size of the sample data chunk in a SoundFont file object.

file :

SoundFont file object to set the size of the sample chunk

sample_size :

Size of the sample data chunk, in samples

ipatch_sf2_file_get_sample_size ()

guint               ipatch_sf2_file_get_sample_size     (IpatchSF2File *file);

Gets the size of the sample data chunk in a SoundFont file object.

file :

SoundFont file object to get the size of the sample chunk from

Returns :

Size of the sample data chunk, in samples

ipatch_sf2_file_set_sample24_pos ()

void                ipatch_sf2_file_set_sample24_pos    (IpatchSF2File *file,
                                                         guint sample24_pos);

Sets the position of the sample 24 data chunk in a SoundFont file object. This optional chunk contains the lower significant bytes of 24 bit samples.

file :

SoundFont file object to set position of sample24 chunk

sample24_pos :

Position in the SoundFont file of the first sample of the sample 24 data chunk, in bytes

ipatch_sf2_file_get_sample24_pos ()

guint               ipatch_sf2_file_get_sample24_pos    (IpatchSF2File *file);

Gets the position of the sample24 data chunk in a SoundFont file object.

file :

SoundFont file object to get position of sample24 chunk from

Returns :

Position in the SoundFont file of the first byte of the sample24 data chunk, in bytes

Property Details

The "sample-pos" property

  "sample-pos"               guint                 : Read / Write

Position in file of sample data chunk.

Default value: 0


The "sample-size" property

  "sample-size"              guint                 : Read / Write

Size of sample data chunk, in samples.

Default value: 0


The "sample24-pos" property

  "sample24-pos"             guint                 : Read / Write

Position in file of 24 bit sample chunk.

Default value: 0

libinstpatch-1.0.0/docs/reference/html/IpatchSampleStoreVirtual.html0000644000175000017500000002656711461404255022615 00000000000000 IpatchSampleStoreVirtual

IpatchSampleStoreVirtual

IpatchSampleStoreVirtual — Virtual sample storage object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSampleStore
               +----IpatchSampleStoreVirtual

Implemented Interfaces

IpatchSampleStoreVirtual implements IpatchSample.

Properties

  "sample-lists"             GValueArray*          : Read / Write

Description

A sample store that does in place sample conversions of other samples using sample lists (IpatchSampleList).

Details

IpatchSampleStoreVirtual

typedef struct _IpatchSampleStoreVirtual IpatchSampleStoreVirtual;

ipatch_sample_store_virtual_new ()

IpatchSample *      ipatch_sample_store_virtual_new     (void);

Creates a new virtual sample store.

Returns :

New virtual sample store, cast as a IpatchSample for convenience.

ipatch_sample_store_virtual_get_list ()

IpatchSampleList *  ipatch_sample_store_virtual_get_list
                                                        (IpatchSampleStoreVirtual *store,
                                                         guint chan);

Gets a sample list from a virtual sample store.

store :

Virtual store to get sample list from

chan :

Which channel to get sample list from (0 = mono or left stereo channel, 1 = right stereo channel).

Returns :

The sample list for the corresponding channel or NULL if not assigned. The list is internal and should not be modified or freed and should be used only as long as store.

ipatch_sample_store_virtual_set_list ()

void                ipatch_sample_store_virtual_set_list
                                                        (IpatchSampleStoreVirtual *store,
                                                         guint chan,
                                                         IpatchSampleList *list);

Sets a sample list of a virtual sample store. Can only be assigned before the sample store is active. The size of store is set to that of list.

store :

Virtual store to set sample list of

chan :

Which channel to set sample list of (0 = mono or left stereo channel, 1 = right stereo channel).

list :

List to assign to virtual store. The allocation is taken over by the virtual store (if caller would like to continue using it beyond the life of store or modify it, it should be duplicated).

Property Details

The "sample-lists" property

  "sample-lists"             GValueArray*          : Read / Write

Sample lists.

See Also

#IpatchSampleList
libinstpatch-1.0.0/docs/reference/html/libinstpatch.devhelp20000644000175000017500000073607111461404255021106 00000000000000 libinstpatch-1.0.0/docs/reference/html/IpatchGigInst.html0000644000175000017500000002035311461404255020337 00000000000000 IpatchGigInst

IpatchGigInst

IpatchGigInst — GigaSampler instrument object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchDLS2Inst
                     +----IpatchGigInst

Description

GigaSampler instrument objects are the toplevel instrument objects in a GigaSampler file.

Details

IpatchGigInstParams

typedef struct _IpatchGigInstParams IpatchGigInstParams;

IpatchGigInst

typedef struct _IpatchGigInst IpatchGigInst;

ipatch_gig_inst_new ()

IpatchGigInst *     ipatch_gig_inst_new                 (void);

Create a new GigaSampler instrument object.

Returns :

New GigaSampler instrument with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_gig_inst_first ()

IpatchGigInst *     ipatch_gig_inst_first               (IpatchIter *iter);

Gets the first item in a GigaSampler instrument iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchGigInst items

Returns :

The first GigaSampler instrument in iter or NULL if empty.

ipatch_gig_inst_next ()

IpatchGigInst *     ipatch_gig_inst_next                (IpatchIter *iter);

Gets the next item in a GigaSampler instrument iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchGigInst items

Returns :

The next GigaSampler instrument in iter or NULL if at the end of the list.
libinstpatch-1.0.0/docs/reference/html/IpatchVBank.html0000644000175000017500000004013611461404255017775 00000000000000 IpatchVBank

IpatchVBank

IpatchVBank — Virtual bank object

Stability Level

Stable, unless otherwise indicated

Synopsis

#define             IPATCH_VBANK_INFO_COUNT
                    IpatchVBank;
#define             IPATCH_VBANK_PARSER_VERSION
IpatchVBank *       ipatch_vbank_new                    (void);
#define             ipatch_vbank_get_insts              (vbank)
IpatchVBankInst *   ipatch_vbank_find_inst              (IpatchVBank *vbank,
                                                         const char *name,
                                                         int bank,
                                                         int program,
                                                         const IpatchVBankInst *exclude);
char *              ipatch_vbank_make_unique_name       (IpatchVBank *vbank,
                                                         const char *name,
                                                         const IpatchVBankInst *exclude);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchBase
                     +----IpatchVBank

Properties

  "author"                   gchar*                : Read / Write
  "comment"                  gchar*                : Read / Write
  "date"                     gchar*                : Read / Write
  "engine"                   gchar*                : Read / Write
  "name"                     gchar*                : Read / Write
  "parser-version"           gchar*                : Read / Write
  "require-version"          gchar*                : Read / Write

Description

Virtual banks provide the capability of creating new instrument MIDI maps from components from other files of possibly different types.

Details

IPATCH_VBANK_INFO_COUNT

#define IPATCH_VBANK_INFO_COUNT		7

Count of info strings


IpatchVBank

typedef struct _IpatchVBank IpatchVBank;

IPATCH_VBANK_PARSER_VERSION

#define IPATCH_VBANK_PARSER_VERSION	"1.0"

Current IVBank parser version.


ipatch_vbank_new ()

IpatchVBank *       ipatch_vbank_new                    (void);

Create a new virtual bank base object.

Returns :

New IVBank base object with a reference count of 1. Caller owns the reference and removing it will destroy the item.

ipatch_vbank_get_insts()

#define             ipatch_vbank_get_insts(vbank)

ipatch_vbank_find_inst ()

IpatchVBankInst *   ipatch_vbank_find_inst              (IpatchVBank *vbank,
                                                         const char *name,
                                                         int bank,
                                                         int program,
                                                         const IpatchVBankInst *exclude);

Find an instrument by name or bank:preset MIDI numbers. If instrument name and bank:program are specified then match for either condition. If an instrument is found its reference count is incremented before it is returned. The caller is responsible for removing the reference with g_object_unref() when finished with it.

vbank :

VBank to search in

name :

Name of instrument to find or NULL to match any name

bank :

MIDI bank number of instrument to search for or -1 to not search by MIDI bank:program numbers

program :

MIDI program number of instrument to search for, only used if bank is 0-128

exclude :

An instrument to exclude from the search or NULL

Returns :

The matching instrument or NULL if not found. Remember to unref the item when finished with it.

ipatch_vbank_make_unique_name ()

char *              ipatch_vbank_make_unique_name       (IpatchVBank *vbank,
                                                         const char *name,
                                                         const IpatchVBankInst *exclude);

Generates a unique instrument name for vbank. The name parameter is used as a base and is modified, by appending a number, to make it unique (if necessary). The exclude parameter is used to exclude an existing vbank instrument from the search.

MT-Note: To ensure that an item is actually unique before being added to a VBank object, ipatch_container_add_unique() should be used.

vbank :

VBank item

name :

An initial name to use or NULL

exclude :

An item to exclude from search or NULL

Returns :

A new unique name which should be freed when finished with it.

Property Details

The "author" property

  "author"                   gchar*                : Read / Write

Author of file.

Default value: NULL


The "comment" property

  "comment"                  gchar*                : Read / Write

Comments.

Default value: NULL


The "date" property

  "date"                     gchar*                : Read / Write

Creation date.

Default value: NULL


The "engine" property

  "engine"                   gchar*                : Read / Write

Synthesis engine.

Default value: NULL


The "name" property

  "name"                     gchar*                : Read / Write

Descriptive name.

Default value: NULL


The "parser-version" property

  "parser-version"           gchar*                : Read / Write

Parser version.

Default value: "1.0"


The "require-version" property

  "require-version"          gchar*                : Read / Write

Required parser version.

Default value: "1.0"

libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchUnit-generic.html0000644000175000017500000001206211461404255024004 00000000000000 IpatchUnit_generic

IpatchUnit_generic

IpatchUnit_generic — Generic unit types and conversions

Stability Level

Stable, unless otherwise indicated

Synopsis

double              ipatch_unit_hertz_to_cents          (double hz);
double              ipatch_unit_cents_to_hertz          (double cents);

Description

Details

ipatch_unit_hertz_to_cents ()

double              ipatch_unit_hertz_to_cents          (double hz);

Convert frequency in Hertz to relative cents.

hz :

Hertz (cycles per second) value

Returns :

Converted value in relative cents.

ipatch_unit_cents_to_hertz ()

double              ipatch_unit_cents_to_hertz          (double cents);

Convert cents to relative frequency in Hertz.

cents :

Value in cents

Returns :

Value in relative Hertz (cycles per second)
libinstpatch-1.0.0/docs/reference/html/home.png0000644000175000017500000000121611461404255016407 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME1KvIDATxՕkq?rCp ~CnpCAAJ .B-\'G]:ܠC -(8 Ԁ!fDғklbRoyxwpðIJ<of_-@RHf֟t^ښ$Q|pgv;X^^&s(bwwZF9&3඙ ^IRZUE.0Z]]U PYM8HGIekqqҀ! $۬3n e{-/seeeÌXOͷ$8==USQRR'9-s+B^ Cەs+%<7W :2IENDB`libinstpatch-1.0.0/docs/reference/html/IpatchSampleStore.html0000644000175000017500000003527011461404255021235 00000000000000 IpatchSampleStore

IpatchSampleStore

IpatchSampleStore — Abstract sample storage object

Stability Level

Stable, unless otherwise indicated

Implemented Interfaces

IpatchSampleStore implements IpatchSample.

Properties

  "sample-format"            gint                  : Read / Write
  "sample-rate"              gint                  : Read / Write
  "sample-size"              guint                 : Read / Write

Description

Sample stores provide for various storage methods for audio data. Examples include: IpatchSampleStoreFile for audio data stored in files on disk, IpatchSampleStoreRAM for audio in RAM, IpatchSampleStoreROM for samples in ROM of a sound card, etc.

Details

IpatchSampleStore

typedef struct _IpatchSampleStore IpatchSampleStore;

IPATCH_SAMPLE_STORE_FORMAT_SHIFT

#define IPATCH_SAMPLE_STORE_FORMAT_SHIFT IPATCH_ITEM_UNUSED_FLAG_SHIFT

ipatch_sample_store_get_format()

#define             ipatch_sample_store_get_format(store)

Macro for getting the sample format from a sample store. No lock is required since format can only be set prior to the store being actively used.

Returns :

Sample format field. See sample.

ipatch_sample_store_get_size()

#define ipatch_sample_store_get_size(store) ((store)->size)

Macro for getting the sample size in frames of a sample store. No lock is required since size can only be set prior to the store being actively used.

Returns :

Sample store size in frames.

ipatch_sample_store_get_rate()

#define ipatch_sample_store_get_rate(store) ((store)->rate)

Macro for getting the sample rate from a sample store. No lock is required since rate can only be set prior to the store being actively used.

Returns :

Sample rate in HZ.

ipatch_sample_store_get_size_bytes()

#define             ipatch_sample_store_get_size_bytes(store)

Macro for getting the sample store data size in bytes. No lock is required since format and size can only be set prior to the store being actively used.

Returns :

Sample store size in bytes.

IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT

ipatch_sample_store_first ()

IpatchSampleStore * ipatch_sample_store_first           (IpatchIter *iter);

Gets the first item in a sample store iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchSampleStore items

Returns :

The first sample store in iter or NULL if empty.

ipatch_sample_store_next ()

IpatchSampleStore * ipatch_sample_store_next            (IpatchIter *iter);

Gets the next item in a sample store iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchSampleStore items

Returns :

The next sample store in iter or NULL if at the end of the list.

Property Details

The "sample-format" property

  "sample-format"            gint                  : Read / Write

Sample format.

Allowed values: >= 0

Default value: 2


The "sample-rate" property

  "sample-rate"              gint                  : Read / Write

Sampling rate in Hertz.

Allowed values: [8000,192000]

Default value: 44100


The "sample-size" property

  "sample-size"              guint                 : Read / Write

Size in frames.

Default value: 0

libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchXmlObject.html0000644000175000017500000017451611461404255023357 00000000000000 IpatchXmlObject

IpatchXmlObject

IpatchXmlObject — GObject related XML tree functions

Stability Level

Stable, unless otherwise indicated

Synopsis

gboolean            (*IpatchXmlEncodeFunc)              (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);
gboolean            (*IpatchXmlDecodeFunc)              (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);
void                ipatch_xml_register_handler         (GType type,
                                                         const char *prop_name,
                                                         IpatchXmlEncodeFunc encode_func,
                                                         IpatchXmlDecodeFunc decode_func);
gboolean            ipatch_xml_lookup_handler           (GType type,
                                                         GParamSpec *pspec,
                                                         IpatchXmlEncodeFunc *encode_func,
                                                         IpatchXmlDecodeFunc *decode_func);
gboolean            ipatch_xml_lookup_handler_by_prop_name
                                                        (GType type,
                                                         const char *prop_name,
                                                         IpatchXmlEncodeFunc *encode_func,
                                                         IpatchXmlDecodeFunc *decode_func);
gboolean            ipatch_xml_encode_object            (GNode *node,
                                                         GObject *object,
                                                         gboolean create_element,
                                                         GError **err);
gboolean            ipatch_xml_encode_property          (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         gboolean create_element,
                                                         GError **err);
gboolean            ipatch_xml_encode_property_by_name  (GNode *node,
                                                         GObject *object,
                                                         const char *propname,
                                                         gboolean create_element,
                                                         GError **err);
gboolean            ipatch_xml_encode_value             (GNode *node,
                                                         GValue *value,
                                                         GError **err);
gboolean            ipatch_xml_decode_object            (GNode *node,
                                                         GObject *object,
                                                         GError **err);
gboolean            ipatch_xml_decode_property          (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GError **err);
gboolean            ipatch_xml_decode_property_by_name  (GNode *node,
                                                         GObject *object,
                                                         const char *propname,
                                                         GError **err);
gboolean            ipatch_xml_decode_value             (GNode *node,
                                                         GValue *value,
                                                         GError **err);
gboolean            ipatch_xml_default_encode_object_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);
gboolean            ipatch_xml_default_encode_property_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);
gboolean            ipatch_xml_default_encode_value_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);
gboolean            ipatch_xml_default_decode_object_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);
gboolean            ipatch_xml_default_decode_property_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);
gboolean            ipatch_xml_default_decode_value_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);

Description

Functions for saving/loading GObject, GValue and GObject properties to/from XML trees. Includes a system for registering custom encoding and decoding handlers for objects, properties and value types.

Details

IpatchXmlEncodeFunc ()

gboolean            (*IpatchXmlEncodeFunc)              (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);

Function type for encoding objects, properties or GValue types to XML trees. Forms the basis of serializing GObject and GValues to XML. The caller handles creating an XML node element to contain the given object, property or value XML encoding.

node :

XML node to encode XML to

object :

Object being encoded (object and property encoders)

pspec :

Spec of property being encoded (property encoders only)

value :

Value to encode (property and GValue encoders only)

err :

Location to store error value (or NULL if ignoring)

Returns :

Should return TRUE on success and FALSE on error (in which case err should be set).

IpatchXmlDecodeFunc ()

gboolean            (*IpatchXmlDecodeFunc)              (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);

Function type for decoding objects, properties or GValue types from XML trees to their original instance values in memory. For object decoders, only object will be set and the decoded XML content should be assigned to the object; for property decoders object, pspec and value will be set, value is initialized to the property value type and the decoded value should be assigned to it; for GValue decoders, only the value will be initialized which the decoded value should be assigned to.

node :

XML node to be decoded

object :

Object being decoded to (object and property decoders, NULL otherwise)

pspec :

Spec of property being decoded (property decoders only, NULL otherwise)

value :

Value to decode to (property and GValue decoders only, NULL otherwise)

err :

Location to store error value (or NULL if ignoring)

Returns :

Should return TRUE on success, FALSE otherwise (in which case err should be set)

ipatch_xml_register_handler ()

void                ipatch_xml_register_handler         (GType type,
                                                         const char *prop_name,
                                                         IpatchXmlEncodeFunc encode_func,
                                                         IpatchXmlDecodeFunc decode_func);

Registers XML encoding/decoding handlers for a GObject type, GObject property or GValue type.

type :

GType to register handler functions for (GObject type if an object or object property handler, GValue type for value handlers).

prop_name :

GObject property name (or NULL if not a GObject property handler)

encode_func :

Function to handle encoding (object/property/value -> XML)

decode_func :

Function to handle decoding (XML -> object/property/value)

ipatch_xml_lookup_handler ()

gboolean            ipatch_xml_lookup_handler           (GType type,
                                                         GParamSpec *pspec,
                                                         IpatchXmlEncodeFunc *encode_func,
                                                         IpatchXmlDecodeFunc *decode_func);

Looks up handlers for a given GObject type, GObject property or GValue type previously registered with ipatch_xml_register_handler(). These functions are used for encoding/decoding to/from XML.

type :

GObject or GValue type of handler to lookup

pspec :

GObject property spec (or NULL if not a GObject property handler)

encode_func :

Location to store encoding function (or NULL)

decode_func :

Location to store decoding function (or NULL)

Returns :

TRUE if handler found, FALSE otherwise

ipatch_xml_lookup_handler_by_prop_name ()

gboolean            ipatch_xml_lookup_handler_by_prop_name
                                                        (GType type,
                                                         const char *prop_name,
                                                         IpatchXmlEncodeFunc *encode_func,
                                                         IpatchXmlDecodeFunc *decode_func);

Like ipatch_xml_lookup_handler() but takes a prop_name string to indicate which GObject property to lookup instead of a GParamSpec.

type :

GObject or GValue type of handler to lookup

prop_name :

GObject property name (or NULL if not a GObject property handler)

encode_func :

Location to store encoding function (or NULL)

decode_func :

Location to store decoding function (or NULL)

Returns :

TRUE if handler found, FALSE otherwise

ipatch_xml_encode_object ()

gboolean            ipatch_xml_encode_object            (GNode *node,
                                                         GObject *object,
                                                         gboolean create_element,
                                                         GError **err);

Encodes an object to XML.

node :

XML node to encode to

object :

Object to encode to XML

create_element :

TRUE to create a <obj> element, FALSE to add object properties to current open element

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_xml_encode_property ()

gboolean            ipatch_xml_encode_property          (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         gboolean create_element,
                                                         GError **err);

Encode an object property to an XML node.

node :

XML node to encode to

object :

GObject to encode property of

pspec :

Parameter specification of property to encode

create_element :

TRUE to create a <prop name="PROPNAME"> element, FALSE to assign object property value to node

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE otherwise

ipatch_xml_encode_property_by_name ()

gboolean            ipatch_xml_encode_property_by_name  (GNode *node,
                                                         GObject *object,
                                                         const char *propname,
                                                         gboolean create_element,
                                                         GError **err);

Encode an object property by name to an XML node.

node :

XML node to encode to

object :

GObject to encode property of

propname :

Name of object property to encode

create_element :

TRUE to create a <prop name="PROPNAME"> element, FALSE to assign object property value to node

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE otherwise

ipatch_xml_encode_value ()

gboolean            ipatch_xml_encode_value             (GNode *node,
                                                         GValue *value,
                                                         GError **err);

Encodes a GValue to an XML node text value.

node :

XML node to encode to

value :

Value to encode

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE on error (err may be set)

ipatch_xml_decode_object ()

gboolean            ipatch_xml_decode_object            (GNode *node,
                                                         GObject *object,
                                                         GError **err);

Decodes XML to an object. The default GObject decoder will only decode those properties which don't have the IPATCH_PARAM_NO_SAVE flag set.

node :

XML node to decode from

object :

Object to decode to from XML

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_xml_decode_property ()

gboolean            ipatch_xml_decode_property          (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GError **err);

Decode an object property from an XML node value to an object. Note that the property is NOT checked for the IPATCH_PARAM_NO_SAVE flag.

node :

XML node to decode from

object :

GObject to decode property of

pspec :

Parameter specification of property to decode

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE otherwise

ipatch_xml_decode_property_by_name ()

gboolean            ipatch_xml_decode_property_by_name  (GNode *node,
                                                         GObject *object,
                                                         const char *propname,
                                                         GError **err);

Decode an object property from an XML node value to an object by property name. Note that the property is NOT checked for the IPATCH_PARAM_NO_SAVE flag.

node :

XML node to decode from

object :

GObject to decode property of

propname :

Name of object property to decode

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE otherwise

ipatch_xml_decode_value ()

gboolean            ipatch_xml_decode_value             (GNode *node,
                                                         GValue *value,
                                                         GError **err);

Decodes a GValue from an XML node text value.

node :

XML node to decode from

value :

Value to decode to

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE on error (err may be set)

ipatch_xml_default_encode_object_func ()

gboolean            ipatch_xml_default_encode_object_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);

Default GObject encode handler. Useful for custom handlers to chain to the default if needed.

node :

XML node to encode XML to

object :

Object to encode

pspec :

Will be NULL

value :

Will be NULL

err :

Location to store error value (or NULL if ignoring)

Returns :

TRUE on success, FALSE on error (err may be set)

ipatch_xml_default_encode_property_func ()

gboolean            ipatch_xml_default_encode_property_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);

Default GObject property encode handler. Useful for custom handlers to chain to the default if needed.

node :

XML node to encode XML to

object :

Object to encode

pspec :

Parameter spec of property to encode

value :

Value of the property

err :

Location to store error value (or NULL if ignoring)

Returns :

TRUE on success, FALSE on error (err may be set)

ipatch_xml_default_encode_value_func ()

gboolean            ipatch_xml_default_encode_value_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);

Default GValue encode handler. Useful for custom handlers to chain to the default if needed.

node :

XML node to encode XML to

object :

Will be NULL

pspec :

Will be NULL

value :

Value to encode

err :

Location to store error value (or NULL if ignoring)

Returns :

TRUE on success, FALSE on error (err may be set)

ipatch_xml_default_decode_object_func ()

gboolean            ipatch_xml_default_decode_object_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);

Default GObject decode handler. Useful for custom handlers to chain to the default if needed.

node :

XML node to decode XML from

object :

Object to decode to

pspec :

Will be NULL

value :

Will be NULL

err :

Location to store error value (or NULL if ignoring)

Returns :

TRUE on success, FALSE on error (err may be set)

ipatch_xml_default_decode_property_func ()

gboolean            ipatch_xml_default_decode_property_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);

Default GObject property decode handler. Useful for custom handlers to chain to the default if needed.

node :

XML node to decode XML from

object :

Object whose property is being decoded

pspec :

Parameter spec of property to decode

value :

Initialized value to decode to

err :

Location to store error value (or NULL if ignoring)

Returns :

TRUE on success, FALSE on error (err may be set)

ipatch_xml_default_decode_value_func ()

gboolean            ipatch_xml_default_decode_value_func
                                                        (GNode *node,
                                                         GObject *object,
                                                         GParamSpec *pspec,
                                                         GValue *value,
                                                         GError **err);

Default GValue decode handler. Useful for custom handlers to chain to the default if needed.

node :

XML node to decode XML from

object :

Will be NULL

pspec :

Will be NULL

value :

Value to decode to

err :

Location to store error value (or NULL if ignoring)

Returns :

TRUE on success, FALSE on error (err may be set)

See Also

IpatchXml
libinstpatch-1.0.0/docs/reference/html/IpatchSF2PZone.html0000644000175000017500000017353611461404255020355 00000000000000 IpatchSF2PZone

IpatchSF2PZone

IpatchSF2PZone — SoundFont preset zone object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSF2Zone
               +----IpatchSF2PZone

Implemented Interfaces

IpatchSF2PZone implements IpatchSF2GenItemIface and IpatchSF2ModItemIface.

Properties

  "attenuation"              gint                  : Read / Write
  "attenuation-set"          gboolean              : Read / Write
  "chorus"                   gint                  : Read / Write
  "chorus-set"               gboolean              : Read / Write
  "coarse-tune"              gint                  : Read / Write
  "coarse-tune-set"          gboolean              : Read / Write
  "filter-cutoff"            gint                  : Read / Write
  "filter-cutoff-set"        gboolean              : Read / Write
  "filter-q"                 gint                  : Read / Write
  "filter-q-set"             gboolean              : Read / Write
  "fine-tune-override"       gint                  : Read / Write
  "fine-tune-override-set"   gboolean              : Read / Write
  "link-item"                IpatchSF2Inst*        : Read / Write
  "mod-env-attack"           gint                  : Read / Write
  "mod-env-attack-set"       gboolean              : Read / Write
  "mod-env-decay"            gint                  : Read / Write
  "mod-env-decay-set"        gboolean              : Read / Write
  "mod-env-delay"            gint                  : Read / Write
  "mod-env-delay-set"        gboolean              : Read / Write
  "mod-env-hold"             gint                  : Read / Write
  "mod-env-hold-set"         gboolean              : Read / Write
  "mod-env-release"          gint                  : Read / Write
  "mod-env-release-set"      gboolean              : Read / Write
  "mod-env-sustain"          gint                  : Read / Write
  "mod-env-sustain-set"      gboolean              : Read / Write
  "mod-env-to-filter-cutoff" gint                  : Read / Write
  "mod-env-to-filter-cutoff-set" gboolean              : Read / Write
  "mod-env-to-pitch"         gint                  : Read / Write
  "mod-env-to-pitch-set"     gboolean              : Read / Write
  "mod-lfo-delay"            gint                  : Read / Write
  "mod-lfo-delay-set"        gboolean              : Read / Write
  "mod-lfo-freq"             gint                  : Read / Write
  "mod-lfo-freq-set"         gboolean              : Read / Write
  "mod-lfo-to-filter-cutoff" gint                  : Read / Write
  "mod-lfo-to-filter-cutoff-set" gboolean              : Read / Write
  "mod-lfo-to-pitch"         gint                  : Read / Write
  "mod-lfo-to-pitch-set"     gboolean              : Read / Write
  "mod-lfo-to-volume"        gint                  : Read / Write
  "mod-lfo-to-volume-set"    gboolean              : Read / Write
  "note-range"               IpatchRange*          : Read / Write
  "note-range-set"           gboolean              : Read / Write
  "note-to-mod-env-decay"    gint                  : Read / Write
  "note-to-mod-env-decay-set" gboolean              : Read / Write
  "note-to-mod-env-hold"     gint                  : Read / Write
  "note-to-mod-env-hold-set" gboolean              : Read / Write
  "note-to-vol-env-decay"    gint                  : Read / Write
  "note-to-vol-env-decay-set" gboolean              : Read / Write
  "note-to-vol-env-hold"     gint                  : Read / Write
  "note-to-vol-env-hold-set" gboolean              : Read / Write
  "pan"                      gint                  : Read / Write
  "pan-set"                  gboolean              : Read / Write
  "reverb"                   gint                  : Read / Write
  "reverb-set"               gboolean              : Read / Write
  "scale-tune"               gint                  : Read / Write
  "scale-tune-set"           gboolean              : Read / Write
  "velocity-range"           IpatchRange*          : Read / Write
  "velocity-range-set"       gboolean              : Read / Write
  "vib-lfo-delay"            gint                  : Read / Write
  "vib-lfo-delay-set"        gboolean              : Read / Write
  "vib-lfo-freq"             gint                  : Read / Write
  "vib-lfo-freq-set"         gboolean              : Read / Write
  "vib-lfo-to-pitch"         gint                  : Read / Write
  "vib-lfo-to-pitch-set"     gboolean              : Read / Write
  "vol-env-attack"           gint                  : Read / Write
  "vol-env-attack-set"       gboolean              : Read / Write
  "vol-env-decay"            gint                  : Read / Write
  "vol-env-decay-set"        gboolean              : Read / Write
  "vol-env-delay"            gint                  : Read / Write
  "vol-env-delay-set"        gboolean              : Read / Write
  "vol-env-hold"             gint                  : Read / Write
  "vol-env-hold-set"         gboolean              : Read / Write
  "vol-env-release"          gint                  : Read / Write
  "vol-env-release-set"      gboolean              : Read / Write
  "vol-env-sustain"          gint                  : Read / Write
  "vol-env-sustain-set"      gboolean              : Read / Write

Description

Preset zones are children to IpatchSF2Preset objects and define how offset generators (effect parameters) for their referenced IpatchSF2Inst.

Details

IpatchSF2PZone

typedef struct _IpatchSF2PZone IpatchSF2PZone;

ipatch_sf2_pzone_new ()

IpatchSF2PZone *    ipatch_sf2_pzone_new                (void);

Create a new SoundFont preset zone object.

Returns :

New SoundFont preset zone with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_sf2_pzone_first ()

IpatchSF2PZone *    ipatch_sf2_pzone_first              (IpatchIter *iter);

Gets the first item in a preset zone iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchSF2PZone items

Returns :

The first preset zone in iter or NULL if empty.

ipatch_sf2_pzone_next ()

IpatchSF2PZone *    ipatch_sf2_pzone_next               (IpatchIter *iter);

Gets the next item in a preset zone iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchSF2PZone items

Returns :

The next preset zone in iter or NULL if at the end of the list.

ipatch_sf2_pzone_set_inst ()

void                ipatch_sf2_pzone_set_inst           (IpatchSF2PZone *pzone,
                                                         IpatchSF2Inst *inst);

Sets the referenced instrument of a preset zone.

pzone :

Preset zone to set referenced instrument of

inst :

Instrument to set preset zone's referenced item to

ipatch_sf2_pzone_get_inst ()

IpatchSF2Inst *     ipatch_sf2_pzone_get_inst           (IpatchSF2PZone *pzone);

Gets the referenced instrument from a preset zone. The returned instrument's reference count is incremented and the caller is responsible for unrefing it with g_object_unref().

pzone :

Preset zone to get referenced instrument from

Returns :

Preset zone's referenced instrument or NULL if global zone. Remember to unreference the instrument with g_object_unref() when done with it.

Property Details

The "attenuation" property

  "attenuation"              gint                  : Read / Write

Volume attenuation.

Allowed values: [-1440,1440]

Default value: 0


The "attenuation-set" property

  "attenuation-set"          gboolean              : Read / Write

Default value: FALSE


The "chorus" property

  "chorus"                   gint                  : Read / Write

Chorus.

Allowed values: [-1000,1000]

Default value: 0


The "chorus-set" property

  "chorus-set"               gboolean              : Read / Write

Default value: FALSE


The "coarse-tune" property

  "coarse-tune"              gint                  : Read / Write

Coarse Tune.

Allowed values: [-240,240]

Default value: 0


The "coarse-tune-set" property

  "coarse-tune-set"          gboolean              : Read / Write

Default value: FALSE


The "filter-cutoff" property

  "filter-cutoff"            gint                  : Read / Write

Low pass filter cutoff frequency.

Allowed values: [-12000,12000]

Default value: 0


The "filter-cutoff-set" property

  "filter-cutoff-set"        gboolean              : Read / Write

Default value: FALSE


The "filter-q" property

  "filter-q"                 gint                  : Read / Write

Low pass filter Q factor.

Allowed values: [-960,960]

Default value: 0


The "filter-q-set" property

  "filter-q-set"             gboolean              : Read / Write

Default value: FALSE


The "fine-tune-override" property

  "fine-tune-override"       gint                  : Read / Write

Fine Tune.

Allowed values: [-198,198]

Default value: 0


The "fine-tune-override-set" property

  "fine-tune-override-set"   gboolean              : Read / Write

Default value: FALSE


The "link-item" property

  "link-item"                IpatchSF2Inst*        : Read / Write

Link item.


The "mod-env-attack" property

  "mod-env-attack"           gint                  : Read / Write

Modulation envelope attack.

Allowed values: [-20000,20000]

Default value: 0


The "mod-env-attack-set" property

  "mod-env-attack-set"       gboolean              : Read / Write

Default value: FALSE


The "mod-env-decay" property

  "mod-env-decay"            gint                  : Read / Write

Modulation envelope decay.

Allowed values: [-20000,20000]

Default value: 0


The "mod-env-decay-set" property

  "mod-env-decay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-env-delay" property

  "mod-env-delay"            gint                  : Read / Write

Modulation envelope delay.

Allowed values: [-17000,17000]

Default value: 0


The "mod-env-delay-set" property

  "mod-env-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-env-hold" property

  "mod-env-hold"             gint                  : Read / Write

Modulation envelope hold.

Allowed values: [-17000,17000]

Default value: 0


The "mod-env-hold-set" property

  "mod-env-hold-set"         gboolean              : Read / Write

Default value: FALSE


The "mod-env-release" property

  "mod-env-release"          gint                  : Read / Write

Modulation envelope release.

Allowed values: [-20000,20000]

Default value: 0


The "mod-env-release-set" property

  "mod-env-release-set"      gboolean              : Read / Write

Default value: FALSE


The "mod-env-sustain" property

  "mod-env-sustain"          gint                  : Read / Write

Modulation envelope sustain.

Allowed values: [-1000,1000]

Default value: 0


The "mod-env-sustain-set" property

  "mod-env-sustain-set"      gboolean              : Read / Write

Default value: FALSE


The "mod-env-to-filter-cutoff" property

  "mod-env-to-filter-cutoff" gint                  : Read / Write

Modulation envelope to filter cutoff.

Allowed values: [-24000,24000]

Default value: 0


The "mod-env-to-filter-cutoff-set" property

  "mod-env-to-filter-cutoff-set" gboolean              : Read / Write

Default value: FALSE


The "mod-env-to-pitch" property

  "mod-env-to-pitch"         gint                  : Read / Write

Modulation envelope to pitch.

Allowed values: [-24000,24000]

Default value: 0


The "mod-env-to-pitch-set" property

  "mod-env-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-delay" property

  "mod-lfo-delay"            gint                  : Read / Write

Modulation oscillator delay.

Allowed values: [-17000,17000]

Default value: 0


The "mod-lfo-delay-set" property

  "mod-lfo-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-freq" property

  "mod-lfo-freq"             gint                  : Read / Write

Modulation oscillator frequency.

Allowed values: [-20500,20500]

Default value: 0


The "mod-lfo-freq-set" property

  "mod-lfo-freq-set"         gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-filter-cutoff" property

  "mod-lfo-to-filter-cutoff" gint                  : Read / Write

Modulation oscillator to filter cutoff.

Allowed values: [-24000,24000]

Default value: 0


The "mod-lfo-to-filter-cutoff-set" property

  "mod-lfo-to-filter-cutoff-set" gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-pitch" property

  "mod-lfo-to-pitch"         gint                  : Read / Write

Modulation oscillator to pitch.

Allowed values: [-24000,24000]

Default value: 0


The "mod-lfo-to-pitch-set" property

  "mod-lfo-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-volume" property

  "mod-lfo-to-volume"        gint                  : Read / Write

Modulation oscillator to volume.

Allowed values: [-1920,1920]

Default value: 0


The "mod-lfo-to-volume-set" property

  "mod-lfo-to-volume-set"    gboolean              : Read / Write

Default value: FALSE


The "note-range" property

  "note-range"               IpatchRange*          : Read / Write

Note Range.


The "note-range-set" property

  "note-range-set"           gboolean              : Read / Write

Default value: FALSE


The "note-to-mod-env-decay" property

  "note-to-mod-env-decay"    gint                  : Read / Write

MIDI note to modulation envelope decay.

Allowed values: [-2400,2400]

Default value: 0


The "note-to-mod-env-decay-set" property

  "note-to-mod-env-decay-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-mod-env-hold" property

  "note-to-mod-env-hold"     gint                  : Read / Write

MIDI note to modulation envelope hold.

Allowed values: [-2400,2400]

Default value: 0


The "note-to-mod-env-hold-set" property

  "note-to-mod-env-hold-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-vol-env-decay" property

  "note-to-vol-env-decay"    gint                  : Read / Write

MIDI note to volume envelope decay.

Allowed values: [-2400,2400]

Default value: 0


The "note-to-vol-env-decay-set" property

  "note-to-vol-env-decay-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-vol-env-hold" property

  "note-to-vol-env-hold"     gint                  : Read / Write

MIDI note to volume envelope hold.

Allowed values: [-2400,2400]

Default value: 0


The "note-to-vol-env-hold-set" property

  "note-to-vol-env-hold-set" gboolean              : Read / Write

Default value: FALSE


The "pan" property

  "pan"                      gint                  : Read / Write

Panning.

Allowed values: [-1000,1000]

Default value: 0


The "pan-set" property

  "pan-set"                  gboolean              : Read / Write

Default value: FALSE


The "reverb" property

  "reverb"                   gint                  : Read / Write

Reverb.

Allowed values: [-1000,1000]

Default value: 0


The "reverb-set" property

  "reverb-set"               gboolean              : Read / Write

Default value: FALSE


The "scale-tune" property

  "scale-tune"               gint                  : Read / Write

Scale Tune.

Allowed values: [-1200,1200]

Default value: 0


The "scale-tune-set" property

  "scale-tune-set"           gboolean              : Read / Write

Default value: FALSE


The "velocity-range" property

  "velocity-range"           IpatchRange*          : Read / Write

Velocity Range.


The "velocity-range-set" property

  "velocity-range-set"       gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-delay" property

  "vib-lfo-delay"            gint                  : Read / Write

Vibrato oscillator delay.

Allowed values: [-17000,17000]

Default value: 0


The "vib-lfo-delay-set" property

  "vib-lfo-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-freq" property

  "vib-lfo-freq"             gint                  : Read / Write

Vibrato oscillator frequency.

Allowed values: [-20500,20500]

Default value: 0


The "vib-lfo-freq-set" property

  "vib-lfo-freq-set"         gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-to-pitch" property

  "vib-lfo-to-pitch"         gint                  : Read / Write

Vibrato oscillator to pitch.

Allowed values: [-24000,24000]

Default value: 0


The "vib-lfo-to-pitch-set" property

  "vib-lfo-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "vol-env-attack" property

  "vol-env-attack"           gint                  : Read / Write

Volume envelope attack.

Allowed values: [-20000,20000]

Default value: 0


The "vol-env-attack-set" property

  "vol-env-attack-set"       gboolean              : Read / Write

Default value: FALSE


The "vol-env-decay" property

  "vol-env-decay"            gint                  : Read / Write

Volume envelope decay.

Allowed values: [-20000,20000]

Default value: 0


The "vol-env-decay-set" property

  "vol-env-decay-set"        gboolean              : Read / Write

Default value: FALSE


The "vol-env-delay" property

  "vol-env-delay"            gint                  : Read / Write

Volume envelope delay.

Allowed values: [-17000,17000]

Default value: 0


The "vol-env-delay-set" property

  "vol-env-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "vol-env-hold" property

  "vol-env-hold"             gint                  : Read / Write

Volume envelope hold.

Allowed values: [-17000,17000]

Default value: 0


The "vol-env-hold-set" property

  "vol-env-hold-set"         gboolean              : Read / Write

Default value: FALSE


The "vol-env-release" property

  "vol-env-release"          gint                  : Read / Write

Volume envelope release.

Allowed values: [-20000,20000]

Default value: 0


The "vol-env-release-set" property

  "vol-env-release-set"      gboolean              : Read / Write

Default value: FALSE


The "vol-env-sustain" property

  "vol-env-sustain"          gint                  : Read / Write

Volume envelope sustain.

Allowed values: [-1440,1440]

Default value: 0


The "vol-env-sustain-set" property

  "vol-env-sustain-set"      gboolean              : Read / Write

Default value: FALSE

See Also

#IpatchSF2Preset, IpatchSF2Inst
libinstpatch-1.0.0/docs/reference/html/IpatchBase.html0000644000175000017500000004467411461404255017661 00000000000000 IpatchBase

IpatchBase

IpatchBase — Base instrument file object type

Stability Level

Stable, unless otherwise indicated

Synopsis

enum                IpatchBaseFlags;
#define             IPATCH_BASE_UNUSED_FLAG_SHIFT
                    IpatchBase;
#define             IPATCH_BASE_DEFAULT_NAME
void                ipatch_base_set_file                (IpatchBase *base,
                                                         IpatchFile *file);
IpatchFile *        ipatch_base_get_file                (IpatchBase *base);
void                ipatch_base_set_file_name           (IpatchBase *base,
                                                         const char *file_name);
char *              ipatch_base_get_file_name           (IpatchBase *base);
void                ipatch_base_find_unused_midi_locale (IpatchBase *base,
                                                         int *bank,
                                                         int *program,
                                                         const IpatchItem *exclude,
                                                         gboolean percussion);
IpatchItem *        ipatch_base_find_item_by_midi_locale
                                                        (IpatchBase *base,
                                                         int bank,
                                                         int program);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchBase
                     +----IpatchDLS2
                     +----IpatchSF2
                     +----IpatchVBank

Properties

  "changed"                  gboolean              : Read / Write
  "file"                     IpatchFile*           : Read / Write
  "file-name"                gchar*                : Read / Write
  "saved"                    gboolean              : Read / Write

Description

Defines an abstract object type which is used as the basis of instrument files, such as IpatchSF2, IpatchDLS, etc.

Details

enum IpatchBaseFlags

typedef enum
{
  /* patch changed flag */
  IPATCH_BASE_CHANGED = 1 << IPATCH_ITEM_UNUSED_FLAG_SHIFT,
  /* patch been saved ever? */
  IPATCH_BASE_SAVED   = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 1)
} IpatchBaseFlags;

IPATCH_BASE_UNUSED_FLAG_SHIFT

#define IPATCH_BASE_UNUSED_FLAG_SHIFT (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 4)

IpatchBase

typedef struct _IpatchBase IpatchBase;

IPATCH_BASE_DEFAULT_NAME

#define IPATCH_BASE_DEFAULT_NAME "Untitled"

ipatch_base_set_file ()

void                ipatch_base_set_file                (IpatchBase *base,
                                                         IpatchFile *file);

Sets the file object associated with a patch.

base :

Patch base object to set file object of

file :

File object

ipatch_base_get_file ()

IpatchFile *        ipatch_base_get_file                (IpatchBase *base);

Get the file object associated with a patch base object. Caller owns a reference to the returned file object and it should be unrefed when done with it.

base :

Patch base object to get file object from

Returns :

File object or NULL if not set. Remember to unref it when done with it.

ipatch_base_set_file_name ()

void                ipatch_base_set_file_name           (IpatchBase *base,
                                                         const char *file_name);

Sets the file name of the file object in a patch base object. File object should have been set before calling this function (otherwise request is silently ignored). A convenience function as one could get the file object and set it directly.

base :

Patch base object to set file name of

file_name :

Path and name to set filename to

ipatch_base_get_file_name ()

char *              ipatch_base_get_file_name           (IpatchBase *base);

Get the file name of the file object in a base patch item. A convenience function.

base :

Base patch item to get file name from.

Returns :

New allocated file name or NULL if not set or file object not set. String should be freed when finished with it.

ipatch_base_find_unused_midi_locale ()

void                ipatch_base_find_unused_midi_locale (IpatchBase *base,
                                                         int *bank,
                                                         int *program,
                                                         const IpatchItem *exclude,
                                                         gboolean percussion);

Finds an unused MIDI locale (bank:program number pair) in a patch base object. The way in which MIDI bank and program numbers are used is implementation dependent. Percussion instruments often affect the bank parameter (for example SoundFont uses bank 128 for percussion presets). On input the bank and program parameters set the initial locale to start from (set to 0:0 to find the first free value). If the percussion parameter is set it may affect bank, if its not set, bank will not be modified (e.g., if bank is a percussion value it will be used). The exclude parameter can be set to a child item of base to exclude from the list of "used" locales (useful when making an item unique that is already parented to base). On return bank and program will be set to an unused MIDI locale based on the input criteria.

base :

Patch base object

bank :

MIDI bank number (input and output parameter)

program :

MIDI program number (input and output parameter)

exclude :

Child of base with MIDI locale to exclude or NULL

percussion :

Set to TRUE to find a free percussion MIDI locale

ipatch_base_find_item_by_midi_locale ()

IpatchItem *        ipatch_base_find_item_by_midi_locale
                                                        (IpatchBase *base,
                                                         int bank,
                                                         int program);

Find a child object in a base patch object which matches the given MIDI locale (bank and program numbers).

base :

Patch base object

bank :

MIDI bank number of item to search for

program :

MIDI program number of item to search for

Returns :

The item or NULL if not found. The caller owns a reference to the returned object, and is responsible for unref'ing when finished.

Property Details

The "changed" property

  "changed"                  gboolean              : Read / Write

Changed Flag.

Default value: TRUE


The "file" property

  "file"                     IpatchFile*           : Read / Write

File Object.


The "file-name" property

  "file-name"                gchar*                : Read / Write

File Name.

Default value: "untitled"


The "saved" property

  "saved"                    gboolean              : Read / Write

Been Saved Flag.

Default value: FALSE

libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchParamProp.html0000644000175000017500000005134211461404255023360 00000000000000 IpatchParamProp

IpatchParamProp

IpatchParamProp — GParamSpec extended properties

Stability Level

Stable, unless otherwise indicated

Synopsis

#define             IPATCH_PARAM_USER_SHIFT
void                ipatch_param_install_property       (GParamSpec *prop_spec);
GParamSpec *        ipatch_param_find_property          (const char *name);
GParamSpec **       ipatch_param_list_properties        (guint *n_properties);
GParamSpec *        ipatch_param_set                    (GParamSpec *spec,
                                                         const char *first_property_name,
                                                         ...);
void                ipatch_param_set_valist             (GParamSpec *spec,
                                                         const char *first_property_name,
                                                         va_list args);
void                ipatch_param_set_property           (GParamSpec *spec,
                                                         const char *property_name,
                                                         const GValue *value);
void                ipatch_param_get                    (GParamSpec *spec,
                                                         const char *first_property_name,
                                                         ...);
void                ipatch_param_get_valist             (GParamSpec *spec,
                                                         const char *first_property_name,
                                                         va_list args);
gboolean            ipatch_param_get_property           (GParamSpec *spec,
                                                         const char *property_name,
                                                         GValue *value);

Description

Extensions to standard GParamSpec include flags (for compact single bit data extensions) and GValue based extensions. An example of usage is the IPATCH_PARAM_UNIQUE flag which indicates a parameter that should be unique amongst sibling items and the "string-max-length" integer GValue which specifies a max length of a GParamSpecString parameter.

Details

IPATCH_PARAM_USER_SHIFT

#define IPATCH_PARAM_USER_SHIFT  (G_PARAM_USER_SHIFT + 12)

ipatch_param_install_property ()

void                ipatch_param_install_property       (GParamSpec *prop_spec);

Install a new GParamSpec property which can be used to extend existing GParamSpec types or define common parameters shared by all types. An example property is the "string-max-length" property which defines a max length for use with GParamSpecString properties.

prop_spec :

Specification for the new GParamSpec property. Ownership of the GParamSpec is taken over by this function. The name field of the GParamSpec should be a static string and is used as the property's ID.

ipatch_param_find_property ()

GParamSpec *        ipatch_param_find_property          (const char *name);

Lookup a GParamSpec property by name.

name :

Name of GParamSpec property

Returns :

The matching GParamSpec or NULL if not found. The GParamSpec is internal and should NOT be modified or freed.

ipatch_param_list_properties ()

GParamSpec **       ipatch_param_list_properties        (guint *n_properties);

Get a list of all registered GParamSpec properties.

n_properties :

Output: Length of returned array

Returns :

An array of GParamSpecs which should be freed when finished.

ipatch_param_set ()

GParamSpec *        ipatch_param_set                    (GParamSpec *spec,
                                                         const char *first_property_name,
                                                         ...);

Set extended parameter properties. Parameter properties are used to extend existing GParamSpec types. "string-max-length" is an example of an extended property, which is used for GParamSpecString parameters to define the max allowed length.

spec :

Parameter spec to set extended properties of

first_property_name :

Name of first property to set

... :

Value of first property to set and optionally followed by more property name/value pairs, terminated with NULL name.

Returns :

The spec pointer for convenience, makes it easy to create/install a parameter spec and set its properties at the same time.

ipatch_param_set_valist ()

void                ipatch_param_set_valist             (GParamSpec *spec,
                                                         const char *first_property_name,
                                                         va_list args);

Like ipatch_param_set() but uses a va_list.

spec :

Parameter spec to set extended properties of

first_property_name :

Name of first property to set

args :

Value of first property to set and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_param_set_property ()

void                ipatch_param_set_property           (GParamSpec *spec,
                                                         const char *property_name,
                                                         const GValue *value);

Set a single extended parameter property of a GParamSpec.

spec :

Parameter spec to set an extended property of

property_name :

Name of property to set

value :

Value to set the the property to. The value's type must be the same as the parameter property's type.

ipatch_param_get ()

void                ipatch_param_get                    (GParamSpec *spec,
                                                         const char *first_property_name,
                                                         ...);

Get extended parameter properties. Parameter properties are used to extend existing GParamSpec types. "string-max-length" is an example of an extended property, which is used for GParamSpecString parameters to define the max allowed length.

spec :

Parameter spec to get extended properties from

first_property_name :

Name of first property to get

... :

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_param_get_valist ()

void                ipatch_param_get_valist             (GParamSpec *spec,
                                                         const char *first_property_name,
                                                         va_list args);

Like ipatch_param_get() but uses a va_list.

spec :

Parameter spec to get extended properties from

first_property_name :

Name of first property to get

args :

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_param_get_property ()

gboolean            ipatch_param_get_property           (GParamSpec *spec,
                                                         const char *property_name,
                                                         GValue *value);

Get a single extended parameter property from a GParamSpec.

spec :

Parameter spec to get an extended property from

property_name :

Name of property to get

value :

An initialized value to store the property value in. The value's type must be a type that the property can be transformed to.

Returns :

TRUE if the parameter property is set, FALSE otherwise (in which case value will contain the default value for this property).
libinstpatch-1.0.0/docs/reference/html/ch03.html0000644000175000017500000001170111461404255016374 00000000000000 Sample data objects and functions

Sample data objects and functions

IpatchSample — Sample audio interface
IpatchSampleData — Sample data proxy object.
IpatchSampleStore — Abstract sample storage object
IpatchSampleTransform — Audio format conversion instance
sample — Audio sample format conversion functions and defines.
IpatchSampleList — Sample list data types and functions
IpatchSndFile — libsndfile file object
IpatchSampleStoreCache — Sample store object for cached samples in RAM
IpatchSampleStoreFile — Sample store object type for audio in files on disk
IpatchSampleStoreRam — Sample store object for audio data in RAM
IpatchSampleStoreRom — Sample storage object for audio in ROM of a sound card
IpatchSampleStoreSndFile — Sample store object type which uses libsndfile to access audio in sound files
IpatchSampleStoreSplit24 — Sample storage object for 24 bit audio in 16 and 8 bit segments
IpatchSampleStoreSwap — Sample storage object for audio in a temporary swap file
IpatchSampleStoreVirtual — Virtual sample storage object
libinstpatch-1.0.0/docs/reference/html/IpatchVBankRegion.html0000644000175000017500000004267511461404255021153 00000000000000 IpatchVBankRegion

IpatchVBankRegion

IpatchVBankRegion — Virtual bank instrument region

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchVBankRegion

Properties

  "file-index"               guint                 : Read
  "id-props"                 GValueArray*          : Read / Write
  "link-item"                IpatchItem*           : Read / Write
  "note-range"               IpatchRange*          : Read / Write
  "note-range-mode"          IpatchVBankRegionNoteRangeMode  : Read / Write
  "root-note"                gint                  : Read / Write
  "root-note-mode"           IpatchVBankRegionRootNoteMode  : Read / Write

Description

Virtual bank regions are children to IpatchVBankInst objects and reference synthesizable IpatchItem objects from other files. This object forms the bases for constructing new instruments from one or more items in other instrument bank files.

Details

IpatchVBankRegion

typedef struct _IpatchVBankRegion IpatchVBankRegion;

enum IpatchVBankRegionNoteRangeMode

typedef enum
{
  IPATCH_VBANK_REGION_NOTE_RANGE_MODE_INTERSECT	= 0,
  IPATCH_VBANK_REGION_NOTE_RANGE_MODE_OVERRIDE	= 1
} IpatchVBankRegionNoteRangeMode;

enum IpatchVBankRegionRootNoteMode

typedef enum
{
  IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OFFSET	= 0,
  IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OVERRIDE	= 1
} IpatchVBankRegionRootNoteMode;

ipatch_vbank_region_new ()

IpatchVBankRegion * ipatch_vbank_region_new             (void);

Create a new virtual bank region object.

Returns :

New virtual bank region with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_vbank_region_first ()

IpatchVBankRegion * ipatch_vbank_region_first           (IpatchIter *iter);

Gets the first item in a virtual bank region iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchVBankRegion items

Returns :

The first virtual bank region in iter or NULL if empty.

ipatch_vbank_region_next ()

IpatchVBankRegion * ipatch_vbank_region_next            (IpatchIter *iter);

Gets the next item in a virtual bank region iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchVBankRegion items

Returns :

The next virtual bank region in iter or NULL if at the end of the list.

ipatch_vbank_region_set_id_props ()

void                ipatch_vbank_region_set_id_props    (IpatchVBankRegion *region,
                                                         char **id_props);

Set the ID properties of a virtual bank region. These are used to uniquely identify an item in an external instrument file. This function is likely only used by the VBank loader before an item is resolved. Normal users will likely just assign to the "item-link" parameter.

region :

VBank region

id_props :

NULL terminated array of name/value string pairs

ipatch_vbank_region_get_id_props ()

char **             ipatch_vbank_region_get_id_props    (IpatchVBankRegion *region,
                                                         guint *n_elements);

Get ID properties which uniquely identify the referenced item. These are usually only available until the item gets resolved, at which point "item-link" is set.

region :

VBank region

n_elements :

Pointer to store count of elements in returned string array or NULL to ignore.

Returns :

NULL terminated array of name/value pair property strings or NULL if none. Free with g_strfreev() when finished using it.

Property Details

The "file-index" property

  "file-index"               guint                 : Read

File index.

Default value: 0


The "id-props" property

  "id-props"                 GValueArray*          : Read / Write

Identification properties.


The "link-item" property

  "link-item"                IpatchItem*           : Read / Write

Link item.


The "note-range" property

  "note-range"               IpatchRange*          : Read / Write

Note range.


The "note-range-mode" property

  "note-range-mode"          IpatchVBankRegionNoteRangeMode  : Read / Write

Note range mode.

Default value: IPATCH_VBANK_REGION_NOTE_RANGE_MODE_INTERSECT


The "root-note" property

  "root-note"                gint                  : Read / Write

Root note.

Allowed values: [-127,127]

Default value: 0


The "root-note-mode" property

  "root-note-mode"           IpatchVBankRegionRootNoteMode  : Read / Write

Root note mode.

Default value: IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OFFSET

See Also

#IpatchVBankInst, IpatchVBank
libinstpatch-1.0.0/docs/reference/html/IpatchSample.html0000644000175000017500000027673511461404255020235 00000000000000 IpatchSample

IpatchSample

IpatchSample — Sample audio interface

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchSample;
                    IpatchSampleIface;
                    IpatchSampleHandle;
gboolean            (*IpatchSampleHandleOpenFunc)       (IpatchSampleHandle *handle,
                                                         GError **err);
void                (*IpatchSampleHandleCloseFunc)      (IpatchSampleHandle *handle);
gboolean            (*IpatchSampleHandleReadFunc)       (IpatchSampleHandle *handle,
                                                         guint offset,
                                                         guint frames,
                                                         gpointer buf,
                                                         GError **err);
gboolean            (*IpatchSampleHandleWriteFunc)      (IpatchSampleHandle *handle,
                                                         guint offset,
                                                         guint frames,
                                                         gconstpointer buf,
                                                         GError **err);
enum                IpatchSampleLoopType;
#define             IPATCH_SAMPLE_FORMAT_DEFAULT
#define             IPATCH_SAMPLE_RATE_MIN
#define             IPATCH_SAMPLE_RATE_MAX
#define             IPATCH_SAMPLE_RATE_DEFAULT
#define             IPATCH_SAMPLE_ROOT_NOTE_DEFAULT
#define             IPATCH_SAMPLE_LOOP_TYPE_TERM
#define             IPATCH_SAMPLE_HANDLE_FORMAT         (handle)
int *               ipatch_sample_get_loop_types        (IpatchSample *sample);
int *               ipatch_sample_type_get_loop_types   (GType type);
void                ipatch_sample_set_format            (IpatchSample *sample,
                                                         int format);
int                 ipatch_sample_get_format            (IpatchSample *sample);
void                ipatch_sample_set_size              (IpatchSample *sample,
                                                         guint size);
guint               ipatch_sample_get_size              (IpatchSample *sample,
                                                         guint *bytes);
int                 ipatch_sample_get_frame_size        (IpatchSample *sample);
IpatchSampleData *  ipatch_sample_get_sample_data       (IpatchSample *sample);
gboolean            ipatch_sample_set_sample_data       (IpatchSample *sample,
                                                         IpatchSampleData *sampledata);
gboolean            ipatch_sample_read                  (IpatchSample *sample,
                                                         guint offset,
                                                         guint frames,
                                                         gpointer buf,
                                                         GError **err);
gboolean            ipatch_sample_write                 (IpatchSample *sample,
                                                         guint offset,
                                                         guint frames,
                                                         gconstpointer buf,
                                                         GError **err);
gboolean            ipatch_sample_read_transform        (IpatchSample *sample,
                                                         guint offset,
                                                         guint frames,
                                                         gpointer buf,
                                                         int format,
                                                         guint32 channel_map,
                                                         GError **err);
gboolean            ipatch_sample_write_transform       (IpatchSample *sample,
                                                         guint offset,
                                                         guint frames,
                                                         gconstpointer buf,
                                                         int format,
                                                         guint32 channel_map,
                                                         GError **err);
gboolean            ipatch_sample_copy                  (IpatchSample *dest_sample,
                                                         IpatchSample *src_sample,
                                                         guint32 channel_map,
                                                         GError **err);
gboolean            ipatch_sample_save_to_file          (IpatchSample *sample,
                                                         const char *filename,
                                                         int file_format,
                                                         int sub_format,
                                                         GError **err);
gboolean            ipatch_sample_handle_open           (IpatchSample *sample,
                                                         IpatchSampleHandle *handle,
                                                         char mode,
                                                         int format,
                                                         guint32 channel_map,
                                                         GError **err);
void                ipatch_sample_handle_close          (IpatchSampleHandle *handle);
IpatchSampleTransform * ipatch_sample_handle_get_transform
                                                        (IpatchSampleHandle *handle);
void                ipatch_sample_handle_set_transform  (IpatchSampleHandle *handle,
                                                         IpatchSampleTransform *transform);
int                 ipatch_sample_handle_get_format     (IpatchSampleHandle *handle);
int                 ipatch_sample_handle_get_frame_size (IpatchSampleHandle *handle);
guint               ipatch_sample_handle_get_max_frames (IpatchSampleHandle *handle);
gpointer            ipatch_sample_handle_read           (IpatchSampleHandle *handle,
                                                         guint offset,
                                                         guint frames,
                                                         gpointer buf,
                                                         GError **err);
gboolean            ipatch_sample_handle_write          (IpatchSampleHandle *handle,
                                                         guint offset,
                                                         guint frames,
                                                         gconstpointer buf,
                                                         GError **err);
gboolean            ipatch_sample_handle_cascade_open   (IpatchSampleHandle *handle,
                                                         IpatchSample *sample,
                                                         GError **err);
GParamSpec *        ipatch_sample_install_property      (GObjectClass *oclass,
                                                         guint property_id,
                                                         const char *property_name);
GParamSpec *        ipatch_sample_install_property_readonly
                                                        (GObjectClass *oclass,
                                                         guint property_id,
                                                         const char *property_name);
GParamSpec *        ipatch_sample_new_property_param_spec
                                                        (const char *property_name,
                                                         GParamFlags flags);

Object Hierarchy

  GInterface
   +----IpatchSample

Prerequisites

IpatchSample requires IpatchItem.

Properties

  "fine-tune"                gint                  : Read
  "loop-end"                 guint                 : Read
  "loop-start"               guint                 : Read
  "loop-type"                IpatchSampleLoopType  : Read
  "root-note"                gint                  : Read
  "sample-data"              IpatchSampleData*     : Read
  "sample-format"            gint                  : Read
  "sample-rate"              gint                  : Read
  "sample-size"              guint                 : Read

Description

This interface provides a basic API for accessing audio of sample objects.

Details

IpatchSample

typedef struct _IpatchSample IpatchSample;

IpatchSampleIface

typedef struct {
  GTypeInterface parent_class;

  IpatchSampleHandleOpenFunc open;
  IpatchSampleHandleCloseFunc close;
  IpatchSampleHandleReadFunc read;
  IpatchSampleHandleWriteFunc write;

  int *loop_types; /* -1 terminated array of supp. loop types (NULL = none) */
} IpatchSampleIface;

IpatchSampleHandle

typedef struct {
  IpatchSample *sample;		      /* The sample which this handle applies to */
  IpatchSampleTransform *transform;   /* Set if sample is being converted */
  IpatchSampleHandleReadFunc read;    /* Read method pointer (copied from IpatchItem interface) */
  IpatchSampleHandleWriteFunc write;  /* Write method pointer (copied from IpatchItem interface) */
  IpatchSampleHandleCloseFunc close;  /* Write method pointer (copied from IpatchItem interface) */
  guint32 read_mode : 1;              /* TRUE if read mode, FALSE if write mode */
  guint32 manual_transform : 1;       /* Methods handle sample transform */
  guint32 release_transform : 1;      /* TRUE if transform should be released from transform pool */
  guint32 format : 12;                /* Format to transform to */
  guint32 reserved : 17;
  guint32 channel_map;                /* Channel map for multi-channel audio transform */
  gpointer data1;		      /* sample interface defined */
  gpointer data2;		      /* sample interface defined */
  gpointer data3;		      /* sample interface defined */
  gpointer data4;		      /* sample interface defined */
  guint32 reserved2;
} IpatchSampleHandle;

IpatchSampleHandleOpenFunc ()

gboolean            (*IpatchSampleHandleOpenFunc)       (IpatchSampleHandle *handle,
                                                         GError **err);

IpatchSample interface method function type to open a sample for reading or writing. This method is optional for an IpatchSample interface and if not specified then it is assumed that the open was successful and nothing additional need be done. All fields of handle structure are already initialized, except data1, data2 and data3 which are available for the interface implementation.

handle :

Caller supplied structure to initialize

err :

Location to store error information

Returns :

TRUE on success, FALSE otherwise (in which case an error should optionally be stored in err).

IpatchSampleHandleCloseFunc ()

void                (*IpatchSampleHandleCloseFunc)      (IpatchSampleHandle *handle);

IpatchSample interface method to free any resources allocated in IpatchSampleOpenFunc to handle. This method is optional for an IpatchSample interface and need not be specified if nothing needs to be done to release any resources allocated by IpatchSampleHandleOpenFunc.

handle :

Sample handle to close (as returned from IpatchSampleHandleOpenFunc)

IpatchSampleHandleReadFunc ()

gboolean            (*IpatchSampleHandleReadFunc)       (IpatchSampleHandle *handle,
                                                         guint offset,
                                                         guint frames,
                                                         gpointer buf,
                                                         GError **err);

IpatchSample interface method function type to read data from a sample handle. Can be NULL in IpatchSampleIface if sample data is not readable. Sample data should be stored in its native format.

handle :

Handle to read from (as returned from IpatchSampleOpenFunc)

offset :

Offset in sample to start read from (in frames), use IPATCH_SAMPLE_CUROFS to use current offset (starts at 0 if not specified)

frames :

Size of sample data to read (in frames)

buf :

Buffer to store sample data in

err :

Location to store error information

Returns :

Should return TRUE on success, FALSE otherwise (in which case an error should optionally be stored in err).

IpatchSampleHandleWriteFunc ()

gboolean            (*IpatchSampleHandleWriteFunc)      (IpatchSampleHandle *handle,
                                                         guint offset,
                                                         guint frames,
                                                         gconstpointer buf,
                                                         GError **err);

IpatchSample interface method function type to write data to a sample handle. Can be NULL in IpatchSampleIface if sample data is not writable. Sample data will be supplied in its native format.

handle :

Handle to write to (as returned from IpatchSampleOpenFunc)

offset :

Offset in sample to start write to (in frames), use IPATCH_SAMPLE_CUROFS to use current offset (starts at 0 if not specified)

frames :

Size of sample data to write (in frames)

buf :

Buffer to store sample data in

err :

Location to store error information

Returns :

Should return TRUE on success, FALSE otherwise (in which case an error should optionally be stored in err).

enum IpatchSampleLoopType

typedef enum
{
  IPATCH_SAMPLE_LOOP_NONE,
  IPATCH_SAMPLE_LOOP_STANDARD,
  IPATCH_SAMPLE_LOOP_RELEASE,
  IPATCH_SAMPLE_LOOP_PINGPONG
} IpatchSampleLoopType;

Sample looping type.

IPATCH_SAMPLE_LOOP_NONE

No loop.

IPATCH_SAMPLE_LOOP_STANDARD

Standard loop.

IPATCH_SAMPLE_LOOP_RELEASE

Loop till note release stage.

IPATCH_SAMPLE_LOOP_PINGPONG

Play forward and then in reverse continously.

IPATCH_SAMPLE_FORMAT_DEFAULT

#define             IPATCH_SAMPLE_FORMAT_DEFAULT

Default sample format for IpatchSample interface.


IPATCH_SAMPLE_RATE_MIN

#define IPATCH_SAMPLE_RATE_MIN     8000

Minimum sample rate.


IPATCH_SAMPLE_RATE_MAX

#define IPATCH_SAMPLE_RATE_MAX     192000

Maximum sample rate.


IPATCH_SAMPLE_RATE_DEFAULT

#define IPATCH_SAMPLE_RATE_DEFAULT 44100

Default sample rate.


IPATCH_SAMPLE_ROOT_NOTE_DEFAULT

#define IPATCH_SAMPLE_ROOT_NOTE_DEFAULT  60

Default root note.


IPATCH_SAMPLE_LOOP_TYPE_TERM

#define IPATCH_SAMPLE_LOOP_TYPE_TERM (-1)

Value used for terminating list of supported loop types.


IPATCH_SAMPLE_HANDLE_FORMAT()

#define IPATCH_SAMPLE_HANDLE_FORMAT(handle)  ((handle)->format)

Macro to access transform sample format of a sample handle.

handle :

Sample handle

Returns :

Sample transform format.

ipatch_sample_get_loop_types ()

int *               ipatch_sample_get_loop_types        (IpatchSample *sample);

Get an array of supported loop type enums for a sample object.

sample :

Object with IpatchSample interface

Returns :

-1 terminated array of IpatchSampleLoopType values. If no loop types are supported, then NULL is returned. Array is internal and should not be modified or freed.

ipatch_sample_type_get_loop_types ()

int *               ipatch_sample_type_get_loop_types   (GType type);

Like ipatch_sample_get_loop_types() but retrieves the supported loop types from an object type rather than an instance of an object.

type :

A GType that has a IpatchItem interface

Returns :

-1 terminated array of IpatchSampleLoopType values. If no loop types are supported, then NULL is returned. Array is internal and should not be modified or freed.

ipatch_sample_set_format ()

void                ipatch_sample_set_format            (IpatchSample *sample,
                                                         int format);

Set sample format of a new sample. Should only be assigned once. Same as assigning to a sample's "sample-format" property.

sample :

Sample to set format of

format :

Sample format to assign to sample (see IpatchSampleWidth, etc)

ipatch_sample_get_format ()

int                 ipatch_sample_get_format            (IpatchSample *sample);

Get the sample format of a sample. Same as getting a sample's "sample-format" property.

sample :

Sample to get format of

Returns :

Sample format integer (see IpatchSampleWidth, etc).

ipatch_sample_set_size ()

void                ipatch_sample_set_size              (IpatchSample *sample,
                                                         guint size);

Set the size of a sample. Should be done once, and only once when created.

sample :

Sample to set size of

size :

Size to assign (in frames)

ipatch_sample_get_size ()

guint               ipatch_sample_get_size              (IpatchSample *sample,
                                                         guint *bytes);

Get the size of a sample. Same as getting a sample's "sample-size" property.

sample :

Sample to get size of

bytes :

Location to store sample size in bytes (size * frame size) or NULL to ignore

Returns :

Sample size (in frames)

ipatch_sample_get_frame_size ()

int                 ipatch_sample_get_frame_size        (IpatchSample *sample);

A convenience function to get size of a single sample frame for a given sample. This is useful for determining buffer allocation sizes when reading or writing data.

sample :

Sample to get data frame size of

Returns :

Size in bytes of a single sample frame

ipatch_sample_get_sample_data ()

IpatchSampleData *  ipatch_sample_get_sample_data       (IpatchSample *sample);

Get sample data object from a sample. Not every sample object supports this property, in which case NULL is returned.

sample :

Sample to get sample data from

Returns :

Sample data object of the sample or NULL if not set or unsupported by this sample type. Caller owns a reference to the returned object.

ipatch_sample_set_sample_data ()

gboolean            ipatch_sample_set_sample_data       (IpatchSample *sample,
                                                         IpatchSampleData *sampledata);

Set sample data object of a sample. Not every sample object supports writing to this property, in which case FALSE will be returned.

sample :

Sample to set sample data of

Returns :

TRUE if the sample supports this property and it was assigned, FALSE otherwise.

ipatch_sample_read ()

gboolean            ipatch_sample_read                  (IpatchSample *sample,
                                                         guint offset,
                                                         guint frames,
                                                         gpointer buf,
                                                         GError **err);

Read sample data from a sample. This is a convenience function which opens/reads/closes a IpatchSampleHandle and is therefore not as efficient when making multiple accesses. Sample data transform is also not handled (see ipatch_sample_read_transform()).

sample :

Sample to read from

offset :

Offset in frames to read from

frames :

Number of frames to read

buf :

Buffer to store sample data in (should be at least frames * sizeof (frame), the frame size can be had from ipatch_sample_get_frame_size()).

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE on error (in which case err may be set).

ipatch_sample_write ()

gboolean            ipatch_sample_write                 (IpatchSample *sample,
                                                         guint offset,
                                                         guint frames,
                                                         gconstpointer buf,
                                                         GError **err);

Write sample data to a sample. This is a convenience function which opens/writes/closes a IpatchSampleHandle and is therefore not as efficient when making multiple accesses. Sample data transform is also not handled (see ipatch_sample_write_transform()).

sample :

Sample to write to

offset :

Offset in frames to write to

frames :

Number of frames to write

buf :

Buffer of sample data to write (should be at least frames * sizeof (frame), the frame size can be had from ipatch_sample_get_frame_size()).

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_sample_read_transform ()

gboolean            ipatch_sample_read_transform        (IpatchSample *sample,
                                                         guint offset,
                                                         guint frames,
                                                         gpointer buf,
                                                         int format,
                                                         guint32 channel_map,
                                                         GError **err);

Like ipatch_sample_read() but allows for sample transformation.

sample :

Sample to read from

offset :

Offset in frames to read from

frames :

Number of frames to read

buf :

Buffer to store sample data in (should be at least frames * ipatch_sample_format_size() of format).

format :

Format to transform sample data to (if its the same as the native format of sample no transformation occurs)

channel_map :

Channel mapping if format is set (set to 0 otherwise), use IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel mapping (see ipatch_sample_get_transform_funcs() for details).

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE on error (in which case err may be set).

ipatch_sample_write_transform ()

gboolean            ipatch_sample_write_transform       (IpatchSample *sample,
                                                         guint offset,
                                                         guint frames,
                                                         gconstpointer buf,
                                                         int format,
                                                         guint32 channel_map,
                                                         GError **err);

Like ipatch_sample_write() but allows for sample transformation.

sample :

Sample to write to

offset :

Offset in frames to write to

frames :

Number of frames to write

buf :

Buffer of sample data to write (should be at least frames * ipatch_sample_format_size() of format).

format :

Format to transform sample data from (if its the same as the native format of sample no transformation occurs)

channel_map :

Channel mapping if format is set (set to 0 otherwise), use IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel mapping (see ipatch_sample_get_transform_funcs() for details).

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_sample_copy ()

gboolean            ipatch_sample_copy                  (IpatchSample *dest_sample,
                                                         IpatchSample *src_sample,
                                                         guint32 channel_map,
                                                         GError **err);

Copy sample data from one sample to another. The two samples may differ in format, in which case the sample data will be converted. The dest_sample must either be the same size in frames as src_sample or not yet assigned a size.

dest_sample :

Destination sample to copy data to

src_sample :

Source sample to copy data from

channel_map :

Channel mapping, use IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel mapping (see ipatch_sample_get_transform_funcs() for details).

err :

Location to store error information or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_sample_save_to_file ()

gboolean            ipatch_sample_save_to_file          (IpatchSample *sample,
                                                         const char *filename,
                                                         int file_format,
                                                         int sub_format,
                                                         GError **err);

Convenience function to save a sample to a file using libsndfile.

sample :

Sample to save to file

filename :

File name to save to

file_format :

A value from the dynamic GEnum "IpatchSndFileFormat".

sub_format :

A value from the dynamic GEnum "IpatchSndFileSubFormat" or -1 to calculate optimal value based on the format of sample.

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE otherwise

ipatch_sample_handle_open ()

gboolean            ipatch_sample_handle_open           (IpatchSample *sample,
                                                         IpatchSampleHandle *handle,
                                                         char mode,
                                                         int format,
                                                         guint32 channel_map,
                                                         GError **err);

Open a handle to a sample for reading or writing sample data. Can optionally provide data conversion if format is set. If it is desirable to have more control over the transform object and buffer allocation, the transform object can be assigned with ipatch_sample_handle_set_transform(). Note that a sample transform is acquired if format is set, even if the format is identical to the sample format, as a convenience to always provide a data buffer.

sample :

Sample to open a handle to

handle :

Caller supplied structure to initialize

mode :

Access mode to sample, 'r' for reading and 'w' for writing

format :

Sample format to convert to/from (0 for no conversion or to assign a transform object with ipatch_sample_handle_set_transform()).

channel_map :

Channel mapping if format is set (set to 0 otherwise), use IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel mapping (see ipatch_sample_get_transform_funcs() for details).

err :

Location to store error information

Returns :

TRUE on success, FALSE on failure (in which case err may be set)

ipatch_sample_handle_close ()

void                ipatch_sample_handle_close          (IpatchSampleHandle *handle);

Close a handle previously opened with ipatch_sample_handle_open().

handle :

Sample handle to close

ipatch_sample_handle_get_transform ()

IpatchSampleTransform * ipatch_sample_handle_get_transform
                                                        (IpatchSampleHandle *handle);

Get sample transform from a sample handle. Only exists if sample data conversion is taking place or even if formats are the same but was implicitly supplied to ipatch_sample_handle_open(). Transform should not be modified unless it was assigned via ipatch_sample_handle_set_transform().

handle :

Sample handle to get transform from

Returns :

Sample transform or NULL if none.

ipatch_sample_handle_set_transform ()

void                ipatch_sample_handle_set_transform  (IpatchSampleHandle *handle,
                                                         IpatchSampleTransform *transform);

Assign a sample transform to a sample handle. Provided for added control over transform allocation. A transform can also be automatically created and assigned with ipatch_sample_handle_open(). Sample transform allocation is taken over by handle.

handle :

Sample handle to set transform of

transform :

Transform to assign, source format must match that of the handle's sample (read mode) or destination format must match (write mode), can be NULL to de-activate sample transformation for handle.

ipatch_sample_handle_get_format ()

int                 ipatch_sample_handle_get_format     (IpatchSampleHandle *handle);

Get the sample format of a sample handle. May differ from the IpatchSample format of the handle, if it was opened with a different format and is therefore being converted.

handle :

Sample handle to get format of

Returns :

Sample format integer (see IpatchSampleWidth, etc).

ipatch_sample_handle_get_frame_size ()

int                 ipatch_sample_handle_get_frame_size (IpatchSampleHandle *handle);

A convenience function to get size of a single sample frame for a given sample handle. This is useful for determining buffer allocation sizes when reading or writing data.

handle :

Sample handle to get data frame size of

Returns :

Size in bytes of a single sample frame

ipatch_sample_handle_get_max_frames ()

guint               ipatch_sample_handle_get_max_frames (IpatchSampleHandle *handle);

A convenience function to get the maximum transform frames that can fit in the sample transform of handle.

handle :

Sample handle to get max transform frames of

Returns :

Maximum frames that can be read or written using the sample transform buffers. 0 if no sample transform is assigned.

ipatch_sample_handle_read ()

gpointer            ipatch_sample_handle_read           (IpatchSampleHandle *handle,
                                                         guint offset,
                                                         guint frames,
                                                         gpointer buf,
                                                         GError **err);

Read sample data from a sample handle. If the number of frames read is within the sample transform buffer size and buf is NULL then the transform buffer will be returned (extra copy not needed).

handle :

Sample handle

offset :

Offset in frames to read from

frames :

Number of frames to read

buf :

Buffer to store sample data in (should be at least frames * sizeof (frame), the frame size can be had from ipatch_sample_handle_get_frame_size()). Can be NULL if transforming audio data with not more than the maximum frames that can be transformed at a time, in which case the internal transform buffer pointer will be returned.

err :

Location to store error info or NULL

Returns :

Pointer to sample data on success, NULL on error (in which case err may be set). The internal transform buffer will only be returned if the buf parameter is NULL.

ipatch_sample_handle_write ()

gboolean            ipatch_sample_handle_write          (IpatchSampleHandle *handle,
                                                         guint offset,
                                                         guint frames,
                                                         gconstpointer buf,
                                                         GError **err);

Write sample data to a sample handle.

handle :

Sample handle

offset :

Offset in frames to write to

frames :

Number of frames to write

buf :

Buffer of sample data to write (should be at least frames * sizeof (frame), the frame size can be had from ipatch_sample_handle_get_frame_size()). Can be NULL, in which case it is assumed that the sample data has been loaded into the first buffer of the handle's sample transform.

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_sample_handle_cascade_open ()

gboolean            ipatch_sample_handle_cascade_open   (IpatchSampleHandle *handle,
                                                         IpatchSample *sample,
                                                         GError **err);

This can be called from IpatchSampleIface.open methods for objects which contain a pointer to an IpatchSample that contains the sample's data.

handle :

Already open handle

sample :

The cascade sample containing the actual data

err :

Location to store error information

Returns :

TRUE on success, FALSE on failure (in which case err may be set)

ipatch_sample_install_property ()

GParamSpec *        ipatch_sample_install_property      (GObjectClass *oclass,
                                                         guint property_id,
                                                         const char *property_name);

A helper function for objects that have an IpatchSample interface. Installs a IpatchSample interface property for the given object class. The parameter will be G_PARAM_READWRITE.

oclass :

Object class to install IpatchSample property

property_id :

Property ID for set/get property class method

property_name :

IpatchSample property name to install

Returns :

The newly created and installed parameter spec.

ipatch_sample_install_property_readonly ()

GParamSpec *        ipatch_sample_install_property_readonly
                                                        (GObjectClass *oclass,
                                                         guint property_id,
                                                         const char *property_name);

A helper function for objects that have an IpatchSample interface. Identical to ipatch_sample_install_property() but installs the property as readonly and uses g_object_class_override_property() instead of creating a new GParamSpec.

oclass :

Object class to install IpatchSample property

property_id :

Property ID for set/get property class method

property_name :

IpatchSample property name to install

Returns :

The newly created and installed parameter spec (GParamSpecOverride).

ipatch_sample_new_property_param_spec ()

GParamSpec *        ipatch_sample_new_property_param_spec
                                                        (const char *property_name,
                                                         GParamFlags flags);

Seldom used function that creates a new GParamSpec that is identical to a IpatchSample property by the name property_name, except the flags can differ.

property_name :

Name of a IpatchSample property

flags :

Flags to use for the new GParamSpec

Returns :

New GParamSpec.

Property Details

The "fine-tune" property

  "fine-tune"                gint                  : Read

Fine tuning in cents.

Allowed values: [-99,99]

Default value: 0


The "loop-end" property

  "loop-end"                 guint                 : Read

Loop end in frames (after loop).

Default value: 0


The "loop-start" property

  "loop-start"               guint                 : Read

Start of loop in frames.

Default value: 0


The "loop-type" property

  "loop-type"                IpatchSampleLoopType  : Read

Loop method type.

Default value: IPATCH_SAMPLE_LOOP_NONE


The "root-note" property

  "root-note"                gint                  : Read

Root MIDI note.

Allowed values: [0,127]

Default value: 60


The "sample-data" property

  "sample-data"              IpatchSampleData*     : Read

Sample data.


The "sample-format" property

  "sample-format"            gint                  : Read

Sample format.

Allowed values: >= 0

Default value: 2


The "sample-rate" property

  "sample-rate"              gint                  : Read

Sampling rate in Hertz.

Allowed values: [8000,192000]

Default value: 44100


The "sample-size" property

  "sample-size"              guint                 : Read

Size in frames.

Default value: 0

libinstpatch-1.0.0/docs/reference/html/IpatchItem.html0000644000175000017500000025400311461404255017672 00000000000000 IpatchItem

IpatchItem

IpatchItem — Abstract base item object

Stability Level

Stable, unless otherwise indicated

Synopsis

IpatchItem *        (*IpatchItemCopyLinkFunc)           (IpatchItem *item,
                                                         IpatchItem *link,
                                                         gpointer user_data);
                    IpatchItem;
enum                IpatchItemFlags;
#define             IPATCH_ITEM_UNUSED_FLAG_SHIFT
#define             IPATCH_ITEM_WLOCK                   (item)
#define             IPATCH_ITEM_WUNLOCK                 (item)
#define             IPATCH_ITEM_RLOCK                   (item)
#define             IPATCH_ITEM_RUNLOCK                 (item)
#define             IPATCH_ITEM_PROP_NOTIFY_SET_EVENT   (info, index, data, destroy)
void                (*IpatchItemPropCallback)           (IpatchItemPropNotify *notify);
void                (*IpatchItemPropDisconnect)         (IpatchItem *item,
                                                         GParamSpec *pspec,
                                                         gpointer user_data);
#define             IPATCH_ITEM_COPY_LINK_FUNC          (item, link, func, userdata)
extern              GParamSpec *ipatch_item_pspec_title;
void                ipatch_item_set_parent              (IpatchItem *item,
                                                         IpatchItem *parent);
void                ipatch_item_unparent                (IpatchItem *item);
IpatchItem *        ipatch_item_get_parent              (IpatchItem *item);
IpatchItem *        ipatch_item_peek_parent             (IpatchItem *item);
IpatchItem *        ipatch_item_get_base                (IpatchItem *item);
IpatchItem *        ipatch_item_peek_base               (IpatchItem *item);
IpatchItem *        ipatch_item_get_ancestor_by_type    (IpatchItem *item,
                                                         GType ancestor_type);
IpatchItem *        ipatch_item_peek_ancestor_by_type   (IpatchItem *item,
                                                         GType ancestor_type);
void                ipatch_item_remove                  (IpatchItem *item);
void                ipatch_item_changed                 (IpatchItem *item);
void                ipatch_item_get_property_fast       (IpatchItem *item,
                                                         GParamSpec *pspec,
                                                         GValue *value);
void                ipatch_item_copy                    (IpatchItem *dest,
                                                         IpatchItem *src);
void                ipatch_item_copy_link_func          (IpatchItem *dest,
                                                         IpatchItem *src,
                                                         IpatchItemCopyLinkFunc link_func,
                                                         gpointer user_data);
void                ipatch_item_copy_replace            (IpatchItem *dest,
                                                         IpatchItem *src,
                                                         GHashTable *repl_hash);
IpatchItem *        ipatch_item_duplicate               (IpatchItem *item);
IpatchItem *        ipatch_item_duplicate_link_func     (IpatchItem *item,
                                                         IpatchItemCopyLinkFunc link_func,
                                                         gpointer user_data);
IpatchItem *        ipatch_item_duplicate_replace       (IpatchItem *item,
                                                         GHashTable *repl_hash);
IpatchList *        ipatch_item_duplicate_deep          (IpatchItem *item);
IpatchItem *        ipatch_item_copy_link_func_deep     (IpatchItem *item,
                                                         IpatchItem *link,
                                                         gpointer user_data);
IpatchItem *        ipatch_item_copy_link_func_hash     (IpatchItem *item,
                                                         IpatchItem *link,
                                                         gpointer user_data);
gboolean            ipatch_item_type_can_conflict       (GType item_type);
GParamSpec **       ipatch_item_type_get_unique_specs   (GType item_type,
                                                         guint32 *groups);
GValueArray *       ipatch_item_get_unique_props        (IpatchItem *item);
guint               ipatch_item_test_conflict           (IpatchItem *item1,
                                                         IpatchItem *item2);
void                ipatch_item_set_atomic              (gpointer item,
                                                         const char *first_property_name,
                                                         ...);
void                ipatch_item_get_atomic              (gpointer item,
                                                         const char *first_property_name,
                                                         ...);
IpatchItem *        ipatch_item_first                   (IpatchIter *iter);
IpatchItem *        ipatch_item_next                    (IpatchIter *iter);
void                ipatch_item_prop_notify             (IpatchItem *item,
                                                         GParamSpec *pspec,
                                                         const GValue *new_value,
                                                         const GValue *old_value);
void                ipatch_item_prop_notify_by_name     (IpatchItem *item,
                                                         const char *prop_name,
                                                         const GValue *new_value,
                                                         const GValue *old_value);
guint               ipatch_item_prop_connect            (IpatchItem *item,
                                                         GParamSpec *pspec,
                                                         IpatchItemPropCallback callback,
                                                         IpatchItemPropDisconnect disconnect,
                                                         gpointer user_data);
guint               ipatch_item_prop_connect_by_name    (IpatchItem *item,
                                                         const char *prop_name,
                                                         IpatchItemPropCallback callback,
                                                         IpatchItemPropDisconnect disconnect,
                                                         gpointer user_data);
void                ipatch_item_prop_disconnect         (guint handler_id);
void                ipatch_item_prop_disconnect_matched (IpatchItem *item,
                                                         GParamSpec *pspec,
                                                         IpatchItemPropCallback callback,
                                                         gpointer user_data);
void                ipatch_item_prop_disconnect_by_name (IpatchItem *item,
                                                         const char *prop_name,
                                                         IpatchItemPropCallback callback,
                                                         gpointer user_data);

Known Derived Interfaces

IpatchItem is required by IpatchSF2ModItemIface, IpatchSample and IpatchSF2GenItemIface.

Properties

  "base"                     IpatchBase*           : Read
  "flags"                    guint                 : Read / Write
  "parent"                   IpatchItem*           : Read / Write
  "title"                    gchar*                : Read

Description

The abstract base item type from which all instrument objects are derived and many other object types as well.

Details

IpatchItemCopyLinkFunc ()

IpatchItem *        (*IpatchItemCopyLinkFunc)           (IpatchItem *item,
                                                         IpatchItem *link,
                                                         gpointer user_data);

A callback function called during item copy/duplicate operations for any item link reference which needs to be resolved. An example usage is for deep duplicating an object (all references can also be duplicated). Item copy methods should call this for any linked item references which are not part of the new object.

item :

Item which is being linked (contains a reference to link).

link :

The item being referenced (can be NULL).

user_data :

User data supplied to copy/duplicate function.

Returns :

Pointer to item to use for link property (can be the link item if the duplicated/copied item is local to the same file).

IpatchItem

typedef struct _IpatchItem IpatchItem;

enum IpatchItemFlags

typedef enum
{
  IPATCH_ITEM_HOOKS_ACTIVE = 1 << 0,  /* hook callbacks active? */
  IPATCH_ITEM_FREE_MUTEX   = 1 << 1   /* TRUE if item should free its mutex */
} IpatchItemFlags;

IPATCH_ITEM_UNUSED_FLAG_SHIFT

#define IPATCH_ITEM_UNUSED_FLAG_SHIFT 4

IPATCH_ITEM_WLOCK()

#define             IPATCH_ITEM_WLOCK(item)

IPATCH_ITEM_WUNLOCK()

#define             IPATCH_ITEM_WUNLOCK(item)

IPATCH_ITEM_RLOCK()

#define IPATCH_ITEM_RLOCK(item)		IPATCH_ITEM_WLOCK(item)

IPATCH_ITEM_RUNLOCK()

#define IPATCH_ITEM_RUNLOCK(item)	IPATCH_ITEM_WUNLOCK(item)

IPATCH_ITEM_PROP_NOTIFY_SET_EVENT()

#define             IPATCH_ITEM_PROP_NOTIFY_SET_EVENT(info, index, data, destroy)

A macro for assigning per event pointers to IpatchItemPropNotify.

info :

IpatchItemPropNotify pointer

index :

Pointer index (0-3)

data :

Data to assign to pointer field

destroy :

Callback function to cleanup data when done (or NULL)

IpatchItemPropCallback ()

void                (*IpatchItemPropCallback)           (IpatchItemPropNotify *notify);

IpatchItem property change callback function prototype.


IpatchItemPropDisconnect ()

void                (*IpatchItemPropDisconnect)         (IpatchItem *item,
                                                         GParamSpec *pspec,
                                                         gpointer user_data);

Function prototype which gets called when a property notify callback gets disconnected.

item :

Item of prop change match criteria

pspec :

Parameter spec of prop change match criteria

user_data :

User defined pointer from when callback was added

IPATCH_ITEM_COPY_LINK_FUNC()

#define             IPATCH_ITEM_COPY_LINK_FUNC(item, link, func, userdata)

ipatch_item_pspec_title

extern GParamSpec *ipatch_item_pspec_title;

ipatch_item_set_parent ()

void                ipatch_item_set_parent              (IpatchItem *item,
                                                         IpatchItem *parent);

Usually only used by IpatchItem type implementations. Sets the parent of a patch item. Also recursively sets base parent and IPATCH_ITEM_HOOKS_ACTIVE flag if set in parent. Also assigns the item's thread mutex to that of the parent if its class has mutex_slave set. The parent container is responsible for adding a reference to item - this function does not do so.

NOTE: If the item has mutex_slave set in its class then the item will use parent object's mutex. During the call to this function item should not be accessed by any other threads, otherwise problems may occur when the mutex is changed. Normally this shouldn't be much of an issue, since new item's are often only accessed by 1 thread until being parented.

item :

Item to set parent of (should not have a parent).

parent :

New parent of item.

ipatch_item_unparent ()

void                ipatch_item_unparent                (IpatchItem *item);

Usually only used by IpatchItem type implementations. Unparent an item. Also recursively unsets base parent and IPATCH_ITEM_HOOKS_ACTIVE flag. Parent container object is responsible for removing reference of item - this function does not do so.

item :

Item to unparent

ipatch_item_get_parent ()

IpatchItem *        ipatch_item_get_parent              (IpatchItem *item);

Gets the parent of item after incrementing its reference count. The caller is responsible for decrementing the reference count with g_object_unref when finished with it. This function is useful because all code paths must contain references to the items that they are working with in a multi-thread environment (there is no guarantee an item won't be destroyed unless a refcount is held).

item :

Item to get parent of

Returns :

The parent of item or NULL if not parented or a root item. If not NULL then the reference count of parent has been incremented and the caller is responsible for removing it when finished with parent.

ipatch_item_peek_parent ()

IpatchItem *        ipatch_item_peek_parent             (IpatchItem *item);

This function is the same as ipatch_item_get_parent() (gets an item's parent) but does not increment the parent's ref count. Therefore this function should only be used when the caller already holds a reference or when only the value of the pointer will be used (not the contents), to avoid multi-thread problems.

item :

Item to get the parent of

Returns :

The parent of item or NULL if not parented or a root item.

ipatch_item_get_base ()

IpatchItem *        ipatch_item_get_base                (IpatchItem *item);

Gets the base parent of item (toplevel patch file object) after incrementing its reference count. The caller is responsible for decrementing the reference count with g_object_unref when finished with it. If item is itself a IpatchBase object then it is returned.

item :

Item to get base parent of

Returns :

The base parent of item or NULL if no IpatchBase type in parent ancestry. If not NULL then the reference count of parent has been incremented and the caller is responsible for removing it when finished with the base parent.

ipatch_item_peek_base ()

IpatchItem *        ipatch_item_peek_base               (IpatchItem *item);

This function is the same as ipatch_item_get_base() (gets an item's toplevel base parent) but does not increment the parent's ref count. Therefore this function should only be used when the caller already holds a reference or when only the value of the pointer will be used (not the contents), to avoid multi-thread problems.

item :

Item to get the base parent of

Returns :

The base parent of item or NULL if no IpatchBase type in parent ancestry.

ipatch_item_get_ancestor_by_type ()

IpatchItem *        ipatch_item_get_ancestor_by_type    (IpatchItem *item,
                                                         GType ancestor_type);

Searches for the first parent item that is derived from ancestor_type in the item object's ancestry. ancestor_type must be an IpatchItem derived type (as well as the ancestry of item). Of note is that item can also match. The returned item's reference count has been incremented and it is the responsiblity of the caller to remove it with g_object_unref() when finished with it.

item :

Item to search for parent of a given type

ancestor_type :

Type of parent in the item object's ancestry

Returns :

The matched item (can be the item itself) or NULL if no item matches ancestor_type in the ancestry. Remember to unref the matched item when done with it.

ipatch_item_peek_ancestor_by_type ()

IpatchItem *        ipatch_item_peek_ancestor_by_type   (IpatchItem *item,
                                                         GType ancestor_type);

Just like ipatch_item_get_ancestor_by_type() but doesn't ref returned item. This should only be used when caller already owns a reference or only the pointer value is of importance, since otherwise there is a potential multi-thread race condition.

item :

Item to search for parent of a given type

ancestor_type :

Type of parent in the item object's ancestry

Returns :

The matched item (can be the item itself) or NULL if no item matches ancestor_type in the ancestry. Remember that the returned item is not referenced.

ipatch_item_remove ()

void                ipatch_item_remove                  (IpatchItem *item);

This function removes an item from its parent container and removes other references from within the same patch (e.g., a IpatchSF2Sample will be removed from its parent IpatchSF2 and all IpatchSF2IZone objects referencing the sample will also be removed).

item :

Item to remove

ipatch_item_changed ()

void                ipatch_item_changed                 (IpatchItem *item);

This function should be called when an item's saveable state (what ends up in a patch file) has changed. Causes the item object's base parent to have its changed flag set, indicating that the file has changes that have not been saved. Note that this function is automatically called when an ipatch_item_prop_notify() occurs for a property without the IPATCH_PARAM_NO_SAVE_CHANGE flag in its GParamSpec and therefore this function should not be called additionally.

item :

Item that has changed

ipatch_item_get_property_fast ()

void                ipatch_item_get_property_fast       (IpatchItem *item,
                                                         GParamSpec *pspec,
                                                         GValue *value);

Usually only used by IpatchItem implementations. A faster way to retrieve an object property. Often used for fetching current value for property notifies. Notice that this function currently doesn't work with interface or class overridden properties.

item :

Item to get property value from

pspec :

Parameter spec of property to get

value :

Uninitialized caller supplied value to store the current value in. Remember to call g_value_unset when done with it.

ipatch_item_copy ()

void                ipatch_item_copy                    (IpatchItem *dest,
                                                         IpatchItem *src);

Copy an item using the item class' "copy" method. Object links are copied as is, meaning the resulting object is a local object to the same IpatchBase.

dest :

New destination item to copy to (should be same type or derived from src type)

src :

Item to copy from

ipatch_item_copy_link_func ()

void                ipatch_item_copy_link_func          (IpatchItem *dest,
                                                         IpatchItem *src,
                                                         IpatchItemCopyLinkFunc link_func,
                                                         gpointer user_data);

Copy an item using the item class' "copy" method. Like ipatch_item_copy() but takes a link_func which can be used for handling replication of externally linked objects (recursively deep duplicate for example, although there is ipatch_item_duplicate_deep() specifically for that).

dest :

New destination item to copy to (should be same type or derived from src type)

src :

Item to copy from

link_func :

Function to call for each object link pointer in src. This function can alter the copied link if desired.

user_data :

User defined data to pass to link_func.

ipatch_item_copy_replace ()

void                ipatch_item_copy_replace            (IpatchItem *dest,
                                                         IpatchItem *src,
                                                         GHashTable *repl_hash);

Like ipatch_item_copy() but takes a link replacement hash, which can be used for substituting different objects for object links. See ipatch_item_copy_link_func() if even more flexibility is desired.

dest :

New destination item to copy to (should be same type or derived from src type)

src :

Item to copy from

repl_hash :

Hash of link pointer substitutions. The original link pointer is the hash key, and the hash value is the replacement pointer.

ipatch_item_duplicate ()

IpatchItem *        ipatch_item_duplicate               (IpatchItem *item);

A convenience function to duplicate an item. Like ipatch_item_copy() but creates a new duplicate item, rather than using an existing item. Note that externally linked objects are not duplicated for non IpatchBase derived types, making the item local to the same IpatchBase object.

item :

Item to duplicate

Returns :

New duplicate item. Caller owns the reference to the new item.

ipatch_item_duplicate_link_func ()

IpatchItem *        ipatch_item_duplicate_link_func     (IpatchItem *item,
                                                         IpatchItemCopyLinkFunc link_func,
                                                         gpointer user_data);

Like ipatch_item_copy_link_func() but duplicates the item instead of copying to an existing item.

item :

Item to duplicate

link_func :

Function to call for each object link pointer in item. This function can alter the copied link if desired.

user_data :

User defined data to pass to link_func.

Returns :

New duplicate item. Caller owns the reference to the new item.

ipatch_item_duplicate_replace ()

IpatchItem *        ipatch_item_duplicate_replace       (IpatchItem *item,
                                                         GHashTable *repl_hash);

Like ipatch_item_copy_replace() but duplicates the item instead of copying it to an already created item.

item :

Item to duplicate

repl_hash :

Hash of link pointer substitutions. The original link pointer is the hash key, and the hash value is the replacement pointer.

Returns :

New duplicate item. Caller owns the reference to the new item.

ipatch_item_duplicate_deep ()

IpatchList *        ipatch_item_duplicate_deep          (IpatchItem *item);

Recursively duplicate an item (i.e., its dependencies also).

item :

Item to deep duplicate

Returns :

List of duplicated item and dependencies (duplicated item is the first in the list). List object is owned by the caller and should be unreferenced when finished using it.

ipatch_item_copy_link_func_deep ()

IpatchItem *        ipatch_item_copy_link_func_deep     (IpatchItem *item,
                                                         IpatchItem *link,
                                                         gpointer user_data);

ipatch_item_copy_link_func_hash ()

IpatchItem *        ipatch_item_copy_link_func_hash     (IpatchItem *item,
                                                         IpatchItem *link,
                                                         gpointer user_data);

A predefined IpatchItemCopyLinkFunc which takes a hash for the user_data component, which is used for replacing link pointers. link is used as the hash key, the hash value is used in its place if present otherwise link is used unchanged.

item :

Item which is being linked (contains a reference to link).

link :

The item being referenced.

user_data :

User data supplied to copy/duplicate function.

Returns :

Value in hash (user_data) if link is present in hash, or link itself if not.

ipatch_item_type_can_conflict ()

gboolean            ipatch_item_type_can_conflict       (GType item_type);

Test if a given IpatchItem derived type can conflict with another item (only applies to items of the same type in the same IpatchBase object).

item_type :

Type to test

Returns :

TRUE if item_type can conflict (has properties which should be unique among its siblings), FALSE otherwise.

ipatch_item_type_get_unique_specs ()

GParamSpec **       ipatch_item_type_get_unique_specs   (GType item_type,
                                                         guint32 *groups);

Get the list of unique parameter specs which can conflict for a given item type.

item_type :

Type to get unique parameter specs for

groups :

Location to store an integer describing groups. Each bit corresponds to a GParamSpec in the returned array. GParamSpecs of the same group will have the same bit value (0 or 1) and be consecutive. Unique properties in the same group must all match (logic AND) for a conflict to occur. Pass NULL to ignore.

Returns :

NULL terminated list of parameter specs or NULL if item_type can never conflict. The returned array is internal and should not be modified or freed.

ipatch_item_get_unique_props ()

GValueArray *       ipatch_item_get_unique_props        (IpatchItem *item);

Get the values of the unique properties for item. This is useful when doing conflict detection processing and more flexibility is desired than with ipatch_item_test_conflict().

item :

Item to get unique properties of

Returns :

GValueArray of the unique property values of item in the same order as the parameter specs returned by ipatch_item_type_get_unique_specs(). NULL is returned if item doesn't have any unique properties. Use g_value_array_free() to free the array when finished using it.

ipatch_item_test_conflict ()

guint               ipatch_item_test_conflict           (IpatchItem *item1,
                                                         IpatchItem *item2);

Test if two items would conflict if they were siblings (doesn't actually test if they are siblings).

item1 :

First item to test

item2 :

Second item to test

Returns :

Flags of unique properties which conflict. The bit index corresponds to the parameter index in the array returned by ipatch_item_type_get_unique_specs(). 0 is returned if the items do not conflict.

ipatch_item_set_atomic ()

void                ipatch_item_set_atomic              (gpointer item,
                                                         const char *first_property_name,
                                                         ...);

Sets properties on a patch item atomically (i.e. item is multi-thread locked while all properties are set). This avoids critical parameter sync problems when multiple threads are accessing the same item. See g_object_set() for more information on setting properties.

item :

IpatchItem derived object to set properties of

first_property_name :

Name of first property

... :

Variable list of arguments that should start with the value to set first_property_name to, followed by property name/value pairs. List is terminated with a NULL property name.

ipatch_item_get_atomic ()

void                ipatch_item_get_atomic              (gpointer item,
                                                         const char *first_property_name,
                                                         ...);

Gets properties from a patch item atomically (i.e. item is multi-thread locked while all properties are retrieved). This avoids critical parameter sync problems when multiple threads are accessing the same item. See g_object_get() for more information on getting properties.

item :

IpatchItem derived object to get properties from

first_property_name :

Name of first property

... :

Variable list of arguments that should start with a pointer to store the value from first_property_name, followed by property name/value pointer pairs. List is terminated with a NULL property name.

ipatch_item_first ()

IpatchItem *        ipatch_item_first                   (IpatchIter *iter);

Gets the first item in a patch item iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchItem items

Returns :

The first item in iter or NULL if empty.

ipatch_item_next ()

IpatchItem *        ipatch_item_next                    (IpatchIter *iter);

Gets the next item in a patch item iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchItem items

Returns :

The next item in iter or NULL if no more items.

ipatch_item_prop_notify ()

void                ipatch_item_prop_notify             (IpatchItem *item,
                                                         GParamSpec *pspec,
                                                         const GValue *new_value,
                                                         const GValue *old_value);

Usually only used by IpatchItem object implementations, rather than explicitly called by the user. It should be called AFTER item property changes that occur outside of the IpatchItem item_set_property method.

item :

Item whose property changed

pspec :

Parameter specification for item of parameter that changed

new_value :

The new value that was assigned

old_value :

Old value that property had (can be NULL for read only props)

ipatch_item_prop_notify_by_name ()

void                ipatch_item_prop_notify_by_name     (IpatchItem *item,
                                                         const char *prop_name,
                                                         const GValue *new_value,
                                                         const GValue *old_value);

Usually only used by IpatchItem object implementations, rather than explicitly called by the user. Like ipatch_item_prop_notify() except takes a property name instead of a parameter spec, for added convenience.

item :

Item whose property changed

prop_name :

Name of property that changed

new_value :

The new value that was assigned

old_value :

Old value that property had (can be NULL for read only properties)

ipatch_item_prop_connect ()

guint               ipatch_item_prop_connect            (IpatchItem *item,
                                                         GParamSpec *pspec,
                                                         IpatchItemPropCallback callback,
                                                         IpatchItemPropDisconnect disconnect,
                                                         gpointer user_data);

Connect a callback for a specific IpatchItem and property. If a property change occurs for the given item and pspec then the callback is invoked. The parameters item and/or pspec may be NULL for wild card matching (if both are NULL then callback will be called for all IpatchItem property changes).

item :

IpatchItem to match (or NULL for wildcard)

pspec :

Property parameter specification to match (or NULL for wildcard)

callback :

Callback function

disconnect :

Callback disconnect function (called when the callback is disconnected) can be NULL.

user_data :

User defined data to pass to callback and disconnect function.

Returns :

Unique handler ID which can be used to remove the handler or 0 on error (only when function params are incorrect).

ipatch_item_prop_connect_by_name ()

guint               ipatch_item_prop_connect_by_name    (IpatchItem *item,
                                                         const char *prop_name,
                                                         IpatchItemPropCallback callback,
                                                         IpatchItemPropDisconnect disconnect,
                                                         gpointer user_data);

Like ipatch_item_prop_add_callback() but takes the name of a property\ instead of the parameter spec, for added convenience.

item :

IpatchItem to match (or NULL for wildcard)

prop_name :

Name of property of item to match

callback :

Callback function

disconnect :

Callback disconnect function (called when the callback is disconnect) can be NULL.

user_data :

User defined data to pass to callback and disconnect function.

Returns :

Unique handler ID which can be used to remove the handler or 0 on error (only when function params are incorrect).

ipatch_item_prop_disconnect ()

void                ipatch_item_prop_disconnect         (guint handler_id);

Disconnects an IpatchItem property change callback handler by its ID.

handler_id :

Handler ID as returned from ipatch_item_prop_connect().

ipatch_item_prop_disconnect_matched ()

void                ipatch_item_prop_disconnect_matched (IpatchItem *item,
                                                         GParamSpec *pspec,
                                                         IpatchItemPropCallback callback,
                                                         gpointer user_data);

Disconnects first IpatchItem property change callback matching all the function parameters. Note: Only the pointer values of item and pspec are used so they don't actually need to be valid anymore.

item :

IpatchItem of handler to match (does not need to be valid)

pspec :

GParamSpec of handler to match (does not need to be valid)

callback :

Callback function to match

user_data :

User data to match

ipatch_item_prop_disconnect_by_name ()

void                ipatch_item_prop_disconnect_by_name (IpatchItem *item,
                                                         const char *prop_name,
                                                         IpatchItemPropCallback callback,
                                                         gpointer user_data);

Like ipatch_item_prop_disconnect_matched() but takes a name of the property to match instead of a parameter spec, for added convenience. Note: item must still be valid (to look up the property), contrary to ipatch_item_prop_disconnect_matched().

item :

IpatchItem of handler to match (NOTE: Must be a valid object!)

prop_name :

Name of property of item to match

callback :

Callback function to match

user_data :

User data to match

Property Details

The "base" property

  "base"                     IpatchBase*           : Read

Base.


The "flags" property

  "flags"                    guint                 : Read / Write

Flags.

Default value: 0


The "parent" property

  "parent"                   IpatchItem*           : Read / Write

Parent.


The "title" property

  "title"                    gchar*                : Read

Title.

Default value: NULL

libinstpatch-1.0.0/docs/reference/html/libinstpatch-misc.html0000644000175000017500000002723511461404255021265 00000000000000 misc

misc

misc — Miscellaneous stuff

Stability Level

Stable, unless otherwise indicated

Synopsis

#define             IPATCH_ERROR
enum                IpatchError;
#define             ipatch_code_error                   (...)
extern              char *ipatch_application_name;
void                ipatch_init                         (void);
void                ipatch_set_application_name         (const char *name);
GQuark              ipatch_error_quark                  (void);
const char *        ipatch_gerror_message               (GError *err);
void                ipatch_strconcat_num                (const char *src,
                                                         int num,
                                                         char *dest,
                                                         int size);
void                ipatch_dump_object                  (GObject *object,
                                                         gboolean recursive,
                                                         FILE *file);

Description

Details

IPATCH_ERROR

#define IPATCH_ERROR  ipatch_error_quark()

enum IpatchError

typedef enum
{
  IPATCH_ERROR_FAIL,		/* a general failure */
  IPATCH_ERROR_IO,		/* I/O error (file operations, etc) */
  IPATCH_ERROR_PROGRAM,		/* a programming error */
  IPATCH_ERROR_INVALID,		/* invalid parameter or data */
  IPATCH_ERROR_CORRUPT,		/* corrupted data */
  IPATCH_ERROR_NOMEM,		/* out of memory error */
  IPATCH_ERROR_UNSUPPORTED,	/* unsupported feature */
  IPATCH_ERROR_UNEXPECTED_EOF,	/* unexpected end of file */
  IPATCH_ERROR_UNHANDLED_CONVERSION	/* unhandled object conversion */
} IpatchError;

ipatch_code_error()

#define             ipatch_code_error(...)

ipatch_application_name

extern char *ipatch_application_name;

ipatch_init ()

void                ipatch_init                         (void);

Initialize libInstPatch library. Should be called before any other libInstPatch related functions.


ipatch_set_application_name ()

void                ipatch_set_application_name         (const char *name);

Set the global application name string which is used as the software string written to patch files. This string should contain the name of the application, and its version, that is using libInstPatch. The libInstPatch version will also be output where appropriate, so the software string written to a SoundFont for example would look something like "swami 1.0 (libInstPatch 1.0)".

name :

Application name and version (example: "swami 1.0") or NULL to unset application name

ipatch_error_quark ()

GQuark              ipatch_error_quark                  (void);

ipatch_gerror_message ()

const char *        ipatch_gerror_message               (GError *err);

A utility function to check if a GError is set and return the GError's message field if it is, or a string explaining that there isn't any error info if err is NULL.

err :

A GError object or NULL

Returns :

The GError's message or a "<No detailed error information>" string.

ipatch_strconcat_num ()

void                ipatch_strconcat_num                (const char *src,
                                                         int num,
                                                         char *dest,
                                                         int size);

Creates a string with a number appended to it but ensures that it is of the specified size (including NULL termination). Characters in the middle of the string are removed and a ".." is inserted, if necessary.

src :

Source string

num :

Number to concatenate

dest :

Destination buffer

size :

Size of destination buffer

ipatch_dump_object ()

void                ipatch_dump_object                  (GObject *object,
                                                         gboolean recursive,
                                                         FILE *file);

Dumps object info to a file for debugging purposes.

object :

Object to dump

recursive :

Set to TRUE to recurse the object children (if its a IpatchContainer derived object).

file :

File to dump to or NULL for stdout
libinstpatch-1.0.0/docs/reference/html/IpatchSF2IZone.html0000644000175000017500000025217511461404255020343 00000000000000 IpatchSF2IZone

IpatchSF2IZone

IpatchSF2IZone — SoundFont instrument zone object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSF2Zone
               +----IpatchSF2IZone

Implemented Interfaces

IpatchSF2IZone implements IpatchSample, IpatchSF2GenItemIface and IpatchSF2ModItemIface.

Properties

  "attenuation"              gint                  : Read / Write
  "attenuation-set"          gboolean              : Read / Write
  "chorus"                   gint                  : Read / Write
  "chorus-set"               gboolean              : Read / Write
  "coarse-tune"              gint                  : Read / Write
  "coarse-tune-set"          gboolean              : Read / Write
  "exclusive-class"          gint                  : Read / Write
  "exclusive-class-set"      gboolean              : Read / Write
  "filter-cutoff"            gint                  : Read / Write
  "filter-cutoff-set"        gboolean              : Read / Write
  "filter-q"                 gint                  : Read / Write
  "filter-q-set"             gboolean              : Read / Write
  "fine-tune"                gint                  : Read / Write
  "fine-tune-override"       gint                  : Read / Write
  "fine-tune-override-set"   gboolean              : Read / Write
  "fixed-note"               gint                  : Read / Write
  "fixed-note-set"           gboolean              : Read / Write
  "fixed-velocity"           gint                  : Read / Write
  "fixed-velocity-set"       gboolean              : Read / Write
  "link-item"                IpatchSF2Sample*      : Read / Write
  "loop-end"                 guint                 : Read / Write
  "loop-start"               guint                 : Read / Write
  "loop-type"                IpatchSampleLoopType  : Read / Write
  "mod-env-attack"           gint                  : Read / Write
  "mod-env-attack-set"       gboolean              : Read / Write
  "mod-env-decay"            gint                  : Read / Write
  "mod-env-decay-set"        gboolean              : Read / Write
  "mod-env-delay"            gint                  : Read / Write
  "mod-env-delay-set"        gboolean              : Read / Write
  "mod-env-hold"             gint                  : Read / Write
  "mod-env-hold-set"         gboolean              : Read / Write
  "mod-env-release"          gint                  : Read / Write
  "mod-env-release-set"      gboolean              : Read / Write
  "mod-env-sustain"          gint                  : Read / Write
  "mod-env-sustain-set"      gboolean              : Read / Write
  "mod-env-to-filter-cutoff" gint                  : Read / Write
  "mod-env-to-filter-cutoff-set" gboolean              : Read / Write
  "mod-env-to-pitch"         gint                  : Read / Write
  "mod-env-to-pitch-set"     gboolean              : Read / Write
  "mod-lfo-delay"            gint                  : Read / Write
  "mod-lfo-delay-set"        gboolean              : Read / Write
  "mod-lfo-freq"             gint                  : Read / Write
  "mod-lfo-freq-set"         gboolean              : Read / Write
  "mod-lfo-to-filter-cutoff" gint                  : Read / Write
  "mod-lfo-to-filter-cutoff-set" gboolean              : Read / Write
  "mod-lfo-to-pitch"         gint                  : Read / Write
  "mod-lfo-to-pitch-set"     gboolean              : Read / Write
  "mod-lfo-to-volume"        gint                  : Read / Write
  "mod-lfo-to-volume-set"    gboolean              : Read / Write
  "note-range"               IpatchRange*          : Read / Write
  "note-range-set"           gboolean              : Read / Write
  "note-to-mod-env-decay"    gint                  : Read / Write
  "note-to-mod-env-decay-set" gboolean              : Read / Write
  "note-to-mod-env-hold"     gint                  : Read / Write
  "note-to-mod-env-hold-set" gboolean              : Read / Write
  "note-to-vol-env-decay"    gint                  : Read / Write
  "note-to-vol-env-decay-set" gboolean              : Read / Write
  "note-to-vol-env-hold"     gint                  : Read / Write
  "note-to-vol-env-hold-set" gboolean              : Read / Write
  "pan"                      gint                  : Read / Write
  "pan-set"                  gboolean              : Read / Write
  "reverb"                   gint                  : Read / Write
  "reverb-set"               gboolean              : Read / Write
  "root-note"                gint                  : Read / Write
  "root-note-override"       gint                  : Read / Write
  "root-note-override-set"   gboolean              : Read / Write
  "sample-coarse-end"        gint                  : Read / Write
  "sample-coarse-end-set"    gboolean              : Read / Write
  "sample-coarse-loop-end"   gint                  : Read / Write
  "sample-coarse-loop-end-set" gboolean              : Read / Write
  "sample-coarse-loop-start" gint                  : Read / Write
  "sample-coarse-loop-start-set" gboolean              : Read / Write
  "sample-coarse-start"      gint                  : Read / Write
  "sample-coarse-start-set"  gboolean              : Read / Write
  "sample-end"               gint                  : Read / Write
  "sample-end-set"           gboolean              : Read / Write
  "sample-loop-end"          gint                  : Read / Write
  "sample-loop-end-set"      gboolean              : Read / Write
  "sample-loop-start"        gint                  : Read / Write
  "sample-loop-start-set"    gboolean              : Read / Write
  "sample-modes"             gint                  : Read / Write
  "sample-modes-set"         gboolean              : Read / Write
  "sample-rate"              gint                  : Read / Write
  "sample-start"             gint                  : Read / Write
  "sample-start-set"         gboolean              : Read / Write
  "scale-tune"               gint                  : Read / Write
  "scale-tune-set"           gboolean              : Read / Write
  "velocity-range"           IpatchRange*          : Read / Write
  "velocity-range-set"       gboolean              : Read / Write
  "vib-lfo-delay"            gint                  : Read / Write
  "vib-lfo-delay-set"        gboolean              : Read / Write
  "vib-lfo-freq"             gint                  : Read / Write
  "vib-lfo-freq-set"         gboolean              : Read / Write
  "vib-lfo-to-pitch"         gint                  : Read / Write
  "vib-lfo-to-pitch-set"     gboolean              : Read / Write
  "vol-env-attack"           gint                  : Read / Write
  "vol-env-attack-set"       gboolean              : Read / Write
  "vol-env-decay"            gint                  : Read / Write
  "vol-env-decay-set"        gboolean              : Read / Write
  "vol-env-delay"            gint                  : Read / Write
  "vol-env-delay-set"        gboolean              : Read / Write
  "vol-env-hold"             gint                  : Read / Write
  "vol-env-hold-set"         gboolean              : Read / Write
  "vol-env-release"          gint                  : Read / Write
  "vol-env-release-set"      gboolean              : Read / Write
  "vol-env-sustain"          gint                  : Read / Write
  "vol-env-sustain-set"      gboolean              : Read / Write

Description

Instrument zones are children to IpatchSF2Inst objects and define how their referenced IpatchSF2Sample is synthesized.

Details

IpatchSF2IZone

typedef struct _IpatchSF2IZone IpatchSF2IZone;

IPATCH_SF2_IZONE_UNUSED_FLAG_SHIFT

#define             IPATCH_SF2_IZONE_UNUSED_FLAG_SHIFT

ipatch_sf2_izone_new ()

IpatchSF2IZone *    ipatch_sf2_izone_new                (void);

Create a new SoundFont instrument zone object.

Returns :

New SoundFont instrument zone with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_sf2_izone_first ()

IpatchSF2IZone *    ipatch_sf2_izone_first              (IpatchIter *iter);

Gets the first item in an instrument zone iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchSF2IZone items

Returns :

The first instrument zone in iter or NULL if empty.

ipatch_sf2_izone_next ()

IpatchSF2IZone *    ipatch_sf2_izone_next               (IpatchIter *iter);

Gets the next item in an instrument zone iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchSF2IZone items

Returns :

The next instrument zone in iter or NULL if at the end of the list.

ipatch_sf2_izone_set_sample ()

void                ipatch_sf2_izone_set_sample         (IpatchSF2IZone *izone,
                                                         IpatchSF2Sample *sample);

Sets the referenced sample of an instrument zone.

izone :

Instrument zone to set referenced sample of

sample :

Sample to set instrument zone's referenced item to

ipatch_sf2_izone_get_sample ()

IpatchSF2Sample *   ipatch_sf2_izone_get_sample         (IpatchSF2IZone *izone);

Gets the referenced sample from an instrument zone. The returned sample's reference count is incremented and the caller is responsible for unrefing it with g_object_unref().

izone :

Instrument zone to get referenced sample from

Returns :

Instrument zone's referenced sample or NULL if global zone. Remember to unreference the sample with g_object_unref() when done with it.

ipatch_sf2_izone_get_stereo_link ()

IpatchSF2IZone *    ipatch_sf2_izone_get_stereo_link    (IpatchSF2IZone *izone);

Get the stereo linked instrument zone of another zone. This is a zone which has the same IpatchSF2Inst parent and has its link-item set to the counter part of izone.

izone :

Instrument zone

Returns :

Stereo linked instrument zone or NULL if not stereo or it could not be found in the same instrument. Caller owns a reference to the returned object.

Property Details

The "attenuation" property

  "attenuation"              gint                  : Read / Write

Volume attenuation.

Allowed values: [0,1440]

Default value: 0


The "attenuation-set" property

  "attenuation-set"          gboolean              : Read / Write

Default value: FALSE


The "chorus" property

  "chorus"                   gint                  : Read / Write

Chorus.

Allowed values: [0,1000]

Default value: 0


The "chorus-set" property

  "chorus-set"               gboolean              : Read / Write

Default value: FALSE


The "coarse-tune" property

  "coarse-tune"              gint                  : Read / Write

Coarse Tune.

Allowed values: [-120,120]

Default value: 0


The "coarse-tune-set" property

  "coarse-tune-set"          gboolean              : Read / Write

Default value: FALSE


The "exclusive-class" property

  "exclusive-class"          gint                  : Read / Write

Exclusive Class.

Allowed values: [0,127]

Default value: 0


The "exclusive-class-set" property

  "exclusive-class-set"      gboolean              : Read / Write

Default value: FALSE


The "filter-cutoff" property

  "filter-cutoff"            gint                  : Read / Write

Low pass filter cutoff frequency.

Allowed values: [1500,13500]

Default value: 13500


The "filter-cutoff-set" property

  "filter-cutoff-set"        gboolean              : Read / Write

Default value: FALSE


The "filter-q" property

  "filter-q"                 gint                  : Read / Write

Low pass filter Q factor.

Allowed values: [0,960]

Default value: 0


The "filter-q-set" property

  "filter-q-set"             gboolean              : Read / Write

Default value: FALSE


The "fine-tune" property

  "fine-tune"                gint                  : Read / Write

Fine tuning in cents.

Allowed values: [-99,99]

Default value: 0


The "fine-tune-override" property

  "fine-tune-override"       gint                  : Read / Write

Fine Tune.

Allowed values: [-99,99]

Default value: 0


The "fine-tune-override-set" property

  "fine-tune-override-set"   gboolean              : Read / Write

Default value: FALSE


The "fixed-note" property

  "fixed-note"               gint                  : Read / Write

Fixed Note.

Allowed values: [-1,127]

Default value: -1


The "fixed-note-set" property

  "fixed-note-set"           gboolean              : Read / Write

Default value: FALSE


The "fixed-velocity" property

  "fixed-velocity"           gint                  : Read / Write

Fixed Velocity.

Allowed values: [-1,127]

Default value: -1


The "fixed-velocity-set" property

  "fixed-velocity-set"       gboolean              : Read / Write

Default value: FALSE


The "link-item" property

  "link-item"                IpatchSF2Sample*      : Read / Write

Link item.


The "loop-end" property

  "loop-end"                 guint                 : Read / Write

Loop end in frames (after loop).

Default value: 0


The "loop-start" property

  "loop-start"               guint                 : Read / Write

Start of loop in frames.

Default value: 0


The "loop-type" property

  "loop-type"                IpatchSampleLoopType  : Read / Write

Loop method type.

Default value: IPATCH_SAMPLE_LOOP_NONE


The "mod-env-attack" property

  "mod-env-attack"           gint                  : Read / Write

Modulation envelope attack.

Allowed values: [-12000,8000]

Default value: -12000


The "mod-env-attack-set" property

  "mod-env-attack-set"       gboolean              : Read / Write

Default value: FALSE


The "mod-env-decay" property

  "mod-env-decay"            gint                  : Read / Write

Modulation envelope decay.

Allowed values: [-12000,8000]

Default value: -12000


The "mod-env-decay-set" property

  "mod-env-decay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-env-delay" property

  "mod-env-delay"            gint                  : Read / Write

Modulation envelope delay.

Allowed values: [-12000,5000]

Default value: -12000


The "mod-env-delay-set" property

  "mod-env-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-env-hold" property

  "mod-env-hold"             gint                  : Read / Write

Modulation envelope hold.

Allowed values: [-12000,5000]

Default value: -12000


The "mod-env-hold-set" property

  "mod-env-hold-set"         gboolean              : Read / Write

Default value: FALSE


The "mod-env-release" property

  "mod-env-release"          gint                  : Read / Write

Modulation envelope release.

Allowed values: [-12000,8000]

Default value: -12000


The "mod-env-release-set" property

  "mod-env-release-set"      gboolean              : Read / Write

Default value: FALSE


The "mod-env-sustain" property

  "mod-env-sustain"          gint                  : Read / Write

Modulation envelope sustain.

Allowed values: [0,1000]

Default value: 0


The "mod-env-sustain-set" property

  "mod-env-sustain-set"      gboolean              : Read / Write

Default value: FALSE


The "mod-env-to-filter-cutoff" property

  "mod-env-to-filter-cutoff" gint                  : Read / Write

Modulation envelope to filter cutoff.

Allowed values: [-12000,12000]

Default value: 0


The "mod-env-to-filter-cutoff-set" property

  "mod-env-to-filter-cutoff-set" gboolean              : Read / Write

Default value: FALSE


The "mod-env-to-pitch" property

  "mod-env-to-pitch"         gint                  : Read / Write

Modulation envelope to pitch.

Allowed values: [-12000,12000]

Default value: 0


The "mod-env-to-pitch-set" property

  "mod-env-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-delay" property

  "mod-lfo-delay"            gint                  : Read / Write

Modulation oscillator delay.

Allowed values: [-12000,5000]

Default value: -12000


The "mod-lfo-delay-set" property

  "mod-lfo-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-freq" property

  "mod-lfo-freq"             gint                  : Read / Write

Modulation oscillator frequency.

Allowed values: [-16000,4500]

Default value: 0


The "mod-lfo-freq-set" property

  "mod-lfo-freq-set"         gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-filter-cutoff" property

  "mod-lfo-to-filter-cutoff" gint                  : Read / Write

Modulation oscillator to filter cutoff.

Allowed values: [-12000,12000]

Default value: 0


The "mod-lfo-to-filter-cutoff-set" property

  "mod-lfo-to-filter-cutoff-set" gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-pitch" property

  "mod-lfo-to-pitch"         gint                  : Read / Write

Modulation oscillator to pitch.

Allowed values: [-12000,12000]

Default value: 0


The "mod-lfo-to-pitch-set" property

  "mod-lfo-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-volume" property

  "mod-lfo-to-volume"        gint                  : Read / Write

Modulation oscillator to volume.

Allowed values: [-960,960]

Default value: 0


The "mod-lfo-to-volume-set" property

  "mod-lfo-to-volume-set"    gboolean              : Read / Write

Default value: FALSE


The "note-range" property

  "note-range"               IpatchRange*          : Read / Write

Note Range.


The "note-range-set" property

  "note-range-set"           gboolean              : Read / Write

Default value: FALSE


The "note-to-mod-env-decay" property

  "note-to-mod-env-decay"    gint                  : Read / Write

MIDI note to modulation envelope decay.

Allowed values: [-1200,1200]

Default value: 0


The "note-to-mod-env-decay-set" property

  "note-to-mod-env-decay-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-mod-env-hold" property

  "note-to-mod-env-hold"     gint                  : Read / Write

MIDI note to modulation envelope hold.

Allowed values: [-1200,1200]

Default value: 0


The "note-to-mod-env-hold-set" property

  "note-to-mod-env-hold-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-vol-env-decay" property

  "note-to-vol-env-decay"    gint                  : Read / Write

MIDI note to volume envelope decay.

Allowed values: [-1200,1200]

Default value: 0


The "note-to-vol-env-decay-set" property

  "note-to-vol-env-decay-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-vol-env-hold" property

  "note-to-vol-env-hold"     gint                  : Read / Write

MIDI note to volume envelope hold.

Allowed values: [-1200,1200]

Default value: 0


The "note-to-vol-env-hold-set" property

  "note-to-vol-env-hold-set" gboolean              : Read / Write

Default value: FALSE


The "pan" property

  "pan"                      gint                  : Read / Write

Panning.

Allowed values: [-500,500]

Default value: 0


The "pan-set" property

  "pan-set"                  gboolean              : Read / Write

Default value: FALSE


The "reverb" property

  "reverb"                   gint                  : Read / Write

Reverb.

Allowed values: [0,1000]

Default value: 0


The "reverb-set" property

  "reverb-set"               gboolean              : Read / Write

Default value: FALSE


The "root-note" property

  "root-note"                gint                  : Read / Write

Root MIDI note.

Allowed values: [0,127]

Default value: 60


The "root-note-override" property

  "root-note-override"       gint                  : Read / Write

Root Note.

Allowed values: [-1,127]

Default value: -1


The "root-note-override-set" property

  "root-note-override-set"   gboolean              : Read / Write

Default value: FALSE


The "sample-coarse-end" property

  "sample-coarse-end"        gint                  : Read / Write

Sample End Coarse Ofs.

Allowed values: [-32768,0]

Default value: 0


The "sample-coarse-end-set" property

  "sample-coarse-end-set"    gboolean              : Read / Write

Default value: FALSE


The "sample-coarse-loop-end" property

  "sample-coarse-loop-end"   gint                  : Read / Write

Sample Loop End Coarse Ofs.

Allowed values: [-32768,32767]

Default value: 0


The "sample-coarse-loop-end-set" property

  "sample-coarse-loop-end-set" gboolean              : Read / Write

Default value: FALSE


The "sample-coarse-loop-start" property

  "sample-coarse-loop-start" gint                  : Read / Write

Sample Loop Start Coarse Ofs.

Allowed values: [-32768,32767]

Default value: 0


The "sample-coarse-loop-start-set" property

  "sample-coarse-loop-start-set" gboolean              : Read / Write

Default value: FALSE


The "sample-coarse-start" property

  "sample-coarse-start"      gint                  : Read / Write

Sample Start Coarse Ofs.

Allowed values: [0,32767]

Default value: 0


The "sample-coarse-start-set" property

  "sample-coarse-start-set"  gboolean              : Read / Write

Default value: FALSE


The "sample-end" property

  "sample-end"               gint                  : Read / Write

Sample End Ofs.

Allowed values: [0,1073741823]

Default value: 0


The "sample-end-set" property

  "sample-end-set"           gboolean              : Read / Write

Default value: FALSE


The "sample-loop-end" property

  "sample-loop-end"          gint                  : Read / Write

Sample Loop End Ofs.

Allowed values: [0,1073741823]

Default value: 0


The "sample-loop-end-set" property

  "sample-loop-end-set"      gboolean              : Read / Write

Default value: FALSE


The "sample-loop-start" property

  "sample-loop-start"        gint                  : Read / Write

Sample Loop Start Ofs.

Allowed values: [0,1073741823]

Default value: 0


The "sample-loop-start-set" property

  "sample-loop-start-set"    gboolean              : Read / Write

Default value: FALSE


The "sample-modes" property

  "sample-modes"             gint                  : Read / Write

Sample Modes.

Allowed values: [0,3]

Default value: 0


The "sample-modes-set" property

  "sample-modes-set"         gboolean              : Read / Write

Default value: FALSE


The "sample-rate" property

  "sample-rate"              gint                  : Read / Write

Sampling rate in Hertz.

Allowed values: [8000,192000]

Default value: 44100


The "sample-start" property

  "sample-start"             gint                  : Read / Write

Sample Start Ofs.

Allowed values: [0,1073741823]

Default value: 0


The "sample-start-set" property

  "sample-start-set"         gboolean              : Read / Write

Default value: FALSE


The "scale-tune" property

  "scale-tune"               gint                  : Read / Write

Scale Tune.

Allowed values: [0,1200]

Default value: 100


The "scale-tune-set" property

  "scale-tune-set"           gboolean              : Read / Write

Default value: FALSE


The "velocity-range" property

  "velocity-range"           IpatchRange*          : Read / Write

Velocity Range.


The "velocity-range-set" property

  "velocity-range-set"       gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-delay" property

  "vib-lfo-delay"            gint                  : Read / Write

Vibrato oscillator delay.

Allowed values: [-12000,5000]

Default value: -12000


The "vib-lfo-delay-set" property

  "vib-lfo-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-freq" property

  "vib-lfo-freq"             gint                  : Read / Write

Vibrato oscillator frequency.

Allowed values: [-16000,4500]

Default value: 0


The "vib-lfo-freq-set" property

  "vib-lfo-freq-set"         gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-to-pitch" property

  "vib-lfo-to-pitch"         gint                  : Read / Write

Vibrato oscillator to pitch.

Allowed values: [-12000,12000]

Default value: 0


The "vib-lfo-to-pitch-set" property

  "vib-lfo-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "vol-env-attack" property

  "vol-env-attack"           gint                  : Read / Write

Volume envelope attack.

Allowed values: [-12000,8000]

Default value: -12000


The "vol-env-attack-set" property

  "vol-env-attack-set"       gboolean              : Read / Write

Default value: FALSE


The "vol-env-decay" property

  "vol-env-decay"            gint                  : Read / Write

Volume envelope decay.

Allowed values: [-12000,8000]

Default value: -12000


The "vol-env-decay-set" property

  "vol-env-decay-set"        gboolean              : Read / Write

Default value: FALSE


The "vol-env-delay" property

  "vol-env-delay"            gint                  : Read / Write

Volume envelope delay.

Allowed values: [-12000,5000]

Default value: -12000


The "vol-env-delay-set" property

  "vol-env-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "vol-env-hold" property

  "vol-env-hold"             gint                  : Read / Write

Volume envelope hold.

Allowed values: [-12000,5000]

Default value: -12000


The "vol-env-hold-set" property

  "vol-env-hold-set"         gboolean              : Read / Write

Default value: FALSE


The "vol-env-release" property

  "vol-env-release"          gint                  : Read / Write

Volume envelope release.

Allowed values: [-12000,8000]

Default value: -12000


The "vol-env-release-set" property

  "vol-env-release-set"      gboolean              : Read / Write

Default value: FALSE


The "vol-env-sustain" property

  "vol-env-sustain"          gint                  : Read / Write

Volume envelope sustain.

Allowed values: [0,1440]

Default value: 0


The "vol-env-sustain-set" property

  "vol-env-sustain-set"      gboolean              : Read / Write

Default value: FALSE

See Also

#IpatchSF2Inst, IpatchSF2Sample
libinstpatch-1.0.0/docs/reference/html/IpatchSF2Reader.html0000644000175000017500000004070711461404255020515 00000000000000 IpatchSF2Reader

IpatchSF2Reader

IpatchSF2Reader — SoundFont file reader

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchRiff
         +----IpatchSF2Reader

Description

Reads a SoundFont file and loads it into a object tree (IpatchSF2).

Details

IpatchSF2Reader

typedef struct _IpatchSF2Reader IpatchSF2Reader;

ipatch_sf2_reader_new ()

IpatchSF2Reader *   ipatch_sf2_reader_new               (IpatchFileHandle *handle);

Create a new SoundFont file reader

handle :

SoundFont 2 file handle to parse or NULL to set later

Returns :

The new SoundFont file reader

ipatch_sf2_reader_set_file_handle ()

void                ipatch_sf2_reader_set_file_handle   (IpatchSF2Reader *reader,
                                                         IpatchFileHandle *handle);

Set the SoundFont file handle of a SoundFont reader. A convenience function, since ipatch_riff_set_file_handle() could also be used, albeit without stricter type casting.

reader :

SoundFont reader object

handle :

SoundFont 2 file handle

ipatch_sf2_reader_load ()

IpatchSF2 *         ipatch_sf2_reader_load              (IpatchSF2Reader *reader,
                                                         GError **err);

Load an SF2 file.

reader :

SF2 reader object

err :

Location to store error info or NULL

Returns :

New SF2 object with refcount of 1.

ipatch_sf2_load_phdr ()

void                ipatch_sf2_load_phdr                (IpatchFileHandle *handle,
                                                         IpatchSF2Phdr *phdr);

Parses a raw preset header in file handle with buffered data.

handle :

File handle containing buffered data

phdr :

Pointer to a user supplied preset header structure

ipatch_sf2_load_ihdr ()

void                ipatch_sf2_load_ihdr                (IpatchFileHandle *handle,
                                                         IpatchSF2Ihdr *ihdr);

Parses a raw instrument header in file handle with buffered data.

handle :

File handle containing buffered data

ihdr :

Pointer to a user supplied instrument header structure

ipatch_sf2_load_shdr ()

void                ipatch_sf2_load_shdr                (IpatchFileHandle *handle,
                                                         IpatchSF2Shdr *shdr);

Parses a raw sample header in file handle with buffered data.

handle :

File handle containing buffered data

shdr :

Pointer to a user supplied sample header structure

ipatch_sf2_load_bag ()

void                ipatch_sf2_load_bag                 (IpatchFileHandle *handle,
                                                         IpatchSF2Bag *bag);

Parses a raw preset or instrument bag in file handle with buffered data.

handle :

File handle containing buffered data

bag :

Pointer to a user supplied bag structure

ipatch_sf2_load_mod ()

void                ipatch_sf2_load_mod                 (IpatchFileHandle *handle,
                                                         IpatchSF2Mod *mod);

Parses a raw modulator in file handle with buffered data.

handle :

File handle containing buffered data

mod :

Pointer to a user supplied modulator structure

ipatch_sf2_load_gen ()

void                ipatch_sf2_load_gen                 (IpatchFileHandle *handle,
                                                         int *genid,
                                                         IpatchSF2GenAmount *amount);

Parses a raw generator in file handle with buffered data.

handle :

File handle containing buffered data

genid :

Pointer to store the generator ID in

amount :

Pointer to a generator amount to store the amount in
libinstpatch-1.0.0/docs/reference/html/libinstpatch-version.html0000644000175000017500000001411411461404255022007 00000000000000 version

version

version

Synopsis

#define             IPATCH_VERSION
#define             IPATCH_VERSION_MAJOR
#define             IPATCH_VERSION_MINOR
#define             IPATCH_VERSION_MICRO
void                ipatch_version                      (guint *major,
                                                         guint *minor,
                                                         guint *micro);

Description

Details

IPATCH_VERSION

#define IPATCH_VERSION       "1.0.0"

IPATCH_VERSION_MAJOR

#define IPATCH_VERSION_MAJOR 1

IPATCH_VERSION_MINOR

#define IPATCH_VERSION_MINOR 0

IPATCH_VERSION_MICRO

#define IPATCH_VERSION_MICRO 0

ipatch_version ()

void                ipatch_version                      (guint *major,
                                                         guint *minor,
                                                         guint *micro);

Fetch the runtime version of the libInstPatch library.

major :

Pointer to store major version or NULL

minor :

Pointer to store minor version or NULL

micro :

Pointer to store micro version or NULL
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchXml.html0000644000175000017500000020002011461404255022204 00000000000000 IpatchXml

IpatchXml

IpatchXml — XML tree functions

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchXmlNode;
                    IpatchXmlAttr;
GNode *             ipatch_xml_new_node                 (GNode *parent,
                                                         const char *name,
                                                         const char *value,
                                                         const char *attr_name,
                                                         ...);
GNode *             ipatch_xml_new_node_strv            (GNode *parent,
                                                         const char *name,
                                                         const char *value,
                                                         const char **attr_names,
                                                         const char **attr_values);
gpointer            ipatch_xml_get_data                 (GNode *node,
                                                         const char *key);
void                ipatch_xml_set_data                 (GNode *node,
                                                         const char *key,
                                                         gpointer data);
void                ipatch_xml_set_data_full            (GNode *node,
                                                         const char *key,
                                                         gpointer data,
                                                         GDestroyNotify destroy_func);
gpointer            ipatch_xml_steal_data               (GNode *node,
                                                         const char *key);
gpointer            ipatch_xml_get_qdata                (GNode *node,
                                                         GQuark quark);
void                ipatch_xml_set_qdata                (GNode *node,
                                                         GQuark quark,
                                                         gpointer data);
void                ipatch_xml_set_qdata_full           (GNode *node,
                                                         GQuark quark,
                                                         gpointer data,
                                                         GDestroyNotify destroy_func);
gpointer            ipatch_xml_steal_qdata              (GNode *node,
                                                         GQuark quark);
void                ipatch_xml_destroy                  (GNode *node);
GNode *             ipatch_xml_copy                     (GNode *node);
void                ipatch_xml_set_name                 (GNode *node,
                                                         const char *name);
void                ipatch_xml_set_value                (GNode *node,
                                                         const char *value);
void                ipatch_xml_set_value_printf         (GNode *node,
                                                         const char *format,
                                                         ...);
void                ipatch_xml_take_name                (GNode *node,
                                                         char *name);
void                ipatch_xml_take_value               (GNode *node,
                                                         char *value);
const char *        ipatch_xml_get_name                 (GNode *node);
gboolean            ipatch_xml_test_name                (GNode *node,
                                                         const char *cmpname);
const char *        ipatch_xml_get_value                (GNode *node);
char *              ipatch_xml_dup_value                (GNode *node);
gboolean            ipatch_xml_test_value               (GNode *node,
                                                         const char *cmpvalue);
void                ipatch_xml_set_attribute            (GNode *node,
                                                         const char *attr_name,
                                                         const char *attr_value);
void                ipatch_xml_set_attributes           (GNode *node,
                                                         const char *attr_name,
                                                         const char *attr_value,
                                                         const char *attr2_name,
                                                         ...);
const char *        ipatch_xml_get_attribute            (GNode *node,
                                                         const char *name);
gboolean            ipatch_xml_test_attribute           (GNode *node,
                                                         const char *attr_name,
                                                         const char *cmpval);
GNode *             ipatch_xml_find_child               (GNode *node,
                                                         const char *name);
GNode *             ipatch_xml_find_by_path             (GNode *node,
                                                         const char *path);
char *              ipatch_xml_to_str                   (GNode *node,
                                                         guint indent);
gboolean            ipatch_xml_save_to_file             (GNode *node,
                                                         guint indent,
                                                         const char *filename,
                                                         GError **err);
GNode *             ipatch_xml_from_str                 (const char *str,
                                                         GError **err);
GNode *             ipatch_xml_load_from_file           (const char *filename,
                                                         GError **err);
IpatchXmlNode *     ipatch_xml_node_new                 (void);
void                ipatch_xml_node_free                (IpatchXmlNode *node);
IpatchXmlNode *     ipatch_xml_node_duplicate           (const IpatchXmlNode *xmlnode);
IpatchXmlAttr *     ipatch_xml_attr_new                 (void);
void                ipatch_xml_attr_free                (IpatchXmlAttr *attr);
IpatchXmlAttr *     ipatch_xml_attr_duplicate           (const IpatchXmlAttr *attr);

Description

Functions for manipulating XML node trees and saving/loading to/from XML content in strings or files. XML node trees use the glib GNode N-ary tree data type for added flexibility.

Details

IpatchXmlNode

typedef struct {
  char *name;		/* XML element name */
  char *value;		/* Text content of element */
  GData *qdata;		/* To associate arbitrary data with XML nodes */
  GList *attributes;	/* List of IpatchXmlAttr structures */
} IpatchXmlNode;

An XML element node. Note that a given node can contain only one text value.

char *name;

XML element name

char *value;

XML text value or NULL

GData *qdata;

GList *attributes;

Linked list of IpatchXmlAttr structures

IpatchXmlAttr

typedef struct {
  char *name;
  char *value;
} IpatchXmlAttr;

Structure for storing an XML attribute.

char *name;

Attribute name

char *value;

Attribute value

ipatch_xml_new_node ()

GNode *             ipatch_xml_new_node                 (GNode *parent,
                                                         const char *name,
                                                         const char *value,
                                                         const char *attr_name,
                                                         ...);

Create a new XML tree node and append it to the given parent, if supplied. Note that the returned GNode can be used with other N-Array glib operations.

parent :

Parent node to add new node to as a child, or NULL to create new root node

name :

Name of the new XML node

value :

Text value to assign to the new node or NULL

attr_name :

First attribute name to assign or NULL

... :

If attr_name was supplied first string value to be assigned should be the first parameter, additional name/value attribute string pairs may follow terminated by a NULL name.

Returns :

New XML tree node

ipatch_xml_new_node_strv ()

GNode *             ipatch_xml_new_node_strv            (GNode *parent,
                                                         const char *name,
                                                         const char *value,
                                                         const char **attr_names,
                                                         const char **attr_values);

Like ipatch_xml_new_node() but takes attribute name/values as separate strv arrays.

parent :

Parent node to add new node to as a child, or NULL to create new root node

name :

Name of the new XML node

value :

Text value to assign to the new node or NULL

attr_names :

NULL terminated array of attribute names or NULL

attr_values :

NULL terminated array of attribute values or NULL

Returns :

New XML tree node

ipatch_xml_get_data ()

gpointer            ipatch_xml_get_data                 (GNode *node,
                                                         const char *key);

Lookup data assigned to an XML node using a quark. This is faster than ipatch_xml_get_data() since the key must be converted to a quark anyways.

node :

XML node

quark :

Quark key

Returns :

The data pointer or NULL if not set

ipatch_xml_set_data ()

void                ipatch_xml_set_data                 (GNode *node,
                                                         const char *key,
                                                         gpointer data);

Assigns arbitrary data to an XML node specified by a key.

node :

XML node

key :

Name of the key

data :

Data to associate with the key

ipatch_xml_set_data_full ()

void                ipatch_xml_set_data_full            (GNode *node,
                                                         const char *key,
                                                         gpointer data,
                                                         GDestroyNotify destroy_func);

Assigns arbitrary data to an XML node specified by a key. Also assigns a destroy_func callback to destroy the data when it is removed.

node :

XML node

key :

Name of the key

data :

Data to associate with the key

ipatch_xml_steal_data ()

gpointer            ipatch_xml_steal_data               (GNode *node,
                                                         const char *key);

Remove keyed data from an XML node, but don't call the data's destroy notify. Caller is thus given the ownership of the data.

node :

XML node

key :

Name of the key

Returns :

The data pointer or NULL if not set

ipatch_xml_get_qdata ()

gpointer            ipatch_xml_get_qdata                (GNode *node,
                                                         GQuark quark);

ipatch_xml_set_qdata ()

void                ipatch_xml_set_qdata                (GNode *node,
                                                         GQuark quark,
                                                         gpointer data);

Assigns arbitrary data to an XML node specified by a quark key. This is faster than ipatch_xml_set_data() since the key must be converted to a quark anyways.

node :

XML node

quark :

Quark key

data :

Data to associate with the key

ipatch_xml_set_qdata_full ()

void                ipatch_xml_set_qdata_full           (GNode *node,
                                                         GQuark quark,
                                                         gpointer data,
                                                         GDestroyNotify destroy_func);

Assigns arbitrary data to an XML node specified by a key. Also assigns a destroy_func callback to destroy the data when it is removed. This is faster than ipatch_xml_set_data_full() since the key must be converted to a quark anyways.

node :

XML node

quark :

Quark key

data :

Data to associate with the key

ipatch_xml_steal_qdata ()

gpointer            ipatch_xml_steal_qdata              (GNode *node,
                                                         GQuark quark);

Remove keyed data from an XML node, but don't call the data's destroy notify. Caller is thus given the ownership of the data. This is faster than ipatch_xml_steal_data() since the key must be converted to a quark anyways.

node :

XML node

quark :

Quark key

Returns :

The data pointer or NULL if not set

ipatch_xml_destroy ()

void                ipatch_xml_destroy                  (GNode *node);

Free an XML tree (a root node and all its children). Does not need to be the actual root of a tree, i.e., can remove a sub tree.

node :

Root of XML tree/sub tree to destroy

ipatch_xml_copy ()

GNode *             ipatch_xml_copy                     (GNode *node);

Perform a deep copy on an XML tree.

node :

XML tree to copy

Returns :

New duplicate XML tree.

ipatch_xml_set_name ()

void                ipatch_xml_set_name                 (GNode *node,
                                                         const char *name);

Set the name of an XML node.

node :

XML node

name :

Name to assign

ipatch_xml_set_value ()

void                ipatch_xml_set_value                (GNode *node,
                                                         const char *value);

Set the text value of an XML node.

node :

XML node

value :

Text value to assign or NULL to clear it

ipatch_xml_set_value_printf ()

void                ipatch_xml_set_value_printf         (GNode *node,
                                                         const char *format,
                                                         ...);

Assign a value to an XML node using a printf format and arguments.

node :

XML node

format :

Printf format

... :

Printf arguments

ipatch_xml_take_name ()

void                ipatch_xml_take_name                (GNode *node,
                                                         char *name);

Like ipatch_xml_set_name() but takes over the allocation of name rather than duplicating it.

node :

XML node

name :

Name to assign or NULL to clear it

ipatch_xml_take_value ()

void                ipatch_xml_take_value               (GNode *node,
                                                         char *value);

Like ipatch_xml_set_value() but takes over the allocation of value rather than duplicating it.

node :

XML node

value :

Text value to assign

ipatch_xml_get_name ()

const char *        ipatch_xml_get_name                 (GNode *node);

Get the name of an XML node.

node :

XML node to get name of

Returns :

Name of XML node which is internal and should not be modified or freed.

ipatch_xml_test_name ()

gboolean            ipatch_xml_test_name                (GNode *node,
                                                         const char *cmpname);

Test if the node has the given name.

node :

XML node to get name of

cmpname :

Name to compare to

Returns :

TRUE if the node has the given name, FALSE otherwise

ipatch_xml_get_value ()

const char *        ipatch_xml_get_value                (GNode *node);

Get the text value of an XML node.

node :

XML node to get value of

Returns :

Value of XML node or NULL, which is internal and should not be modified or freed.

ipatch_xml_dup_value ()

char *              ipatch_xml_dup_value                (GNode *node);

Duplicate the text value of an XML node. Like ipatch_xml_get_value() but makes a copy of the value which the caller owns.

node :

XML node to duplicate value of

Returns :

Newly allocated duplicate value of XML node or NULL.

ipatch_xml_test_value ()

gboolean            ipatch_xml_test_value               (GNode *node,
                                                         const char *cmpvalue);

Test if the node has the given value.

node :

XML node to get name of

cmpvalue :

Value to compare to

Returns :

TRUE if the node has the given value, FALSE otherwise

ipatch_xml_set_attribute ()

void                ipatch_xml_set_attribute            (GNode *node,
                                                         const char *attr_name,
                                                         const char *attr_value);

Set or unset an attribute of an XML node. If there is already an existing attribute with the given attr_name, its value will be replaced.

node :

XML node

attr_name :

Attribute name to assign to

attr_value :

Attribute value to assign or NULL to unset

ipatch_xml_set_attributes ()

void                ipatch_xml_set_attributes           (GNode *node,
                                                         const char *attr_name,
                                                         const char *attr_value,
                                                         const char *attr2_name,
                                                         ...);

Set one or more attributes of an XML node.

node :

XML node

attr_name :

First attribute name

attr_value :

First attribute value

... :

Additional name/value attribute strings, terminated by a NULL name

ipatch_xml_get_attribute ()

const char *        ipatch_xml_get_attribute            (GNode *node,
                                                         const char *name);

Get the value of an attribute of an XML node.

node :

XML node

attr_name :

Name of attribute

Returns :

Value of the named attribute or NULL if not found, value is internal and should not be modified or freed.

ipatch_xml_test_attribute ()

gboolean            ipatch_xml_test_attribute           (GNode *node,
                                                         const char *attr_name,
                                                         const char *cmpval);

Test if an attribute of an XML node is a given value or exists (cmpval = NULL).

node :

XML node

attr_name :

Name of attribute

cmpval :

Value to compare attribute to (NULL to just check existence).

Returns :

TRUE if attribute exists and matches cmpval (if set).

ipatch_xml_find_child ()

GNode *             ipatch_xml_find_child               (GNode *node,
                                                         const char *name);

Find a child node with the given name. Only searches the children of node and does not search recursively.

node :

XML node

name :

Node name of child to find

Returns :

Matching node or NULL if not found.

ipatch_xml_find_by_path ()

GNode *             ipatch_xml_find_by_path             (GNode *node,
                                                         const char *path);

Get a node in a tree from a path string.

node :

XML node

path :

Path specification in the form "name1.name2.name3" where each child of a node is separated by a '.' character.

Returns :

Matching node or NULL if not found.

ipatch_xml_to_str ()

char *              ipatch_xml_to_str                   (GNode *node,
                                                         guint indent);

Render an XML tree to a string.

node :

XML node

indent :

Number of spaces of indent per level (0 for no indent)

Returns :

Newly allocated string of XML content representing node, free with g_free() when done using it.

ipatch_xml_save_to_file ()

gboolean            ipatch_xml_save_to_file             (GNode *node,
                                                         guint indent,
                                                         const char *filename,
                                                         GError **err);

Store an XML tree to a file.

node :

XML tree to save

indent :

Number of spaces to indent per level

filename :

File name to save to

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE otherwise (in which case err may be set)

ipatch_xml_from_str ()

GNode *             ipatch_xml_from_str                 (const char *str,
                                                         GError **err);

Parse XML content into an XML node tree.

str :

XML content to parse

err :

Location to store error info or NULL to ignore

Returns :

Newly allocated XML node tree or NULL on error (err may be set), can be freed with ipatch_xml_destroy().

ipatch_xml_load_from_file ()

GNode *             ipatch_xml_load_from_file           (const char *filename,
                                                         GError **err);

Parse an XML file into an XML node tree.

filename :

File name containing XML content to parse

err :

Location to store error info or NULL to ignore

Returns :

Newly allocated XML node tree or NULL on error (err may be set), can be freed with ipatch_xml_destroy().

ipatch_xml_node_new ()

IpatchXmlNode *     ipatch_xml_node_new                 (void);

Create a new XML node structure. Not normally used.

Returns :

New XML node structure, which should be added to a GNode.

ipatch_xml_node_free ()

void                ipatch_xml_node_free                (IpatchXmlNode *node);

Free an XML node structure and its contents. Not normally used.

xmlnode :

XML node structure to free

ipatch_xml_node_duplicate ()

IpatchXmlNode *     ipatch_xml_node_duplicate           (const IpatchXmlNode *xmlnode);

Duplicate an XML node structure and its contents. Not normally used. Note that arbitrary user data assigned to the XML node will not be duplicated.

xmlnode :

XML node structure to duplicate

Returns :

New duplicate of xmlnode.

ipatch_xml_attr_new ()

IpatchXmlAttr *     ipatch_xml_attr_new                 (void);

Create a new XML attribute structure. Not normally used.

Returns :

New XML attribute structure which should be added to an IpatchXmlNode attributes list.

ipatch_xml_attr_free ()

void                ipatch_xml_attr_free                (IpatchXmlAttr *attr);

Free an XML attribute structure. Not normally used.

attr :

Attribute structure to free

ipatch_xml_attr_duplicate ()

IpatchXmlAttr *     ipatch_xml_attr_duplicate           (const IpatchXmlAttr *attr);

Duplicate an XML attribute structure. Not normally used.

attr :

Attribute structure to duplicate

Returns :

New duplicate attribute structure

See Also

IpatchXmlObject
libinstpatch-1.0.0/docs/reference/html/IpatchSampleStoreCache.html0000644000175000017500000003164711461404255022165 00000000000000 IpatchSampleStoreCache

IpatchSampleStoreCache

IpatchSampleStoreCache — Sample store object for cached samples in RAM

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSampleStore
               +----IpatchSampleStoreCache

Implemented Interfaces

IpatchSampleStoreCache implements IpatchSample.

Properties

  "location"                 gpointer              : Read / Write

Description

This sample store type is tightly integrated with IpatchSampleData to provide managed cached samples in RAM.

Details

IpatchSampleStoreCache

typedef struct _IpatchSampleStoreCache IpatchSampleStoreCache;

ipatch_sample_store_cache_get_location()

#define             ipatch_sample_store_cache_get_location(store)

Macro to quickly fetch a cache sample store's data location pointer.

store :

Sample store to get sample data location from

Returns :

Sample data pointer.

ipatch_sample_store_cache_get_channel_map()

#define             ipatch_sample_store_cache_get_channel_map(store)

Macro to quickly fetch a cache sample store's channel map value. Cached samples store a channel map in reference to the native sample of their parent IpatchSampleData.

store :

Sample store to get channel map from

Returns :

Channel map value.

ipatch_sample_store_cache_get_open_count()

#define             ipatch_sample_store_cache_get_open_count(store)

IPATCH_SAMPLE_STORE_CACHE_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_STORE_CACHE_UNUSED_FLAG_SHIFT

ipatch_sample_store_cache_new ()

IpatchSample *      ipatch_sample_store_cache_new       (gpointer location);

Creates a new cached RAM sample store. If location is provided, its allocation is taken over by the store.

NOTE: This store type should not be used outside of the IpatchSampleData implementation, as it is tightly coupled with it.

location :

Location of existing sample data or NULL if the sample buffer should be allocated (in which case the sample must be written to first).

Returns :

New cached RAM sample store, cast as a IpatchSample for convenience.

ipatch_sample_store_cache_open ()

void                ipatch_sample_store_cache_open      (IpatchSampleStoreCache *store);

A dummy open function which can be used if the location pointer will be accessed directly, rather than opening a IpatchSampleHandle. Keeping a cached sample store open will ensure it isn't destroyed. Call ipatch_sample_store_cache_close() when done with it.

store :

Sample cache store

ipatch_sample_store_cache_close ()

void                ipatch_sample_store_cache_close     (IpatchSampleStoreCache *store);

A dummy close function which is called after a sample store cache is no longer needed after opening it with ipatch_sample_store_cache_open().

store :

Sample cache store

Property Details

The "location" property

  "location"                 gpointer              : Read / Write

Sample data pointer.

See Also

#IpatchSampleData
libinstpatch-1.0.0/docs/reference/html/ch02.html0000644000175000017500000001235011461404255016374 00000000000000 Utility objects and functions

Utility objects and functions

IpatchIter — Iterator instance
IpatchList — An object containing a list of object pointers
IpatchConverter — Base class for object conversion handlers
IpatchConverterSF2VoiceCache — Base object type used for IpatchSF2Voice cache converters
IpatchRiff — RIFF file parser/composer object
IpatchSF2VoiceCache — SoundFont voice cache object
IpatchParamProp — GParamSpec extended properties
IpatchTypeProp — GObject style properties for GTypes
IpatchPaste — Object paste instance
IpatchUnit — Unit conversion system
IpatchUnit_generic — Generic unit types and conversions
IpatchXml — XML tree functions
IpatchXmlObject — GObject related XML tree functions
IpatchRange — A boxed type which defines a number range
md5 — MD5 hashing functions
misc — Miscellaneous stuff
util — Utility functions
version
libinstpatch-1.0.0/docs/reference/html/IpatchSampleStoreSplit24.html0000644000175000017500000002033211461404255022410 00000000000000 IpatchSampleStoreSplit24

IpatchSampleStoreSplit24

IpatchSampleStoreSplit24 — Sample storage object for 24 bit audio in 16 and 8 bit segments

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSampleStore
               +----IpatchSampleStoreFile
                     +----IpatchSampleStoreSplit24

Implemented Interfaces

IpatchSampleStoreSplit24 implements IpatchSample.

Properties

  "location-lsbytes"         guint                 : Read / Write

Description

SoundFont 2.04 adds support for 24 bit audio. This is done in a semi backwards compatible fashion where the most significant 16 bits is stored separately from the remaining 8 bit segments. This storage object handles this transparently.

Details

IpatchSampleStoreSplit24

typedef struct _IpatchSampleStoreSplit24 IpatchSampleStoreSplit24;

ipatch_sample_store_split24_new ()

IpatchSample *      ipatch_sample_store_split24_new     (IpatchFile *file,
                                                         guint loc_16bit,
                                                         guint loc_lsbytes);

Creates a new split 24 bit sample store (lower byte of 24 bit samples is stored in a separate block). New SoundFont 2.04 uses this method.

file :

File object

loc_16bit :

Location of 16 bit audio data

loc_lsbytes :

Location of 24 bit LS bytes

Returns :

New split 24 sample store

Property Details

The "location-lsbytes" property

  "location-lsbytes"         guint                 : Read / Write

LS byte sample data file position.

Default value: 0

libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchDLS2Conn.html0000644000175000017500000005667611461404255023020 00000000000000 IpatchDLS2Conn

IpatchDLS2Conn

IpatchDLS2Conn — DLS version 2 connection structures and functions

Stability Level

Stable, unless otherwise indicated

Description

Defines structures and functions used for DLS version 2 instrument parameters (called connections in DLS terminology).

Details

IpatchDLS2Conn

typedef struct {
  guint16 src;			/* source enum */
  guint16 ctrlsrc;		/* second source enum */
  guint16 dest;			/* destination enum */
  guint16 trans;		/* transform enum */
  gint32 scale;			/* scale value */
} IpatchDLS2Conn;

IpatchDLS2ConnInfo

typedef struct {
  guint16 type;			/* IpatchDLS2ConnDestType */
  gint32 min;			/* minimum value allowed */
  gint32 max;			/* maximum value allowed */
  gint32 def;			/* default value */
  int unit;			/* #IpatchUnitType type */
  char *label;			/* short descriptive label */
  char *descr;			/* more complete description */
} IpatchDLS2ConnInfo;

IPATCH_TYPE_DLS2_CONN

#define IPATCH_TYPE_DLS2_CONN   (ipatch_dls2_conn_get_type ())

IPATCH_DLS2_CONN_ARE_IDENTICAL()

#define             IPATCH_DLS2_CONN_ARE_IDENTICAL(a, b)

enum IpatchDLS2ConnSrcType

typedef enum
{
  IPATCH_DLS2_CONN_SRC_NONE = 0, /* No source */
  IPATCH_DLS2_CONN_SRC_LFO = 1,	/* Modulation LFO */
  IPATCH_DLS2_CONN_SRC_VELOCITY = 2, /* MIDI Note-On velocity */
  IPATCH_DLS2_CONN_SRC_NOTE = 3, /* MIDI Note number */
  IPATCH_DLS2_CONN_SRC_EG1 = 4,	/* Envelope Generator 1 */
  IPATCH_DLS2_CONN_SRC_EG2 = 5,	/* Envelope Generator 2 */
  IPATCH_DLS2_CONN_SRC_PITCH_WHEEL = 6, /* Pitch Wheel */
  IPATCH_DLS2_CONN_SRC_POLY_PRESSURE = 7, /* Polyphonic pressure */
  IPATCH_DLS2_CONN_SRC_CHANNEL_PRESSURE = 8, /* Channel Pressure */
  IPATCH_DLS2_CONN_SRC_VIBRATO = 9, /* Vibrato LFO */

  /* defined MIDI controller sources */
  IPATCH_DLS2_CONN_SRC_CC1 = 0x0081, /* Modulation */
  IPATCH_DLS2_CONN_SRC_CC7 = 0x0087, /* Volume */
  IPATCH_DLS2_CONN_SRC_CC10 = 0x008A, /* Pan */
  IPATCH_DLS2_CONN_SRC_CC11 = 0x008B, /* Expression */
  IPATCH_DLS2_CONN_SRC_CC91 = 0x00DB, /* Chorus Send */
  IPATCH_DLS2_CONN_SRC_CC93 = 0x00DD, /* Reverb Send */

  /* MIDI registered parameter numbers */
  IPATCH_DLS2_CONN_SRC_RPN0 = 0x0100, /* Pitch bend range */
  IPATCH_DLS2_CONN_SRC_RPN1 = 0x0101, /* Fine tune */
  IPATCH_DLS2_CONN_SRC_RPN2 = 0x0102 /* Coarse tune */
} IpatchDLS2ConnSrcType;

enum IpatchDLS2ConnDestType

typedef enum
{
  IPATCH_DLS2_CONN_DEST_NONE = 0,
  IPATCH_DLS2_CONN_DEST_GAIN = 1,
  IPATCH_DLS2_CONN_DEST_RESERVED = 2,
  IPATCH_DLS2_CONN_DEST_PITCH = 3,
  IPATCH_DLS2_CONN_DEST_PAN = 4,
  IPATCH_DLS2_CONN_DEST_NOTE = 5,

  IPATCH_DLS2_CONN_DEST_LEFT = 0x0010,
  IPATCH_DLS2_CONN_DEST_RIGHT = 0x0011,
  IPATCH_DLS2_CONN_DEST_CENTER = 0x0012,
  IPATCH_DLS2_CONN_DEST_LFE_CHANNEL = 0x0013,
  IPATCH_DLS2_CONN_DEST_LEFT_REAR = 0x0014,
  IPATCH_DLS2_CONN_DEST_RIGHT_REAR = 0x0015,

  IPATCH_DLS2_CONN_DEST_CHORUS = 0x0080,
  IPATCH_DLS2_CONN_DEST_REVERB = 0x0081,

  IPATCH_DLS2_CONN_DEST_LFO_FREQ = 0x0104,
  IPATCH_DLS2_CONN_DEST_LFO_DELAY = 0x0105,

  IPATCH_DLS2_CONN_DEST_VIB_FREQ = 0x0114,
  IPATCH_DLS2_CONN_DEST_VIB_DELAY = 0x0115,

  IPATCH_DLS2_CONN_DEST_EG1_ATTACK = 0x0206,
  IPATCH_DLS2_CONN_DEST_EG1_DECAY = 0x0207,
  IPATCH_DLS2_CONN_DEST_EG1_RESERVED = 0x0208,
  IPATCH_DLS2_CONN_DEST_EG1_RELEASE = 0x0209,
  IPATCH_DLS2_CONN_DEST_EG1_SUSTAIN = 0x020A,
  IPATCH_DLS2_CONN_DEST_EG1_DELAY = 0x020B,
  IPATCH_DLS2_CONN_DEST_EG1_HOLD = 0x020C,
  IPATCH_DLS2_CONN_DEST_EG1_SHUTDOWN = 0x020D,

  IPATCH_DLS2_CONN_DEST_EG2_ATTACK = 0x030A,
  IPATCH_DLS2_CONN_DEST_EG2_DECAY = 0x030B,
  IPATCH_DLS2_CONN_DEST_EG2_RESERVED = 0x030C,
  IPATCH_DLS2_CONN_DEST_EG2_RELEASE = 0x030D,
  IPATCH_DLS2_CONN_DEST_EG2_SUSTAIN = 0x030E,
  IPATCH_DLS2_CONN_DEST_EG2_DELAY = 0x030F,
  IPATCH_DLS2_CONN_DEST_EG2_HOLD = 0x0310,

  IPATCH_DLS2_CONN_DEST_FILTER_CUTOFF = 0x0500,
  IPATCH_DLS2_CONN_DEST_FILTER_Q = 0x0501
} IpatchDLS2ConnDestType;

IPATCH_DLS2_CONN_OUTPUT_TRANS_NONE

#define IPATCH_DLS2_CONN_OUTPUT_TRANS_NONE 0

enum IpatchDLS2ConnTransformType

typedef enum
{
  IPATCH_DLS2_CONN_TRANS_LINEAR = 0,
  IPATCH_DLS2_CONN_TRANS_CONCAVE = 1,
  IPATCH_DLS2_CONN_TRANS_CONVEX = 2,
  IPATCH_DLS2_CONN_TRANS_SWITCH = 3
} IpatchDLS2ConnTransformType;

enum IpatchDLS2ConnPolarityType

typedef enum
{
  IPATCH_DLS2_CONN_POLARITY_UNI = 0,
  IPATCH_DLS2_CONN_POLARITY_BI  = 1
} IpatchDLS2ConnPolarityType;

enum IpatchDLS2ConnTransformMasks

typedef enum
{
  IPATCH_DLS2_CONN_MASK_OUTPUT_TRANS = 0x000F, /* Output transform mask */
  IPATCH_DLS2_CONN_MASK_CTRLSRC_TRANS = 0x00F0,	/* Control transform mask */
  IPATCH_DLS2_CONN_MASK_CTRLSRC_POLARITY = 0x0100, /* Control polarity mask */
  IPATCH_DLS2_CONN_MASK_CTRLSRC_INVERT = 0x0200, /* Control invert mask */
  IPATCH_DLS2_CONN_MASK_SRC_TRANS = 0x3C00, /* Source transform mask */
  IPATCH_DLS2_CONN_MASK_SRC_POLARITY = 0x4000, /* Source polarity mask */
  IPATCH_DLS2_CONN_MASK_SRC_INVERT = 0x8000 /* Source invert mask */
} IpatchDLS2ConnTransformMasks;

enum IpatchDLS2ConnTransformShifts

typedef enum
{
  IPATCH_DLS2_CONN_SHIFT_OUTPUT_TRANS = 0, /* Output transform shift */
  IPATCH_DLS2_CONN_SHIFT_CTRLSRC_TRANS = 4, /* Control transform shift */
  IPATCH_DLS2_CONN_SHIFT_CTRLSRC_POLARITY = 8, /* Control polarity shift */
  IPATCH_DLS2_CONN_SHIFT_CTRLSRC_INVERT = 9, /* Control invert shift */
  IPATCH_DLS2_CONN_SHIFT_SRC_TRANS = 10, /* Source transform shift */
  IPATCH_DLS2_CONN_SHIFT_SRC_POLARITY = 14, /* Source polarity shift */
  IPATCH_DLS2_CONN_SHIFT_SRC_INVERT = 15 /* Source invert shift */
} IpatchDLS2ConnTransformShifts;

ipatch_dls2_conn_get_type ()

GType               ipatch_dls2_conn_get_type           (void);

Get the IpatchDLS2Conn boxed type

Returns :

Boxed GType of the IpatchDLS2Conn structure

ipatch_dls2_conn_new ()

IpatchDLS2Conn *    ipatch_dls2_conn_new                (void);

Create a new connection

Returns :

New connection

ipatch_dls2_conn_free ()

void                ipatch_dls2_conn_free               (IpatchDLS2Conn *conn);

Free an IpatchDLS2Conn structure

conn :

Connection to free, should not be referenced by any zones.

ipatch_dls2_conn_duplicate ()

IpatchDLS2Conn *    ipatch_dls2_conn_duplicate          (const IpatchDLS2Conn *conn);

Duplicate a connection

conn :

DLS connection to duplicate

Returns :

New duplicate connection

ipatch_dls2_conn_list_set ()

void                ipatch_dls2_conn_list_set           (GSList **list,
                                                         const IpatchDLS2Conn *conn);

Set a connection in a connection list. The connection list is searched for any existing identical connection (same source, control and destination). If an identical connection is found, its values are overwritten with the new values, otherwise a new connection is added to the list and the values copied to it.

list :

Pointer to the root pointer of a connection list

conn :

DLS connection to set in list

ipatch_dls2_conn_list_unset ()

void                ipatch_dls2_conn_list_unset         (GSList **list,
                                                         const IpatchDLS2Conn *conn);

Remove a connection from a connection list. The connection list is searched for an identical connection to conn (same source, control and destination). If a match is found, it is removed, otherwise nothing. This essentially sets a connection to its default value, for those connections which are defined.

list :

Pointer to the root pointer of a connection list

conn :

DLS connection to remove from list

ipatch_dls2_conn_list_duplicate ()

GSList *            ipatch_dls2_conn_list_duplicate     (const GSList *list);

Like ipatch_dls2_conn_list_duplicate() but optimized for speed, new list is backwards from original.

list :

GSList of IpatchDLS2Conn structures to duplicate

Returns :

New duplicate connection list which should be freed with ipatch_dls2_conn_list_free() when finished with it.

ipatch_dls2_conn_list_duplicate_fast ()

GSList *            ipatch_dls2_conn_list_duplicate_fast
                                                        (const GSList *list);

ipatch_dls2_conn_list_free ()

void                ipatch_dls2_conn_list_free          (GSList *list,
                                                         gboolean free_conns);

Free a list of connections

list :

Connection list to free

free_conns :

If TRUE then the connections themselves are freed, FALSE makes this function act just like g_slist_free() (only the list is freed not the connections).
libinstpatch-1.0.0/docs/reference/html/IpatchSF2VoiceCache.html0000644000175000017500000010336711461404255021306 00000000000000 IpatchSF2VoiceCache

IpatchSF2VoiceCache

IpatchSF2VoiceCache — SoundFont voice cache object

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchSF2Voice;
                    IpatchSF2VoiceUpdate;
                    IpatchSF2VoiceSelInfo;
void                (*IpatchSF2VoiceCacheItemFunc)      (IpatchSF2VoiceCache *cache,
                                                         GObject *item);
                    IpatchSF2VoiceCache;
int                 (*IpatchSF2VoiceCacheUpdateHandler) (IpatchSF2VoiceCache *cache,
                                                         int *select_values,
                                                         GObject *cache_item,
                                                         GObject *item,
                                                         GParamSpec *pspec,
                                                         const GValue *value,
                                                         IpatchSF2VoiceUpdate *updates,
                                                         guint max_updates);
enum                IpatchSF2VoiceSelType;
#define             IPATCH_SF2_VOICE_CACHE_MAX_SEL_VALUES
#define             IPATCH_SF2_VOICE_SEL_WILDCARD
#define             ipatch_sf2_voice_cache_declare_item (cache, item)
#define             IPATCH_SF2_VOICE_CACHE_GET_VOICE    (cache, index)
IpatchSF2VoiceCache * ipatch_sf2_voice_cache_new        (IpatchSF2VoiceSelInfo *info,
                                                         int sel_count);
void                ipatch_sf2_voice_cache_set_default_mods
                                                        (IpatchSF2VoiceCache *cache,
                                                         GSList *mods);
IpatchSF2Voice *    ipatch_sf2_voice_cache_add_voice    (IpatchSF2VoiceCache *cache);
void                ipatch_sf2_voice_cache_set_voice_range
                                                        (IpatchSF2VoiceCache *cache,
                                                         IpatchSF2Voice *voice,
                                                         guint sel_index,
                                                         int low,
                                                         int high);
void                ipatch_sf2_voice_set_sample_data    (IpatchSF2Voice *voice,
                                                         IpatchSampleData *sample_data);
gboolean            ipatch_sf2_voice_cache_sample_data  (IpatchSF2Voice *voice,
                                                         GError **err);
void                ipatch_sf2_voice_copy               (IpatchSF2Voice *dest,
                                                         IpatchSF2Voice *src);
void                ipatch_sf2_voice_cache_optimize     (IpatchSF2VoiceCache *cache);
int                 ipatch_sf2_voice_cache_select       (IpatchSF2VoiceCache *cache,
                                                         int *select_values,
                                                         guint16 *index_array,
                                                         guint16 max_indexes);
int                 ipatch_sf2_voice_cache_update       (IpatchSF2VoiceCache *cache,
                                                         int *select_values,
                                                         GObject *cache_item,
                                                         GObject *item,
                                                         GParamSpec *pspec,
                                                         const GValue *value,
                                                         IpatchSF2VoiceUpdate *updates,
                                                         guint max_updates);

Object Hierarchy

  GObject
   +----IpatchSF2VoiceCache

Description

This is used for pre-processing instruments into arrays of SoundFont compatible voices which can then be accessed very quickly without multi-thread locking or other issues (during synthesis for example).

Details

IpatchSF2Voice

typedef struct {
  /* Set by SF2VoiceCache converter via ipatch_sf2_voice_set_sample_data() */
  IpatchSampleData *sample_data;	/* sample data for voice */
  IpatchSampleStore *sample_store;	/* Cached store */
  guint32 sample_size;			/* size of sample in frames */

  /* Set by SF2VoiceCache converter */
  guint32 loop_start;		/* loop start offset (in samples) */
  guint32 loop_end;   /* loop end offset (in samples, 1st sample after loop) */
  guint32 rate;			/* sample rate */
  guint8 root_note;		/* MIDI root note of sample */
  gint8 fine_tune;		/* fine tune (in cents, -99 - 99) */
  guint16 reserved;		/* reserved (should be 0) */

  IpatchSF2GenArray gen_array;	/* generator effect values */
  GSList *mod_list;		/* modulator list */

  /* IpatchSF2VoiceCache user defined */
  gpointer user_data;           /* Arbitrary data defined by IpatchSF2VoiceCache user */

  /* Set internally */
  int range_index;  /* index in ranges array (int *) to first selection range */
} IpatchSF2Voice;

IpatchSF2VoiceUpdate

typedef struct {
  guint16 voice;	/* index of voice with parameter to update */

  union			/* new value for parameter */
  {
    gint16 ival;
    guint16 uval;
} IpatchSF2VoiceUpdate;

IpatchSF2VoiceSelInfo

typedef struct {
  IpatchSF2VoiceSelType type;
  int param1;
  int param2;				/* currently not used */
} IpatchSF2VoiceSelInfo;

IpatchSF2VoiceCacheItemFunc ()

void                (*IpatchSF2VoiceCacheItemFunc)      (IpatchSF2VoiceCache *cache,
                                                         GObject *item);

A callback function type which is called during voice cache population for each item which the voice cache is dependent on. This can be useful for determining when a voice cache needs to be updated or for real time effects.

cache :

Voice cache

item :

Item which voice cache is dependent on

IpatchSF2VoiceCache

typedef struct _IpatchSF2VoiceCache IpatchSF2VoiceCache;

IpatchSF2VoiceCacheUpdateHandler ()

int                 (*IpatchSF2VoiceCacheUpdateHandler) (IpatchSF2VoiceCache *cache,
                                                         int *select_values,
                                                         GObject *cache_item,
                                                         GObject *item,
                                                         GParamSpec *pspec,
                                                         const GValue *value,
                                                         IpatchSF2VoiceUpdate *updates,
                                                         guint max_updates);

Function prototype used to re-calculate SoundFont effect generators for a single object property change. Useful for real time effect changes.

cache :

Voice cache to get updates for

select_values :

The voice selection criteria to use, should be the same number of select values as in cache

cache_item :

Original item cache was created from

item :

Object for which a property changed

pspec :

Parameter specification of property which changed

value :

The new value of the property

updates :

Output array to store updates to

max_updates :

Size of updates array (max possible update values).

Returns :

Should return number of updates stored to updates array. Will be 0 if no updates required.

enum IpatchSF2VoiceSelType

typedef enum
{
  IPATCH_SF2_VOICE_SEL_NOTE,		/* MIDI note range */
  IPATCH_SF2_VOICE_SEL_VELOCITY,	/* MIDI velocity range */
  IPATCH_SF2_VOICE_SEL_AFTER_TOUCH,	/* MIDI aftertouch range */
  IPATCH_SF2_VOICE_SEL_MIDI_CC	/* MIDI custom controller (param1: ctrlnum) */
} IpatchSF2VoiceSelType;

IPATCH_SF2_VOICE_CACHE_MAX_SEL_VALUES

#define IPATCH_SF2_VOICE_CACHE_MAX_SEL_VALUES   32

IPATCH_SF2_VOICE_SEL_WILDCARD

#define IPATCH_SF2_VOICE_SEL_WILDCARD (G_MININT)

ipatch_sf2_voice_cache_declare_item()

#define             ipatch_sf2_voice_cache_declare_item(cache, item)

IPATCH_SF2_VOICE_CACHE_GET_VOICE()

#define             IPATCH_SF2_VOICE_CACHE_GET_VOICE(cache, index)

ipatch_sf2_voice_cache_new ()

IpatchSF2VoiceCache * ipatch_sf2_voice_cache_new        (IpatchSF2VoiceSelInfo *info,
                                                         int sel_count);

Create a new SoundFont voice cache object. The sel_count parameter defines the number of selection ranges for the cache. Examples of selection ranges include MIDI note and velocity ranges for a voice. The info parameter should be a pointer to an array of selection info structures which describes each selection type.

info :

Array of selection info structures (length should be sel_count), use NULL for default selection info (MIDI note and velocity)

sel_count :

Count of selection ranges for this cache (ignored if info is NULL)

Returns :

New SoundFont voice cache with a reference count of 1 which the caller owns.

ipatch_sf2_voice_cache_set_default_mods ()

void                ipatch_sf2_voice_cache_set_default_mods
                                                        (IpatchSF2VoiceCache *cache,
                                                         GSList *mods);

Set the default modulator list for the voice cache. Modulator list is used directly and the allocation of the list is taken over by the voice cache.

cache :

Voice cache

mods :

SoundFont modulator list to use as default (used directly)

ipatch_sf2_voice_cache_add_voice ()

IpatchSF2Voice *    ipatch_sf2_voice_cache_add_voice    (IpatchSF2VoiceCache *cache);

Adds a new initialized voice to a SoundFont voice cache.

cache :

Voice cache to create voice for

Returns :

Newly allocated and initialized SoundFont voice structure. The sample pointer is set to NULL, generator array is initialized to default absolute unset values, selection ranges are set to G_MININT-G_MAXINT and all other fields are initialized to defaults.

ipatch_sf2_voice_cache_set_voice_range ()

void                ipatch_sf2_voice_cache_set_voice_range
                                                        (IpatchSF2VoiceCache *cache,
                                                         IpatchSF2Voice *voice,
                                                         guint sel_index,
                                                         int low,
                                                         int high);

Set a voice selection range. Selection ranges are used for selection criteria such as MIDI velocity and note ranges.

cache :

Voice cache object

voice :

Voice pointer in cache

sel_index :

Selection index

low :

Range low value

high :

Range high value

ipatch_sf2_voice_set_sample_data ()

void                ipatch_sf2_voice_set_sample_data    (IpatchSF2Voice *voice,
                                                         IpatchSampleData *sample_data);

Assign sample data to a SoundFont voice.

voice :

SoundFont voice structure

sample_data :

Sample data to assign to voice

err :

Location to store error info or NULL to ignore

ipatch_sf2_voice_cache_sample_data ()

gboolean            ipatch_sf2_voice_cache_sample_data  (IpatchSF2Voice *voice,
                                                         GError **err);

Cache an already assigned sample data object of a voice. The sample data is cached as 16 bit mono native endian format, if not already cached, and the new cached sample is assigned to the sample_store field.

voice :

SoundFont voice structure

err :

Location to store error info or NULL to ignore

Returns :

TRUE on success, FALSE otherwise (in which case err may be set)

ipatch_sf2_voice_copy ()

void                ipatch_sf2_voice_copy               (IpatchSF2Voice *dest,
                                                         IpatchSF2Voice *src);

Copy a source (src) voice's information to a destination voice (dest). Does not copy selection criteria integers in parent IpatchSF2VoiceCache objects.

dest :

Destination voice to copy to (initialized to 0s or already valid)

src :

Source voice to copy from

ipatch_sf2_voice_cache_optimize ()

void                ipatch_sf2_voice_cache_optimize     (IpatchSF2VoiceCache *cache);

Can be called after all voices have been added to a voice cache. Will optimize voice cache for use with ipatch_sf2_voice_cache_select(). NOTE: Currently does nothing, but will in the future..

cache :

SoundFont voice cache

ipatch_sf2_voice_cache_select ()

int                 ipatch_sf2_voice_cache_select       (IpatchSF2VoiceCache *cache,
                                                         int *select_values,
                                                         guint16 *index_array,
                                                         guint16 max_indexes);

Stores pointers to voices matching select_values criteria.

cache :

SoundFont voice cache

select_values :

Array of select values which must be the same length as the voice cache was initialized with. Each selection value is tested against each voice's selection ranges (use IPATCH_SF2_VOICE_SEL_WILDCARD as a wildcard selection value).

index_array :

Voice indexes are stored in this array.

max_indexes :

Maximum number of voices to match. index_array should be at least this value in size.

Returns :

Number of indexes stored to index_array.

ipatch_sf2_voice_cache_update ()

int                 ipatch_sf2_voice_cache_update       (IpatchSF2VoiceCache *cache,
                                                         int *select_values,
                                                         GObject *cache_item,
                                                         GObject *item,
                                                         GParamSpec *pspec,
                                                         const GValue *value,
                                                         IpatchSF2VoiceUpdate *updates,
                                                         guint max_updates);
libinstpatch-1.0.0/docs/reference/html/IpatchSampleStoreSndFile.html0000644000175000017500000004622611461404255022505 00000000000000 IpatchSampleStoreSndFile

IpatchSampleStoreSndFile

IpatchSampleStoreSndFile — Sample store object type which uses libsndfile to access audio in sound files

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSampleStore
               +----IpatchSampleStoreSndFile

Implemented Interfaces

IpatchSampleStoreSndFile implements IpatchSample.

Properties

  "endian"                   IpatchSndFileEndian   : Read / Write
  "file-format"              IpatchSndFileFormat   : Read / Write
  "file-name"                gchar*                : Read / Write
  "fine-tune"                gint                  : Read / Write
  "loop-end"                 guint                 : Read / Write
  "loop-start"               guint                 : Read / Write
  "loop-type"                IpatchSampleLoopType  : Read / Write
  "root-note"                gint                  : Read / Write
  "sub-format"               IpatchSndFileSubFormat  : Read / Write

Description

Details

IpatchSampleStoreSndFile

typedef struct _IpatchSampleStoreSndFile IpatchSampleStoreSndFile;

IPATCH_SAMPLE_STORE_SND_FILE_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_STORE_SND_FILE_UNUSED_FLAG_SHIFT

ipatch_sample_store_snd_file_new ()

IpatchSample *      ipatch_sample_store_snd_file_new    (const char *filename);

Creates a new libsndfile sample store. ipatch_sample_store_snd_file_init_read() or ipatch_sample_store_snd_file_init_write() must be called, depending on audio file mode, prior to opening the sample.

filename :

File name to assign to the new libsndfile sample store

Returns :

New libsndfile sample store, cast as a IpatchSample for convenience.

ipatch_sample_store_snd_file_init_read ()

gboolean            ipatch_sample_store_snd_file_init_read
                                                        (IpatchSampleStoreSndFile *store);

Initialize a libsndfile sample store for reading. Should be called prior to opening the sample store and after the filename has been assigned. Fills in the "file-format", "sub-format", "endian", "sample-rate" and "sample-size" information properties. In addition the "sample-format" property is set to a value for optimal loading of the audio data (least amount of conversion necessary to yield uncompressed PCM audio), which will be the audio format of the sample store.

store :

libsndfile sample store

Returns :

TRUE on success, FALSE otherwise

ipatch_sample_store_snd_file_init_write ()

gboolean            ipatch_sample_store_snd_file_init_write
                                                        (IpatchSampleStoreSndFile *store,
                                                         int file_format,
                                                         int sub_format,
                                                         int endian,
                                                         int channels,
                                                         int samplerate);

Initialize a libsndfile sample store for writing. Should be called prior to opening the sample store. The "file-format", "sub-format", "endian" and "sample-rate" properties will be assigned the provided values. In addition the "sample-format" property is set to a value for optimal writing of the audio data (including the channels value), which will be the audio format of the sample store.

store :

libsndfile sample store

file_format :

libsndfile file format type (GEnum "IpatchSndFileFormat")

sub_format :

libsndfile audio format type (GEnum "IpatchSndFileSubFormat")

endian :

libsndfile endian selection (IpatchSampleStoreSndFileEndian)

channels :

Number of channels (1-8, 1=mono, 2=stereo, etc)

samplerate :

Audio sample rate

Returns :

TRUE if format variables are valid, FALSE otherwise

Property Details

The "endian" property

  "endian"                   IpatchSndFileEndian   : Read / Write

Endian byte order of file.

Default value: IPATCH_SND_FILE_ENDIAN_FILE


The "file-format" property

  "file-format"              IpatchSndFileFormat   : Read / Write

File format.

Default value: wav


The "file-name" property

  "file-name"                gchar*                : Read / Write

File name.

Default value: NULL


The "fine-tune" property

  "fine-tune"                gint                  : Read / Write

Fine tuning in cents.

Allowed values: [-99,99]

Default value: 0


The "loop-end" property

  "loop-end"                 guint                 : Read / Write

Loop end in frames (after loop).

Default value: 0


The "loop-start" property

  "loop-start"               guint                 : Read / Write

Start of loop in frames.

Default value: 0


The "loop-type" property

  "loop-type"                IpatchSampleLoopType  : Read / Write

Loop method type.

Default value: IPATCH_SAMPLE_LOOP_NONE


The "root-note" property

  "root-note"                gint                  : Read / Write

Root MIDI note.

Allowed values: [0,127]

Default value: 60


The "sub-format" property

  "sub-format"               IpatchSndFileSubFormat  : Read / Write

File sub audio format.

Default value: Signed 16 bit PCM

libinstpatch-1.0.0/docs/reference/html/IpatchVirtualContainer.html0000644000175000017500000001547611461404255022276 00000000000000 IpatchVirtualContainer

IpatchVirtualContainer

IpatchVirtualContainer — Virtual container object

Stability Level

Stable, unless otherwise indicated

Synopsis

#define             IPATCH_VIRTUAL_CONTAINER_CREATE     (type_under, TypeCase, name, blurb, childtype)
                    IpatchVirtualContainer;
void                (*IpatchVirtualContainerConformFunc)
                                                        (GObject *object);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchVirtualContainer

Description

Virtual containers are used in user interfaces to group items in containers that aren't actually present in the hierarchy, such as "Instruments", "Melodic Presets", "Percussion Presets" in SF2 files.

Details

IPATCH_VIRTUAL_CONTAINER_CREATE()

#define             IPATCH_VIRTUAL_CONTAINER_CREATE(type_under, TypeCase, name, blurb, childtype)

type_under :

Type string in the form "type_name"

TypeCase :

Type string in the form "TypeName"

name :

Name type property

blurb :

Blurb type property (more detailed description)

childtype :

Child type of this virtual container type

IpatchVirtualContainer

typedef struct _IpatchVirtualContainer IpatchVirtualContainer;

IpatchVirtualContainerConformFunc ()

void                (*IpatchVirtualContainerConformFunc)
                                                        (GObject *object);

A function type used to make an item conform to the criteria of a virtual container (force a SoundFont preset to be a percussion preset for example).

object :

Object to conform to a virtual container criteria.
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchSF2ModItem.html0000644000175000017500000004462411461404255023335 00000000000000 IpatchSF2ModItem

IpatchSF2ModItem

IpatchSF2ModItem — SoundFont modulator item interface

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GInterface
   +----IpatchSF2ModItemIface

Prerequisites

IpatchSF2ModItemIface requires IpatchItem.

Known Implementations

IpatchSF2ModItemIface is implemented by IpatchSF2Inst, IpatchSF2Zone, IpatchSF2PZone, IpatchSF2IZone and IpatchSF2Preset.

Properties

  "modulators"               IpatchSF2ModList*     : Read / Write

Description

An interface type which is used by IpatchSF2Preset, IpatchSF2Inst, IpatchSF2PZone and IpatchSF2IZone objects to add modulator realtime effect functionality.

Details

IpatchSF2ModItem

typedef IpatchItem IpatchSF2ModItem;

IpatchSF2ModItemIface

typedef struct _IpatchSF2ModItemIface IpatchSF2ModItemIface;

ipatch_sf2_mod_item_add()

#define             ipatch_sf2_mod_item_add(item, mod)

ipatch_sf2_mod_item_get_mods ()

GSList *            ipatch_sf2_mod_item_get_mods        (IpatchSF2ModItem *item);

Gets a list of modulators from an item with modulators. List should be freed with ipatch_sf2_mod_list_free() (free_mods set to TRUE) when finished with it.

item :

Item with modulators

Returns :

New list of modulators (IpatchSF2Mod) in item or NULL if no modulators. Remember to free it with ipatch_sf2_mod_list_free() when finished.

ipatch_sf2_mod_item_set_mods ()

void                ipatch_sf2_mod_item_set_mods        (IpatchSF2ModItem *item,
                                                         GSList *mod_list,
                                                         int flags);

Sets the complete modulator list of an item with modulators. If IPATCH_SF2_MOD_NO_NOTIFY is not in flags then IpatchItem property notify is done.

item :

Item with modulators

mod_list :

Modulator list to assign to zone.

flags :

Flags for controlling list duplication and item property notification (IpatchSF2ModFlags). If IPATCH_SF2_MOD_NO_DUPLICATE is set then ownership of mod_list is taken over (not duplicated). If IPATCH_SF2_MOD_NO_NOTIFY is set, then item property notify will not be done.

ipatch_sf2_mod_item_insert ()

void                ipatch_sf2_mod_item_insert          (IpatchSF2ModItem *item,
                                                         const IpatchSF2Mod *mod,
                                                         int pos);

Inserts a modulator into an item's modulator list. Does not check for duplicates! The modulator is not used directly, a new one is created and the values in mod are copied to it. An IpatchItem property notify is done.

item :

Item with modulators

mod :

Modulator to insert (a new modulator is created and the values are copied to it)

pos :

Index position in zone's modulator list to insert (0 = first, < 0 = last)

ipatch_sf2_mod_item_remove ()

void                ipatch_sf2_mod_item_remove          (IpatchSF2ModItem *item,
                                                         const IpatchSF2Mod *mod);

Remove a modulator from an item with modulators. The modulator values in mod are used to search the modulator list. The first modulator that matches all fields in mod is removed. An IpatchItem property notify is done.

item :

Item with modulators

mod :

Matching values of modulator to remove

ipatch_sf2_mod_item_change ()

void                ipatch_sf2_mod_item_change          (IpatchSF2ModItem *item,
                                                         const IpatchSF2Mod *oldmod,
                                                         const IpatchSF2Mod *newmod);

Sets the values of an existing modulator in an item with modulators. The modulator list in item is searched for a modulator that matches the values in oldmod. If a modulator is found its values are set to those in newmod. If it is not found, nothing is done. If change occurs IpatchItem property notify is done.

item :

Item with modulators

oldmod :

Current values of modulator to set

newmod :

New modulator values

ipatch_sf2_mod_item_count ()

guint               ipatch_sf2_mod_item_count           (IpatchSF2ModItem *item);

Count number of modulators in an item with modulators.

item :

Item with modulators

Returns :

Count of modulators

Property Details

The "modulators" property

  "modulators"               IpatchSF2ModList*     : Read / Write

Modulators.

libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchSF2Mod.html0000644000175000017500000007621111461404255022513 00000000000000 IpatchSF2Mod

IpatchSF2Mod

IpatchSF2Mod — SoundFont modulators

Stability Level

Stable, unless otherwise indicated

Description

SoundFont modulators are used to define real time MIDI effect controls.

Details

IpatchSF2Mod

typedef struct {
  guint16 src;			/* source modulator (MIDI controller, etc) */
  guint16 dest;			/* destination generator */
  gint16 amount;		/* degree of modulation */
  guint16 amtsrc;		/* second source controls amount of first */
  guint16 trans;		/* transform function applied to source */
} IpatchSF2Mod;

IpatchSF2ModList

typedef GSList IpatchSF2ModList;

IPATCH_TYPE_SF2_MOD

#define IPATCH_TYPE_SF2_MOD   (ipatch_sf2_mod_get_type ())

IPATCH_TYPE_SF2_MOD_LIST

#define IPATCH_TYPE_SF2_MOD_LIST   (ipatch_sf2_mod_list_get_type ())

IPATCH_SF2_MOD_ARE_IDENTICAL()

#define             IPATCH_SF2_MOD_ARE_IDENTICAL(a, b)

IPATCH_SF2_MOD_ARE_IDENTICAL_AMOUNT()

#define             IPATCH_SF2_MOD_ARE_IDENTICAL_AMOUNT(a, b)

enum IpatchSF2ModFieldMasks

typedef enum
{
  IPATCH_SF2_MOD_MASK_CONTROL = 0x007F,
  IPATCH_SF2_MOD_MASK_CC = 0x0080,
  IPATCH_SF2_MOD_MASK_DIRECTION = 0x0100,
  IPATCH_SF2_MOD_MASK_POLARITY = 0x0200,
  IPATCH_SF2_MOD_MASK_TYPE = 0xFC00
} IpatchSF2ModFieldMasks;

enum IpatchSF2ModFieldShifts

typedef enum
{
  IPATCH_SF2_MOD_SHIFT_CONTROL = 0,
  IPATCH_SF2_MOD_SHIFT_CC = 7,
  IPATCH_SF2_MOD_SHIFT_DIRECTION = 8,
  IPATCH_SF2_MOD_SHIFT_POLARITY = 9,
  IPATCH_SF2_MOD_SHIFT_TYPE = 10
} IpatchSF2ModFieldShifts;

enum IpatchSF2ModControl

typedef enum
{
  IPATCH_SF2_MOD_CONTROL_NONE = 0,
  IPATCH_SF2_MOD_CONTROL_NOTE_ON_VELOCITY = 2,
  IPATCH_SF2_MOD_CONTROL_NOTE_NUMBER = 3,
  IPATCH_SF2_MOD_CONTROL_POLY_PRESSURE = 10,
  IPATCH_SF2_MOD_CONTROL_CHAN_PRESSURE = 13,
  IPATCH_SF2_MOD_CONTROL_PITCH_WHEEL = 14,
  IPATCH_SF2_MOD_CONTROL_BEND_RANGE = 16
} IpatchSF2ModControl;

enum IpatchSF2ModControlPalette

typedef enum
{
  IPATCH_SF2_MOD_CC_GENERAL = (0 << IPATCH_SF2_MOD_SHIFT_CC),
  IPATCH_SF2_MOD_CC_MIDI = (1 << IPATCH_SF2_MOD_SHIFT_CC)
} IpatchSF2ModControlPalette;

enum IpatchSF2ModDirection

typedef enum
{
  IPATCH_SF2_MOD_DIRECTION_POSITIVE = (0 << IPATCH_SF2_MOD_SHIFT_DIRECTION),
  IPATCH_SF2_MOD_DIRECTION_NEGATIVE = (1 << IPATCH_SF2_MOD_SHIFT_DIRECTION)
} IpatchSF2ModDirection;

enum IpatchSF2ModPolarity

typedef enum
{
  IPATCH_SF2_MOD_POLARITY_UNIPOLAR = (0 << IPATCH_SF2_MOD_SHIFT_POLARITY),
  IPATCH_SF2_MOD_POLARITY_BIPOLAR = (1 << IPATCH_SF2_MOD_SHIFT_POLARITY)
} IpatchSF2ModPolarity;

enum IpatchSF2ModType

typedef enum
{
  IPATCH_SF2_MOD_TYPE_LINEAR = (0 << IPATCH_SF2_MOD_SHIFT_TYPE),
  IPATCH_SF2_MOD_TYPE_CONCAVE = (1 << IPATCH_SF2_MOD_SHIFT_TYPE),
  IPATCH_SF2_MOD_TYPE_CONVEX = (2 << IPATCH_SF2_MOD_SHIFT_TYPE),
  IPATCH_SF2_MOD_TYPE_SWITCH = (3 << IPATCH_SF2_MOD_SHIFT_TYPE)
} IpatchSF2ModType;

enum IpatchSF2ModTransform

typedef enum
{
  IPATCH_SF2_MOD_TRANSFORM_LINEAR = 0
} IpatchSF2ModTransform;

enum IpatchSF2ModFlags

typedef enum
{
  IPATCH_SF2_MOD_NO_DUPLICATE	= 1 << 0,  /* don't duplicate mod list (owned!) */
  IPATCH_SF2_MOD_NO_NOTIFY	= 1 << 1   /* don't do item property notify */
} IpatchSF2ModFlags;

ipatch_sf2_mod_get_type ()

GType               ipatch_sf2_mod_get_type             (void);

ipatch_sf2_mod_list_get_type ()

GType               ipatch_sf2_mod_list_get_type        (void);

ipatch_sf2_mod_new ()

IpatchSF2Mod *      ipatch_sf2_mod_new                  (void);

Create a new modulator

Returns :

New modulator

ipatch_sf2_mod_free ()

void                ipatch_sf2_mod_free                 (IpatchSF2Mod *mod);

Free an IpatchSF2Mod structure

mod :

Modulator to free, should not be referenced by any zones.

ipatch_sf2_mod_duplicate ()

IpatchSF2Mod *      ipatch_sf2_mod_duplicate            (const IpatchSF2Mod *mod);

Duplicate a modulator

mod :

Modulator to duplicate

Returns :

New duplicate modulator

ipatch_sf2_mod_list_duplicate ()

GSList *            ipatch_sf2_mod_list_duplicate       (const GSList *list);

Duplicates a modulator list (GSList and modulator data).

list :

Modulator list to duplicate

Returns :

New duplicate modulator list which should be freed with ipatch_sf2_mod_list_free() with free_mods set to TRUE when finished with it.

ipatch_sf2_mod_list_override ()

GSList *            ipatch_sf2_mod_list_override        (const GSList *alist,
                                                         const GSList *blist,
                                                         gboolean copy);

Creates a new modulator list by combining alist and blist. Modulators in blist override identical modulators in alist. If copy is set then the modulator data is also duplicated (a new GSList is created).

alist :

First modulator list

blist :

Second modulator list

copy :

If TRUE then modulator data is duplicated

Returns :

New GSList of combined modulator lists. Should be freed with ipatch_sf2_mod_list_free() with the free_mods parameter set to the value of copy.

ipatch_sf2_mod_list_boxed_free ()

void                ipatch_sf2_mod_list_boxed_free      (GSList *list);

ipatch_sf2_mod_list_insert ()

GSList *            ipatch_sf2_mod_list_insert          (GSList *mods,
                                                         const IpatchSF2Mod *modvals,
                                                         int pos);

Inserts a modulator into a modulator list. Does not check for duplicates! The modulator is not used directly, a new one is created and the values in mod are copied to it.

mods :

Modulator list to insert into

modvals :

Modulator values to insert (a new modulator is created and the values are copied to it)

pos :

Index position in zone's modulator list to insert (0 = first, < 0 = last)

Returns :

New start (root) of mods list.

ipatch_sf2_mod_list_remove ()

GSList *            ipatch_sf2_mod_list_remove          (GSList *mods,
                                                         const IpatchSF2Mod *modvals,
                                                         gboolean *changed);

Remove a modulator from a modulator list. The modulator values in modvals are used to search the modulator list. The first modulator that matches all fields in modvals is removed.

mods :

Modulator list to remove from

modvals :

Values of modulator to remove

changed :

Pointer to store bool of whether the list was changed (NULL to ignore)

ipatch_sf2_mod_list_change ()

gboolean            ipatch_sf2_mod_list_change          (GSList *mods,
                                                         const IpatchSF2Mod *oldvals,
                                                         const IpatchSF2Mod *newvals);

Sets the values of an existing modulator in a modulator list. The list is searched for a modulator that matches the values in oldvals. If a modulator is found its values are set to those in newvals. If it is not found, nothing is done.

mods :

Modulator list to change a modulator in

oldvals :

Current values of modulator to set

newvals :

New modulator values

Returns :

TRUE if changed, FALSE otherwise (no match)

ipatch_sf2_mod_list_offset ()

GSList *            ipatch_sf2_mod_list_offset          (const GSList *alist,
                                                         const GSList *blist);

Creates a new modulator list by combining list and blist. Modulators in blist offset (amounts are added) identical modulators in alist. Operation is non-destructive as a new list is created and modulator data is duplicated.

NOTE: Optimized for empty blist.

alist :

First modulator list

blist :

Second modulator list

Returns :

New GSList of combined modulator lists. Should be freed with ipatch_sf2_mod_list_free() with free_mods set to TRUE when finished with it.

ipatch_sf2_mod_list_free ()

void                ipatch_sf2_mod_list_free            (GSList *list,
                                                         gboolean free_mods);

Like ipatch_sf2_mod_list_free() but used for boxed type declaration and so therefore frees all modulators in the list.

list :

Modulator list to free

ipatch_sf2_mod_list_get_default ()

const GSList *      ipatch_sf2_mod_list_get_default     (void);

Get the list of default instrument modulators.

Returns :

The list of default modulators. The same modulator list is returned on subsequent calls and should not be modified or freed.
libinstpatch-1.0.0/docs/reference/html/ch01.html0000644000175000017500000000576011461404255016402 00000000000000 Base objects and functions

Base objects and functions

IpatchItem — Abstract base item object
IpatchContainer — Abstract object type used for items containing other child items.
IpatchBase — Base instrument file object type
IpatchFile — File abstraction object
IpatchVirtualContainer — Virtual container object
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchUnit-DLS.html0000644000175000017500000004233211461404255023015 00000000000000 IpatchUnit_DLS

IpatchUnit_DLS

IpatchUnit_DLS — Unit types and conversions for DLS

Stability Level

Stable, unless otherwise indicated

Synopsis

#define             IPATCH_UNIT_DLS_ABS_TIME_0SECS
int                 ipatch_unit_dls_class_convert       (guint16 src_units,
                                                         const GValue *src_val);
double              ipatch_unit_dls_percent_to_percent  (int dls_percent);
int                 ipatch_unit_percent_to_dls_percent  (double percent);
double              ipatch_unit_dls_gain_to_decibels    (int dls_gain);
int                 ipatch_unit_decibels_to_dls_gain    (double db);
double              ipatch_unit_dls_abs_time_to_seconds (int dls_abs_time);
int                 ipatch_unit_seconds_to_dls_abs_time (double seconds);
double              ipatch_unit_dls_rel_time_to_time_cents
                                                        (int dls_rel_time);
int                 ipatch_unit_time_cents_to_dls_rel_time
                                                        (double time_cents);
double              ipatch_unit_dls_abs_pitch_to_hertz  (int dls_abs_pitch);
int                 ipatch_unit_hertz_to_dls_abs_pitch  (double hertz);
double              ipatch_unit_dls_rel_pitch_to_cents  (int dls_rel_pitch);
int                 ipatch_unit_cents_to_dls_rel_pitch  (double cents);

Description

Details

IPATCH_UNIT_DLS_ABS_TIME_0SECS

#define IPATCH_UNIT_DLS_ABS_TIME_0SECS 0x80000000L

ipatch_unit_dls_class_convert ()

int                 ipatch_unit_dls_class_convert       (guint16 src_units,
                                                         const GValue *src_val);

Converts a value to "DLS" units. DLS units are unit types that are used by DLS (Downloadable Sounds) patches. The IPATCH_UNIT_CLASS_DLS map is used to lookup the corresponding type to convert to. Only some types have an associated DLS type. It is an error to pass a src_units type that has no DLS mapping (note that this is contrary to the behavior of ipatch_unit_user_class_convert()).

src_units :

Source unit type ID

src_val :

Source value (type should be compatible with the source unit's value type)

Returns :

The value converted to DLS units.

ipatch_unit_dls_percent_to_percent ()

double              ipatch_unit_dls_percent_to_percent  (int dls_percent);

Convert value in DLS percent units to percent.

percent = dls_percent / (10 * 65536)

dls_percent :

Value in DLS percent units

Returns :

Value in percent

ipatch_unit_percent_to_dls_percent ()

int                 ipatch_unit_percent_to_dls_percent  (double percent);

Convert percent to DLS percent.

dls_percent = percent * 10 * 65536

percent :

Value in percent

Returns :

Converted integer in DLS percent

ipatch_unit_dls_gain_to_decibels ()

double              ipatch_unit_dls_gain_to_decibels    (int dls_gain);

Converts a value from DLS gain to decibels.

dls_gain = 200 * 65536 * log10 (V / v) decibels = 20 * log10 (V / v)

dls_gain :

Value in DLS gain units

Returns :

Value converted to decibels

ipatch_unit_decibels_to_dls_gain ()

int                 ipatch_unit_decibels_to_dls_gain    (double db);

Converts a value from decibels to DLS gain. See ipatch_unit_dls_gain_to_decibel()

db :

Value in decibels

Returns :

Value converted to DLS gain

ipatch_unit_dls_abs_time_to_seconds ()

double              ipatch_unit_dls_abs_time_to_seconds (int dls_abs_time);

Converts a value from DLS absolute time to seconds. seconds = 2^(dls_abs_time / (1200 * 65536))

0x80000000 is used as a 0 value.

dls_abs_time :

Value in DLS absolute time

Returns :

Value converted to seconds

ipatch_unit_seconds_to_dls_abs_time ()

int                 ipatch_unit_seconds_to_dls_abs_time (double seconds);

Converts a value from seconds to DLS absolute time. dls_rel_time = 1200 * log2 (seconds) * 65536

seconds :

Value in seconds

Returns :

Value converted to DLS relative time

ipatch_unit_dls_rel_time_to_time_cents ()

double              ipatch_unit_dls_rel_time_to_time_cents
                                                        (int dls_rel_time);

Converts a value from DLS relative time to time cents. time_cents = dls_rel_time / 65536

dls_rel_time :

Value in DLS relative time

Returns :

Value converted to time cents

ipatch_unit_time_cents_to_dls_rel_time ()

int                 ipatch_unit_time_cents_to_dls_rel_time
                                                        (double time_cents);

Converts a value from time_cents to DLS relative time. dls_rel_time = time_cents * 65536

time_cents :

Value in time cents

Returns :

Value converted to DLS relative time

ipatch_unit_dls_abs_pitch_to_hertz ()

double              ipatch_unit_dls_abs_pitch_to_hertz  (int dls_abs_pitch);

Converts a value from DLS absolute pitch to hertz. hertz = 440 * 2^((dls_abs_pitch / 65536 - 6900) / 1200)

dls_abs_pitch :

Value in DLS absolute pitch

Returns :

Value converted to hertz

ipatch_unit_hertz_to_dls_abs_pitch ()

int                 ipatch_unit_hertz_to_dls_abs_pitch  (double hertz);

Converts a value from hertz to DLS absolute pitch. dls_abs_pitch = (1200 * log2(hertz/440) + 6900) * 65536

hertz :

Value in hertz

Returns :

Value converted to DLS absolute pitch

ipatch_unit_dls_rel_pitch_to_cents ()

double              ipatch_unit_dls_rel_pitch_to_cents  (int dls_rel_pitch);

Converts a value from DLS relative pitch to cents. cents = dls_rel_pitch / 65536

dls_rel_pitch :

Value in DLS relative pitch

Returns :

Value converted to cents

ipatch_unit_cents_to_dls_rel_pitch ()

int                 ipatch_unit_cents_to_dls_rel_pitch  (double cents);

Converts a value from cents to DLS relative pitch. dls_rel_pitch = cents * 65536

cents :

Value in cents

Returns :

Value converted to DLS relative pitch
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchSF2Gen.html0000644000175000017500000012400611461404255022501 00000000000000 IpatchSF2Gen

IpatchSF2Gen

IpatchSF2Gen — SoundFont generator functions and definitions

Stability Level

Stable, unless otherwise indicated

Synopsis

#define             IPATCH_SF2_GEN_COUNT
                    IpatchSF2GenArray;
                    IpatchSF2GenInfo;
#define             IPATCH_TYPE_SF2_GEN_ARRAY
enum                IpatchSF2GenPropsType;
#define             IPATCH_SF2_GEN_PROPS_GLOBAL_FLAG
#define             IPATCH_SF2_GEN_PROPS_MASK
union               IpatchSF2GenAmount;
struct              IpatchSF2Gen;
#define             IPATCH_SF2_GENID_SET                (genid)
#define             IPATCH_SF2_GEN_ARRAY_TEST_FLAG      (array, genid)
#define             IPATCH_SF2_GEN_ARRAY_SET_FLAG       (array, genid)
#define             IPATCH_SF2_GEN_ARRAY_CLEAR_FLAG     (array, genid)
enum                IpatchSF2GenType;
enum                IpatchSF2GenSampleModes;
extern              IpatchSF2GenArray *ipatch_sf2_gen_ofs_array;
extern              IpatchSF2GenArray *ipatch_sf2_gen_abs_array;
extern              guint64 ipatch_sf2_gen_ofs_valid_mask;
extern              guint64 ipatch_sf2_gen_abs_valid_mask;
extern              guint64 ipatch_sf2_gen_add_mask;
gboolean            ipatch_sf2_gen_is_valid             (guint genid,
                                                         IpatchSF2GenPropsType propstype);
GType               ipatch_sf2_gen_array_get_type       (void);
IpatchSF2GenArray * ipatch_sf2_gen_array_new            (gboolean clear);
void                ipatch_sf2_gen_array_free           (IpatchSF2GenArray *genarray);
IpatchSF2GenArray * ipatch_sf2_gen_array_duplicate      (const IpatchSF2GenArray *array);
void                ipatch_sf2_gen_array_init           (IpatchSF2GenArray *array,
                                                         gboolean offset,
                                                         gboolean set);
gboolean            ipatch_sf2_gen_array_offset         (IpatchSF2GenArray *abs_array,
                                                         const IpatchSF2GenArray *ofs_array);
gboolean            ipatch_sf2_gen_array_intersect_test (const IpatchSF2GenArray *array1,
                                                         const IpatchSF2GenArray *array2);
guint               ipatch_sf2_gen_array_count_set      (IpatchSF2GenArray *array);
void                ipatch_sf2_gen_amount_to_value      (guint genid,
                                                         const IpatchSF2GenAmount *amt,
                                                         GValue *value);
void                ipatch_sf2_gen_default_value        (guint genid,
                                                         gboolean ispreset,
                                                         IpatchSF2GenAmount *out_amt);
gboolean            ipatch_sf2_gen_offset               (guint genid,
                                                         IpatchSF2GenAmount *dst,
                                                         const IpatchSF2GenAmount *ofs);
void                ipatch_sf2_gen_clamp                (guint genid,
                                                         int *sfval,
                                                         gboolean ispreset);
gboolean            ipatch_sf2_gen_range_intersect      (IpatchSF2GenAmount *dst,
                                                         const IpatchSF2GenAmount *src);
gboolean            ipatch_sf2_gen_range_intersect_test (const IpatchSF2GenAmount *amt1,
                                                         const IpatchSF2GenAmount *amt2);
const char *        ipatch_sf2_gen_get_prop_name        (guint genid);

Description

SoundFont generators are synthesis parameters used by IpatchSF2Preset, IpatchSF2Inst, IpatchSF2PZone and IpatchSF2IZone objects.

Details

IPATCH_SF2_GEN_COUNT

#define IPATCH_SF2_GEN_COUNT 59

IpatchSF2GenArray

typedef struct {
  guint64 flags; /* 1 bit for each generator indicating if it is set */
  IpatchSF2GenAmount values[IPATCH_SF2_GEN_COUNT]; /* gen values */
} IpatchSF2GenArray;

IpatchSF2GenInfo

typedef struct {
  IpatchSF2GenAmount min;	/* minimum value allowed */
  IpatchSF2GenAmount max;	/* maximum value allowed */
  IpatchSF2GenAmount def;	/* default value */
  gint16 unit;			/* #IpatchUnitType type */
  char *label;			/* short descriptive label */
  char *descr;			/* more complete description */
} IpatchSF2GenInfo;

IPATCH_TYPE_SF2_GEN_ARRAY

#define IPATCH_TYPE_SF2_GEN_ARRAY   (ipatch_sf2_gen_array_get_type ())

enum IpatchSF2GenPropsType

typedef enum
{
  IPATCH_SF2_GEN_PROPS_INST = 0,	/* instrument "absolute" properties */
  IPATCH_SF2_GEN_PROPS_PRESET = 1,	/* preset "offset" properties */
  IPATCH_SF2_GEN_PROPS_INST_GLOBAL = 2,	/* inst properties with no sample link */
  IPATCH_SF2_GEN_PROPS_PRESET_GLOBAL = 3  /* preset props with no inst link */
} IpatchSF2GenPropsType;

Generator property type (defines which gens are valid and their ranges). Note that TRUE/FALSE can be used to designate PRESET/INST (backwards compatible with previous function). Also note that global properties can be treated as a flag: IPATCH_SF2_GEN_PROPS_GLOBAL_FLAG.


IPATCH_SF2_GEN_PROPS_GLOBAL_FLAG

#define IPATCH_SF2_GEN_PROPS_GLOBAL_FLAG	0x02

IPATCH_SF2_GEN_PROPS_MASK

#define IPATCH_SF2_GEN_PROPS_MASK		0x01

union IpatchSF2GenAmount

union IpatchSF2GenAmount
{
  /*< public >*/
  gint16 sword;			/* signed 16 bit value */
  guint16 uword;		/* unsigned 16 bit value */
  struct
  {
    guint8 low;			/* low value of range */
    guint8 high;		/* high value of range */
  } range;			/* range values, low - high */
};

struct IpatchSF2Gen

struct IpatchSF2Gen {
  guint16 id;			/* generator #IPGenType ID */
  IpatchSF2GenAmount amount;	/* generator value */
};

IPATCH_SF2_GENID_SET()

#define IPATCH_SF2_GENID_SET(genid) ((guint64)0x1 << (genid))

IPATCH_SF2_GEN_ARRAY_TEST_FLAG()

#define             IPATCH_SF2_GEN_ARRAY_TEST_FLAG(array, genid)

IPATCH_SF2_GEN_ARRAY_SET_FLAG()

#define             IPATCH_SF2_GEN_ARRAY_SET_FLAG(array, genid)

IPATCH_SF2_GEN_ARRAY_CLEAR_FLAG()

#define             IPATCH_SF2_GEN_ARRAY_CLEAR_FLAG(array, genid)

enum IpatchSF2GenType

typedef enum
{
  IPATCH_SF2_GEN_SAMPLE_START = 0, /* sample start offset */
  IPATCH_SF2_GEN_SAMPLE_END = 1,	/* sample end offset */
  IPATCH_SF2_GEN_SAMPLE_LOOP_START = 2,/* sample loop start offset */
  IPATCH_SF2_GEN_SAMPLE_LOOP_END = 3, /* sample loop end offset */
  IPATCH_SF2_GEN_SAMPLE_COARSE_START = 4, /* sample start coarse offset */
  IPATCH_SF2_GEN_MOD_LFO_TO_PITCH = 5, /* modulation LFO to pitch */
  IPATCH_SF2_GEN_VIB_LFO_TO_PITCH = 6, /* vibrato LFO to pitch */
  IPATCH_SF2_GEN_MOD_ENV_TO_PITCH = 7, /* modulation envelope to pitch */
  IPATCH_SF2_GEN_FILTER_CUTOFF = 8,	/* initial filter cutoff */
  IPATCH_SF2_GEN_FILTER_Q = 9,	/* filter Q */
  IPATCH_SF2_GEN_MOD_LFO_TO_FILTER_CUTOFF = 10, /* mod LFO to filter cutoff */
  IPATCH_SF2_GEN_MOD_ENV_TO_FILTER_CUTOFF = 11, /* mod envelope to filter cutoff */
  IPATCH_SF2_GEN_SAMPLE_COARSE_END = 12, /* sample end course offset */
  IPATCH_SF2_GEN_MOD_LFO_TO_VOLUME = 13, /* modulation LFO to volume */
  IPATCH_SF2_GEN_UNUSED1 = 14,
  IPATCH_SF2_GEN_CHORUS = 15, /* chorus */
  IPATCH_SF2_GEN_REVERB = 16, /* reverb */
  IPATCH_SF2_GEN_PAN = 17,	/* panning */
  IPATCH_SF2_GEN_UNUSED2 = 18,
  IPATCH_SF2_GEN_UNUSED3 = 19,
  IPATCH_SF2_GEN_UNUSED4 = 20,
  IPATCH_SF2_GEN_MOD_LFO_DELAY = 21, /* modulation LFO delay */
  IPATCH_SF2_GEN_MOD_LFO_FREQ = 22, /* modulation LFO frequency */
  IPATCH_SF2_GEN_VIB_LFO_DELAY = 23, /* vibrato LFO delay */
  IPATCH_SF2_GEN_VIB_LFO_FREQ = 24, /* vibrato LFO frequency */
  IPATCH_SF2_GEN_MOD_ENV_DELAY = 25, /* modulation envelope delay */
  IPATCH_SF2_GEN_MOD_ENV_ATTACK = 26, /* modulation envelope attack */
  IPATCH_SF2_GEN_MOD_ENV_HOLD = 27, /* modulation envelope hold */
  IPATCH_SF2_GEN_MOD_ENV_DECAY = 28, /* modulation envelope decay */
  IPATCH_SF2_GEN_MOD_ENV_SUSTAIN = 29, /* modulation envelope sustain */
  IPATCH_SF2_GEN_MOD_ENV_RELEASE = 30, /* modulation envelope release */
  IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_HOLD = 31, /* MIDI note to mod envelope hold */
  IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_DECAY = 32, /* MIDI note to mod env decay */
  IPATCH_SF2_GEN_VOL_ENV_DELAY = 33, /* volume envelope delay */
  IPATCH_SF2_GEN_VOL_ENV_ATTACK = 34, /* volume envelope attack */
  IPATCH_SF2_GEN_VOL_ENV_HOLD = 35, /* volume envelope hold */
  IPATCH_SF2_GEN_VOL_ENV_DECAY = 36, /* volume envelope decay */
  IPATCH_SF2_GEN_VOL_ENV_SUSTAIN = 37, /* volume envelope sustain */
  IPATCH_SF2_GEN_VOL_ENV_RELEASE = 38, /* volume envelope release */
  IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_HOLD = 39, /* MIDI note to vol envelope hold */
  IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_DECAY = 40, /* MIDI note to volume env decay */
  IPATCH_SF2_GEN_INSTRUMENT_ID = 41, /* instrument ID */
  IPATCH_SF2_GEN_RESERVED1 = 42,
  IPATCH_SF2_GEN_NOTE_RANGE = 43,	/* note range */
  IPATCH_SF2_GEN_VELOCITY_RANGE = 44, /* note on velocity range */
  IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START = 45, /* sample coarse loop start */
  IPATCH_SF2_GEN_FIXED_NOTE = 46, /* MIDI fixed note */
  IPATCH_SF2_GEN_FIXED_VELOCITY = 47, /* MIDI fixed velocity */
  IPATCH_SF2_GEN_ATTENUATION = 48, /* initial volume attenuation */
  IPATCH_SF2_GEN_RESERVED2 = 49,
  IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END = 50, /* sample end loop course ofs */
  IPATCH_SF2_GEN_COARSE_TUNE = 51, /* course tuning */
  IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE = 52,	/* fine tune override */
  IPATCH_SF2_GEN_SAMPLE_ID = 53,	/* sample ID */
  IPATCH_SF2_GEN_SAMPLE_MODES = 54, /* sample flags (IpatchSF2GenSampleModes)*/
  IPATCH_SF2_GEN_RESERVED3 = 55,
  IPATCH_SF2_GEN_SCALE_TUNE = 56, /* scale tuning (tuning per MIDI note) */
  IPATCH_SF2_GEN_EXCLUSIVE_CLASS = 57, /* exclusive class (only 1 at a time) */
  IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE = 58	/* root note override */
} IpatchSF2GenType;

enum IpatchSF2GenSampleModes

typedef enum
{
  IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP = 0,
  IPATCH_SF2_GEN_SAMPLE_MODE_LOOP   = 1 << 0,
  IPATCH_SF2_GEN_SAMPLE_MODE_LOOP_RELEASE = 1 << 1
} IpatchSF2GenSampleModes;

ipatch_sf2_gen_ofs_array

extern IpatchSF2GenArray *ipatch_sf2_gen_ofs_array;

ipatch_sf2_gen_abs_array

extern IpatchSF2GenArray *ipatch_sf2_gen_abs_array;

ipatch_sf2_gen_ofs_valid_mask

extern guint64 ipatch_sf2_gen_ofs_valid_mask;

ipatch_sf2_gen_abs_valid_mask

extern guint64 ipatch_sf2_gen_abs_valid_mask;

ipatch_sf2_gen_add_mask

extern guint64 ipatch_sf2_gen_add_mask;

ipatch_sf2_gen_is_valid ()

gboolean            ipatch_sf2_gen_is_valid             (guint genid,
                                                         IpatchSF2GenPropsType propstype);

Checks if a generator is valid for the given propstype.

genid :

Generator ID to check

propstype :

Generator property type (instrument/preset + global)

Returns :

TRUE if valid, FALSE otherwise

ipatch_sf2_gen_array_get_type ()

GType               ipatch_sf2_gen_array_get_type       (void);

ipatch_sf2_gen_array_new ()

IpatchSF2GenArray * ipatch_sf2_gen_array_new            (gboolean clear);

Create a new generator array object. A convenience function really, because one could just allocate an IpatchSF2GenArray structure instead.

clear :

If TRUE then array will be cleared, FALSE will not initalize it and it is up to the caller to do so.

Returns :

New generator

ipatch_sf2_gen_array_free ()

void                ipatch_sf2_gen_array_free           (IpatchSF2GenArray *genarray);

ipatch_sf2_gen_array_duplicate ()

IpatchSF2GenArray * ipatch_sf2_gen_array_duplicate      (const IpatchSF2GenArray *array);

Duplicates a generator array structure.

array :

Generator array to duplicate

Returns :

A newly allocated generator array structure which is a duplicate of array.

ipatch_sf2_gen_array_init ()

void                ipatch_sf2_gen_array_init           (IpatchSF2GenArray *array,
                                                         gboolean offset,
                                                         gboolean set);

Initialize a generator array to default values.

array :

Generator array

offset :

TRUE = initialize to Preset offset (zero) values, FALSE = initialize to instrument default values

set :

TRUE to set flags indicating generator values are set, FALSE to clear all flag "set" bits

ipatch_sf2_gen_array_offset ()

gboolean            ipatch_sf2_gen_array_offset         (IpatchSF2GenArray *abs_array,
                                                         const IpatchSF2GenArray *ofs_array);

Offsets the generators amount array in abs_array by adding the values in ofs_array to it. Values are clamped to their valid ranges.

abs_array :

Destination generator amount array that contains absolute (Instrument) generator values

ofs_array :

Source generator amount array that contains offset (Preset) generator values

Returns :

FALSE if note or velocity range does not intersect (in which case the non-intersecting ranges are left unassigned), TRUE otherwise

ipatch_sf2_gen_array_intersect_test ()

gboolean            ipatch_sf2_gen_array_intersect_test (const IpatchSF2GenArray *array1,
                                                         const IpatchSF2GenArray *array2);

Checks if the note and velocity ranges in two generator arrays intersect.

array1 :

First generator amount array

array2 :

Second generator amount array

Returns :

TRUE if both ranges intersect, FALSE if one or both do not.

ipatch_sf2_gen_array_count_set ()

guint               ipatch_sf2_gen_array_count_set      (IpatchSF2GenArray *array);

Get count of "set" generators in a generator array.

array :

Generator array

Returns :

Count of "set" generators.

ipatch_sf2_gen_amount_to_value ()

void                ipatch_sf2_gen_amount_to_value      (guint genid,
                                                         const IpatchSF2GenAmount *amt,
                                                         GValue *value);

Converts a generator amount to a GValue. Value will be initialized to one of two types: G_TYPE_INT for signed/unsigned integers or IPATCH_TYPE_RANGE for velocity or note split ranges.

genid :

Generator ID

amt :

Generator amount for given genid

value :

Uninitialized GValue to set to amt

ipatch_sf2_gen_default_value ()

void                ipatch_sf2_gen_default_value        (guint genid,
                                                         gboolean ispreset,
                                                         IpatchSF2GenAmount *out_amt);

Get default value for a generator ID for the specified (ispreset) zone type.

genid :

Generator ID

ispreset :

TRUE for preset generators, FALSE for instrument

out_amt :

A pointer to store the default amount into

ipatch_sf2_gen_offset ()

gboolean            ipatch_sf2_gen_offset               (guint genid,
                                                         IpatchSF2GenAmount *dst,
                                                         const IpatchSF2GenAmount *ofs);

Offsets a generator amount. Result of offset is clamped to maximum and minimum values for the given generator ID. In the case of note or velocity ranges a return value of TRUE (clamped) means that the ranges don't intersect (contrary return value to other range related functions).

genid :

ID of Generator to offset. Must be a valid preset generator.

dst :

Pointer to the initial amount to offset, result is stored back into this parameter.

ofs :

Pointer to offset amount.

Returns :

TRUE if value was clamped, FALSE otherwise.

ipatch_sf2_gen_clamp ()

void                ipatch_sf2_gen_clamp                (guint genid,
                                                         int *sfval,
                                                         gboolean ispreset);

Clamp a generators value to its valid range.

genid :

Generator ID (IpatchSF2GenType)

sfval :

Generator value to clamp (changed in place)

ispreset :

TRUE if its a Preset generator, FALSE if Instrument

ipatch_sf2_gen_range_intersect ()

gboolean            ipatch_sf2_gen_range_intersect      (IpatchSF2GenAmount *dst,
                                                         const IpatchSF2GenAmount *src);

Find intersection of two generator ranges (common shared range). If ranges don't share anything in common dst is not assigned.

dst :

First generator amount range, result is also stored here

src :

Second generator amount range

Returns :

FALSE if ranges don't share any range in common.

ipatch_sf2_gen_range_intersect_test ()

gboolean            ipatch_sf2_gen_range_intersect_test (const IpatchSF2GenAmount *amt1,
                                                         const IpatchSF2GenAmount *amt2);

Test if two ranges intersect.

amt1 :

First generator amount range

amt2 :

Second generator amount range

Returns :

FALSE if ranges don't share any range in common, TRUE otherwise

ipatch_sf2_gen_get_prop_name ()

const char *        ipatch_sf2_gen_get_prop_name        (guint genid);

Get the GObject property name for a given generator ID.

genid :

Generator ID

Returns :

Property name or NULL if no property name for genid. The returned string is internal and should not be modified or freed.
libinstpatch-1.0.0/docs/reference/html/IpatchSampleStoreRom.html0000644000175000017500000001575011461404255021714 00000000000000 IpatchSampleStoreRom

IpatchSampleStoreRom

IpatchSampleStoreRom — Sample storage object for audio in ROM of a sound card

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSampleStore
               +----IpatchSampleStoreRom

Implemented Interfaces

IpatchSampleStoreRom implements IpatchSample.

Properties

  "location"                 guint                 : Read / Write

Description

Details

IpatchSampleStoreRom

typedef struct _IpatchSampleStoreRom IpatchSampleStoreRom;

ipatch_sample_store_rom_new ()

IpatchSample *      ipatch_sample_store_rom_new         (guint location);

Creates a new rom sample store. No data can actually be read or written from this store type. Its used only to keep track of ROM locations in older SoundFont files.

location :

Location in ROM

Returns :

New rom sample store, cast as an IpatchSample for convenience.

Property Details

The "location" property

  "location"                 guint                 : Read / Write

Sample data ROM location.

Default value: 0

libinstpatch-1.0.0/docs/reference/html/index.sgml0000644000175000017500000102217411461404255016753 00000000000000 libinstpatch-1.0.0/docs/reference/html/IpatchGigDimension.html0000644000175000017500000003162511461404255021353 00000000000000 IpatchGigDimension

IpatchGigDimension

IpatchGigDimension — GigaSampler dimension object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchGigDimension

Properties

  "name"                     gchar*                : Read / Write
  "split-count"              gint                  : Read / Write
  "type"                     IpatchGigDimensionType  : Read / Write

Description

Defines a GigaSampler dimension object which are the children of IpatchGigInst objects.

Details

enum IpatchGigDimensionType

typedef enum
{
  IPATCH_GIG_DIMENSION_NONE            = 0x00, /* not in use (is this in files?) */

  /* MIDI controllers - see IpatchGigControlType (IpatchGigEffects.h) */

  IPATCH_GIG_DIMENSION_MOD_WHEEL       = 0x01,
  IPATCH_GIG_DIMENSION_BREATH          = 0x02,
  IPATCH_GIG_DIMENSION_FOOT            = 0x04,
  IPATCH_GIG_DIMENSION_PORTAMENTO_TIME = 0x05,
  IPATCH_GIG_DIMENSION_EFFECT_1        = 0x0C,
  IPATCH_GIG_DIMENSION_EFFECT_2        = 0x0D,
  IPATCH_GIG_DIMENSION_GEN_PURPOSE_1   = 0x10,
  IPATCH_GIG_DIMENSION_GEN_PURPOSE_2   = 0x11,
  IPATCH_GIG_DIMENSION_GEN_PURPOSE_3   = 0x12,
  IPATCH_GIG_DIMENSION_GEN_PURPOSE_4   = 0x13,
  IPATCH_GIG_DIMENSION_SUSTAIN_PEDAL   = 0x40,
  IPATCH_GIG_DIMENSION_PORTAMENTO      = 0x41,
  IPATCH_GIG_DIMENSION_SOSTENUTO       = 0x42,
  IPATCH_GIG_DIMENSION_SOFT_PEDAL      = 0x43,
  IPATCH_GIG_DIMENSION_GEN_PURPOSE_5   = 0x50,
  IPATCH_GIG_DIMENSION_GEN_PURPOSE_6   = 0x51,
  IPATCH_GIG_DIMENSION_GEN_PURPOSE_7   = 0x52,
  IPATCH_GIG_DIMENSION_GEN_PURPOSE_8   = 0x53,
  IPATCH_GIG_DIMENSION_EFFECT_DEPTH_1  = 0x5B,
  IPATCH_GIG_DIMENSION_EFFECT_DEPTH_2  = 0x5C,
  IPATCH_GIG_DIMENSION_EFFECT_DEPTH_3  = 0x5D,
  IPATCH_GIG_DIMENSION_EFFECT_DEPTH_4  = 0x5E,
  IPATCH_GIG_DIMENSION_EFFECT_DEPTH_5  = 0x5F,

  IPATCH_GIG_DIMENSION_CHANNEL         = 0x80, /* sample has more than 1 channel */
  IPATCH_GIG_DIMENSION_LAYER           = 0x81, /* layer up to 8 zones (cross fade 2 or 4) */
  IPATCH_GIG_DIMENSION_VELOCITY        = 0x82, /* key velocity (only type that allows specific ranges) */
  IPATCH_GIG_DIMENSION_AFTER_TOUCH     = 0x83, /* channel MIDI after touch */
  IPATCH_GIG_DIMENSION_RELEASE_TRIG    = 0x84, /* trigger on key release */
  IPATCH_GIG_DIMENSION_KEYBOARD        = 0x85, /* key switching (FIXME WTF?) */
  IPATCH_GIG_DIMENSION_ROUND_ROBIN     = 0x86, /* selects zones in sequence */
  IPATCH_GIG_DIMENSION_RANDOM          = 0x87  /* selects random zone */
} IpatchGigDimensionType;

IPATCH_GIG_DIMENSION_TYPE_MAX

#define IPATCH_GIG_DIMENSION_TYPE_MAX   IPATCH_GIG_DIMENSION_RANDOM

IpatchGigDimension

typedef struct _IpatchGigDimension IpatchGigDimension;

ipatch_gig_dimension_new ()

IpatchGigDimension * ipatch_gig_dimension_new           (void);

Create a new GigaSampler instrument dimension.

Returns :

New GigaSampler dimension with a ref count of 1 which the caller owns.

ipatch_gig_dimension_first ()

IpatchGigDimension * ipatch_gig_dimension_first         (IpatchIter *iter);

Gets the first item in a dimension iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchGigDimension items

Returns :

The first dimension in iter or NULL if empty.

ipatch_gig_dimension_next ()

IpatchGigDimension * ipatch_gig_dimension_next          (IpatchIter *iter);

Gets the next item in a dimension iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchGigDimension items

Returns :

The next dimension in iter or NULL if at the end of the list.

Property Details

The "name" property

  "name"                     gchar*                : Read / Write

Dimension name.

Default value: NULL


The "split-count" property

  "split-count"              gint                  : Read / Write

Number of split bits.

Allowed values: [1,5]

Default value: 1


The "type" property

  "type"                     IpatchGigDimensionType  : Read / Write

Dimension type.

Default value: IPATCH_GIG_DIMENSION_NONE

See Also

#IpatchGigInst
libinstpatch-1.0.0/docs/reference/html/IpatchSampleStoreFile.html0000644000175000017500000002103611461404255022030 00000000000000 IpatchSampleStoreFile

IpatchSampleStoreFile

IpatchSampleStoreFile — Sample store object type for audio in files on disk

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSampleStore
               +----IpatchSampleStoreFile
                     +----IpatchSampleStoreSplit24
                     +----IpatchSampleStoreSwap

Implemented Interfaces

IpatchSampleStoreFile implements IpatchSample.

Properties

  "file"                     IpatchFile*           : Read / Write / Construct Only
  "location"                 guint                 : Read / Write / Construct Only

Description

Details

IpatchSampleStoreFile

typedef struct _IpatchSampleStoreFile IpatchSampleStoreFile;

IPATCH_SAMPLE_STORE_FILE_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_STORE_FILE_UNUSED_FLAG_SHIFT

ipatch_sample_store_file_new ()

IpatchSample *      ipatch_sample_store_file_new        (IpatchFile *file,
                                                         guint location);

Creates a new file sample store.

file :

File object to use for file sample store

location :

Location in file of audio data

Returns :

New file sample store, cast as a IpatchSample for convenience.

Property Details

The "file" property

  "file"                     IpatchFile*           : Read / Write / Construct Only

File object.


The "location" property

  "location"                 guint                 : Read / Write / Construct Only

Sample data file location.

Default value: 0

libinstpatch-1.0.0/docs/reference/html/IpatchSF2.html0000644000175000017500000012035311461404255017366 00000000000000 IpatchSF2

IpatchSF2

IpatchSF2 — SoundFont instrument file object

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchSF2;
enum                IpatchSF2Flags;
#define             IPATCH_SF2_UNUSED_FLAG_SHIFT
enum                IpatchSF2InfoType;
#define             IPATCH_SF2_INFO_COUNT
#define             IPATCH_SF2_DEFAULT_ENGINE
IpatchSF2 *         ipatch_sf2_new                      (void);
#define             ipatch_sf2_get_presets              (sfont)
#define             ipatch_sf2_get_insts                (sfont)
#define             ipatch_sf2_get_samples              (sfont)
void                ipatch_sf2_set_file                 (IpatchSF2 *sf,
                                                         IpatchSF2File *file);
IpatchSF2File *     ipatch_sf2_get_file                 (IpatchSF2 *sf);
char *              ipatch_sf2_get_info                 (IpatchSF2 *sf,
                                                         IpatchSF2InfoType id);
void                ipatch_sf2_set_info                 (IpatchSF2 *sf,
                                                         IpatchSF2InfoType id,
                                                         const char *val);
IpatchSF2Info *     ipatch_sf2_get_info_array           (IpatchSF2 *sf);
void                ipatch_sf2_free_info_array          (IpatchSF2Info *array);
gboolean            ipatch_sf2_info_id_is_valid         (guint32 id);
int                 ipatch_sf2_get_info_max_size        (IpatchSF2InfoType infotype);
IpatchSF2Preset *   ipatch_sf2_find_preset              (IpatchSF2 *sf,
                                                         const char *name,
                                                         int bank,
                                                         int program,
                                                         const IpatchSF2Preset *exclude);
IpatchSF2Inst *     ipatch_sf2_find_inst                (IpatchSF2 *sf,
                                                         const char *name,
                                                         const IpatchSF2Inst *exclude);
IpatchSF2Sample *   ipatch_sf2_find_sample              (IpatchSF2 *sf,
                                                         const char *name,
                                                         const IpatchSF2Sample *exclude);
IpatchList *        ipatch_sf2_get_zone_references      (IpatchItem *item);
char *              ipatch_sf2_make_unique_name         (IpatchSF2 *sfont,
                                                         GType child_type,
                                                         const char *name,
                                                         const IpatchItem *exclude);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchBase
                     +----IpatchSF2

Properties

  "author"                   gchar*                : Read / Write
  "comment"                  gchar*                : Read / Write
  "copyright"                gchar*                : Read / Write
  "date"                     gchar*                : Read / Write
  "engine"                   gchar*                : Read / Write
  "name"                     gchar*                : Read / Write
  "product"                  gchar*                : Read / Write
  "rom-name"                 gchar*                : Read / Write
  "rom-version"              gchar*                : Read / Write
  "samples-24bit"            gboolean              : Read / Write
  "software"                 gchar*                : Read / Write
  "version"                  gchar*                : Read / Write

Description

SoundFont version 2 instrument file object. Parent to IpatchSF2Preset, IpatchSF2Inst and IpatchSF2Sample objects.

Details

IpatchSF2

typedef struct {
  IpatchBase parent_instance;

  guint16 ver_major, ver_minor;	/* SoundFont version */
  guint16 romver_major, romver_minor; /* ROM version (if any) */

  GHashTable *info;		/* hash of info strings by 4 char ID */
  GSList *presets;		/* list of #IpatchSF2Preset structures */
  GSList *insts;		/* list of #IpatchSF2Inst structures */
  GSList *samples;		/* list of #IpatchSF2Sample structures */
} IpatchSF2;

enum IpatchSF2Flags

typedef enum
{
  /* SoundFont 24 bit samples enabled flag */
  IPATCH_SF2_SAMPLES_24BIT = 1 << IPATCH_BASE_UNUSED_FLAG_SHIFT
} IpatchSF2Flags;

IPATCH_SF2_UNUSED_FLAG_SHIFT

#define IPATCH_SF2_UNUSED_FLAG_SHIFT (IPATCH_BASE_UNUSED_FLAG_SHIFT + 3)

enum IpatchSF2InfoType

typedef enum
{
  IPATCH_SF2_UNKNOWN,		/* unknown chunk ("NULL" value) */
  IPATCH_SF2_VERSION = IPATCH_SFONT_FOURCC_IFIL, /* SoundFont version */
  IPATCH_SF2_ENGINE = IPATCH_SFONT_FOURCC_ISNG,/* target sound engine */
  IPATCH_SF2_NAME = IPATCH_SFONT_FOURCC_INAM, /* SoundFont name */
  IPATCH_SF2_ROM_NAME = IPATCH_SFONT_FOURCC_IROM, /* ROM name */
  IPATCH_SF2_ROM_VERSION = IPATCH_SFONT_FOURCC_IVER, /* ROM version */
  IPATCH_SF2_DATE = IPATCH_SFONT_FOURCC_ICRD, /* creation date */
  IPATCH_SF2_AUTHOR = IPATCH_SFONT_FOURCC_IENG,/* sound designers/engineers */
  IPATCH_SF2_PRODUCT = IPATCH_SFONT_FOURCC_IPRD, /* product intended for */
  IPATCH_SF2_COPYRIGHT = IPATCH_SFONT_FOURCC_ICOP, /* copyright message */
  IPATCH_SF2_COMMENT = IPATCH_SFONT_FOURCC_ICMT, /* comments */
  IPATCH_SF2_SOFTWARE = IPATCH_SFONT_FOURCC_ISFT /* software "create:modify" */
}IpatchSF2InfoType;

IPATCH_SF2_INFO_COUNT

#define IPATCH_SF2_INFO_COUNT 11

IPATCH_SF2_DEFAULT_ENGINE

#define IPATCH_SF2_DEFAULT_ENGINE "EMU8000"

ipatch_sf2_new ()

IpatchSF2 *         ipatch_sf2_new                      (void);

Create a new SoundFont base object.

Returns :

New SoundFont base object with a reference count of 1. Caller owns the reference and removing it will destroy the item.

ipatch_sf2_get_presets()

#define             ipatch_sf2_get_presets(sfont)

ipatch_sf2_get_insts()

#define             ipatch_sf2_get_insts(sfont)

ipatch_sf2_get_samples()

#define             ipatch_sf2_get_samples(sfont)

ipatch_sf2_set_file ()

void                ipatch_sf2_set_file                 (IpatchSF2 *sf,
                                                         IpatchSF2File *file);

Sets the file object of a SoundFont. SoundFont files are kept open for sample data that references the file. This function sets a SoundFonts authoritive file object. A convenience function, as ipatch_base_set_file() does the same thing (albeit without more specific type casting).

sf :

SoundFont to set file object of

file :

File object to use with the SoundFont.

ipatch_sf2_get_file ()

IpatchSF2File *     ipatch_sf2_get_file                 (IpatchSF2 *sf);

Gets the file object of a SoundFont. The returned SoundFont file object's reference count has incremented. The caller owns the reference and is responsible for removing it with g_object_unref(). A convenience function as ipatch_base_get_file() does the same thing (albeit without more specific type casting).

sf :

SoundFont to get file object of

Returns :

The SoundFont file object or NULL if sf is not open. Remember to unref the file object with g_object_unref() when done with it.

ipatch_sf2_get_info ()

char *              ipatch_sf2_get_info                 (IpatchSF2 *sf,
                                                         IpatchSF2InfoType id);

Get a SoundFont info string by RIFF FOURCC ID.

sf :

SoundFont to get info from

id :

RIFF FOURCC id

Returns :

New allocated info string value or NULL if no info with the given id. String should be freed when finished with it.

ipatch_sf2_set_info ()

void                ipatch_sf2_set_info                 (IpatchSF2 *sf,
                                                         IpatchSF2InfoType id,
                                                         const char *val);

Set SoundFont info. Validates id and ensures val does not exceed the maximum allowed length for the given info type.

Emits changed signal on SoundFont.

sf :

SoundFont to set info of

id :

RIFF FOURCC id

val :

Value to set info to or NULL to unset (clear) info.

ipatch_sf2_get_info_array ()

IpatchSF2Info *     ipatch_sf2_get_info_array           (IpatchSF2 *sf);

Get all string info (not IPATCH_SF2_VERSION or IPATCH_SF2_ROM_VERSION) from a SoundFont object. The array is sorted in the order recommended by the SoundFont standard for saving.

sf :

SoundFont to get all info strings from

Returns :

A newly allocated array of info structures terminated by an array member with 0 valued id field. Remember to free the array with ipatch_sf2_free_info_array() when finished with it.

ipatch_sf2_free_info_array ()

void                ipatch_sf2_free_info_array          (IpatchSF2Info *array);

Frees an info array returned by ipatch_sf2_get_info_array().

array :

SoundFont info array

ipatch_sf2_info_id_is_valid ()

gboolean            ipatch_sf2_info_id_is_valid         (guint32 id);

Check if a given RIFF FOURCC id is a valid SoundFont info id.

id :

RIFF FOURCC id (see IpatchSF2InfoType)

Returns :

TRUE if id is a valid info id, FALSE otherwise

ipatch_sf2_get_info_max_size ()

int                 ipatch_sf2_get_info_max_size        (IpatchSF2InfoType infotype);

Get maximum chunk size for info chunks.

NOTE: Max size includes terminating NULL character so subtract one from returned value to get max allowed string length.

infotype :

An info enumeration

Returns :

Maximum info chunk size or 0 if invalid or variable length info chunk type. Subtract one to get max allowed string length (if returned value was not 0).

ipatch_sf2_find_preset ()

IpatchSF2Preset *   ipatch_sf2_find_preset              (IpatchSF2 *sf,
                                                         const char *name,
                                                         int bank,
                                                         int program,
                                                         const IpatchSF2Preset *exclude);

Find a preset by name or bank:preset MIDI numbers. If preset name and bank:program are specified then match for either condition. If a preset is found its reference count is incremented before it is returned. The caller is responsible for removing the reference with g_object_unref() when finished with it.

sf :

SoundFont to search in

name :

Name of preset to find or NULL to match any name

bank :

MIDI bank number of preset to search for or -1 to not search by MIDI bank:program numbers

program :

MIDI program number of preset to search for, only used if bank is 0-128

exclude :

A preset to exclude from the search or NULL

Returns :

The matching preset or NULL if not found. Remember to unref the item when finished with it.

ipatch_sf2_find_inst ()

IpatchSF2Inst *     ipatch_sf2_find_inst                (IpatchSF2 *sf,
                                                         const char *name,
                                                         const IpatchSF2Inst *exclude);

Find an instrument by name in a SoundFont. If a matching instrument is found, its reference count is incremented before it is returned. The caller is responsible for removing the reference with g_object_unref() when finished with it.

sf :

SoundFont to search in

name :

Name of Instrument to find

exclude :

An instrument to exclude from the search or NULL

Returns :

The matching instrument or NULL if not found. Remember to unref the item when finished with it.

ipatch_sf2_find_sample ()

IpatchSF2Sample *   ipatch_sf2_find_sample              (IpatchSF2 *sf,
                                                         const char *name,
                                                         const IpatchSF2Sample *exclude);

Find a sample by name in a SoundFont. If a sample is found its reference count is incremented before it is returned. The caller is responsible for removing the reference with g_object_unref() when finished with it.

sf :

SoundFont to search in

name :

Name of sample to find

exclude :

A sample to exclude from the search or NULL

Returns :

The matching sample or NULL if not found. Remember to unref the item when finished with it.

ipatch_sf2_get_zone_references ()

IpatchList *        ipatch_sf2_get_zone_references      (IpatchItem *item);

Get list of zones referencing an IpatchSF2Inst or IpatchSF2Sample.

item :

Item to locate referencing zones of, must be of type IpatchSF2Inst or IpatchSF2Sample and be parented to an IpatchSF2 object.

Returns :

New object list containing IpatchSF2Zone objects that refer to item. The new list object has a reference count of 1 which the caller owns, unreference to free the list.

ipatch_sf2_make_unique_name ()

char *              ipatch_sf2_make_unique_name         (IpatchSF2 *sfont,
                                                         GType child_type,
                                                         const char *name,
                                                         const IpatchItem *exclude);

Generates a unique name for the given child_type in sfont. The name parameter is used as a base and is modified, by appending a number, to make it unique (if necessary). The exclude parameter is used to exclude an existing sfont child item from the search.

MT-Note: To ensure that an item is actually unique before being added to a SoundFont object, ipatch_container_add_unique() should be used.

sfont :

SoundFont item

child_type :

A child type of sfont to search for a unique name in

name :

An initial name to use or NULL

exclude :

An item to exclude from search or NULL

Returns :

A new unique name which should be freed when finished with it.

Property Details

The "author" property

  "author"                   gchar*                : Read / Write

Author of SoundFont.

Default value: NULL


The "comment" property

  "comment"                  gchar*                : Read / Write

Comments.

Default value: NULL


The "copyright" property

  "copyright"                gchar*                : Read / Write

Copyright.

Default value: NULL


The "date" property

  "date"                     gchar*                : Read / Write

Creation date.

Default value: NULL


The "engine" property

  "engine"                   gchar*                : Read / Write

Sound synthesis engine identifier.

Default value: "EMU8000"


The "name" property

  "name"                     gchar*                : Read / Write

SoundFont name.

Default value: NULL


The "product" property

  "product"                  gchar*                : Read / Write

Product SoundFont is intended for.

Default value: NULL


The "rom-name" property

  "rom-name"                 gchar*                : Read / Write

ROM name identifier.

Default value: NULL


The "rom-version" property

  "rom-version"              gchar*                : Read / Write

ROM version "major.minor".

Default value: NULL


The "samples-24bit" property

  "samples-24bit"            gboolean              : Read / Write

Enable 24 bit samples.

Default value: FALSE


The "software" property

  "software"                 gchar*                : Read / Write

Software 'created by:modified by'.

Default value: NULL


The "version" property

  "version"                  gchar*                : Read / Write

SoundFont version ("major.minor").

Default value: "2.01"

See Also

#IpatchSF2Preset, IpatchSF2Inst, IpatchSF2Sample
libinstpatch-1.0.0/docs/reference/html/ch07.html0000644000175000017500000000515511461404255016406 00000000000000 Virtual banks

Virtual banks

IpatchVBank — Virtual bank object
IpatchVBankInst — VBank instrument item
IpatchVBankRegion — Virtual bank instrument region
libinstpatch-1.0.0/docs/reference/html/IpatchGigSample.html0000644000175000017500000002307511461404255020647 00000000000000 IpatchGigSample

IpatchGigSample

IpatchGigSample — GigaSampler sample object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchDLS2Sample
               +----IpatchGigSample

Implemented Interfaces

IpatchGigSample implements IpatchSample.

Properties

  "group-number"             guint                 : Read / Write

Description

Object defining a GigaSampler sample object. Child of IpatchGig objects and referenced by IpatchGigSubRegion objects.

Details

IpatchGigSample

typedef struct _IpatchGigSample IpatchGigSample;

ipatch_gig_sample_new ()

IpatchGigSample *   ipatch_gig_sample_new               (void);

Create a new GigaSampler sample object.

Returns :

New GigaSampler sample with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_gig_sample_first ()

IpatchGigSample *   ipatch_gig_sample_first             (IpatchIter *iter);

Gets the first item in a GigaSampler sample iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchGigSample items

Returns :

The first GigaSampler sample in iter or NULL if empty.

ipatch_gig_sample_next ()

IpatchGigSample *   ipatch_gig_sample_next              (IpatchIter *iter);

Gets the next item in a GigaSampler sample iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchGigSample items

Returns :

The next GigaSampler sample in iter or NULL if at the end of the list.

Property Details

The "group-number" property

  "group-number"             guint                 : Read / Write

Sample group index.

Default value: 0

See Also

#IpatchGig
libinstpatch-1.0.0/docs/reference/html/ch04.html0000644000175000017500000000745211461404255016405 00000000000000 DLS patches

DLS patches

IpatchDLS2 — DLS version 2 instrument file object
IpatchDLSFile — DLS file object and functions
IpatchDLS2Info — DLS version 2 info functions and structure
IpatchDLSReader — DLS version 2 file reader
IpatchDLSWriter — DLS instrument file writer
IpatchDLS2Inst — DLS instrument object
IpatchDLS2Region — DLS region object
IpatchDLS2Conn — DLS version 2 connection structures and functions
IpatchDLS2Sample — DLS audio sample object
IpatchUnit_DLS — Unit types and conversions for DLS
libinstpatch-1.0.0/docs/reference/html/IpatchSF2Writer.html0000644000175000017500000004606411461404255020571 00000000000000 IpatchSF2Writer

IpatchSF2Writer

IpatchSF2Writer — SoundFont writer object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchRiff
         +----IpatchSF2Writer

Properties

  "migrate-samples"          gboolean              : Read / Write

Description

Object for writing a tree of SoundFont objects (IpatchSF2) to a SoundFont file.

Details

IpatchSF2Writer

typedef struct _IpatchSF2Writer IpatchSF2Writer;

ipatch_sf2_writer_new ()

IpatchSF2Writer *   ipatch_sf2_writer_new               (IpatchFileHandle *handle,
                                                         IpatchSF2 *sfont);

Create a new SoundFont 2 file writer.

handle :

SoundFont file handle to save to or NULL to set later

sfont :

SoundFont object to save or NULL to set later

Returns :

The new SoundFont writer

ipatch_sf2_writer_set_patch ()

void                ipatch_sf2_writer_set_patch         (IpatchSF2Writer *writer,
                                                         IpatchSF2 *sfont);

Set the SoundFont patch object to save with a SoundFont writer.

writer :

SoundFont writer object

sfont :

SoundFont patch to save

ipatch_sf2_writer_set_file_handle ()

void                ipatch_sf2_writer_set_file_handle   (IpatchSF2Writer *writer,
                                                         IpatchFileHandle *handle);

ipatch_sf2_writer_save ()

gboolean            ipatch_sf2_writer_save              (IpatchSF2Writer *writer,
                                                         GError **err);

Write a SoundFont object to a file.

writer :

SoundFont writer object

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE on error

ipatch_sf2_write_phdr ()

void                ipatch_sf2_write_phdr               (IpatchFileHandle *handle,
                                                         const IpatchSF2Phdr *phdr);

Buffer writes a preset header into handle from a phdr structure.

handle :

File handle to buffer writes to, commit after calling this function

phdr :

Preset header structure to store

ipatch_sf2_write_ihdr ()

void                ipatch_sf2_write_ihdr               (IpatchFileHandle *handle,
                                                         const IpatchSF2Ihdr *ihdr);

Writes an instrument header into handle from a ihdr structure.

handle :

File handle to buffer writes to, commit after calling this function

ihdr :

Instrument header structure to store

ipatch_sf2_write_shdr ()

void                ipatch_sf2_write_shdr               (IpatchFileHandle *handle,
                                                         const IpatchSF2Shdr *shdr);

Writes a sample header into handle from a shdr structure.

handle :

File handle to buffer writes to, commit after calling this function

shdr :

Sample header structure to store

ipatch_sf2_write_bag ()

void                ipatch_sf2_write_bag                (IpatchFileHandle *handle,
                                                         const IpatchSF2Bag *bag);

Writes a preset or instrument bag into handle from a bag structure.

handle :

File handle to buffer writes to, commit after calling this function

bag :

Bag structure to store

ipatch_sf2_write_mod ()

void                ipatch_sf2_write_mod                (IpatchFileHandle *handle,
                                                         const IpatchSF2Mod *mod);

Writes a modulator into handle from a mod structure.

handle :

File handle to buffer writes to, commit after calling this function

mod :

Modulator structure to store

ipatch_sf2_write_gen ()

void                ipatch_sf2_write_gen                (IpatchFileHandle *handle,
                                                         int genid,
                                                         const IpatchSF2GenAmount *amount);

Writes a generator into handle from a genid and amount structure.

handle :

File handle to buffer writes to, commit after calling this function

genid :

ID of generator to store

amount :

Generator amount to store

Property Details

The "migrate-samples" property

  "migrate-samples"          gboolean              : Read / Write

Migrate samples to new file.

Default value: FALSE

libinstpatch-1.0.0/docs/reference/html/IpatchDLSWriter.html0000644000175000017500000002375711461404255020625 00000000000000 IpatchDLSWriter

IpatchDLSWriter

IpatchDLSWriter — DLS instrument file writer

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchRiff
         +----IpatchDLSWriter

Description

Writes a DLS instrument object tree (IpatchDLS) to a DLS file.

Details

IpatchDLSWriter

typedef struct _IpatchDLSWriter IpatchDLSWriter;

ipatch_dls_writer_new ()

IpatchDLSWriter *   ipatch_dls_writer_new               (IpatchFileHandle *handle,
                                                         IpatchDLS2 *dls);

Create a new DLS file writer.

handle :

DLS file handle to save to or NULL to set later, taken over by writer object and will be closed on finalize.

dls :

DLS object to save or NULL to set later

Returns :

The new DLS writer

ipatch_dls_writer_set_patch ()

void                ipatch_dls_writer_set_patch         (IpatchDLSWriter *writer,
                                                         IpatchDLS2 *dls);

Set the DLS patch object to save with a DLS writer.

writer :

DLS writer object

dls :

DLS patch to save

ipatch_dls_writer_set_file_handle ()

void                ipatch_dls_writer_set_file_handle   (IpatchDLSWriter *writer,
                                                         IpatchFileHandle *handle);

Set the DLS file handle of a DLS writer. A convenience function, since ipatch_riff_set_file_handle() could also be used.

writer :

DLS writer object

handle :

DLS file handle

ipatch_dls_writer_save ()

gboolean            ipatch_dls_writer_save              (IpatchDLSWriter *writer,
                                                         GError **err);

Write a DLS or GigaSampler object to a file.

writer :

DLS writer object

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE on error

See Also

#IpatchDLS
libinstpatch-1.0.0/docs/reference/html/IpatchRiff.html0000644000175000017500000013637611461404256017677 00000000000000 IpatchRiff

IpatchRiff

IpatchRiff — RIFF file parser/composer object

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchRiffChunk;
enum                IpatchRiffStatus;
enum                IpatchRiffMode;
                    IpatchRiff;
#define             IPATCH_RIFF_NEED_SWAP               (riff)
#define             IPATCH_RIFF_BIG_ENDIAN              (riff)
enum                IpatchRiffChunkType;
#define             IPATCH_RIFF_ERROR
enum                IpatchRiffError;
#define             IPATCH_FOURCC                       (c1, c2, c3, c4)
#define             IPATCH_FOURCC_RIFF
#define             IPATCH_FOURCC_RIFX
#define             IPATCH_FOURCC_LIST
#define             IPATCH_RIFF_HEADER_SIZE
#define             IPATCH_RIFF_FOURCC_SIZE
#define             IPATCH_RIFF_LIST_HEADER_SIZE
#define             IPATCH_RIFF_WAVE_FMT_PCM
#define             IPATCH_RIFF_WAVE_FMT_FLOAT
GQuark              ipatch_riff_error_quark             (void);
IpatchRiff *        ipatch_riff_new                     (IpatchFileHandle *handle);
void                ipatch_riff_set_file_handle         (IpatchRiff *riff,
                                                         IpatchFileHandle *handle);
IpatchFileHandle *  ipatch_riff_get_file_handle         (IpatchRiff *riff);
int                 ipatch_riff_get_chunk_level         (IpatchRiff *riff);
IpatchRiffChunk *   ipatch_riff_get_chunk_array         (IpatchRiff *riff,
                                                         int *count);
IpatchRiffChunk *   ipatch_riff_get_chunk               (IpatchRiff *riff,
                                                         int level);
guint32             ipatch_riff_get_total_size          (IpatchRiff *riff);
guint32             ipatch_riff_get_position            (IpatchRiff *riff);
void                ipatch_riff_push_state              (IpatchRiff *riff);
gboolean            ipatch_riff_pop_state               (IpatchRiff *riff,
                                                         GError **err);
IpatchRiffChunk *   ipatch_riff_start_read              (IpatchRiff *riff,
                                                         GError **err);
IpatchRiffChunk *   ipatch_riff_start_read_chunk        (IpatchRiff *riff,
                                                         GError **err);
IpatchRiffChunk *   ipatch_riff_read_chunk_verify       (IpatchRiff *riff,
                                                         IpatchRiffChunkType type,
                                                         guint32 id,
                                                         GError **err);
IpatchRiffChunk *   ipatch_riff_read_chunk              (IpatchRiff *riff,
                                                         GError **err);
#define             ipatch_riff_write_list_chunk        (parser, id, err)
#define             ipatch_riff_write_sub_chunk         (parser, id, err)
gboolean            ipatch_riff_write_chunk             (IpatchRiff *riff,
                                                         IpatchRiffChunkType type,
                                                         guint32 id,
                                                         GError **err);
#define             ipatch_riff_end_chunk               (parser, err)
gboolean            ipatch_riff_close_chunk             (IpatchRiff *riff,
                                                         int level,
                                                         GError **err);
#define             ipatch_riff_skip_chunk              (parser, err)
gboolean            ipatch_riff_skip_chunks             (IpatchRiff *riff,
                                                         guint count,
                                                         GError **err);
gboolean            ipatch_riff_get_error               (IpatchRiff *riff,
                                                         GError **err);
char *              ipatch_riff_message_detail          (IpatchRiff *riff,
                                                         int level,
                                                         const char *format,
                                                         ...);

Object Hierarchy

  GObject
   +----IpatchRiff
         +----IpatchDLSReader
         +----IpatchDLSWriter
         +----IpatchSF2Reader
         +----IpatchSF2Writer

Description

A RIFF file parser/composer. Used for DLS, SoundFont and GigaSampler files.

Details

IpatchRiffChunk

typedef struct {
  IpatchRiffChunkType type;	/* type of chunk */
  guint32 id;	  /* chunk ID in integer format for easy comparison */
  char idstr[4];		/* four character chunk ID string */
  gint32 position; /* current position in chunk (read or write mode) */
  guint32 size;			/* size of chunk (read mode only) */
  guint32 filepos;              /* Position in file object of chunk data */
} IpatchRiffChunk;

enum IpatchRiffStatus

typedef enum
{
  IPATCH_RIFF_STATUS_FAIL = 0,	/* error occured */
  IPATCH_RIFF_STATUS_BEGIN,	/* parsing has not yet began */
  IPATCH_RIFF_STATUS_FINISHED,	/* no more parsing to be done */
  IPATCH_RIFF_STATUS_NORMAL,	/* normal status */
  IPATCH_RIFF_STATUS_CHUNK_END	/* end of a chunk */
} IpatchRiffStatus;

enum IpatchRiffMode

typedef enum
{
  IPATCH_RIFF_READ,
  IPATCH_RIFF_WRITE
} IpatchRiffMode;

IpatchRiff

typedef struct _IpatchRiff IpatchRiff;

IPATCH_RIFF_NEED_SWAP()

#define IPATCH_RIFF_NEED_SWAP(riff)  IPATCH_FILE_NEED_SWAP (riff->handle->file)

IPATCH_RIFF_BIG_ENDIAN()

#define IPATCH_RIFF_BIG_ENDIAN(riff) IPATCH_FILE_BIG_ENDIAN (riff->handle->file)

enum IpatchRiffChunkType

typedef enum
{
  IPATCH_RIFF_CHUNK_RIFF,	/* toplevel "RIFF" (or "RIFX") list chunk */
  IPATCH_RIFF_CHUNK_LIST,	/* a "LIST" chunk */
  IPATCH_RIFF_CHUNK_SUB		/* a sub chunk */
} IpatchRiffChunkType;

IPATCH_RIFF_ERROR

#define IPATCH_RIFF_ERROR  ipatch_riff_error_quark()

enum IpatchRiffError

typedef enum
{
  IPATCH_RIFF_ERROR_NOT_RIFF,	/* not a RIFF file */
  IPATCH_RIFF_ERROR_UNEXPECTED_ID, /* unexpected chunk ID */
  IPATCH_RIFF_ERROR_UNEXPECTED_CHUNK_END,  /* unexpected LIST chunk end */
  IPATCH_RIFF_ERROR_INVALID_ID, /* invalid chunk FOURCC ID */
  IPATCH_RIFF_ERROR_ODD_SIZE,	/* chunk size is ODD */
  IPATCH_RIFF_ERROR_SIZE_EXCEEDED, /* chunk size exceeded */

  /* convenience errors - not used by the riff object itself */
  IPATCH_RIFF_ERROR_SIZE_MISMATCH, /* chunk size mismatch */
  IPATCH_RIFF_ERROR_INVALID_DATA /* generic invalid data error */
} IpatchRiffError;

IPATCH_FOURCC()

#define             IPATCH_FOURCC(c1, c2, c3, c4)

IPATCH_FOURCC_RIFF

#define IPATCH_FOURCC_RIFF IPATCH_FOURCC ('R','I','F','F')

IPATCH_FOURCC_RIFX

#define IPATCH_FOURCC_RIFX IPATCH_FOURCC ('R','I','F','X') /* big endian */

IPATCH_FOURCC_LIST

#define IPATCH_FOURCC_LIST IPATCH_FOURCC ('L','I','S','T')

IPATCH_RIFF_HEADER_SIZE

#define IPATCH_RIFF_HEADER_SIZE 8 /* size of RIFF chunk headers (ID + size) */

IPATCH_RIFF_FOURCC_SIZE

#define IPATCH_RIFF_FOURCC_SIZE 4 /* RIFF FOURCC ID size */

IPATCH_RIFF_LIST_HEADER_SIZE

#define             IPATCH_RIFF_LIST_HEADER_SIZE

IPATCH_RIFF_WAVE_FMT_PCM

#define IPATCH_RIFF_WAVE_FMT_PCM   0x1

IPATCH_RIFF_WAVE_FMT_FLOAT

#define IPATCH_RIFF_WAVE_FMT_FLOAT 0x3

ipatch_riff_error_quark ()

GQuark              ipatch_riff_error_quark             (void);

ipatch_riff_new ()

IpatchRiff *        ipatch_riff_new                     (IpatchFileHandle *handle);

Create a new RIFF file riff/composer object

handle :

File object handle to parse or NULL to set later, the handle will be taken over by the riff object and closed when finalized.

Returns :

The RIFF object

ipatch_riff_set_file_handle ()

void                ipatch_riff_set_file_handle         (IpatchRiff *riff,
                                                         IpatchFileHandle *handle);

Set the file object handle of a RIFF object. The handle is taken over by the riff object and will be closed when finalized.

riff :

RIFF object

handle :

File object handle to assign

ipatch_riff_get_file_handle ()

IpatchFileHandle *  ipatch_riff_get_file_handle         (IpatchRiff *riff);

ipatch_riff_get_chunk_level ()

int                 ipatch_riff_get_chunk_level         (IpatchRiff *riff);

Gets the current chunk level count (number of embedded chunks) currently being processed in a RIFF file.

riff :

RIFF object

Returns :

Chunk level count (0 = no open chunks)

ipatch_riff_get_chunk_array ()

IpatchRiffChunk *   ipatch_riff_get_chunk_array         (IpatchRiff *riff,
                                                         int *count);

Gets the array of open chunk info structures.

riff :

RIFF object

count :

Location to store the number of elements in the returned array

Returns :

Array of IpatchRiffChunk structures or NULL if no chunks being processed (processing hasn't started). The returned array is internal and should not be modified or freed. Also note that the array is valid only while the chunk state is unchanged (riff object or file operations). The number of elements in the array is stored in count.

ipatch_riff_get_chunk ()

IpatchRiffChunk *   ipatch_riff_get_chunk               (IpatchRiff *riff,
                                                         int level);

Get the chunk at the specified level from a RIFF riff chunk state array.

riff :

RIFF object

level :

Level of chunk to get (-1 for current chunk)

Returns :

Pointer to the chunk or NULL if invalid level. The returned chunk is internal and should not be modified or freed. Also note that the chunk is valid only while the chunk state is unchanged (riff object or file operations).

ipatch_riff_get_total_size ()

guint32             ipatch_riff_get_total_size          (IpatchRiff *riff);

Get total size of toplevel chunk. This is a convenience function that just adds the size of the toplevel chunk and its header, the actual file object size is not checked.

riff :

RIFF object

Returns :

Size of toplevel chunk + header size, in bytes. Actual file size is not checked.

ipatch_riff_get_position ()

guint32             ipatch_riff_get_position            (IpatchRiff *riff);

Get current position in the toplevel RIFF chunk (including header, i.e., the file position).

riff :

RIFF object

Returns :

The current offset, in bytes, into the toplevel RIFF chunk (including header).

ipatch_riff_push_state ()

void                ipatch_riff_push_state              (IpatchRiff *riff);

Pushes the current file position and chunk state onto the state stack. This state can be later restored to return to the same position in a RIFF file.

riff :

RIFF object

ipatch_riff_pop_state ()

gboolean            ipatch_riff_pop_state               (IpatchRiff *riff,
                                                         GError **err);

Pops the most recent state pushed onto the state stack. This causes the position in the RIFF file stored by the state to be restored.

riff :

RIFF object

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise which is fatal

ipatch_riff_start_read ()

IpatchRiffChunk *   ipatch_riff_start_read              (IpatchRiff *riff,
                                                         GError **err);

Start parsing the riff file object as if it were at the beginning of a RIFF file. Clears any current chunk state, loads a chunk and ensures that it has the "RIFF" or "RIFX" ID. If this call is sucessful there will be one chunk on the chunk stack with the secondary ID of the RIFF chunk. If it is desirable to process a chunk that is not the beginning of a RIFF file, ipatch_riff_start_read_chunk() can be used. This function will also automatically enable byte order swapping if needed.

riff :

RIFF object

err :

Location to store error info or NULL

Returns :

Pointer to the opened RIFF chunk or NULL on error. The returned chunk is internal and should not be modified or freed. Also note that the chunk is valid only while the chunk state is unchanged (riff object or file operations).

ipatch_riff_start_read_chunk ()

IpatchRiffChunk *   ipatch_riff_start_read_chunk        (IpatchRiff *riff,
                                                         GError **err);

Start parsing the riff file object at an arbitrary chunk. Clears any current chunk state and loads a chunk. If this call is sucessful there will be one chunk on the chunk stack. If it is desirable to start processing from the beginning of a RIFF file ipatch_riff_start_read() should be used instead. An end of file condition is considered an error. Note that it is up to the caller to ensure byte order swapping is enabled, if needed.

riff :

RIFF object

err :

Location to store error info or NULL

Returns :

Pointer to the opened RIFF chunk or NULL on error. The returned chunk is internal and should not be modified or freed. Also note that the chunk is valid only while the chunk state is unchanged (riff object or file operations).

ipatch_riff_read_chunk_verify ()

IpatchRiffChunk *   ipatch_riff_read_chunk_verify       (IpatchRiff *riff,
                                                         IpatchRiffChunkType type,
                                                         guint32 id,
                                                         GError **err);

Like ipatch_riff_read_chunk() but ensures that the new chunk matches a specific type and ID. If the chunk is not the expected chunk or no more chunks in current list chunk, it is considered an error. ipatch_riff_close_chunk() should be called when finished parsing the opened chunk.

riff :

RIFF object

type :

Expected chunk type

id :

Expected chunk ID

err :

Location to store error info or NULL

Returns :

Pointer to new opened chunk or NULL if current chunk has ended or on error. Returned chunk pointer is internal and should not be modified or freed. Also note that the chunk is valid only while the chunk state is unchanged (riff object or file operations).

ipatch_riff_read_chunk ()

IpatchRiffChunk *   ipatch_riff_read_chunk              (IpatchRiff *riff,
                                                         GError **err);

Parse next RIFF chunk header. The ipatch_riff_close_chunk() function should be called at the end of parsing a chunk, otherwise this function will return NULL if the current chunk has ended. When the first RIFF chunk is read the IPATCH_RIFF_FLAG_BIG_ENDIAN flag is cleared or set depending on if its RIFF or RIFX respectively, endian swapping is also enabled if the file uses non-native endian format to the host.

riff :

RIFF object

err :

Location to store error info or NULL

Returns :

Pointer to new opened chunk or NULL if current chunk has ended or on error. Returned chunk pointer is internal and should not be modified or freed. Also note that the chunk is valid only while the chunk state is unchanged (riff object or file operations).

ipatch_riff_write_list_chunk()

#define             ipatch_riff_write_list_chunk(parser, id, err)

ipatch_riff_write_sub_chunk()

#define             ipatch_riff_write_sub_chunk(parser, id, err)

ipatch_riff_write_chunk ()

gboolean            ipatch_riff_write_chunk             (IpatchRiff *riff,
                                                         IpatchRiffChunkType type,
                                                         guint32 id,
                                                         GError **err);

Opens a new chunk and writes a chunk header to the file object in riff. The size field of the chunk is set to 0 and will be filled in when the chunk is closed (see ipatch_riff_close_chunk()).

riff :

RIFF object

type :

Chunk type (RIFF, LIST, or SUB)

id :

Chunk ID (secondary ID for RIFF and LIST chunks)

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise.

ipatch_riff_end_chunk()

#define             ipatch_riff_end_chunk(parser, err)

ipatch_riff_close_chunk ()

gboolean            ipatch_riff_close_chunk             (IpatchRiff *riff,
                                                         int level,
                                                         GError **err);

Closes the chunk specified by level and all its children (if any).

In write mode the chunk size is filled in for chunks that get closed and therefore the file object of riff must be seekable (anyone need non-seekable RIFF writing?). The chunk size is padded to an even number if necessary (by writing a NULL byte).

Upon successful completion the file position will be where it was prior to the call (write mode) or at the beginning of the next chunk (read mode). There will be level open chunks (or previous chunk count - 1 if level == -1). In read mode the status will be IPATCH_RIFF_STATUS_NORMAL if open chunks remain or IPATCH_RIFF_STATUS_FINISHED if toplevel chunk was closed. The status is not modified in write mode.

riff :

RIFF object

level :

Level of chunk to close (-1 for current chunk)

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise.

ipatch_riff_skip_chunk()

#define             ipatch_riff_skip_chunk(parser, err)

ipatch_riff_skip_chunks ()

gboolean            ipatch_riff_skip_chunks             (IpatchRiff *riff,
                                                         guint count,
                                                         GError **err);

Skips RIFF chunks at the current chunk level (children of the current chunk).

riff :

RIFF object

count :

Number of chunks to skip

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise

ipatch_riff_get_error ()

gboolean            ipatch_riff_get_error               (IpatchRiff *riff,
                                                         GError **err);

Gets error information from a RIFF object.

riff :

RIFF object

err :

Location to store error info

Returns :

FALSE if status is a IPATCH_RIFF_STATUS_FAIL condition and info can be found in err, TRUE if no error has occured.

ipatch_riff_message_detail ()

char *              ipatch_riff_message_detail          (IpatchRiff *riff,
                                                         int level,
                                                         const char *format,
                                                         ...);

Generates a detailed message, including current position in RIFF file and a chunk trace back. Useful for debugging purposes.

riff :

RIFF object

level :

Chunk level to generate detail for (-1 for current chunk)

format :

Printf style format string of message to display at beginning of riff detail

... :

Arguments for msg string

Returns :

Detailed message string which is internal to riff and should not be modified or freed. Also note that this string is only valid until the next call to this function.
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchSampleList.html0000644000175000017500000010052111461404256023527 00000000000000 IpatchSampleList

IpatchSampleList

IpatchSampleList — Sample list data types and functions

Stability Level

Stable, unless otherwise indicated

Description

Sample lists define audio data from concatenated segments of other audio sources. The lists are always mono (a single channel can be selected from multi-channel sources). Multi-channel audio can be created from combining multiple sample lists of the same length.

Details

IpatchSampleList

typedef struct {
  GList *items;			/* list of IpatchSampleListItem structs */
  guint total_size;		/* total size of audio data in frames */
} IpatchSampleList;

A sample edit list. Allows for non-destructive sample editing by defining new audio samples from one or more audio sample segments.


IpatchSampleListItem

typedef struct {
  IpatchSample *sample;	        /* Sample for this segment */
  guint ofs;                    /* Offset in sample of segment start */
  guint size;			/* Size in frames of audio segment */
  guint32 channel : 3;          /* Channel to use in sample */
  guint32 reserved : 29;
} IpatchSampleListItem;

Defines an audio segment in a IpatchSampleList.


IPATCH_TYPE_SAMPLE_LIST

#define IPATCH_TYPE_SAMPLE_LIST   (ipatch_sample_list_get_type ())

ipatch_sample_list_get_type ()

GType               ipatch_sample_list_get_type         (void);

ipatch_sample_list_new ()

IpatchSampleList *  ipatch_sample_list_new              (void);

Creates a new empty (zero item terminated) sample list.

Returns :

Newly allocated empty sample list.

ipatch_sample_list_free ()

void                ipatch_sample_list_free             (IpatchSampleList *list);

Free a sample list.

list :

Sample list to free

ipatch_sample_list_duplicate ()

IpatchSampleList *  ipatch_sample_list_duplicate        (IpatchSampleList *list);

Duplicate a sample list.

list :

Sample list to duplicate

Returns :

Newly allocated duplicate of list.

ipatch_sample_list_item_new ()

IpatchSampleListItem * ipatch_sample_list_item_new      (void);

Create a new node for a sample list.

Returns :

Newly allocated list node which should be freed with ipatch_sample_list_item_free() when finished using it.

ipatch_sample_list_item_new_init ()

IpatchSampleListItem * ipatch_sample_list_item_new_init (IpatchSample *sample,
                                                         guint ofs,
                                                         guint size,
                                                         guint channel);

Create a new sample list item and initialize it with the provided parameters.

sample :

Sample containing audio for the segment

ofs :

Offset in sample of audio segment

size :

Size of audio segment in frames

channel :

Channel to use from sample

Returns :

Newly allocated sample list item which should be freed with ipatch_sample_list_item_free() when done with it.

ipatch_sample_list_item_free ()

void                ipatch_sample_list_item_free        (IpatchSampleListItem *item);

Free a sample list item previously allocated by ipatch_sample_list_item_new().

item :

Sample list item to free

ipatch_sample_list_item_duplicate ()

IpatchSampleListItem * ipatch_sample_list_item_duplicate
                                                        (IpatchSampleListItem *item);

Duplicate a sample list item node.

item :

Sample list item to duplicate

Returns :

New duplicate sample list item.

ipatch_sample_list_append ()

void                ipatch_sample_list_append           (IpatchSampleList *list,
                                                         IpatchSample *sample,
                                                         guint ofs,
                                                         guint size,
                                                         guint channel);

Append an audio segment to a sample list.

list :

Sample list

sample :

Sample containing audio segment to append

ofs :

Offset in sample of beginning of audio segment (in frames)

size :

Number of frames of audio segment to append

channel :

Channel to use from sample

ipatch_sample_list_prepend ()

void                ipatch_sample_list_prepend          (IpatchSampleList *list,
                                                         IpatchSample *sample,
                                                         guint ofs,
                                                         guint size,
                                                         guint channel);

Prepend an audio segment to a sample list.

list :

Sample list

sample :

Sample containing audio segment to prepend

ofs :

Offset in sample of beginning of audio segment (in frames)

size :

Number of frames of audio segment to prepend

channel :

Channel to use from sample

ipatch_sample_list_insert_index ()

void                ipatch_sample_list_insert_index     (IpatchSampleList *list,
                                                         guint index,
                                                         IpatchSample *sample,
                                                         guint ofs,
                                                         guint size,
                                                         guint channel);

Insert an audio segment into a sample list before a given list segment index.

list :

Sample list

index :

List index to insert segment before (0 = prepend, -1 = append)

sample :

Sample containing audio segment to insert

ofs :

Offset in sample of beginning of audio segment (in frames)

size :

Number of frames of audio segment to insert

channel :

Channel to use from sample

ipatch_sample_list_insert ()

void                ipatch_sample_list_insert           (IpatchSampleList *list,
                                                         guint pos,
                                                         IpatchSample *sample,
                                                         guint ofs,
                                                         guint size,
                                                         guint channel);

Insert an audio segment into a sample list at a given sample position in frames (pos). Existing segments will be split as needed to accomodate the inserted segment.

list :

Sample list

pos :

Position in audio data in frames to insert segment at

sample :

Sample containing audio segment to insert

ofs :

Offset in sample of beginning of audio segment (in frames)

size :

Number of frames of audio segment to insert

channel :

Channel to use from sample

ipatch_sample_list_cut ()

void                ipatch_sample_list_cut              (IpatchSampleList *list,
                                                         guint pos,
                                                         guint size);

Cut a segment of audio from a sample list.

list :

Sample list

pos :

Start position of sample data to cut, in frames

size :

Size of area to cut, in frames

ipatch_sample_list_render ()

gboolean            ipatch_sample_list_render           (IpatchSampleList *list,
                                                         gpointer buf,
                                                         guint pos,
                                                         guint size,
                                                         int format,
                                                         GError **err);

Copies sample data from a sample list, converting as necessary and storing to buf.

list :

Sample list

buf :

Buffer to store the rendered audio to (should be size * bytes_per_frame)

pos :

Position in sample list audio to start from, in frames

size :

Size of sample data to render in frames

format :

Sample format to render to (must be mono)

err :

Location to store error to or NULL to ignore
libinstpatch-1.0.0/docs/reference/html/libinstpatch.devhelp0000644000175000017500000064120511461404255021016 00000000000000 libinstpatch-1.0.0/docs/reference/html/IpatchContainer.html0000644000175000017500000015371111461404256020723 00000000000000 IpatchContainer

IpatchContainer

IpatchContainer — Abstract object type used for items containing other child items.

Stability Level

Stable, unless otherwise indicated

Synopsis

void                (*IpatchContainerCallback)          (IpatchContainer *container,
                                                         IpatchItem *item,
                                                         gpointer user_data);
void                (*IpatchContainerDisconnect)        (IpatchContainer *container,
                                                         IpatchItem *child,
                                                         gpointer user_data);
                    IpatchContainer;
#define             IPATCH_CONTAINER_UNUSED_FLAG_SHIFT
#define             IPATCH_CONTAINER_ERRMSG_INVALID_CHILD_2
IpatchList *        ipatch_container_get_children       (IpatchContainer *container,
                                                         GType type);
const GType *       ipatch_container_get_child_types    (IpatchContainer *container);
const GType *       ipatch_container_get_virtual_types  (IpatchContainer *container);
const GType *       ipatch_container_type_get_child_types
                                                        (GType container_type);
void                ipatch_container_insert             (IpatchContainer *container,
                                                         IpatchItem *item,
                                                         int pos);
void                ipatch_container_append             (IpatchContainer *container,
                                                         IpatchItem *item);
#define             ipatch_container_add
void                ipatch_container_prepend            (IpatchContainer *container,
                                                         IpatchItem *item);
void                ipatch_container_remove             (IpatchContainer *container,
                                                         IpatchItem *item);
void                ipatch_container_remove_all         (IpatchContainer *container);
guint               ipatch_container_count              (IpatchContainer *container,
                                                         GType type);
void                ipatch_container_make_unique        (IpatchContainer *container,
                                                         IpatchItem *item);
void                ipatch_container_add_unique         (IpatchContainer *container,
                                                         IpatchItem *item);
gboolean            ipatch_container_init_iter          (IpatchContainer *container,
                                                         IpatchIter *iter,
                                                         GType type);
void                ipatch_container_insert_iter        (IpatchContainer *container,
                                                         IpatchItem *item,
                                                         IpatchIter *iter);
void                ipatch_container_remove_iter        (IpatchContainer *container,
                                                         IpatchIter *iter);
void                ipatch_container_add_notify         (IpatchContainer *container,
                                                         IpatchItem *child);
void                ipatch_container_remove_notify      (IpatchContainer *container,
                                                         IpatchItem *child);
guint               ipatch_container_add_connect        (IpatchContainer *container,
                                                         IpatchContainerCallback callback,
                                                         IpatchContainerDisconnect disconnect,
                                                         gpointer user_data);
guint               ipatch_container_remove_connect     (IpatchContainer *container,
                                                         IpatchItem *child,
                                                         IpatchContainerCallback callback,
                                                         IpatchContainerDisconnect disconnect,
                                                         gpointer user_data);
void                ipatch_container_add_disconnect     (guint handler_id);
void                ipatch_container_add_disconnect_matched
                                                        (IpatchContainer *container,
                                                         IpatchContainerCallback callback,
                                                         gpointer user_data);
void                ipatch_container_remove_disconnect  (guint handler_id);
void                ipatch_container_remove_disconnect_matched
                                                        (IpatchContainer *container,
                                                         IpatchItem *child,
                                                         IpatchContainerCallback callback,
                                                         gpointer user_data);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchBase
               +----IpatchDLS2Inst
               +----IpatchGigRegion
               +----IpatchSF2Preset
               +----IpatchSF2Inst
               +----IpatchVBankInst

Description

Objects which are derived from this abstract type can contain other items, thus forming a tree of items in an instrument file for example.

Details

IpatchContainerCallback ()

void                (*IpatchContainerCallback)          (IpatchContainer *container,
                                                         IpatchItem *item,
                                                         gpointer user_data);

A function prototype callback which is called for container adds or removes (after adds, before removes).

container :

Container item

item :

Item that was added/removed to/from container

user_data :

User defined pointer assigned when callback connected

IpatchContainerDisconnect ()

void                (*IpatchContainerDisconnect)        (IpatchContainer *container,
                                                         IpatchItem *child,
                                                         gpointer user_data);

A function prototype which is called when a callback gets disconnected.

container :

Container item

child :

Match child item of original connect (ipatch_container_remove_connect() only, always NULL for ipatch_container_add_connect()).

user_data :

User defined pointer assigned when callback connected

IpatchContainer

typedef struct _IpatchContainer IpatchContainer;

IPATCH_CONTAINER_UNUSED_FLAG_SHIFT

#define IPATCH_CONTAINER_UNUSED_FLAG_SHIFT  IPATCH_ITEM_UNUSED_FLAG_SHIFT

IPATCH_CONTAINER_ERRMSG_INVALID_CHILD_2

#define             IPATCH_CONTAINER_ERRMSG_INVALID_CHILD_2

ipatch_container_get_children ()

IpatchList *        ipatch_container_get_children       (IpatchContainer *container,
                                                         GType type);

Get a list of child items from a container object. A new IpatchList is created containing all matching child items. The returned list object can be iterated over safely even in a multi-thread environment. If performance is an issue, ipatch_container_init_iter() can be used instead, although it requires locking of the container object.

container :

Container object

type :

GType of child items to get (will match type descendants as well)

Returns :

New object list containing all matching items (an empty list if no items matched). The caller owns a reference to the object list and removing the reference will destroy it.

ipatch_container_get_child_types ()

const GType *       ipatch_container_get_child_types    (IpatchContainer *container);

Get an array of child types for a container object. The number of types is the number of individual lists the container has.

container :

Container object

Returns :

Pointer to a zero terminated array of types. Array is static and should not be modified or freed.

ipatch_container_get_virtual_types ()

const GType *       ipatch_container_get_virtual_types  (IpatchContainer *container);

Get an array of virtual types for a container object. Virtual types are used to group child items in user interfaces (an example is SoundFont "Percussion Presets" which contains all presets in bank number 128). To discover what virtual container a child object is part of lookup it's "virtual-parent-type" type property (ipatch_type_get() or ipatch_type_object_get()).

container :

Container object

Returns :

Pointer to a zero terminated array of types or NULL if no virtual types for container. Array is static and should not be modified or freed.

ipatch_container_type_get_child_types ()

const GType *       ipatch_container_type_get_child_types
                                                        (GType container_type);

Get an array of child types for a container type. The number of types is the number of individual lists the container has. Like ipatch_container_get_child_types() but takes a container GType instead of a container object.

container_type :

A IpatchContainer derived type to get child types of

Returns :

Pointer to a zero terminated array of types. Array is static and should not be modified or freed.

ipatch_container_insert ()

void                ipatch_container_insert             (IpatchContainer *container,
                                                         IpatchItem *item,
                                                         int pos);

Inserts an item into a patch item container.

MT-NOTE: If position in list is critical the container item should be locked and ipatch_container_insert_iter() used instead (see other special requirements for using this function). Only inserting in the first or last position (pos is 0 or less than 0) is guaranteed.

container :

Container item to insert into

item :

Item to insert

pos :

Index position to insert item into (item type is used to determine what list to insert into). 0 = first, less than 0 = last.

ipatch_container_append ()

void                ipatch_container_append             (IpatchContainer *container,
                                                         IpatchItem *item);

Appends an item to a container's children.

container :

Container item

item :

Item to insert

ipatch_container_add

#define ipatch_container_add  ipatch_container_append

ipatch_container_prepend ()

void                ipatch_container_prepend            (IpatchContainer *container,
                                                         IpatchItem *item);

Prepends an item to a container's children.

container :

Container item

item :

Item to insert

ipatch_container_remove ()

void                ipatch_container_remove             (IpatchContainer *container,
                                                         IpatchItem *item);

Removes an item from container.

container :

Container item to remove from

item :

Item to remove from container

ipatch_container_remove_all ()

void                ipatch_container_remove_all         (IpatchContainer *container);

Removes all items from a container object.

container :

Container object

ipatch_container_count ()

guint               ipatch_container_count              (IpatchContainer *container,
                                                         GType type);

Counts children of a specific type (or derived thereof) in a container object.

container :

Container object to count children of

type :

Type of children to count

Returns :

Count of children of type in container.

ipatch_container_make_unique ()

void                ipatch_container_make_unique        (IpatchContainer *container,
                                                         IpatchItem *item);

Ensures an item's duplicate sensitive properties are unique among items of the same type in container. The item need not be a child of container, but can be. The initial values of the duplicate sensitive properties are used if already unique, otherwise they are modified (name strings have numbers appended to them, unused MIDI locale is found, etc).

container :

Patch item container

item :

An item of a type that can be added to container (but not necessarily parented to container).

ipatch_container_add_unique ()

void                ipatch_container_add_unique         (IpatchContainer *container,
                                                         IpatchItem *item);

Adds a patch item to a container and ensures that the item's duplicate sensitive properties are unique (see ipatch_container_make_unique()).

container :

Container to add item to

item :

Item to add

ipatch_container_init_iter ()

gboolean            ipatch_container_init_iter          (IpatchContainer *container,
                                                         IpatchIter *iter,
                                                         GType type);

Initialize an iterator structure to a child list of the specified type in a container object.

MT-NOTE: The container must be locked, or single thread access ensured, for the duration of this call and iteration of iter as the container object's lists are used directly. The iterator related functions are meant to be used for latency critical operations, and they should try and minimize the locking duration.

container :

Container object

iter :

Iterator structure to initialize

type :

Container child type list to initialize iter to

Returns :

TRUE on success, FALSE otherwise in which case the contents of iter are undefined.

ipatch_container_insert_iter ()

void                ipatch_container_insert_iter        (IpatchContainer *container,
                                                         IpatchItem *item,
                                                         IpatchIter *iter);

This function should not normally be used. It is provided to allow for custom high performance functions involving container adds. If used, certain precautions and requirements must be followed.

Insert a patch item into a container after the position marked by iter. No checking is done to see if child item is actually a valid type in container, this is left up to the caller for added performance. Also left up to the caller is a call to ipatch_container_add_notify() to notify that the item has been added (should be called after this function and outside of container lock). It is not necessary to notify if hooks are not enabled for container or caller doesn't care.

MT-NOTE: The container object should be write locked, or single thread access ensured, for the duration of this call and prior iterator functions.

container :

Container object

item :

Patch item to insert

iter :

Iterator marking position to insert after (NULL position to prepend). Iterator is advanced after insert to point to new inserted item. Note that this makes appending multiple items rather fast.

ipatch_container_remove_iter ()

void                ipatch_container_remove_iter        (IpatchContainer *container,
                                                         IpatchIter *iter);

This function should not normally be used. It is provided to allow for custom high performance functions involving container removes. If used, certain precautions and requirements must be followed.

Removes an item from a container object. The item is specified by the current position in iter. It is left up to the caller to call ipatch_container_remove_notify() (should be called before this function and out of container lock) to notify that the item will be removed. It is not necessary to notify if hooks are not enabled for container or caller doesn't care.

MT-NOTE: The container object should be write locked, or single thread access ensured, for the duration of this call and prior iterator functions.

container :

Container object

iter :

Iterator marking item to remove

ipatch_container_add_notify ()

void                ipatch_container_add_notify         (IpatchContainer *container,
                                                         IpatchItem *child);

Notify that a child add has occurred to an IpatchContainer object. Should be called after the add has occurred. This function is normally not needed except when using ipatch_container_insert_iter().

container :

Container item for which an item add occurred

child :

Child which was added

ipatch_container_remove_notify ()

void                ipatch_container_remove_notify      (IpatchContainer *container,
                                                         IpatchItem *child);

Notify that a container remove will occur to an IpatchContainer object. Should be called before the remove occurs. This function is normally not needed, except when using ipatch_container_remove_iter().

container :

Container item for which a remove will occur

child :

Child which will be removed

ipatch_container_add_connect ()

guint               ipatch_container_add_connect        (IpatchContainer *container,
                                                         IpatchContainerCallback callback,
                                                         IpatchContainerDisconnect disconnect,
                                                         gpointer user_data);

Adds a callback which gets called when a container item add operation occurs and the container matches container. When container is NULL, callback will be called for every container add operation.

container :

Container to match (NULL for wildcard)

callback :

Callback function to call on match

disconnect :

Function to call when callback is disconnected or NULL

user_data :

User defined data pointer to pass to callback and disconnect

Returns :

Handler ID which can be used to disconnect the callback or 0 on error (only occurs on invalid function parameters).

ipatch_container_remove_connect ()

guint               ipatch_container_remove_connect     (IpatchContainer *container,
                                                         IpatchItem *child,
                                                         IpatchContainerCallback callback,
                                                         IpatchContainerDisconnect disconnect,
                                                         gpointer user_data);

Adds a callback which gets called when a container item remove operation occurs and the container matches container and child item matches child. The container and/or child parameters can be NULL in which case they are wildcard. If both are NULL then callback will be called for every container remove operation. Note that specifying only child or both container and child is the same, since a child belongs to only one container.

container :

Container to match (NULL for wildcard)

child :

Child item to match (NULL for wildcard)

callback :

Callback function to call on match

disconnect :

Function to call when callback is disconnected or NULL

user_data :

User defined data pointer to pass to callback and disconnect

Returns :

Handler ID which can be used to disconnect the callback or 0 on error (only occurs on invalid function parameters).

ipatch_container_add_disconnect ()

void                ipatch_container_add_disconnect     (guint handler_id);

Disconnects a container add callback previously connected with ipatch_container_add_connect() by handler ID. The ipatch_container_add_disconnect_matched() function can be used instead to disconnect by original callback criteria and is actually faster.

handler_id :

ID of callback handler

ipatch_container_add_disconnect_matched ()

void                ipatch_container_add_disconnect_matched
                                                        (IpatchContainer *container,
                                                         IpatchContainerCallback callback,
                                                         gpointer user_data);

Disconnects a container add callback previously connected with ipatch_container_add_connect() by match criteria.

container :

Container to match

callback :

Callback function to match

user_data :

User data to match

ipatch_container_remove_disconnect ()

void                ipatch_container_remove_disconnect  (guint handler_id);

Disconnects a container remove callback previously connected with ipatch_container_remove_connect() by handler ID. The ipatch_container_remove_disconnect_matched() function can be used instead to disconnect by original callback criteria and is actually faster.

handler_id :

ID of callback handler

ipatch_container_remove_disconnect_matched ()

void                ipatch_container_remove_disconnect_matched
                                                        (IpatchContainer *container,
                                                         IpatchItem *child,
                                                         IpatchContainerCallback callback,
                                                         gpointer user_data);

Disconnects a handler previously connected with ipatch_container_remove_connect() by match criteria.

container :

Container to match

child :

Child item to match

callback :

Callback function to match

user_data :

User data to match
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchSampleTransform.html0000644000175000017500000011335611461404256024601 00000000000000 IpatchSampleTransform

IpatchSampleTransform

IpatchSampleTransform — Audio format conversion instance

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchSampleTransform;
void                (*IpatchSampleTransformFunc)        (IpatchSampleTransform *transform);
IpatchSampleTransform * ipatch_sample_transform_new     (int src_format,
                                                         int dest_format,
                                                         guint32 channel_map);
void                ipatch_sample_transform_free        (IpatchSampleTransform *transform);
void                ipatch_sample_transform_init        (IpatchSampleTransform *transform);
IpatchSampleTransform * ipatch_sample_transform_pool_acquire
                                                        (int src_format,
                                                         int dest_format,
                                                         guint32 channel_map);
void                ipatch_sample_transform_pool_release
                                                        (IpatchSampleTransform *transform);
void                ipatch_sample_transform_set_formats (IpatchSampleTransform *transform,
                                                         int src_format,
                                                         int dest_format,
                                                         guint32 channel_map);
void                ipatch_sample_transform_alloc       (IpatchSampleTransform *transform,
                                                         guint frames);
int                 ipatch_sample_transform_alloc_size  (IpatchSampleTransform *transform,
                                                         guint size);
void                ipatch_sample_transform_free_buffers
                                                        (IpatchSampleTransform *transform);
guint               ipatch_sample_transform_set_buffers_size
                                                        (IpatchSampleTransform *transform,
                                                         gpointer buf,
                                                         guint size);
void                ipatch_sample_transform_get_buffers (IpatchSampleTransform *transform,
                                                         gpointer *buf1,
                                                         gpointer *buf2);
void                ipatch_sample_transform_get_frame_sizes
                                                        (IpatchSampleTransform *transform,
                                                         guint *buf1_size,
                                                         guint *buf2_size);
guint               ipatch_sample_transform_get_max_frames
                                                        (IpatchSampleTransform *transform);
gpointer            ipatch_sample_transform_convert     (IpatchSampleTransform *transform,
                                                         gconstpointer src,
                                                         gpointer dest,
                                                         guint frames);
gpointer            ipatch_sample_transform_convert_single
                                                        (IpatchSampleTransform *transform,
                                                         guint frames);

Description

A structure for converting between audio formats (for example the bit width or number of channels). This structure is initialized with the source and destination audio formats, multi-channel mapping and conversion buffers.

Details

IpatchSampleTransform

typedef struct {
  guint16 src_format;		/* source sample format */
  guint16 dest_format;		/* destination sample format */
  guint8 channel_map[8];        /* channel mapping for multi-channel audio */
  guint8 buf1_max_frame;	/* max bytes per frame for buf1 */
  guint8 buf2_max_frame;	/* max bytes per frame for buf2 */
  guint8 func_count;		/* number of functions in funcs array */
  guint8 free_buffers;		/* set to TRUE if buffers need to be freed */
  guint max_frames;		/* max frames that can be converted in batch */
  guint frames;			/* number of frames to transform */
  guint samples; /* # of samples for current transform func (not frames!)*/
  gpointer buf1;		/* buffer 1 (first input) */
  gpointer buf2;		/* buffer 2 */
  guint combined_size;	/* size in bytes of both buffers (if combined) */
  gpointer reserved1;           /* Reserved field */
  gpointer reserved2;           /* Reserved field */

  /* array of transform funcs */
  IpatchSampleTransformFunc funcs[IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS];
} IpatchSampleTransform;

IpatchSampleTransformFunc ()

void                (*IpatchSampleTransformFunc)        (IpatchSampleTransform *transform);

Audio conversion handler prototype. Handler will modify samples of transform if number of samples changes (a change in the number of channels occurs).

transform :

Sample transform object

ipatch_sample_transform_new ()

IpatchSampleTransform * ipatch_sample_transform_new     (int src_format,
                                                         int dest_format,
                                                         guint32 channel_map);

Create a new sample transform object. If src_format and dest_format are not 0 then the transform is initialized for the given source and destination formats, otherwise they are expected to be set later with ipatch_sample_transform_set_formats().

src_format :

Source sample format or 0 to set later

dest_format :

Destination sample format or 0 to set later

channel_map :

Channel mapping (use IPATCH_SAMPLE_UNITY_CHANNEL_MAP to map all input channels to the same output channels, see IPATCH_SAMPLE_MAP_CHANNEL macro for constructing channel map values)

Returns :

New allocated sample transform structure which should be freed with ipatch_sample_transform_free() when done with it.

ipatch_sample_transform_free ()

void                ipatch_sample_transform_free        (IpatchSampleTransform *transform);

Free a transform structure as allocated by ipatch_sample_transform_new() and its allocated resources.

transform :

Transform structure

ipatch_sample_transform_init ()

void                ipatch_sample_transform_init        (IpatchSampleTransform *transform);

Initialize a sample transform structure. Usually only used to initialize transform structures allocated on the stack, which is done to avoid mallocs.

transform :

Sample transform to initialize

ipatch_sample_transform_pool_acquire ()

IpatchSampleTransform * ipatch_sample_transform_pool_acquire
                                                        (int src_format,
                                                         int dest_format,
                                                         guint32 channel_map);

Get an unused sample transform object from the sample transform pool. Used for quickly getting a transform object for temporary use without the overhead of allocating one. Note though, that if no more transforms exist in the pool an allocation will occur.

src_format :

Source sample format

dest_format :

Destination sample format

channel_map :

Channel mapping (use IPATCH_SAMPLE_UNITY_CHANNEL_MAP to map all input channels to the same output channels, see IPATCH_SAMPLE_MAP_CHANNEL macro for constructing channel map values)

Returns :

Sample transform object. Should be released after use with ipatch_sample_transform_pool_release().

ipatch_sample_transform_pool_release ()

void                ipatch_sample_transform_pool_release
                                                        (IpatchSampleTransform *transform);

Release a sample transform object, returned by ipatch_sample_transform_pool_grab(), back to the transform pool.

transform :

Sample transform

ipatch_sample_transform_set_formats ()

void                ipatch_sample_transform_set_formats (IpatchSampleTransform *transform,
                                                         int src_format,
                                                         int dest_format,
                                                         guint32 channel_map);

Initialize a sample transform object for converting from src_format to dest_format.

transform :

Transform object

src_format :

Source audio format to convert from

dest_format :

Destination audio format to convert to

channel_map :

Channel mapping (use IPATCH_SAMPLE_UNITY_CHANNEL_MAP to map all input channels to the same output channels, see IPATCH_SAMPLE_MAP_CHANNEL macro for constructing channel map values)

ipatch_sample_transform_alloc ()

void                ipatch_sample_transform_alloc       (IpatchSampleTransform *transform,
                                                         guint frames);

Allocate buffers for transforming between two audio formats, for which transform has previously been initialized for with ipatch_sample_transform_new() or ipatch_sample_transform_set_formats().

Note: Assigning buffers with this function allows sample formats to be changed without re-assigning the buffers.

transform :

Sample transform object

frames :

Number of frames to allocate for (max frames processed in batch)

ipatch_sample_transform_alloc_size ()

int                 ipatch_sample_transform_alloc_size  (IpatchSampleTransform *transform,
                                                         guint size);

Like ipatch_sample_transform_alloc() but allocates buffers based on a maximum size and returns the maximum number of sample frames which can be converted at a time using this size. Another difference is that conversion formats do not need to be set before calling this function.

transform :

Sample transform object

size :

Maximum total size in bytes of allocation for both transform buffers.

Returns :

The maximum number of frames that can be converted at a time for the given size of transform buffers. If conversion formats have not yet been set, then this function returns 0.

ipatch_sample_transform_free_buffers ()

void                ipatch_sample_transform_free_buffers
                                                        (IpatchSampleTransform *transform);

Free sample transform buffers.

transform :

Sample transform object

ipatch_sample_transform_set_buffers_size ()

guint               ipatch_sample_transform_set_buffers_size
                                                        (IpatchSampleTransform *transform,
                                                         gpointer buf,
                                                         guint size);

Assign transform buffers using a single buffer of a specific size in bytes and determine optimal division for source and destination buffers. Conversion formats must not be set before calling this function (can be set later).

transform :

Sample transform object

buf :

Buffer to assign for transforming sample formats

size :

Size of buf in bytes

Returns :

The maximum number of frames that can be converted at a time for the given size of transform buffers. If conversion formats have not yet been set, then this function returns 0.

ipatch_sample_transform_get_buffers ()

void                ipatch_sample_transform_get_buffers (IpatchSampleTransform *transform,
                                                         gpointer *buf1,
                                                         gpointer *buf2);

Get the sample data buffers in a sample transform object.

transform :

Sample transform object

buf1 :

Output - first buffer or NULL to ignore

buf2 :

Output - second buffer or NULL to ignore

ipatch_sample_transform_get_frame_sizes ()

void                ipatch_sample_transform_get_frame_sizes
                                                        (IpatchSampleTransform *transform,
                                                         guint *buf1_size,
                                                         guint *buf2_size);

Get max frame sizes for transform buffers. When transforming audio the first buffer must be at least frames * buf1_size bytes in size and the second buffer must be at least frames * buf2_size, where frames is the max number of frames to convert in batch.

transform :

Initialized transform object

buf1_size :

Out: Maximum frame size for buffer 1 or NULL to ignore

buf2_size :

Out: Maximum frame size for buffer 2 or NULL to ignore

ipatch_sample_transform_get_max_frames ()

guint               ipatch_sample_transform_get_max_frames
                                                        (IpatchSampleTransform *transform);

Get the maximum frames that the transform object can convert at a time.

transform :

Sample transform object

Returns :

Max number of frames that can be converted at a time, 0 if buffers have not been allocated yet.

ipatch_sample_transform_convert ()

gpointer            ipatch_sample_transform_convert     (IpatchSampleTransform *transform,
                                                         gconstpointer src,
                                                         gpointer dest,
                                                         guint frames);

Convert an arbitrary number of audio frames from user provided buffers, contrary to ipatch_sample_transform_convert_single() which uses internal buffers and converts a max of 1 buffer at a time. The sample formats should already be assigned and internal buffers assigned or allocated.

transform :

An initialized sample transform object

src :

Audio source buffer (frames X the source frame size in bytes), can be NULL to use internal buffer (provided frames is less than or equal to the max frames that can be converted at a time), in which case buf1 of transform should already be loaded with source data.

dest :

Converted audio destination buffer (frames X the destination frame size in bytes), can be NULL to use internal buffer (provided frames is less than or equal to the max frames that can be converted at a time).

frames :

Number of audio frames to convert

Returns :

Pointer to converted data. Will be dest if it was not NULL or internal buffer containing the converted data otherwise.

ipatch_sample_transform_convert_single ()

gpointer            ipatch_sample_transform_convert_single
                                                        (IpatchSampleTransform *transform,
                                                         guint frames);

Convert the format of a single buffer of audio. The transform object must have had its sample formats set and buffers assigned or allocated. Use ipatch_sample_transform_convert() to convert from one buffer to another regardless of the number of frames.

transform :

An initialized sample transform object

frames :

Number of frames to convert (should be less than or equal to the maximum frames which can be converted at a time (see ipatch_sample_transform_get_max_frames()).

Returns :

Pointer to converted audio data (buffer is internal to transform object).
libinstpatch-1.0.0/docs/reference/html/IpatchFile.html0000644000175000017500000043132711461404256017662 00000000000000 IpatchFile

IpatchFile

IpatchFile — File abstraction object

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchFileIOFuncs;
                    IpatchFileHandle;
                    IpatchFile;
enum                IpatchFileFlags;
enum                IpatchFileIdentifyOrder;
#define             IPATCH_FILE_UNUSED_FLAG_SHIFT
#define             IPATCH_FILE_NEED_SWAP               (file)
#define             IPATCH_FILE_BIG_ENDIAN              (file)
#define             IPATCH_FILE_SWAP16                  (file, p16)
#define             IPATCH_FILE_SWAP32                  (file, p32)
#define             IPATCH_FILE_SWAP64                  (file, p64)
#define             IPATCH_IS_FILE_HANDLE               (handle)
IpatchFile *        ipatch_file_new                     (void);
void                ipatch_file_set_name                (IpatchFile *file,
                                                         const char *file_name);
char *              ipatch_file_get_name                (IpatchFile *file);
IpatchFileHandle *  ipatch_file_open                    (IpatchFile *file,
                                                         const char *file_name,
                                                         const char *mode,
                                                         GError **err);
void                ipatch_file_assign_fd               (IpatchFile *file,
                                                         int fd,
                                                         gboolean close_on_finalize);
void                ipatch_file_assign_io_channel       (IpatchFile *file,
                                                         GIOChannel *iochan);
GIOChannel *        ipatch_file_get_io_channel          (IpatchFileHandle *handle);
int                 ipatch_file_get_fd                  (IpatchFileHandle *handle);
void                ipatch_file_close                   (IpatchFileHandle *handle);
guint               ipatch_file_get_position            (IpatchFileHandle *handle);
void                ipatch_file_update_position         (IpatchFileHandle *handle,
                                                         guint offset);
gboolean            ipatch_file_read                    (IpatchFileHandle *handle,
                                                         gpointer buf,
                                                         guint size,
                                                         GError **err);
GIOStatus           ipatch_file_read_eof                (IpatchFileHandle *handle,
                                                         gpointer buf,
                                                         guint size,
                                                         guint *bytes_read,
                                                         GError **err);
gboolean            ipatch_file_write                   (IpatchFileHandle *handle,
                                                         gconstpointer buf,
                                                         guint size,
                                                         GError **err);
#define             ipatch_file_skip                    (handle, offset, err)
gboolean            ipatch_file_seek                    (IpatchFileHandle *handle,
                                                         int offset,
                                                         GSeekType type,
                                                         GError **err);
GIOStatus           ipatch_file_seek_eof                (IpatchFileHandle *handle,
                                                         int offset,
                                                         GSeekType type,
                                                         GError **err);
int                 ipatch_file_get_size                (IpatchFile *file,
                                                         GError **err);
GType               ipatch_file_identify                (IpatchFile *file,
                                                         GError **err);
GType               ipatch_file_identify_by_ext         (IpatchFile *file);
IpatchFileHandle *  ipatch_file_identify_open           (const char *file_name,
                                                         GError **err);
void                ipatch_file_set_little_endian       (IpatchFile *file);
void                ipatch_file_set_big_endian          (IpatchFile *file);
gboolean            ipatch_file_read_u8                 (IpatchFileHandle *handle,
                                                         guint8 *val,
                                                         GError **err);
gboolean            ipatch_file_read_u16                (IpatchFileHandle *handle,
                                                         guint16 *val,
                                                         GError **err);
gboolean            ipatch_file_read_u32                (IpatchFileHandle *handle,
                                                         guint32 *val,
                                                         GError **err);
gboolean            ipatch_file_read_u64                (IpatchFileHandle *handle,
                                                         guint64 *val,
                                                         GError **err);
gboolean            ipatch_file_read_s8                 (IpatchFileHandle *handle,
                                                         gint8 *val,
                                                         GError **err);
gboolean            ipatch_file_read_s16                (IpatchFileHandle *handle,
                                                         gint16 *val,
                                                         GError **err);
gboolean            ipatch_file_read_s32                (IpatchFileHandle *handle,
                                                         gint32 *val,
                                                         GError **err);
gboolean            ipatch_file_read_s64                (IpatchFileHandle *handle,
                                                         gint64 *val,
                                                         GError **err);
gboolean            ipatch_file_write_u8                (IpatchFileHandle *handle,
                                                         guint8 val,
                                                         GError **err);
gboolean            ipatch_file_write_u16               (IpatchFileHandle *handle,
                                                         guint16 val,
                                                         GError **err);
gboolean            ipatch_file_write_u32               (IpatchFileHandle *handle,
                                                         guint32 val,
                                                         GError **err);
gboolean            ipatch_file_write_u64               (IpatchFileHandle *handle,
                                                         guint64 val,
                                                         GError **err);
gboolean            ipatch_file_write_s8                (IpatchFileHandle *handle,
                                                         gint8 val,
                                                         GError **err);
gboolean            ipatch_file_write_s16               (IpatchFileHandle *handle,
                                                         gint16 val,
                                                         GError **err);
gboolean            ipatch_file_write_s32               (IpatchFileHandle *handle,
                                                         gint32 val,
                                                         GError **err);
gboolean            ipatch_file_write_s64               (IpatchFileHandle *handle,
                                                         gint64 val,
                                                         GError **err);
gboolean            ipatch_file_buf_load                (IpatchFileHandle *handle,
                                                         guint size,
                                                         GError **err);
void                ipatch_file_buf_read                (IpatchFileHandle *handle,
                                                         gpointer buf,
                                                         guint size);
void                ipatch_file_buf_write               (IpatchFileHandle *handle,
                                                         gconstpointer buf,
                                                         guint size);
#define             ipatch_file_buf_zero                (filebuf, size)
void                ipatch_file_buf_memset              (IpatchFileHandle *handle,
                                                         char c,
                                                         guint size);
gboolean            ipatch_file_buf_commit              (IpatchFileHandle *handle,
                                                         GError **err);
#define             ipatch_file_buf_skip                (filebuf, offset)
void                ipatch_file_buf_seek                (IpatchFileHandle *handle,
                                                         int offset,
                                                         GSeekType type);
guint8              ipatch_file_buf_read_u8             (IpatchFileHandle *handle);
guint16             ipatch_file_buf_read_u16            (IpatchFileHandle *handle);
guint32             ipatch_file_buf_read_u32            (IpatchFileHandle *handle);
guint64             ipatch_file_buf_read_u64            (IpatchFileHandle *handle);
gint8               ipatch_file_buf_read_s8             (IpatchFileHandle *handle);
gint16              ipatch_file_buf_read_s16            (IpatchFileHandle *handle);
gint32              ipatch_file_buf_read_s32            (IpatchFileHandle *handle);
gint64              ipatch_file_buf_read_s64            (IpatchFileHandle *handle);
void                ipatch_file_buf_write_u8            (IpatchFileHandle *handle,
                                                         guint8 val);
void                ipatch_file_buf_write_u16           (IpatchFileHandle *handle,
                                                         guint16 val);
void                ipatch_file_buf_write_u32           (IpatchFileHandle *handle,
                                                         guint32 val);
void                ipatch_file_buf_write_u64           (IpatchFileHandle *handle,
                                                         guint64 val);
void                ipatch_file_buf_write_s8            (IpatchFileHandle *handle,
                                                         gint8 val);
void                ipatch_file_buf_write_s16           (IpatchFileHandle *handle,
                                                         gint16 val);
void                ipatch_file_buf_write_s32           (IpatchFileHandle *handle,
                                                         gint32 val);
void                ipatch_file_buf_write_s64           (IpatchFileHandle *handle,
                                                         gint64 val);
void                ipatch_file_set_iofuncs_static      (IpatchFile *file,
                                                         IpatchFileIOFuncs *funcs);
void                ipatch_file_set_iofuncs             (IpatchFile *file,
                                                         const IpatchFileIOFuncs *funcs);
void                ipatch_file_get_iofuncs             (IpatchFile *file,
                                                         IpatchFileIOFuncs *out_funcs);
void                ipatch_file_set_iofuncs_null        (IpatchFile *file);
gboolean            ipatch_file_default_open_method     (IpatchFileHandle *handle,
                                                         const char *mode,
                                                         GError **err);
void                ipatch_file_default_close_method    (IpatchFileHandle *handle);
GIOStatus           ipatch_file_default_read_method     (IpatchFileHandle *handle,
                                                         gpointer buf,
                                                         guint size,
                                                         guint *bytes_read,
                                                         GError **err);
GIOStatus           ipatch_file_default_write_method    (IpatchFileHandle *handle,
                                                         gconstpointer buf,
                                                         guint size,
                                                         GError **err);
GIOStatus           ipatch_file_default_seek_method     (IpatchFileHandle *handle,
                                                         int offset,
                                                         GSeekType type,
                                                         GError **err);
int                 ipatch_file_default_getfd_method    (IpatchFileHandle *handle);
int                 ipatch_file_default_get_size_method (IpatchFile *file,
                                                         GError **err);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchFile
               +----IpatchDLSFile
               +----IpatchSF2File
               +----IpatchSndFile

Properties

  "file-name"                gchar*                : Read / Write

Description

Provides an abstraction of file data sources and file type identification.

Details

IpatchFileIOFuncs

typedef struct {
  gboolean (*open)(IpatchFileHandle *handle, const char *mode, GError **err);
  void (*close)(IpatchFileHandle *handle);
  GIOStatus (*read)(IpatchFileHandle *handle, gpointer buf, guint size,
		    guint *bytes_read, GError **err);
  GIOStatus (*write)(IpatchFileHandle *handle, gconstpointer buf, guint size,
		     GError **err);
  GIOStatus (*seek)(IpatchFileHandle *handle, int offset, GSeekType type, GError **err);
  int (*getfd)(IpatchFileHandle *handle); /* optional get file descriptor method */
  int (*get_size)(IpatchFile *file, GError **err);  /* optional get size method */
} IpatchFileIOFuncs;

IpatchFileHandle

typedef struct {
  IpatchFile *file;		/* Parent file object */
  guint position;               /* Current file position */
  GByteArray *buf;              /* For buffered reads/writes */
  guint buf_position;           /* Current position in buffer */
  GIOChannel *iochan;		/* glib IO channel (default methods) */
  gpointer data;                /* iofuncs defined data */
} IpatchFileHandle;

IpatchFile handle for opening a file and reading/writing from/to it.


IpatchFile

typedef struct _IpatchFile IpatchFile;

enum IpatchFileFlags

typedef enum
{
  IPATCH_FILE_FLAG_SWAP = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT),
  IPATCH_FILE_FLAG_BIG_ENDIAN = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 1),
  IPATCH_FILE_FLAG_FREE_IOFUNCS = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 2)
} IpatchFileFlags;

IPATCH_FILE_FLAG_SWAP

Swap multi-byte numbers?

IPATCH_FILE_FLAG_BIG_ENDIAN

Big endian file?

IPATCH_FILE_FLAG_FREE_IOFUNCS

Should ->iofuncs be freed?

enum IpatchFileIdentifyOrder

typedef enum
{
  IPATCH_FILE_IDENTIFY_ORDER_LAST = -10,
  IPATCH_FILE_IDENTIFY_ORDER_DEFAULT = 0,
  IPATCH_FILE_IDENTIFY_ORDER_FIRST = 10
} IpatchFileIdentifyOrder;

Some helpful constants for the identify_order IpatchFileClass field. Note that any value can be used and this enum just provides some helpful values. This value determines in what order file identification methods are called. Higher values are executed first.

IPATCH_FILE_IDENTIFY_ORDER_LAST

Execute last (toward the end of the list)

IPATCH_FILE_IDENTIFY_ORDER_DEFAULT

Default execution order (no preference)

IPATCH_FILE_IDENTIFY_ORDER_FIRST

Execute first (toward the start of the list)

IPATCH_FILE_UNUSED_FLAG_SHIFT

#define IPATCH_FILE_UNUSED_FLAG_SHIFT  (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 6)

IPATCH_FILE_NEED_SWAP()

#define             IPATCH_FILE_NEED_SWAP(file)

IPATCH_FILE_BIG_ENDIAN()

#define             IPATCH_FILE_BIG_ENDIAN(file)

IPATCH_FILE_SWAP16()

#define             IPATCH_FILE_SWAP16(file, p16)

IPATCH_FILE_SWAP32()

#define             IPATCH_FILE_SWAP32(file, p32)

IPATCH_FILE_SWAP64()

#define             IPATCH_FILE_SWAP64(file, p64)

IPATCH_IS_FILE_HANDLE()

#define             IPATCH_IS_FILE_HANDLE(handle)

ipatch_file_new ()

IpatchFile *        ipatch_file_new                     (void);

Create a new file object

Returns :

The new file object

ipatch_file_set_name ()

void                ipatch_file_set_name                (IpatchFile *file,
                                                         const char *file_name);

Sets the file name of a file object. Assigning the file name of an IpatchFile object is optional, since a file descriptor could be assigned instead, but some subsystems depend on it.

file :

File object to assign file name to

file_name :

File name or NULL to unset the file name

ipatch_file_get_name ()

char *              ipatch_file_get_name                (IpatchFile *file);

Gets the assigned file name from a file object.

file :

File object to get file name from

Returns :

The file name of the file object or NULL if not set. String should be freed when finished with it.

ipatch_file_open ()

IpatchFileHandle *  ipatch_file_open                    (IpatchFile *file,
                                                         const char *file_name,
                                                         const char *mode,
                                                         GError **err);

Opens a handle to a file object. If a I/O channel or file descriptor is already assigned (with ipatch_file_assign_fd() or ipatch_file_assign_io_channel()) then it is used instead of opening a file using file_name or the already assigned "file-name" property.

file :

File object to open from a file name.

file_name :

Name of file to open or NULL to use the file object's assigned file name (in which case it should not be NULL).

mode :

File open mode ("r" for read or "w" for write)

err :

Error information

Returns :

New file handle or NULL (in which case err may be set). The returned file handle is not multi-thread safe, but the file can be opened multiple times for this purpose.

ipatch_file_assign_fd ()

void                ipatch_file_assign_fd               (IpatchFile *file,
                                                         int fd,
                                                         gboolean close_on_finalize);

Assigns a file descriptor to a file, which gets used for calls to ipatch_file_open(). Note that this means multiple opens will use the same file descriptor and will therefore conflict, so it should only be used in the case where the file object is used by a single exclusive handle.

file :

File object

fd :

File descriptor to assign to file object, or -1 to clear it

close_on_finalize :

TRUE if the descriptor should be closed when file is finalized, FALSE to leave it open

ipatch_file_assign_io_channel ()

void                ipatch_file_assign_io_channel       (IpatchFile *file,
                                                         GIOChannel *iochan);

Assigns an I/O channel to a file, which gets used for calls to ipatch_file_open(). Note that this means multiple opens will use the same file descriptor and will therefore conflict, so it should only be used in the case where the file object is used by a single exclusive handle.

file :

File object

iochan :

IO channel to assign to file or NULL to clear it

ipatch_file_get_io_channel ()

GIOChannel *        ipatch_file_get_io_channel          (IpatchFileHandle *handle);

Get the glib IO channel object from a file handle. The caller owns a reference to the returned io channel, and it should be unreferenced with g_io_channel_unref() when finished with it.

handle :

File handle

Returns :

GIOChannel assigned to the handle or NULL if none (some derived IpatchFile types might not use io channels). Remember to unref it with g_io_channel_unref() when finished.

ipatch_file_get_fd ()

int                 ipatch_file_get_fd                  (IpatchFileHandle *handle);

Get the unix file descriptor associated with a file handle. Not all file handles have a real OS file descriptor.

handle :

File handle

Returns :

File descriptor or -1 if not open or failed to get descriptor.

ipatch_file_close ()

void                ipatch_file_close                   (IpatchFileHandle *handle);

Close a file handle and free it.

handle :

File handle

ipatch_file_get_position ()

guint               ipatch_file_get_position            (IpatchFileHandle *handle);

Gets the current position in a file handle. Note that this might not be the actual position in the file if the file handle was attached to an already open file or if ipatch_file_update_position() is used to set virtual positions.

handle :

File handle

Returns :

Position in file handle.

ipatch_file_update_position ()

void                ipatch_file_update_position         (IpatchFileHandle *handle,
                                                         guint offset);

Adds an offset value to the position counter in a file handle. This can be used if one is operating directly on the underlying file descriptor (i.e., not using the IpatchFile functions) or to add virtual space to the counter. Adding virtual space is useful when a system uses the position counter to write data (such as the RIFF parser) to act as a place holder for data that isn't actually written (sample data for example).

handle :

File handle

offset :

Offset to add to the position counter (can be negative)

ipatch_file_read ()

gboolean            ipatch_file_read                    (IpatchFileHandle *handle,
                                                         gpointer buf,
                                                         guint size,
                                                         GError **err);

Reads data from a file handle. An end of file encountered while trying to read the specified size of data is treated as an error. If this is undesirable use ipatch_file_read_eof() instead.

handle :

File handle

buf :

Buffer to read data into

size :

Amount of data to read, in bytes.

err :

A location to return an error of type GIOChannelError or NULL.

Returns :

TRUE on success (the requested size of data was read), FALSE otherwise

ipatch_file_read_eof ()

GIOStatus           ipatch_file_read_eof                (IpatchFileHandle *handle,
                                                         gpointer buf,
                                                         guint size,
                                                         guint *bytes_read,
                                                         GError **err);

Reads data from a file handle. This function does not treat end of file as an error and will return G_IO_STATUS_EOF with the number of bytes actually read in bytes_read. Use ipatch_file_read() for convenience to ensure actual number of requested bytes is read.

handle :

File handle

buf :

Buffer to read data into

size :

Amount of data to read, in bytes.

bytes_read :

Pointer to store number of bytes actually read or NULL.

err :

A location to return an error of type GIOChannelError or NULL.

Returns :

The status of the operation

ipatch_file_write ()

gboolean            ipatch_file_write                   (IpatchFileHandle *handle,
                                                         gconstpointer buf,
                                                         guint size,
                                                         GError **err);

Writes data to a file object.

handle :

File handle

buf :

Buffer of data to write

size :

Amount of data to write, in bytes.

err :

A location to return an error of type GIOChannelError or NULL.

Returns :

The status of the operation

ipatch_file_skip()

#define             ipatch_file_skip(handle, offset, err)

ipatch_file_seek ()

gboolean            ipatch_file_seek                    (IpatchFileHandle *handle,
                                                         int offset,
                                                         GSeekType type,
                                                         GError **err);

Seek in a file handle. An end of file condition is treated as an error, use ipatch_file_seek_eof() if this is undesirable.

handle :

File handle

offset :

Offset in bytes to seek from the position specified by type

type :

Position in file to seek from (see g_io_channel_seek_position for more details, only G_SEEK_CUR and G_SEEK_SET allowed).

err :

A location to return error info or NULL.

Returns :

TRUE on success, FALSE otherwise

ipatch_file_seek_eof ()

GIOStatus           ipatch_file_seek_eof                (IpatchFileHandle *handle,
                                                         int offset,
                                                         GSeekType type,
                                                         GError **err);

Seek in a file object. Does not treat end of file as an error, use ipatch_file_seek() for convenience if this is desirable.

handle :

File handle

offset :

Offset in bytes to seek from the position specified by type

type :

Position in file to seek from (see g_io_channel_seek_position for more details, only G_SEEK_CUR and G_SEEK_SET allowed).

err :

A location to return error info or NULL.

Returns :

The status of the operation

ipatch_file_get_size ()

int                 ipatch_file_get_size                (IpatchFile *file,
                                                         GError **err);

Get the size of a file object.

file :

File object to get size of

err :

Location to store error information

Returns :

File size or -1 on error or if operation unsupported by this file object (in which case err may be set)

ipatch_file_identify ()

GType               ipatch_file_identify                (IpatchFile *file,
                                                         GError **err);

Attempts to identify the type of a file using the "identify" method of registered types derived from IpatchFile. The "file-name" property should already be assigned.

file :

File object to identify type of

err :

Location to store error information

Returns :

The first IpatchFile derived type that had an "identify" method which returned TRUE, or 0 if unknown file type or error, in which case error information will be stored in err provided its not NULL.

ipatch_file_identify_by_ext ()

GType               ipatch_file_identify_by_ext         (IpatchFile *file);

Attempts to identify the type of a file using the "identify" method of registered types derived from IpatchFile. The "file-name" property should already be assigned. Like ipatch_file_identify() but identifies a file by its file name extension only.

file :

File object to identify type of

Returns :

The first IpatchFile derived type that had an "identify" method which returned TRUE, or 0 if unknown file type or error, in which case error information will be stored in err provided its not NULL.

ipatch_file_identify_open ()

IpatchFileHandle *  ipatch_file_identify_open           (const char *file_name,
                                                         GError **err);

A convenience function which calls ipatch_file_identify() to determine the file type of file_name. If the type is identified a new file object, of the identified type, is created and the file is opened with ipatch_file_open() in read mode.

file_name :

File name to identify and open

err :

Location to store error of type GIOChannelError

Returns :

The new opened handle of the identified type or NULL if unable to identify. Caller should free the handle with ipatch_file_close() when done using it, at which point the parent IpatchFile will be destroyed if no other reference is held (by calling ipatch_file_handle_get_file() for example).

ipatch_file_set_little_endian ()

void                ipatch_file_set_little_endian       (IpatchFile *file);

Sets the file object to little endian mode (the default mode). If the system is big endian, byte swapping will be enabled (see IPATCH_FILE_SWAPxx macros). The endian mode affects buffered read and write functions that operate on multi-byte integers.

file :

File object

ipatch_file_set_big_endian ()

void                ipatch_file_set_big_endian          (IpatchFile *file);

Sets the file object to big endian mode (the default is little endian). If the system is little endian, byte swapping will be enabled (see IPATCH_FILE_SWAPxx macros). The endian mode affects buffered read and write functions that operate on multi-byte integers.

file :

File object

ipatch_file_read_u8 ()

gboolean            ipatch_file_read_u8                 (IpatchFileHandle *handle,
                                                         guint8 *val,
                                                         GError **err);

Read an unsigned 8 bit integer from a file.

file :

File to read from

val :

Location to store value

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_read_u16 ()

gboolean            ipatch_file_read_u16                (IpatchFileHandle *handle,
                                                         guint16 *val,
                                                         GError **err);

Read an unsigned 16 bit integer from a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Location to store value

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_read_u32 ()

gboolean            ipatch_file_read_u32                (IpatchFileHandle *handle,
                                                         guint32 *val,
                                                         GError **err);

Read an unsigned 32 bit integer from a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Location to store value

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_read_u64 ()

gboolean            ipatch_file_read_u64                (IpatchFileHandle *handle,
                                                         guint64 *val,
                                                         GError **err);

Read an unsigned 64 bit integer from a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Location to store value

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_read_s8 ()

gboolean            ipatch_file_read_s8                 (IpatchFileHandle *handle,
                                                         gint8 *val,
                                                         GError **err);

Read a signed 8 bit integer from a file.

handle :

File handle

val :

Location to store value

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_read_s16 ()

gboolean            ipatch_file_read_s16                (IpatchFileHandle *handle,
                                                         gint16 *val,
                                                         GError **err);

Read a signed 16 bit integer from a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Location to store value

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_read_s32 ()

gboolean            ipatch_file_read_s32                (IpatchFileHandle *handle,
                                                         gint32 *val,
                                                         GError **err);

Read a signed 32 bit integer from a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Location to store value

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_read_s64 ()

gboolean            ipatch_file_read_s64                (IpatchFileHandle *handle,
                                                         gint64 *val,
                                                         GError **err);

Read a signed 64 bit integer from a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Location to store value

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_write_u8 ()

gboolean            ipatch_file_write_u8                (IpatchFileHandle *handle,
                                                         guint8 val,
                                                         GError **err);

Write an unsigned 8 bit integer to a file.

handle :

File handle

val :

Value to store

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_write_u16 ()

gboolean            ipatch_file_write_u16               (IpatchFileHandle *handle,
                                                         guint16 val,
                                                         GError **err);

Write an unsigned 16 bit integer to a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Value to store

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_write_u32 ()

gboolean            ipatch_file_write_u32               (IpatchFileHandle *handle,
                                                         guint32 val,
                                                         GError **err);

Write an unsigned 32 bit integer to a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Value to store

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_write_u64 ()

gboolean            ipatch_file_write_u64               (IpatchFileHandle *handle,
                                                         guint64 val,
                                                         GError **err);

Write an unsigned 64 bit integer to a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Value to store

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_write_s8 ()

gboolean            ipatch_file_write_s8                (IpatchFileHandle *handle,
                                                         gint8 val,
                                                         GError **err);

Write a signed 8 bit integer to a file.

handle :

File handle

val :

Value to store

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_write_s16 ()

gboolean            ipatch_file_write_s16               (IpatchFileHandle *handle,
                                                         gint16 val,
                                                         GError **err);

Write a signed 16 bit integer to a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Value to store

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_write_s32 ()

gboolean            ipatch_file_write_s32               (IpatchFileHandle *handle,
                                                         gint32 val,
                                                         GError **err);

Write a signed 32 bit integer to a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Value to store

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_write_s64 ()

gboolean            ipatch_file_write_s64               (IpatchFileHandle *handle,
                                                         gint64 val,
                                                         GError **err);

Write a signed 64 bit integer to a file and performs endian byte swapping if necessary.

handle :

File handle

val :

Value to store

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_file_buf_load ()

gboolean            ipatch_file_buf_load                (IpatchFileHandle *handle,
                                                         guint size,
                                                         GError **err);

Load data from a file into a buffer for error checking convenience. I/O errors need only be checked on this function and not on the subsequent buffered read function calls. It is an error if an end of file is encountered before all the requested data is read.

filebuf :

Initialized file buffer structure

size :

Size of data to load

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE on error.

ipatch_file_buf_read ()

void                ipatch_file_buf_read                (IpatchFileHandle *handle,
                                                         gpointer buf,
                                                         guint size);

Read data from a file handle's buffer and advance the buffer's current position. A call to ipatch_file_buf_load() must have been previously executed and there must be enough remaining data in the buffer for the read.

handle :

File handle with loaded data to read from

buf :

Buffer to copy data to

size :

Amount of data to copy in bytes

ipatch_file_buf_write ()

void                ipatch_file_buf_write               (IpatchFileHandle *handle,
                                                         gconstpointer buf,
                                                         guint size);

Write data to a file handle's buffer and advance the buffer's current position. Data will not actually be written to file till ipatch_file_buf_commit() is called.

handle :

File handle to append buffered data to

buf :

Buffer to copy data from

size :

Amount of data to copy in bytes

ipatch_file_buf_zero()

#define             ipatch_file_buf_zero(filebuf, size)

ipatch_file_buf_memset ()

void                ipatch_file_buf_memset              (IpatchFileHandle *handle,
                                                         char c,
                                                         guint size);

Sets the given size in bytes to the character c and advances the current position. Buffer is expanded if necessary.

handle :

File handle to append buffered data to

c :

Character to write

size :

Size of data to set

ipatch_file_buf_commit ()

gboolean            ipatch_file_buf_commit              (IpatchFileHandle *handle,
                                                         GError **err);

Writes all data in a file handle's buffer to the file and resets the buffer to empty.

handle :

File handle with buffered data to write

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise

ipatch_file_buf_skip()

#define             ipatch_file_buf_skip(filebuf, offset)

ipatch_file_buf_seek ()

void                ipatch_file_buf_seek                (IpatchFileHandle *handle,
                                                         int offset,
                                                         GSeekType type);

Seeks the current position in a file handle's buffer specified by an offset and seek type. It is an error to seek outside of the current size of buffered data (loaded or written). The offset is relative to the buffer, not the file position.

handle :

File handle

offset :

Offset to seek

type :

Seek type

ipatch_file_buf_read_u8 ()

guint8              ipatch_file_buf_read_u8             (IpatchFileHandle *handle);

Reads an unsigned byte from a file buffer and advances the buffer's current position.

handle :

File handle with loaded data

Returns :

The value.

ipatch_file_buf_read_u16 ()

guint16             ipatch_file_buf_read_u16            (IpatchFileHandle *handle);

Reads an unsigned 16 bit word from a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary.

handle :

File handle with loaded data

Returns :

The value.

ipatch_file_buf_read_u32 ()

guint32             ipatch_file_buf_read_u32            (IpatchFileHandle *handle);

Reads an unsigned 32 bit word from a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary.

handle :

File handle with loaded data

Returns :

The value.

ipatch_file_buf_read_u64 ()

guint64             ipatch_file_buf_read_u64            (IpatchFileHandle *handle);

Reads an unsigned 64 bit word from a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary.

handle :

File handle with loaded data

Returns :

The value.

ipatch_file_buf_read_s8 ()

gint8               ipatch_file_buf_read_s8             (IpatchFileHandle *handle);

Reads a signed byte from a file buffer and advances the buffer's current position.

handle :

File handle with loaded data

Returns :

The value.

ipatch_file_buf_read_s16 ()

gint16              ipatch_file_buf_read_s16            (IpatchFileHandle *handle);

Reads a signed 16 bit word from a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary.

handle :

File handle with loaded data

Returns :

The value.

ipatch_file_buf_read_s32 ()

gint32              ipatch_file_buf_read_s32            (IpatchFileHandle *handle);

Reads a signed 32 bit word from a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary.

handle :

File handle with loaded data

Returns :

The value.

ipatch_file_buf_read_s64 ()

gint64              ipatch_file_buf_read_s64            (IpatchFileHandle *handle);

Reads a signed 64 bit word from a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary.

handle :

File handle with loaded data

Returns :

The value.

ipatch_file_buf_write_u8 ()

void                ipatch_file_buf_write_u8            (IpatchFileHandle *handle,
                                                         guint8 val);

Writes an unsigned byte to a file buffer and advances the buffer's current position. The file buffer is expanded if needed.

handle :

File handle

val :

Value to write into file buffer

ipatch_file_buf_write_u16 ()

void                ipatch_file_buf_write_u16           (IpatchFileHandle *handle,
                                                         guint16 val);

Writes an unsigned 16 bit word to a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary. The file buffer is expanded if needed.

handle :

File handle

val :

Value to write into file buffer

ipatch_file_buf_write_u32 ()

void                ipatch_file_buf_write_u32           (IpatchFileHandle *handle,
                                                         guint32 val);

Writes an unsigned 32 bit word to a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary. The file buffer is expanded if needed.

handle :

File handle

val :

Value to write into file buffer

ipatch_file_buf_write_u64 ()

void                ipatch_file_buf_write_u64           (IpatchFileHandle *handle,
                                                         guint64 val);

Writes an unsigned 64 bit word to a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary. The file buffer is expanded if needed.

handle :

File handle

val :

Value to write into file buffer

ipatch_file_buf_write_s8 ()

void                ipatch_file_buf_write_s8            (IpatchFileHandle *handle,
                                                         gint8 val);

Writes a signed byte to a file buffer and advances the buffer's current position. The file buffer is expanded if needed.

handle :

File handle

val :

Value to write into file buffer

ipatch_file_buf_write_s16 ()

void                ipatch_file_buf_write_s16           (IpatchFileHandle *handle,
                                                         gint16 val);

Writes a signed 16 bit word to a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary. The file buffer is expanded if needed.

handle :

File handle

val :

Value to write into file buffer

ipatch_file_buf_write_s32 ()

void                ipatch_file_buf_write_s32           (IpatchFileHandle *handle,
                                                         gint32 val);

Writes a signed 32 bit word to a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary. The file buffer is expanded if needed.

handle :

File handle

val :

Value to write into file buffer

ipatch_file_buf_write_s64 ()

void                ipatch_file_buf_write_s64           (IpatchFileHandle *handle,
                                                         gint64 val);

Writes a signed 64 bit word to a file buffer and advances the buffer's current position. Performs endian byte swapping if necessary. The file buffer is expanded if needed.

handle :

File handle

val :

Value to write into file buffer

ipatch_file_set_iofuncs_static ()

void                ipatch_file_set_iofuncs_static      (IpatchFile *file,
                                                         IpatchFileIOFuncs *funcs);

Sets the input/output functions of a file object using a statically allocated (guaranteed to exist for lifetime of file) functions structure. Setting these functions allows one to write custom data sources or hook into other file functions.

file :

File object

funcs :

Static IO functions structure or NULL to set to defaults

ipatch_file_set_iofuncs ()

void                ipatch_file_set_iofuncs             (IpatchFile *file,
                                                         const IpatchFileIOFuncs *funcs);

Sets the input/output functions of a file object. The funcs structure is duplicated so as not to use the original, see ipatch_file_set_iofuncs_static() for using a static structure. Setting these functions allows one to write custom data sources or hook into other file functions.

file :

File object

funcs :

IO functions structure or NULL to set to defaults

ipatch_file_get_iofuncs ()

void                ipatch_file_get_iofuncs             (IpatchFile *file,
                                                         IpatchFileIOFuncs *out_funcs);

Get the current IO functions from a file object. The function pointers are stored in a user supplied structure pointed to by out_funcs.

file :

File object

out_funcs :

Location to store current IO functions to

ipatch_file_set_iofuncs_null ()

void                ipatch_file_set_iofuncs_null        (IpatchFile *file);

Sets the I/O functions of a file object to /dev/null like methods. Reading from the file will return 0s, writing/seeking will do nothing.

file :

File object

ipatch_file_default_open_method ()

gboolean            ipatch_file_default_open_method     (IpatchFileHandle *handle,
                                                         const char *mode,
                                                         GError **err);

Default "open" method for IpatchFileIOFuncs. Useful when overriding only some I/O functions.

handle :

File handle

mode :

File open mode

err :

Error info

Returns :

TRUE on success, FALSE otherwise

ipatch_file_default_close_method ()

void                ipatch_file_default_close_method    (IpatchFileHandle *handle);

Default "close" method for IpatchFileIOFuncs. Useful when overriding only some I/O functions.

handle :

File handle

ipatch_file_default_read_method ()

GIOStatus           ipatch_file_default_read_method     (IpatchFileHandle *handle,
                                                         gpointer buf,
                                                         guint size,
                                                         guint *bytes_read,
                                                         GError **err);

Default "read" method for IpatchFileIOFuncs. Useful when overriding only some I/O functions.

handle :

File handle

buf :

Buffer to store data to

size :

Size of data

bytes_read :

Number of bytes actually read

err :

Error info

Returns :

The status of the operation.

ipatch_file_default_write_method ()

GIOStatus           ipatch_file_default_write_method    (IpatchFileHandle *handle,
                                                         gconstpointer buf,
                                                         guint size,
                                                         GError **err);

Default "write" method for IpatchFileIOFuncs. Useful when overriding only some I/O functions.

handle :

File handle

buf :

Buffer to read data from

size :

Size of data

err :

Error info

Returns :

The status of the operation.

ipatch_file_default_seek_method ()

GIOStatus           ipatch_file_default_seek_method     (IpatchFileHandle *handle,
                                                         int offset,
                                                         GSeekType type,
                                                         GError **err);

Default "seek" method for IpatchFileIOFuncs. Useful when overriding only some I/O functions.

handle :

File handle

offset :

Offset (depends on seek type)

type :

Seek type

err :

Error info

Returns :

The status of the operation.

ipatch_file_default_getfd_method ()

int                 ipatch_file_default_getfd_method    (IpatchFileHandle *handle);

Default "getfd" method for IpatchFileIOFuncs. Useful when overriding only some I/O functions. This method gets a unix file descriptor for the given file object, it is an optional method.

handle :

File handle

Returns :

Unix file descriptor or -1 if no file descriptor or error.

ipatch_file_default_get_size_method ()

int                 ipatch_file_default_get_size_method (IpatchFile *file,
                                                         GError **err);

Default get file size method, which is optional.

file :

File object

err :

Error info

Returns :

File size or -1 on error (in which case err may be set).

Property Details

The "file-name" property

  "file-name"                gchar*                : Read / Write

File Name.

Default value: NULL

libinstpatch-1.0.0/docs/reference/html/IpatchGig.html0000644000175000017500000001242411461404256017502 00000000000000 IpatchGig

IpatchGig

IpatchGig — GigaSampler instrument file object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchBase
                     +----IpatchDLS2
                           +----IpatchGig

Description

Defines a GigaSampler instrument file object.

Details

IpatchGig

typedef struct _IpatchGig IpatchGig;

IPATCH_GIG_DEFAULT_SAMPLE_GROUP_NAME

#define IPATCH_GIG_DEFAULT_SAMPLE_GROUP_NAME "Default Sample Group"

ipatch_gig_new ()

IpatchGig *         ipatch_gig_new                      (void);

Create a new GigaSampler object.

Returns :

New GigaSampler object with a ref count of 1 which the caller owns.
libinstpatch-1.0.0/docs/reference/html/IpatchSampleStoreRam.html0000644000175000017500000002543111461404256021674 00000000000000 IpatchSampleStoreRam

IpatchSampleStoreRam

IpatchSampleStoreRam — Sample store object for audio data in RAM

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSampleStore
               +----IpatchSampleStoreRam

Implemented Interfaces

IpatchSampleStoreRam implements IpatchSample.

Properties

  "free-data"                gboolean              : Read / Write
  "location"                 gpointer              : Read / Write

Description

Details

IpatchSampleStoreRam

typedef struct _IpatchSampleStoreRam IpatchSampleStoreRam;

enum IpatchSampleStoreRamFlags

typedef enum
{
  IPATCH_SAMPLE_STORE_RAM_ALLOCATED = 1 << IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT
} IpatchSampleStoreRamFlags;

Flags crammed into IpatchItem flags field.

IPATCH_SAMPLE_STORE_RAM_ALLOCATED

Indicates if sample data was allocated and therefore should be freed when finalized.

IPATCH_SAMPLE_STORE_RAM_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_STORE_RAM_UNUSED_FLAG_SHIFT

ipatch_sample_store_ram_new ()

IpatchSample *      ipatch_sample_store_ram_new         (gpointer location,
                                                         gboolean free_data);

Creates a new RAM sample store.

location :

Location of existing sample data or NULL if the sample buffer should be allocated (in which case the sample must be written to first).

free_data :

TRUE if sample data at location should be freed when object is destroyed

Returns :

New RAM sample store, cast as a IpatchSample for convenience.

ipatch_sample_store_ram_get_blank ()

IpatchSample *      ipatch_sample_store_ram_get_blank   (void);

Get blank mono RAM sample object. Return's a sample object with 48 stereo 16 bit samples of silent audio. Only creates it on the first call, subsequent calls return the same sample object. Therefore it should not be modified.

Returns :

The blank sample object. Remember to unref it when not using it anymore with g_object_unref().

Property Details

The "free-data" property

  "free-data"                gboolean              : Read / Write

Free data when object destroyed.

Default value: FALSE


The "location" property

  "location"                 gpointer              : Read / Write

Sample data pointer.

libinstpatch-1.0.0/docs/reference/html/IpatchDLS2Inst.html0000644000175000017500000011170111461404256020334 00000000000000 IpatchDLS2Inst

IpatchDLS2Inst

IpatchDLS2Inst — DLS instrument object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchDLS2Inst
                     +----IpatchGigInst

Properties

  "archive-location"         gchar*                : Read / Write
  "artist"                   gchar*                : Read / Write
  "bank"                     gint                  : Read / Write
  "comment"                  gchar*                : Read / Write
  "commissioned"             gchar*                : Read / Write
  "copyright"                gchar*                : Read / Write
  "date"                     gchar*                : Read / Write
  "engineer"                 gchar*                : Read / Write
  "genre"                    gchar*                : Read / Write
  "keywords"                 gchar*                : Read / Write
  "medium"                   gchar*                : Read / Write
  "name"                     gchar*                : Read / Write
  "percussion"               gboolean              : Read / Write
  "product"                  gchar*                : Read / Write
  "program"                  gint                  : Read / Write
  "software"                 gchar*                : Read / Write
  "source"                   gchar*                : Read / Write
  "source-form"              gchar*                : Read / Write
  "subject"                  gchar*                : Read / Write
  "technician"               gchar*                : Read / Write

Description

Defines a DLS instrument object. DLS instruments are the toplevel objects in the DLS instrument file tree hierarchy.

Details

IpatchDLS2Inst

typedef struct _IpatchDLS2Inst IpatchDLS2Inst;

IPATCH_DLS2_INST_BANK_MAX

#define IPATCH_DLS2_INST_BANK_MAX  0x3FFF

enum IpatchDLS2InstFlags

typedef enum
{
  IPATCH_DLS2_INST_PERCUSSION = 1 << IPATCH_CONTAINER_UNUSED_FLAG_SHIFT
} IpatchDLS2InstFlags;

IPATCH_DLS2_INST_UNUSED_FLAG_SHIFT

#define             IPATCH_DLS2_INST_UNUSED_FLAG_SHIFT

ipatch_dls2_inst_new ()

IpatchDLS2Inst *    ipatch_dls2_inst_new                (void);

Create a new DLS instrument object.

Returns :

New DLS instrument with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_dls2_inst_get_regions()

#define             ipatch_dls2_inst_get_regions(inst)

ipatch_dls2_inst_first ()

IpatchDLS2Inst *    ipatch_dls2_inst_first              (IpatchIter *iter);

Gets the first item in an instrument iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchDLS2Inst items

Returns :

The first instrument in iter or NULL if empty.

ipatch_dls2_inst_next ()

IpatchDLS2Inst *    ipatch_dls2_inst_next               (IpatchIter *iter);

Gets the next item in an instrument iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchDLS2Inst items

Returns :

The next instrument in iter or NULL if at the end of the list.

ipatch_dls2_inst_get_info ()

char *              ipatch_dls2_inst_get_info           (IpatchDLS2Inst *inst,
                                                         guint32 fourcc);

Get a DLS instrument info string by FOURCC integer ID (integer representation of a 4 character RIFF chunk ID, see IpatchRiff).

inst :

DLS instrument to get info from

fourcc :

FOURCC integer id of INFO to get

Returns :

New allocated info string value or NULL if no info with the given fourcc ID. String should be freed when finished with it.

ipatch_dls2_inst_set_info ()

void                ipatch_dls2_inst_set_info           (IpatchDLS2Inst *inst,
                                                         guint32 fourcc,
                                                         const char *val);

Sets an INFO value in a DLS instrument object. Emits changed signal.

inst :

DLS instrument to set info of

fourcc :

FOURCC integer ID of INFO to set

val :

Value to set info to or NULL to unset (clear) info.

ipatch_dls2_inst_set_midi_locale ()

void                ipatch_dls2_inst_set_midi_locale    (IpatchDLS2Inst *inst,
                                                         int bank,
                                                         int program);

Sets the MIDI locale of a DLS instrument (bank and program numbers).

inst :

DLS instrument to set MIDI locale of

bank :

MIDI bank number to assign to instrument

program :

MIDI program number to assign to instrument

ipatch_dls2_inst_get_midi_locale ()

void                ipatch_dls2_inst_get_midi_locale    (IpatchDLS2Inst *inst,
                                                         int *bank,
                                                         int *program);

Gets the MIDI locale of a DLS instrument (bank and program numbers).

inst :

Instrument to get MIDI locale from

bank :

Location to store instrument's MIDI bank number or NULL

program :

Location to store instrument's MIDI program number or NULL

ipatch_dls2_inst_compare ()

int                 ipatch_dls2_inst_compare            (const IpatchDLS2Inst *p1,
                                                         const IpatchDLS2Inst *p2);

Instrument comparison function for sorting. Compare two instruments by their MIDI bank:program numbers. Note that this function is compatible with GCompareFunc and can therefore be used with g_list_sort, etc.

FIXME: Also note that percussion instruments are sorted after regular ones.

p1 :

First instrument in comparison

p2 :

Second instrument in comparison

Returns :

Comparison result that is less than, equal to, or greater than zero if p1 is found, respectively, to be less than, to match, or be greater than p2.

ipatch_dls2_inst_get_conns ()

GSList *            ipatch_dls2_inst_get_conns          (IpatchDLS2Inst *inst);

Gets a list of connections from a DLS instrument. List should be freed with ipatch_dls2_conn_list_free() (free_conns set to TRUE) when finished with it.

inst :

Instrument to get connections from

Returns :

New list of connections (IpatchDLS2Conn) in inst or NULL if no connections. Remember to free it when finished.

ipatch_dls2_inst_set_conn ()

void                ipatch_dls2_inst_set_conn           (IpatchDLS2Inst *inst,
                                                         const IpatchDLS2Conn *conn);

Set a global DLS connection in an instrument. See ipatch_dls2_conn_list_set() for more details.

inst :

DLS instrument

conn :

Connection

ipatch_dls2_inst_unset_conn ()

void                ipatch_dls2_inst_unset_conn         (IpatchDLS2Inst *inst,
                                                         const IpatchDLS2Conn *conn);

Remove a global DLS connection from an instrument. See ipatch_dls2_conn_list_unset() for more details.

inst :

DLS instrument

conn :

Connection

ipatch_dls2_inst_unset_all_conns ()

void                ipatch_dls2_inst_unset_all_conns    (IpatchDLS2Inst *inst);

Remove all global connections in an instrument.

inst :

DLS instrument

ipatch_dls2_inst_conn_count ()

guint               ipatch_dls2_inst_conn_count         (IpatchDLS2Inst *inst);

Count number of connections in a instrument

inst :

Instrument to count connections in

Returns :

Count of connections

Property Details

The "archive-location" property

  "archive-location"         gchar*                : Read / Write

Location where subject is archived.

Default value: NULL


The "artist" property

  "artist"                   gchar*                : Read / Write

Original artist.

Default value: NULL


The "bank" property

  "bank"                     gint                  : Read / Write

MIDI bank number.

Allowed values: [0,16383]

Default value: 0


The "comment" property

  "comment"                  gchar*                : Read / Write

Comments.

Default value: NULL


The "commissioned" property

  "commissioned"             gchar*                : Read / Write

Who commissioned the material.

Default value: NULL


The "copyright" property

  "copyright"                gchar*                : Read / Write

Copyright.

Default value: NULL


The "date" property

  "date"                     gchar*                : Read / Write

Creation date (YYYY-MM-DD).

Default value: NULL


The "engineer" property

  "engineer"                 gchar*                : Read / Write

Engineers separated by "; ".

Default value: NULL


The "genre" property

  "genre"                    gchar*                : Read / Write

Genre.

Default value: NULL


The "keywords" property

  "keywords"                 gchar*                : Read / Write

Keywords (separated by "; ").

Default value: NULL


The "medium" property

  "medium"                   gchar*                : Read / Write

Original medium of the material (record, CD, etc).

Default value: NULL


The "name" property

  "name"                     gchar*                : Read / Write

Name.

Default value: "untitled"


The "percussion" property

  "percussion"               gboolean              : Read / Write

Percussion instrument?.

Default value: FALSE


The "product" property

  "product"                  gchar*                : Read / Write

Product intended for.

Default value: NULL


The "program" property

  "program"                  gint                  : Read / Write

MIDI program number.

Allowed values: [0,127]

Default value: 0


The "software" property

  "software"                 gchar*                : Read / Write

Editor software used.

Default value: NULL


The "source" property

  "source"                   gchar*                : Read / Write

Source of the original material.

Default value: NULL


The "source-form" property

  "source-form"              gchar*                : Read / Write

Original source that was digitized.

Default value: NULL


The "subject" property

  "subject"                  gchar*                : Read / Write

Subject of the material.

Default value: NULL


The "technician" property

  "technician"               gchar*                : Read / Write

Technician who sampled the material.

Default value: NULL

libinstpatch-1.0.0/docs/reference/html/IpatchSF2Inst.html0000644000175000017500000023523211461404256020230 00000000000000 IpatchSF2Inst

IpatchSF2Inst

IpatchSF2Inst — SoundFont instrument object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchSF2Inst

Implemented Interfaces

IpatchSF2Inst implements IpatchSF2GenItemIface and IpatchSF2ModItemIface.

Properties

  "attenuation"              gint                  : Read / Write
  "attenuation-set"          gboolean              : Read / Write
  "chorus"                   gint                  : Read / Write
  "chorus-set"               gboolean              : Read / Write
  "coarse-tune"              gint                  : Read / Write
  "coarse-tune-set"          gboolean              : Read / Write
  "exclusive-class"          gint                  : Read / Write
  "exclusive-class-set"      gboolean              : Read / Write
  "filter-cutoff"            gint                  : Read / Write
  "filter-cutoff-set"        gboolean              : Read / Write
  "filter-q"                 gint                  : Read / Write
  "filter-q-set"             gboolean              : Read / Write
  "fine-tune-override"       gint                  : Read / Write
  "fine-tune-override-set"   gboolean              : Read / Write
  "fixed-note"               gint                  : Read / Write
  "fixed-note-set"           gboolean              : Read / Write
  "fixed-velocity"           gint                  : Read / Write
  "fixed-velocity-set"       gboolean              : Read / Write
  "mod-env-attack"           gint                  : Read / Write
  "mod-env-attack-set"       gboolean              : Read / Write
  "mod-env-decay"            gint                  : Read / Write
  "mod-env-decay-set"        gboolean              : Read / Write
  "mod-env-delay"            gint                  : Read / Write
  "mod-env-delay-set"        gboolean              : Read / Write
  "mod-env-hold"             gint                  : Read / Write
  "mod-env-hold-set"         gboolean              : Read / Write
  "mod-env-release"          gint                  : Read / Write
  "mod-env-release-set"      gboolean              : Read / Write
  "mod-env-sustain"          gint                  : Read / Write
  "mod-env-sustain-set"      gboolean              : Read / Write
  "mod-env-to-filter-cutoff" gint                  : Read / Write
  "mod-env-to-filter-cutoff-set" gboolean              : Read / Write
  "mod-env-to-pitch"         gint                  : Read / Write
  "mod-env-to-pitch-set"     gboolean              : Read / Write
  "mod-lfo-delay"            gint                  : Read / Write
  "mod-lfo-delay-set"        gboolean              : Read / Write
  "mod-lfo-freq"             gint                  : Read / Write
  "mod-lfo-freq-set"         gboolean              : Read / Write
  "mod-lfo-to-filter-cutoff" gint                  : Read / Write
  "mod-lfo-to-filter-cutoff-set" gboolean              : Read / Write
  "mod-lfo-to-pitch"         gint                  : Read / Write
  "mod-lfo-to-pitch-set"     gboolean              : Read / Write
  "mod-lfo-to-volume"        gint                  : Read / Write
  "mod-lfo-to-volume-set"    gboolean              : Read / Write
  "name"                     gchar*                : Read / Write
  "note-range"               IpatchRange*          : Read / Write
  "note-range-set"           gboolean              : Read / Write
  "note-to-mod-env-decay"    gint                  : Read / Write
  "note-to-mod-env-decay-set" gboolean              : Read / Write
  "note-to-mod-env-hold"     gint                  : Read / Write
  "note-to-mod-env-hold-set" gboolean              : Read / Write
  "note-to-vol-env-decay"    gint                  : Read / Write
  "note-to-vol-env-decay-set" gboolean              : Read / Write
  "note-to-vol-env-hold"     gint                  : Read / Write
  "note-to-vol-env-hold-set" gboolean              : Read / Write
  "pan"                      gint                  : Read / Write
  "pan-set"                  gboolean              : Read / Write
  "reverb"                   gint                  : Read / Write
  "reverb-set"               gboolean              : Read / Write
  "root-note-override"       gint                  : Read / Write
  "root-note-override-set"   gboolean              : Read / Write
  "sample-coarse-end"        gint                  : Read / Write
  "sample-coarse-end-set"    gboolean              : Read / Write
  "sample-coarse-loop-end"   gint                  : Read / Write
  "sample-coarse-loop-end-set" gboolean              : Read / Write
  "sample-coarse-loop-start" gint                  : Read / Write
  "sample-coarse-loop-start-set" gboolean              : Read / Write
  "sample-coarse-start"      gint                  : Read / Write
  "sample-coarse-start-set"  gboolean              : Read / Write
  "sample-end"               gint                  : Read / Write
  "sample-end-set"           gboolean              : Read / Write
  "sample-loop-end"          gint                  : Read / Write
  "sample-loop-end-set"      gboolean              : Read / Write
  "sample-loop-start"        gint                  : Read / Write
  "sample-loop-start-set"    gboolean              : Read / Write
  "sample-start"             gint                  : Read / Write
  "sample-start-set"         gboolean              : Read / Write
  "scale-tune"               gint                  : Read / Write
  "scale-tune-set"           gboolean              : Read / Write
  "velocity-range"           IpatchRange*          : Read / Write
  "velocity-range-set"       gboolean              : Read / Write
  "vib-lfo-delay"            gint                  : Read / Write
  "vib-lfo-delay-set"        gboolean              : Read / Write
  "vib-lfo-freq"             gint                  : Read / Write
  "vib-lfo-freq-set"         gboolean              : Read / Write
  "vib-lfo-to-pitch"         gint                  : Read / Write
  "vib-lfo-to-pitch-set"     gboolean              : Read / Write
  "vol-env-attack"           gint                  : Read / Write
  "vol-env-attack-set"       gboolean              : Read / Write
  "vol-env-decay"            gint                  : Read / Write
  "vol-env-decay-set"        gboolean              : Read / Write
  "vol-env-delay"            gint                  : Read / Write
  "vol-env-delay-set"        gboolean              : Read / Write
  "vol-env-hold"             gint                  : Read / Write
  "vol-env-hold-set"         gboolean              : Read / Write
  "vol-env-release"          gint                  : Read / Write
  "vol-env-release-set"      gboolean              : Read / Write
  "vol-env-sustain"          gint                  : Read / Write
  "vol-env-sustain-set"      gboolean              : Read / Write

Description

SoundFont instruments are children of IpatchSF2 objects and are referenced by IpatchSF2PZone objects.

Details

IpatchSF2Inst

typedef struct _IpatchSF2Inst IpatchSF2Inst;

ipatch_sf2_inst_new ()

IpatchSF2Inst *     ipatch_sf2_inst_new                 (void);

Create a new SoundFont instrument object.

Returns :

New SoundFont instrument with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_sf2_inst_get_zones()

#define             ipatch_sf2_inst_get_zones(inst)

ipatch_sf2_inst_first ()

IpatchSF2Inst *     ipatch_sf2_inst_first               (IpatchIter *iter);

Gets the first item in an instrument iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchSF2Inst items

Returns :

The first instrument in iter or NULL if empty.

ipatch_sf2_inst_next ()

IpatchSF2Inst *     ipatch_sf2_inst_next                (IpatchIter *iter);

Gets the next item in an instrument iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchSF2Inst items

Returns :

The next instrument in iter or NULL if at the end of the list.

ipatch_sf2_inst_new_zone ()

void                ipatch_sf2_inst_new_zone            (IpatchSF2Inst *inst,
                                                         IpatchSF2Sample *sample);

A convenience function for quickly creating a new instrument zone, adding it to inst and setting the zone's referenced sample to sample.

inst :

SoundFont instrument

sample :

Referenced sample for new zone

ipatch_sf2_inst_set_name ()

void                ipatch_sf2_inst_set_name            (IpatchSF2Inst *inst,
                                                         const char *name);

Sets the name of a SoundFont instrument.

inst :

Instrument to set name of

name :

Value to set name to

ipatch_sf2_inst_get_name ()

char *              ipatch_sf2_inst_get_name            (IpatchSF2Inst *inst);

Gets the name of a SoundFont instrument.

inst :

Instrument to get name of

Returns :

Name of instrument or NULL if not set. String value should be freed when finished with it.

Property Details

The "attenuation" property

  "attenuation"              gint                  : Read / Write

Volume attenuation.

Allowed values: [0,1440]

Default value: 0


The "attenuation-set" property

  "attenuation-set"          gboolean              : Read / Write

Default value: FALSE


The "chorus" property

  "chorus"                   gint                  : Read / Write

Chorus.

Allowed values: [0,1000]

Default value: 0


The "chorus-set" property

  "chorus-set"               gboolean              : Read / Write

Default value: FALSE


The "coarse-tune" property

  "coarse-tune"              gint                  : Read / Write

Coarse Tune.

Allowed values: [-120,120]

Default value: 0


The "coarse-tune-set" property

  "coarse-tune-set"          gboolean              : Read / Write

Default value: FALSE


The "exclusive-class" property

  "exclusive-class"          gint                  : Read / Write

Exclusive Class.

Allowed values: [0,127]

Default value: 0


The "exclusive-class-set" property

  "exclusive-class-set"      gboolean              : Read / Write

Default value: FALSE


The "filter-cutoff" property

  "filter-cutoff"            gint                  : Read / Write

Low pass filter cutoff frequency.

Allowed values: [1500,13500]

Default value: 13500


The "filter-cutoff-set" property

  "filter-cutoff-set"        gboolean              : Read / Write

Default value: FALSE


The "filter-q" property

  "filter-q"                 gint                  : Read / Write

Low pass filter Q factor.

Allowed values: [0,960]

Default value: 0


The "filter-q-set" property

  "filter-q-set"             gboolean              : Read / Write

Default value: FALSE


The "fine-tune-override" property

  "fine-tune-override"       gint                  : Read / Write

Fine Tune.

Allowed values: [-99,99]

Default value: 0


The "fine-tune-override-set" property

  "fine-tune-override-set"   gboolean              : Read / Write

Default value: FALSE


The "fixed-note" property

  "fixed-note"               gint                  : Read / Write

Fixed Note.

Allowed values: [-1,127]

Default value: -1


The "fixed-note-set" property

  "fixed-note-set"           gboolean              : Read / Write

Default value: FALSE


The "fixed-velocity" property

  "fixed-velocity"           gint                  : Read / Write

Fixed Velocity.

Allowed values: [-1,127]

Default value: -1


The "fixed-velocity-set" property

  "fixed-velocity-set"       gboolean              : Read / Write

Default value: FALSE


The "mod-env-attack" property

  "mod-env-attack"           gint                  : Read / Write

Modulation envelope attack.

Allowed values: [-12000,8000]

Default value: -12000


The "mod-env-attack-set" property

  "mod-env-attack-set"       gboolean              : Read / Write

Default value: FALSE


The "mod-env-decay" property

  "mod-env-decay"            gint                  : Read / Write

Modulation envelope decay.

Allowed values: [-12000,8000]

Default value: -12000


The "mod-env-decay-set" property

  "mod-env-decay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-env-delay" property

  "mod-env-delay"            gint                  : Read / Write

Modulation envelope delay.

Allowed values: [-12000,5000]

Default value: -12000


The "mod-env-delay-set" property

  "mod-env-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-env-hold" property

  "mod-env-hold"             gint                  : Read / Write

Modulation envelope hold.

Allowed values: [-12000,5000]

Default value: -12000


The "mod-env-hold-set" property

  "mod-env-hold-set"         gboolean              : Read / Write

Default value: FALSE


The "mod-env-release" property

  "mod-env-release"          gint                  : Read / Write

Modulation envelope release.

Allowed values: [-12000,8000]

Default value: -12000


The "mod-env-release-set" property

  "mod-env-release-set"      gboolean              : Read / Write

Default value: FALSE


The "mod-env-sustain" property

  "mod-env-sustain"          gint                  : Read / Write

Modulation envelope sustain.

Allowed values: [0,1000]

Default value: 0


The "mod-env-sustain-set" property

  "mod-env-sustain-set"      gboolean              : Read / Write

Default value: FALSE


The "mod-env-to-filter-cutoff" property

  "mod-env-to-filter-cutoff" gint                  : Read / Write

Modulation envelope to filter cutoff.

Allowed values: [-12000,12000]

Default value: 0


The "mod-env-to-filter-cutoff-set" property

  "mod-env-to-filter-cutoff-set" gboolean              : Read / Write

Default value: FALSE


The "mod-env-to-pitch" property

  "mod-env-to-pitch"         gint                  : Read / Write

Modulation envelope to pitch.

Allowed values: [-12000,12000]

Default value: 0


The "mod-env-to-pitch-set" property

  "mod-env-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-delay" property

  "mod-lfo-delay"            gint                  : Read / Write

Modulation oscillator delay.

Allowed values: [-12000,5000]

Default value: -12000


The "mod-lfo-delay-set" property

  "mod-lfo-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-freq" property

  "mod-lfo-freq"             gint                  : Read / Write

Modulation oscillator frequency.

Allowed values: [-16000,4500]

Default value: 0


The "mod-lfo-freq-set" property

  "mod-lfo-freq-set"         gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-filter-cutoff" property

  "mod-lfo-to-filter-cutoff" gint                  : Read / Write

Modulation oscillator to filter cutoff.

Allowed values: [-12000,12000]

Default value: 0


The "mod-lfo-to-filter-cutoff-set" property

  "mod-lfo-to-filter-cutoff-set" gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-pitch" property

  "mod-lfo-to-pitch"         gint                  : Read / Write

Modulation oscillator to pitch.

Allowed values: [-12000,12000]

Default value: 0


The "mod-lfo-to-pitch-set" property

  "mod-lfo-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "mod-lfo-to-volume" property

  "mod-lfo-to-volume"        gint                  : Read / Write

Modulation oscillator to volume.

Allowed values: [-960,960]

Default value: 0


The "mod-lfo-to-volume-set" property

  "mod-lfo-to-volume-set"    gboolean              : Read / Write

Default value: FALSE


The "name" property

  "name"                     gchar*                : Read / Write

Name.

Default value: NULL


The "note-range" property

  "note-range"               IpatchRange*          : Read / Write

Note Range.


The "note-range-set" property

  "note-range-set"           gboolean              : Read / Write

Default value: FALSE


The "note-to-mod-env-decay" property

  "note-to-mod-env-decay"    gint                  : Read / Write

MIDI note to modulation envelope decay.

Allowed values: [-1200,1200]

Default value: 0


The "note-to-mod-env-decay-set" property

  "note-to-mod-env-decay-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-mod-env-hold" property

  "note-to-mod-env-hold"     gint                  : Read / Write

MIDI note to modulation envelope hold.

Allowed values: [-1200,1200]

Default value: 0


The "note-to-mod-env-hold-set" property

  "note-to-mod-env-hold-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-vol-env-decay" property

  "note-to-vol-env-decay"    gint                  : Read / Write

MIDI note to volume envelope decay.

Allowed values: [-1200,1200]

Default value: 0


The "note-to-vol-env-decay-set" property

  "note-to-vol-env-decay-set" gboolean              : Read / Write

Default value: FALSE


The "note-to-vol-env-hold" property

  "note-to-vol-env-hold"     gint                  : Read / Write

MIDI note to volume envelope hold.

Allowed values: [-1200,1200]

Default value: 0


The "note-to-vol-env-hold-set" property

  "note-to-vol-env-hold-set" gboolean              : Read / Write

Default value: FALSE


The "pan" property

  "pan"                      gint                  : Read / Write

Panning.

Allowed values: [-500,500]

Default value: 0


The "pan-set" property

  "pan-set"                  gboolean              : Read / Write

Default value: FALSE


The "reverb" property

  "reverb"                   gint                  : Read / Write

Reverb.

Allowed values: [0,1000]

Default value: 0


The "reverb-set" property

  "reverb-set"               gboolean              : Read / Write

Default value: FALSE


The "root-note-override" property

  "root-note-override"       gint                  : Read / Write

Root Note.

Allowed values: [-1,127]

Default value: -1


The "root-note-override-set" property

  "root-note-override-set"   gboolean              : Read / Write

Default value: FALSE


The "sample-coarse-end" property

  "sample-coarse-end"        gint                  : Read / Write

Sample End Coarse Ofs.

Allowed values: [-32768,0]

Default value: 0


The "sample-coarse-end-set" property

  "sample-coarse-end-set"    gboolean              : Read / Write

Default value: FALSE


The "sample-coarse-loop-end" property

  "sample-coarse-loop-end"   gint                  : Read / Write

Sample Loop End Coarse Ofs.

Allowed values: [-32768,32767]

Default value: 0


The "sample-coarse-loop-end-set" property

  "sample-coarse-loop-end-set" gboolean              : Read / Write

Default value: FALSE


The "sample-coarse-loop-start" property

  "sample-coarse-loop-start" gint                  : Read / Write

Sample Loop Start Coarse Ofs.

Allowed values: [-32768,32767]

Default value: 0


The "sample-coarse-loop-start-set" property

  "sample-coarse-loop-start-set" gboolean              : Read / Write

Default value: FALSE


The "sample-coarse-start" property

  "sample-coarse-start"      gint                  : Read / Write

Sample Start Coarse Ofs.

Allowed values: [0,32767]

Default value: 0


The "sample-coarse-start-set" property

  "sample-coarse-start-set"  gboolean              : Read / Write

Default value: FALSE


The "sample-end" property

  "sample-end"               gint                  : Read / Write

Sample End Ofs.

Allowed values: [0,1073741823]

Default value: 0


The "sample-end-set" property

  "sample-end-set"           gboolean              : Read / Write

Default value: FALSE


The "sample-loop-end" property

  "sample-loop-end"          gint                  : Read / Write

Sample Loop End Ofs.

Allowed values: [0,1073741823]

Default value: 0


The "sample-loop-end-set" property

  "sample-loop-end-set"      gboolean              : Read / Write

Default value: FALSE


The "sample-loop-start" property

  "sample-loop-start"        gint                  : Read / Write

Sample Loop Start Ofs.

Allowed values: [0,1073741823]

Default value: 0


The "sample-loop-start-set" property

  "sample-loop-start-set"    gboolean              : Read / Write

Default value: FALSE


The "sample-start" property

  "sample-start"             gint                  : Read / Write

Sample Start Ofs.

Allowed values: [0,1073741823]

Default value: 0


The "sample-start-set" property

  "sample-start-set"         gboolean              : Read / Write

Default value: FALSE


The "scale-tune" property

  "scale-tune"               gint                  : Read / Write

Scale Tune.

Allowed values: [0,1200]

Default value: 100


The "scale-tune-set" property

  "scale-tune-set"           gboolean              : Read / Write

Default value: FALSE


The "velocity-range" property

  "velocity-range"           IpatchRange*          : Read / Write

Velocity Range.


The "velocity-range-set" property

  "velocity-range-set"       gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-delay" property

  "vib-lfo-delay"            gint                  : Read / Write

Vibrato oscillator delay.

Allowed values: [-12000,5000]

Default value: -12000


The "vib-lfo-delay-set" property

  "vib-lfo-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-freq" property

  "vib-lfo-freq"             gint                  : Read / Write

Vibrato oscillator frequency.

Allowed values: [-16000,4500]

Default value: 0


The "vib-lfo-freq-set" property

  "vib-lfo-freq-set"         gboolean              : Read / Write

Default value: FALSE


The "vib-lfo-to-pitch" property

  "vib-lfo-to-pitch"         gint                  : Read / Write

Vibrato oscillator to pitch.

Allowed values: [-12000,12000]

Default value: 0


The "vib-lfo-to-pitch-set" property

  "vib-lfo-to-pitch-set"     gboolean              : Read / Write

Default value: FALSE


The "vol-env-attack" property

  "vol-env-attack"           gint                  : Read / Write

Volume envelope attack.

Allowed values: [-12000,8000]

Default value: -12000


The "vol-env-attack-set" property

  "vol-env-attack-set"       gboolean              : Read / Write

Default value: FALSE


The "vol-env-decay" property

  "vol-env-decay"            gint                  : Read / Write

Volume envelope decay.

Allowed values: [-12000,8000]

Default value: -12000


The "vol-env-decay-set" property

  "vol-env-decay-set"        gboolean              : Read / Write

Default value: FALSE


The "vol-env-delay" property

  "vol-env-delay"            gint                  : Read / Write

Volume envelope delay.

Allowed values: [-12000,5000]

Default value: -12000


The "vol-env-delay-set" property

  "vol-env-delay-set"        gboolean              : Read / Write

Default value: FALSE


The "vol-env-hold" property

  "vol-env-hold"             gint                  : Read / Write

Volume envelope hold.

Allowed values: [-12000,5000]

Default value: -12000


The "vol-env-hold-set" property

  "vol-env-hold-set"         gboolean              : Read / Write

Default value: FALSE


The "vol-env-release" property

  "vol-env-release"          gint                  : Read / Write

Volume envelope release.

Allowed values: [-12000,8000]

Default value: -12000


The "vol-env-release-set" property

  "vol-env-release-set"      gboolean              : Read / Write

Default value: FALSE


The "vol-env-sustain" property

  "vol-env-sustain"          gint                  : Read / Write

Volume envelope sustain.

Allowed values: [0,1440]

Default value: 0


The "vol-env-sustain-set" property

  "vol-env-sustain-set"      gboolean              : Read / Write

Default value: FALSE

See Also

#IpatchSF2, IpatchSF2PZone
libinstpatch-1.0.0/docs/reference/html/IpatchList.html0000644000175000017500000001701311461404256017706 00000000000000 IpatchList

IpatchList

IpatchList — An object containing a list of object pointers

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchList

Description

An object which defines a list of object pointers. A GObject reference is held to all objects until the IpatchList itself is released.

Details

IpatchList

typedef struct {
  GList *items;			/* list of GObject items */
} IpatchList;

ipatch_list_new ()

IpatchList *        ipatch_list_new                     (void);

Create a new object list object. IpatchList objects are often used to duplicate multi-thread sensitive object lists, so they can be iterated over at one's own leasure.

Returns :

New object list container object.

ipatch_list_duplicate ()

IpatchList *        ipatch_list_duplicate               (IpatchList *list);

Duplicate an object list.

list :

Object list to duplicate

Returns :

New duplicate object list with a ref count of one which the caller owns.

ipatch_list_init_iter ()

void                ipatch_list_init_iter               (IpatchList *list,
                                                         IpatchIter *iter);

Initializes a user supplied iterator (usually stack allocated) to iterate over the object list. Further operations on iter will use the list.

list :

List object

iter :

Iterator to initialize
libinstpatch-1.0.0/docs/reference/html/IpatchDLSFile.html0000644000175000017500000007042611461404256020224 00000000000000 IpatchDLSFile

IpatchDLSFile

IpatchDLSFile — DLS file object and functions

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchDLSFile;
#define             IPATCH_DLS_FOURCC_DLS
#define             IPATCH_DLS_FOURCC_COLH
#define             IPATCH_DLS_FOURCC_WVPL
#define             IPATCH_DLS_FOURCC_DWPL
#define             IPATCH_DLS_FOURCC_PTBL
#define             IPATCH_DLS_FOURCC_PATH
#define             IPATCH_DLS_FOURCC_WAVE
#define             IPATCH_DLS_FOURCC_LINS
#define             IPATCH_DLS_FOURCC_INS
#define             IPATCH_DLS_FOURCC_INSH
#define             IPATCH_DLS_FOURCC_LRGN
#define             IPATCH_DLS_FOURCC_RGN
#define             IPATCH_DLS_FOURCC_RGNH
#define             IPATCH_DLS_FOURCC_LART
#define             IPATCH_DLS_FOURCC_ART1
#define             IPATCH_DLS_FOURCC_WLNK
#define             IPATCH_DLS_FOURCC_WSMP
#define             IPATCH_DLS_FOURCC_VERS
#define             IPATCH_DLS_FOURCC_RGN2
#define             IPATCH_DLS_FOURCC_LAR2
#define             IPATCH_DLS_FOURCC_ART2
#define             IPATCH_DLS_FOURCC_CDL
#define             IPATCH_DLS_FOURCC_DLID
#define             IPATCH_DLS_FOURCC_INFO
#define             IPATCH_DLS_FOURCC_FMT
#define             IPATCH_DLS_FOURCC_DATA
#define             IPATCH_DLS_FOURCC_IARL
#define             IPATCH_DLS_FOURCC_IART
#define             IPATCH_DLS_FOURCC_ICMS
#define             IPATCH_DLS_FOURCC_ICMT
#define             IPATCH_DLS_FOURCC_ICOP
#define             IPATCH_DLS_FOURCC_ICRD
#define             IPATCH_DLS_FOURCC_IENG
#define             IPATCH_DLS_FOURCC_IGNR
#define             IPATCH_DLS_FOURCC_IKEY
#define             IPATCH_DLS_FOURCC_IMED
#define             IPATCH_DLS_FOURCC_INAM
#define             IPATCH_DLS_FOURCC_IPRD
#define             IPATCH_DLS_FOURCC_ISBJ
#define             IPATCH_DLS_FOURCC_ISFT
#define             IPATCH_DLS_FOURCC_ISRC
#define             IPATCH_DLS_FOURCC_ISRF
#define             IPATCH_DLS_FOURCC_ITCH
#define             IPATCH_DLS_VERS_SIZE
#define             IPATCH_DLS_INSH_SIZE
#define             IPATCH_DLS_RGNH_SIZE
#define             IPATCH_DLS_RGNH_LAYER_SIZE
#define             IPATCH_DLS_WLNK_SIZE
#define             IPATCH_DLS_WSMP_HEADER_SIZE
#define             IPATCH_DLS_WSMP_LOOP_SIZE
#define             IPATCH_DLS_ART_HEADER_SIZE
#define             IPATCH_DLS_CONN_SIZE
#define             IPATCH_DLS_PTBL_HEADER_SIZE
#define             IPATCH_DLS_POOLCUE_SIZE
#define             IPATCH_DLS_WAVE_FMT_SIZE
#define             IPATCH_DLS_DLID_SIZE
#define             IPATCH_DLS_INSH_BANK_MASK
#define             IPATCH_DLS_INSH_BANK_PERCUSSION
#define             IPATCH_DLS_RGNH_OPTION_SELF_NON_EXCLUSIVE
#define             IPATCH_DLS_WLNK_PHASE_MASTER
#define             IPATCH_DLS_WLNK_MULTI_CHANNEL
#define             IPATCH_DLS_WSMP_NO_TRUNCATION
#define             IPATCH_DLS_WSMP_NO_COMPRESSION
#define             IPATCH_DLS_WSMP_LOOP_FORWARD
#define             IPATCH_DLS_WSMP_LOOP_RELEASE
IpatchDLSFile *     ipatch_dls_file_new                 (void);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchFile
               +----IpatchDLSFile
                     +----IpatchGigFile

Description

Object type for DLS files and other constants and functions dealing with them.

Details

IpatchDLSFile

typedef struct _IpatchDLSFile IpatchDLSFile;

IPATCH_DLS_FOURCC_DLS

#define IPATCH_DLS_FOURCC_DLS   IPATCH_FOURCC ('D','L','S',' ')

IPATCH_DLS_FOURCC_COLH

#define IPATCH_DLS_FOURCC_COLH  IPATCH_FOURCC ('c','o','l','h')

IPATCH_DLS_FOURCC_WVPL

#define IPATCH_DLS_FOURCC_WVPL  IPATCH_FOURCC ('w','v','p','l')

IPATCH_DLS_FOURCC_DWPL

#define IPATCH_DLS_FOURCC_DWPL  IPATCH_FOURCC ('d','w','p','l')

IPATCH_DLS_FOURCC_PTBL

#define IPATCH_DLS_FOURCC_PTBL  IPATCH_FOURCC ('p','t','b','l')

IPATCH_DLS_FOURCC_PATH

#define IPATCH_DLS_FOURCC_PATH  IPATCH_FOURCC ('p','a','t','h')

IPATCH_DLS_FOURCC_WAVE

#define IPATCH_DLS_FOURCC_WAVE  IPATCH_FOURCC ('w','a','v','e')

IPATCH_DLS_FOURCC_LINS

#define IPATCH_DLS_FOURCC_LINS  IPATCH_FOURCC ('l','i','n','s')

IPATCH_DLS_FOURCC_INS

#define IPATCH_DLS_FOURCC_INS   IPATCH_FOURCC ('i','n','s',' ')

IPATCH_DLS_FOURCC_INSH

#define IPATCH_DLS_FOURCC_INSH  IPATCH_FOURCC ('i','n','s','h')

IPATCH_DLS_FOURCC_LRGN

#define IPATCH_DLS_FOURCC_LRGN  IPATCH_FOURCC ('l','r','g','n')

IPATCH_DLS_FOURCC_RGN

#define IPATCH_DLS_FOURCC_RGN   IPATCH_FOURCC ('r','g','n',' ')

IPATCH_DLS_FOURCC_RGNH

#define IPATCH_DLS_FOURCC_RGNH  IPATCH_FOURCC ('r','g','n','h')

IPATCH_DLS_FOURCC_LART

#define IPATCH_DLS_FOURCC_LART  IPATCH_FOURCC ('l','a','r','t')

IPATCH_DLS_FOURCC_ART1

#define IPATCH_DLS_FOURCC_ART1  IPATCH_FOURCC ('a','r','t','1')

IPATCH_DLS_FOURCC_WLNK

#define IPATCH_DLS_FOURCC_WLNK  IPATCH_FOURCC ('w','l','n','k')

IPATCH_DLS_FOURCC_WSMP

#define IPATCH_DLS_FOURCC_WSMP  IPATCH_FOURCC ('w','s','m','p')

IPATCH_DLS_FOURCC_VERS

#define IPATCH_DLS_FOURCC_VERS  IPATCH_FOURCC ('v','e','r','s')

IPATCH_DLS_FOURCC_RGN2

#define IPATCH_DLS_FOURCC_RGN2  IPATCH_FOURCC ('r','g','n','2')

IPATCH_DLS_FOURCC_LAR2

#define IPATCH_DLS_FOURCC_LAR2  IPATCH_FOURCC ('l','a','r','2')

IPATCH_DLS_FOURCC_ART2

#define IPATCH_DLS_FOURCC_ART2  IPATCH_FOURCC ('a','r','t','2')

IPATCH_DLS_FOURCC_CDL

#define IPATCH_DLS_FOURCC_CDL   IPATCH_FOURCC ('c','d','l',' ')

IPATCH_DLS_FOURCC_DLID

#define IPATCH_DLS_FOURCC_DLID  IPATCH_FOURCC ('d','l','i','d')

IPATCH_DLS_FOURCC_INFO

#define IPATCH_DLS_FOURCC_INFO  IPATCH_FOURCC ('I','N','F','O')

IPATCH_DLS_FOURCC_FMT

#define IPATCH_DLS_FOURCC_FMT   IPATCH_FOURCC ('f','m','t',' ')

IPATCH_DLS_FOURCC_DATA

#define IPATCH_DLS_FOURCC_DATA  IPATCH_FOURCC ('d','a','t','a')

IPATCH_DLS_FOURCC_IARL

#define IPATCH_DLS_FOURCC_IARL  IPATCH_FOURCC ('I','A','R','L')

IPATCH_DLS_FOURCC_IART

#define IPATCH_DLS_FOURCC_IART  IPATCH_FOURCC ('I','A','R','T')

IPATCH_DLS_FOURCC_ICMS

#define IPATCH_DLS_FOURCC_ICMS  IPATCH_FOURCC ('I','C','M','S')

IPATCH_DLS_FOURCC_ICMT

#define IPATCH_DLS_FOURCC_ICMT  IPATCH_FOURCC ('I','C','M','T')

IPATCH_DLS_FOURCC_ICOP

#define IPATCH_DLS_FOURCC_ICOP  IPATCH_FOURCC ('I','C','O','P')

IPATCH_DLS_FOURCC_ICRD

#define IPATCH_DLS_FOURCC_ICRD  IPATCH_FOURCC ('I','C','R','D')

IPATCH_DLS_FOURCC_IENG

#define IPATCH_DLS_FOURCC_IENG  IPATCH_FOURCC ('I','E','N','G')

IPATCH_DLS_FOURCC_IGNR

#define IPATCH_DLS_FOURCC_IGNR  IPATCH_FOURCC ('I','G','N','R')

IPATCH_DLS_FOURCC_IKEY

#define IPATCH_DLS_FOURCC_IKEY  IPATCH_FOURCC ('I','K','E','Y')

IPATCH_DLS_FOURCC_IMED

#define IPATCH_DLS_FOURCC_IMED  IPATCH_FOURCC ('I','M','E','D')

IPATCH_DLS_FOURCC_INAM

#define IPATCH_DLS_FOURCC_INAM  IPATCH_FOURCC ('I','N','A','M')

IPATCH_DLS_FOURCC_IPRD

#define IPATCH_DLS_FOURCC_IPRD  IPATCH_FOURCC ('I','P','R','D')

IPATCH_DLS_FOURCC_ISBJ

#define IPATCH_DLS_FOURCC_ISBJ  IPATCH_FOURCC ('I','S','B','J')

IPATCH_DLS_FOURCC_ISFT

#define IPATCH_DLS_FOURCC_ISFT  IPATCH_FOURCC ('I','S','F','T')

IPATCH_DLS_FOURCC_ISRC

#define IPATCH_DLS_FOURCC_ISRC  IPATCH_FOURCC ('I','S','R','C')

IPATCH_DLS_FOURCC_ISRF

#define IPATCH_DLS_FOURCC_ISRF  IPATCH_FOURCC ('I','S','R','F')

IPATCH_DLS_FOURCC_ITCH

#define IPATCH_DLS_FOURCC_ITCH  IPATCH_FOURCC ('I','T','C','H')

IPATCH_DLS_VERS_SIZE

#define IPATCH_DLS_VERS_SIZE        8 /* version chunk size */

IPATCH_DLS_INSH_SIZE

#define IPATCH_DLS_INSH_SIZE        12 /* instrument header chunk size */

IPATCH_DLS_RGNH_SIZE

#define IPATCH_DLS_RGNH_SIZE        12 /* region header size */

IPATCH_DLS_RGNH_LAYER_SIZE

#define IPATCH_DLS_RGNH_LAYER_SIZE  14 /* with optional Layer field */

IPATCH_DLS_WLNK_SIZE

#define IPATCH_DLS_WLNK_SIZE        12 /* wave link chunk size */

IPATCH_DLS_WSMP_HEADER_SIZE

#define IPATCH_DLS_WSMP_HEADER_SIZE 20	/* sample info chunk without loops */

IPATCH_DLS_WSMP_LOOP_SIZE

#define IPATCH_DLS_WSMP_LOOP_SIZE   16 /* sample loop size */

IPATCH_DLS_ART_HEADER_SIZE

#define IPATCH_DLS_ART_HEADER_SIZE  8 /* articulator header size */

IPATCH_DLS_CONN_SIZE

#define IPATCH_DLS_CONN_SIZE        12 /* connection block size */

IPATCH_DLS_PTBL_HEADER_SIZE

#define IPATCH_DLS_PTBL_HEADER_SIZE 8 /* default pool table header size */

IPATCH_DLS_POOLCUE_SIZE

#define IPATCH_DLS_POOLCUE_SIZE     4 /* size of a pool cue offset */

IPATCH_DLS_WAVE_FMT_SIZE

#define IPATCH_DLS_WAVE_FMT_SIZE    16	/* PCM wave fmt chunk size */

IPATCH_DLS_DLID_SIZE

#define IPATCH_DLS_DLID_SIZE        16 /* DLID unique ID chunk size */

IPATCH_DLS_INSH_BANK_MASK

#define IPATCH_DLS_INSH_BANK_MASK 0x3FFF

IPATCH_DLS_INSH_BANK_PERCUSSION

#define IPATCH_DLS_INSH_BANK_PERCUSSION (1 << 31)

IPATCH_DLS_RGNH_OPTION_SELF_NON_EXCLUSIVE

#define IPATCH_DLS_RGNH_OPTION_SELF_NON_EXCLUSIVE 0x0001

IPATCH_DLS_WLNK_PHASE_MASTER

#define IPATCH_DLS_WLNK_PHASE_MASTER  0x0001

IPATCH_DLS_WLNK_MULTI_CHANNEL

#define IPATCH_DLS_WLNK_MULTI_CHANNEL 0x0002

IPATCH_DLS_WSMP_NO_TRUNCATION

#define IPATCH_DLS_WSMP_NO_TRUNCATION  0x0001

IPATCH_DLS_WSMP_NO_COMPRESSION

#define IPATCH_DLS_WSMP_NO_COMPRESSION 0x0002

IPATCH_DLS_WSMP_LOOP_FORWARD

#define IPATCH_DLS_WSMP_LOOP_FORWARD  0x0000

IPATCH_DLS_WSMP_LOOP_RELEASE

#define IPATCH_DLS_WSMP_LOOP_RELEASE  0x0001

ipatch_dls_file_new ()

IpatchDLSFile *     ipatch_dls_file_new                 (void);

Create a new DLS file object.

Returns :

New DLS file object (derived from IpatchFile) with a reference count of 1. Caller owns the reference and removing it will destroy the item.
libinstpatch-1.0.0/docs/reference/html/libinstpatch-util.html0000644000175000017500000002103511461404256021300 00000000000000 util

util

util — Utility functions

Stability Level

Stable, unless otherwise indicated

Description

Details

ipatch_util_value_bool_true

extern GValue *ipatch_util_value_bool_true;

ipatch_util_value_bool_false

extern GValue *ipatch_util_value_bool_false;

IPATCH_UTIL_VALUE_BOOL()

#define             IPATCH_UTIL_VALUE_BOOL(b)

ipatch_util_value_hash ()

guint               ipatch_util_value_hash              (GValue *val);

Hash a GValue. The hash value can then be used in a GHashTable for example.

val :

GValue to hash

Returns :

Hash value corresponding to the val key.

ipatch_util_value_array_hash ()

guint               ipatch_util_value_array_hash        (GValueArray *valarray);

Hash a GValueArray. The hash value can then be used in a GHashTable for example.

valarray :

GValueArray to hash

Returns :

Hash value corresponding to the sum of all values returned by ipatch_util_value_hash() for each GValue in the array.

ipatch_util_file_size ()

guint64             ipatch_util_file_size               (const char *fname,
                                                         GError **err);

Get the size of a file (tired of using stat every time?).

fname :

Path of file to get size of.

err :

Location to store error or NULL

Returns :

File size. Will return 0 on error, but err must be checked if it is set to determine if an error really occurred.
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchRange.html0000644000175000017500000004445211461404256022520 00000000000000 IpatchRange

IpatchRange

IpatchRange — A boxed type which defines a number range

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchRange;
                    IpatchParamSpecRange;
#define             IPATCH_TYPE_RANGE
#define             IPATCH_VALUE_HOLDS_RANGE            (value)
#define             IPATCH_RANGE_SET_VALUES             (range, val1, val2)
#define             IPATCH_RANGE_SET_NULL               (range)
IpatchRange *       ipatch_range_new                    (int low,
                                                         int high);
IpatchRange *       ipatch_range_copy                   (IpatchRange *range);
void                ipatch_range_free                   (IpatchRange *range);
void                ipatch_value_set_range              (GValue *value,
                                                         const IpatchRange *range);
void                ipatch_value_set_static_range       (GValue *value,
                                                         IpatchRange *range);
IpatchRange *       ipatch_value_get_range              (const GValue *value);
#define             IPATCH_TYPE_PARAM_RANGE
GType               ipatch_param_spec_range_get_type    (void);
GParamSpec *        ipatch_param_spec_range             (const char *name,
                                                         const char *nick,
                                                         const char *blurb,
                                                         int min,
                                                         int max,
                                                         int default_low,
                                                         int default_high,
                                                         GParamFlags flags);

Description

Boxed type used for GValue and GParamSpec properties. Consists of a low and a high integer value defining a range.

Details

IpatchRange

typedef struct {
  int low;		/* low endpoint of range or -1 if undefined */
  int high;	       /* high endpoint of range or -1 if undefined */
} IpatchRange;

IpatchParamSpecRange

typedef struct {
  GParamSpec parent_instance;	/* derived from GParamSpec */
  int min, max;		  /* min and max values for range endpoints */
  int default_low, default_high; /* default vals for low and high endpoints */
} IpatchParamSpecRange;

IPATCH_TYPE_RANGE

#define IPATCH_TYPE_RANGE   (ipatch_range_get_type ())

IPATCH_VALUE_HOLDS_RANGE()

#define             IPATCH_VALUE_HOLDS_RANGE(value)

IPATCH_RANGE_SET_VALUES()

#define             IPATCH_RANGE_SET_VALUES(range, val1, val2)

IPATCH_RANGE_SET_NULL()

#define             IPATCH_RANGE_SET_NULL(range)

ipatch_range_new ()

IpatchRange *       ipatch_range_new                    (int low,
                                                         int high);

Create a new value range structure (to store an integer range).

low :

Low value to initialize range to

high :

High value to initialize range to

Returns :

Newly allocated integer range structure.

ipatch_range_copy ()

IpatchRange *       ipatch_range_copy                   (IpatchRange *range);

Duplicates an integer range structure.

range :

Range structure to duplicate

Returns :

New duplicate range structure.

ipatch_range_free ()

void                ipatch_range_free                   (IpatchRange *range);

Free a range structure previously allocated with ipatch_range_new().

range :

Integer range structure to free

ipatch_value_set_range ()

void                ipatch_value_set_range              (GValue *value,
                                                         const IpatchRange *range);

Set the range values of a IPATCH_TYPE_RANGE GValue. The range structure is copied.

value :

a valid GValue of IPATCH_TYPE_RANGE boxed type

range :

Range structure to assign to value

ipatch_value_set_static_range ()

void                ipatch_value_set_static_range       (GValue *value,
                                                         IpatchRange *range);

Set the range values of a IPATCH_TYPE_RANGE GValue. This function uses range directly and so it should be static, use ipatch_value_set_range() if the range value should be duplicated.

value :

A valid GValue of IPATCH_TYPE_RANGE boxed type

range :

Range structure to assign to value

ipatch_value_get_range ()

IpatchRange *       ipatch_value_get_range              (const GValue *value);

Get the range structure from a IPATCH_TYPE_RANGE GValue.

value :

A valid GValue of IPATCH_TYPE_RANGE boxed type

Returns :

IpatchRange structure containing the range values of value or NULL if not set. The returned structure is NOT duplicated and is the same pointer used in value.

IPATCH_TYPE_PARAM_RANGE

#define IPATCH_TYPE_PARAM_RANGE (ipatch_param_spec_range_get_type ())

ipatch_param_spec_range_get_type ()

GType               ipatch_param_spec_range_get_type    (void);

ipatch_param_spec_range ()

GParamSpec *        ipatch_param_spec_range             (const char *name,
                                                         const char *nick,
                                                         const char *blurb,
                                                         int min,
                                                         int max,
                                                         int default_low,
                                                         int default_high,
                                                         GParamFlags flags);

Create a parameter specification for IPATCH_TYPE_RANGE GValues.

name :

Property name

nick :

Property nick name

blurb :

Property description blurb

min :

Minimum value for range end points (can be -1 to allow undefined ranges)

max :

Maximum value for range end points

default_low :

Default value for low endpoint of range

default_high :

Default value for high endpoint of range

flags :

Property flags

Returns :

New range parameter specification.
libinstpatch-1.0.0/docs/reference/html/ch06.html0000644000175000017500000000674111461404256016410 00000000000000 GigaSampler patches

GigaSampler patches

IpatchGig — GigaSampler instrument file object
IpatchGigFile — GigaSampler file object
IpatchGigInst — GigaSampler instrument object
IpatchGigRegion — GigaSampler region object
IpatchGigDimension — GigaSampler dimension object
IpatchGigSubRegion — GigaSampler sub region object
IpatchGigEffects — GigaSampler instrument parameters and effects
IpatchGigSample — GigaSampler sample object
libinstpatch-1.0.0/docs/reference/html/left.png0000644000175000017500000000071311461404255016412 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME1&[(XIDATx!OPE*ID%~ꊯ"p'ŏ`sܖrKf hmiIz}ܯI.p\`x l?l[,Hk<#c%\AUx[S7n6rzEs1j@NL$ݤi0 5/}\EKIo͓$a0jdFbkIAh>WlC'?tk;|/t*INZ^`y4Nr]׮ J<ڐt`X1@p䀸dZ')hK $V?%]+LsgUK"w53OIENDB`libinstpatch-1.0.0/docs/reference/html/IpatchDLSReader.html0000644000175000017500000017405711461404256020554 00000000000000 IpatchDLSReader

IpatchDLSReader

IpatchDLSReader — DLS version 2 file reader

Stability Level

Stable, unless otherwise indicated

Synopsis

#define             IPATCH_DLS_READER_ERROR
enum                IpatchDLSReaderError;
                    IpatchDLSReader;
IpatchDLSReader *   ipatch_dls_reader_new               (IpatchFileHandle *handle);
IpatchDLS2 *        ipatch_dls_reader_load              (IpatchDLSReader *reader,
                                                         GError **err);
gboolean            ipatch_dls_reader_start             (IpatchDLSReader *reader,
                                                         GError **err);
void                ipatch_dls_reader_set_pool_table    (IpatchDLSReader *reader,
                                                         const guint32 pool_table[],
                                                         guint size);
gboolean            ipatch_dls_reader_fixup             (IpatchDLSReader *reader,
                                                         GError **err);
gboolean            ipatch_dls_reader_load_level_0      (IpatchDLSReader *reader,
                                                         GError **err);
gboolean            ipatch_dls_reader_load_inst_list    (IpatchDLSReader *reader,
                                                         GError **err);
gboolean            ipatch_dls_reader_load_region_list  (IpatchDLSReader *reader,
                                                         IpatchDLS2Inst *inst,
                                                         GError **err);
gboolean            ipatch_gig_reader_load_region_list  (IpatchDLSReader *reader,
                                                         IpatchGigInst *giginst,
                                                         GError **err);
gboolean            ipatch_dls_reader_load_art_list     (IpatchDLSReader *reader,
                                                         GSList **conn_list,
                                                         GError **err);
gboolean            ipatch_dls_reader_load_wave_pool    (IpatchDLSReader *reader,
                                                         GError **err);
gboolean            ipatch_gig_reader_load_sub_regions  (IpatchDLSReader *reader,
                                                         IpatchGigRegion *region,
                                                         GError **err);
gboolean            ipatch_gig_reader_load_inst_lart    (IpatchDLSReader *reader,
                                                         IpatchGigInst *inst,
                                                         GError **err);
gboolean            ipatch_dls_load_info                (IpatchRiff *riff,
                                                         IpatchDLS2Info **info,
                                                         GError **err);
gboolean            ipatch_dls_load_region_header       (IpatchRiff *riff,
                                                         IpatchDLS2Region *region,
                                                         GError **err);
gboolean            ipatch_gig_load_region_header       (IpatchRiff *riff,
                                                         IpatchGigRegion *region,
                                                         GError **err);
gboolean            ipatch_dls_load_wave_link           (IpatchRiff *riff,
                                                         IpatchDLS2Region *region,
                                                         GError **err);
gboolean            ipatch_dls_load_sample_info         (IpatchRiff *riff,
                                                         IpatchDLS2SampleInfo *info,
                                                         GError **err);
gboolean            ipatch_dls_load_connection          (IpatchRiff *riff,
                                                         GSList **conn_list,
                                                         GError **err);
gboolean            ipatch_dls_load_sample_format       (IpatchRiff *riff,
                                                         IpatchDLS2Sample *sample,
                                                         int *bitwidth,
                                                         int *channels,
                                                         GError **err);
guint32 *           ipatch_dls_load_pool_table          (IpatchRiff *riff,
                                                         guint *size,
                                                         GError **err);
gboolean            ipatch_dls_load_dlid                (IpatchRiff *riff,
                                                         guint8 *dlid,
                                                         GError **err);
gboolean            ipatch_gig_load_sample_info         (IpatchRiff *riff,
                                                         IpatchDLS2SampleInfo *info,
                                                         GError **err);
gboolean            ipatch_gig_load_dimension_info      (IpatchRiff *riff,
                                                         IpatchGigRegion *region,
                                                         GError **err);
gboolean            ipatch_gig_load_dimension_names     (IpatchRiff *riff,
                                                         IpatchGigRegion *region,
                                                         GError **err);
gboolean            ipatch_gig_load_group_names         (IpatchRiff *riff,
                                                         GSList **name_list,
                                                         GError **err);

Object Hierarchy

  GObject
   +----IpatchRiff
         +----IpatchDLSReader

Description

Parses a DLS file into an object tree (IpatchDLS).

Details

IPATCH_DLS_READER_ERROR

#define IPATCH_DLS_READER_ERROR  ipatch_dls_reader_error_quark()

enum IpatchDLSReaderError

typedef enum
{
  /* this error is returned if a file originally thought to be a plain DLS
     file turns out to be a GigaSampler file, in which case loading should
     be restarted in GigaSampler mode */
  IPATCH_DLS_READER_ERROR_GIG
} IpatchDLSReaderError;

IpatchDLSReader

typedef struct _IpatchDLSReader IpatchDLSReader;

ipatch_dls_reader_new ()

IpatchDLSReader *   ipatch_dls_reader_new               (IpatchFileHandle *handle);

Create a new DLS file reader

handle :

DLS file handle to parse or NULL to set later

Returns :

The new DLS reader

ipatch_dls_reader_load ()

IpatchDLS2 *        ipatch_dls_reader_load              (IpatchDLSReader *reader,
                                                         GError **err);

Load a DLS file.

reader :

DLS reader object

err :

Location to store error info or NULL

Returns :

New DLS object with refcount of 1.

ipatch_dls_reader_start ()

gboolean            ipatch_dls_reader_start             (IpatchDLSReader *reader,
                                                         GError **err);

Starts parsing a DLS/Gig file. This function only needs to be called if using an IpatchDLSReader without ipatch_dls_load() (custom readers). The file object of the reader must be set before calling this function. Loads the first "DLS" RIFF chunk to verify we are loading a DLS file and sets other internal variables.

reader :

DLS/Gig reader

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise

ipatch_dls_reader_set_pool_table ()

void                ipatch_dls_reader_set_pool_table    (IpatchDLSReader *reader,
                                                         const guint32 pool_table[],
                                                         guint size);

Set the pool table of a DLS/Gig reader. This function is only used when doing manual DLS loading (not using ipatch_dls_load()). The pool table is used to fixup region sample references which are indexes into the pool table.

reader :

DLS/Gig reader

pool_table :

An array of unsigned 32 bit integers which are file offsets to samples in a DLS file, can be NULL if size is 0

size :

Number of entries in pool_table

ipatch_dls_reader_fixup ()

gboolean            ipatch_dls_reader_fixup             (IpatchDLSReader *reader,
                                                         GError **err);

Fixup sample pointers in DLS/GigaSampler regions of the DLS object in reader. The sample pointers should be sample pool indexes previously stored by ipatch_dls_load_wave_link() or ipatch_gig_load_dimension_info(). The pool table must also have been previously loaded for this to make any sense.

reader :

DLS/Gig reader

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise

ipatch_dls_reader_load_level_0 ()

gboolean            ipatch_dls_reader_load_level_0      (IpatchDLSReader *reader,
                                                         GError **err);

Load the top level DLS chunk of a DLS or GigaSampler file (essentially the entire file except the toplevel chunk itself).

reader :

DLS/Gig reader

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_dls_reader_load_inst_list ()

gboolean            ipatch_dls_reader_load_inst_list    (IpatchDLSReader *reader,
                                                         GError **err);

Loads DLS or GigaSampler instrument list from the current position in the file assigned to reader.

reader :

DLS/Gig reader

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_dls_reader_load_region_list ()

gboolean            ipatch_dls_reader_load_region_list  (IpatchDLSReader *reader,
                                                         IpatchDLS2Inst *inst,
                                                         GError **err);

Loads DLS region list into an inst object from the current position in the file assigned to reader.

reader :

DLS reader

inst :

DLS instrument to fill with loaded regions

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_gig_reader_load_region_list ()

gboolean            ipatch_gig_reader_load_region_list  (IpatchDLSReader *reader,
                                                         IpatchGigInst *giginst,
                                                         GError **err);

Loads GigaSampler region list into an inst object from the current position in the file assigned to reader.

reader :

DLS/Gig reader

giginst :

Gig instrument to fill with loaded regions

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_dls_reader_load_art_list ()

gboolean            ipatch_dls_reader_load_art_list     (IpatchDLSReader *reader,
                                                         GSList **conn_list,
                                                         GError **err);

Loads DLS or GigaSampler articulator list from the current position in the file assigned to reader.

reader :

DLS/Gig reader

conn_list :

Pointer to a list to populate

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_dls_reader_load_wave_pool ()

gboolean            ipatch_dls_reader_load_wave_pool    (IpatchDLSReader *reader,
                                                         GError **err);

Loads DLS or GigaSampler wave pool ("wvpl" chunk) from the current position in the file assigned to reader. Populates the reader wave pool hash with sample offsets for later fixup.

reader :

DLS/Gig reader

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_gig_reader_load_sub_regions ()

gboolean            ipatch_gig_reader_load_sub_regions  (IpatchDLSReader *reader,
                                                         IpatchGigRegion *region,
                                                         GError **err);

Loads GigaSampler sub regions ("3prg" chunk) from the current position in the file assigned to reader.

reader :

Gig reader

region :

Gig region to load GigaSampler sub regions into

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_gig_reader_load_inst_lart ()

gboolean            ipatch_gig_reader_load_inst_lart    (IpatchDLSReader *reader,
                                                         IpatchGigInst *inst,
                                                         GError **err);

Loads a GigaSampler global parameter chunk '3ewg' from an instrument 'lart' list.

reader :

Gig reader

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_dls_load_info ()

gboolean            ipatch_dls_load_info                (IpatchRiff *riff,
                                                         IpatchDLS2Info **info,
                                                         GError **err);

Loads DLS or GigaSampler info from the current position in the file assigned to riff.

riff :

RIFF parser

info :

Pointer to DLS info list

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_dls_load_region_header ()

gboolean            ipatch_dls_load_region_header       (IpatchRiff *riff,
                                                         IpatchDLS2Region *region,
                                                         GError **err);

Loads DLS instrument region header ("rgnh" chunk) from the current position in the file assigned to riff. The "rgnh" chunk header should have already been loaded.

riff :

RIFF parser

region :

DLS region to store header info in

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_gig_load_region_header ()

gboolean            ipatch_gig_load_region_header       (IpatchRiff *riff,
                                                         IpatchGigRegion *region,
                                                         GError **err);

Loads GigaSampler instrument region header ("rgnh" chunk) from the current position in the file assigned to riff. The "rgnh" chunk header should have already been loaded.

riff :

RIFF parser

region :

Gig region to store header info in

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_dls_load_wave_link ()

gboolean            ipatch_dls_load_wave_link           (IpatchRiff *riff,
                                                         IpatchDLS2Region *region,
                                                         GError **err);

Loads DLS wave link chunk ("wlnk" chunk) from the current position in the file assigned to riff. The "wlnk" chunk header should have already been loaded.

NOTE: Sample pool index is stored in region sample pointer. This index should be fixed up or cleared before the region is freed otherwise bad things will happen.

riff :

RIFF parser

region :

DLS region to load info into

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_dls_load_sample_info ()

gboolean            ipatch_dls_load_sample_info         (IpatchRiff *riff,
                                                         IpatchDLS2SampleInfo *info,
                                                         GError **err);

Loads DLS or GigaSampler sample info ("wsmp" chunk) from the current position in the file assigned to riff. The "wsmp" chunk header should already have been loaded.

riff :

RIFF parser

info :

Sample info structure to load info into

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_dls_load_connection ()

gboolean            ipatch_dls_load_connection          (IpatchRiff *riff,
                                                         GSList **conn_list,
                                                         GError **err);

Load a DLS articulator chunk ("art1" or "art2") containing connection blocks which are loded into conn_list. The articulation chunk header should already have been loaded.

riff :

RIFF parser

conn_list :

Pointer to a list to populate with loaded IpatchDLS2Conn structures.

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_dls_load_sample_format ()

gboolean            ipatch_dls_load_sample_format       (IpatchRiff *riff,
                                                         IpatchDLS2Sample *sample,
                                                         int *bitwidth,
                                                         int *channels,
                                                         GError **err);

Parses DLS sample format info ("fmt " chunk) from the current position in the file assigned to the riff (chunk header should already be loaded).

riff :

RIFF parser

sample :

DLS sample to load data into

bitwidth :

Pointer to an integer to fill with the sample's bit width or NULL

channels :

Pointer to an integer to fill with the number of channels or NULL

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE on error (in which case err may be set).

ipatch_dls_load_pool_table ()

guint32 *           ipatch_dls_load_pool_table          (IpatchRiff *riff,
                                                         guint *size,
                                                         GError **err);

Load a sample pool table ("ptbl" chunk) of a DLS or GigaSampler file from the current position in the file assigned to riff (chunk header should already be loaded).

riff :

RIFF parser

size :

Pointer to an unsigned integer to store number of entries in returned pool table array

err :

Location to store error info or NULL

Returns :

A newly allocated array of 32bit integers for each entry in the pool table, or NULL if empty pool table or on error (in which case err may be set). Free the table when finished with it.

ipatch_dls_load_dlid ()

gboolean            ipatch_dls_load_dlid                (IpatchRiff *riff,
                                                         guint8 *dlid,
                                                         GError **err);

Load a DLSID from the current position in a riff object. This is a 16 byte unique ID used for tracking data changes. The "dlid" header should have already been loaded.

riff :

Riff parser

dlid :

Location to store 16 byte DLSID

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise

ipatch_gig_load_sample_info ()

gboolean            ipatch_gig_load_sample_info         (IpatchRiff *riff,
                                                         IpatchDLS2SampleInfo *info,
                                                         GError **err);

Load Gig sample info ("smpl" chunk) from current position in file assigned to riff (chunk header should already be loaded).

riff :

RIFF parser

info :

DLS sample info to load data into

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE on error (in which case err may be set).

ipatch_gig_load_dimension_info ()

gboolean            ipatch_gig_load_dimension_info      (IpatchRiff *riff,
                                                         IpatchGigRegion *region,
                                                         GError **err);

Load Gigasampler dimension info ("3lnk" chunk), from the current position in the file assigned to riff (chunk header should already be loaded).

NOTE: Sample pool table indexes are stored in the sample pointer of sub regions. These indexes should be fixed up or cleared before the region is freed, otherwise bad things will happen.

riff :

RIFF parser

region :

Region to load data into

err :

Location to store an error or NULL

Returns :

TRUE on success, FALSE on error (in which case err may be set).

ipatch_gig_load_dimension_names ()

gboolean            ipatch_gig_load_dimension_names     (IpatchRiff *riff,
                                                         IpatchGigRegion *region,
                                                         GError **err);

Loads Gigasampler dimension names from the current position in the file assigned to riff. The "3dnl" chunk header should already have been loaded.

riff :

RIFF parser

region :

Gig region to load names into

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_gig_load_group_names ()

gboolean            ipatch_gig_load_group_names         (IpatchRiff *riff,
                                                         GSList **name_list,
                                                         GError **err);

Load a '3gri' sample group name chunk into a GSList of strings. The 3gri chunk header should have already been loaded.

riff :

Riff parser

name_list :

List to add names to

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise

See Also

#IpatchDLS
libinstpatch-1.0.0/docs/reference/html/up.png0000644000175000017500000000062611461404255016107 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME2.E#IDATx=J@Fo] !+2[Z<@/9|t$D9nnBjBRIsI:H8UPN1fcsN95M㧖ɵ 束1~pEe$I 7nrDf!;`'ykI䲤sI_]y^^I>O>?YBIENDB`libinstpatch-1.0.0/docs/reference/html/IpatchSampleStoreSwap.html0000644000175000017500000001575211461404256022074 00000000000000 IpatchSampleStoreSwap

IpatchSampleStoreSwap

IpatchSampleStoreSwap — Sample storage object for audio in a temporary swap file

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSampleStore
               +----IpatchSampleStoreFile
                     +----IpatchSampleStoreSwap

Implemented Interfaces

IpatchSampleStoreSwap implements IpatchSample.

Description

Details

IpatchSampleStoreSwap

typedef struct _IpatchSampleStoreSwap IpatchSampleStoreSwap;

IPATCH_SAMPLE_STORE_SWAP_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_STORE_SWAP_UNUSED_FLAG_SHIFT

ipatch_sample_store_swap_new ()

IpatchSample *      ipatch_sample_store_swap_new        (void);

Creates a new disk swap sample store.

Returns :

New disk swap sample store, cast as an IpatchSample for convenience.

ipatch_sample_store_swap_get_unused_size ()

int                 ipatch_sample_store_swap_get_unused_size
                                                        (void);

Get amount of unused space in the swap file.

Returns :

Amount of unused data in bytes
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchDLS2Info.html0000644000175000017500000006147011461404256023003 00000000000000 IpatchDLS2Info

IpatchDLS2Info

IpatchDLS2Info — DLS version 2 info functions and structure

Stability Level

Stable, unless otherwise indicated

Description

Structure and functions used for storing DLS informational properties at many levels of the format.

Details

IpatchDLS2Info

typedef GSList IpatchDLS2Info;

IpatchDLS2InfoBag

typedef struct {
  guint32 fourcc;		/* FOURCC int ID */
  char *value;			/* info string value */
} IpatchDLS2InfoBag;

enum IpatchDLS2InfoType

typedef enum
{
  IPATCH_DLS2_ARCHIVE_LOCATION = IPATCH_DLS_FOURCC_IARL,
  IPATCH_DLS2_ARTIST           = IPATCH_DLS_FOURCC_IART,
  IPATCH_DLS2_COMMISSIONED     = IPATCH_DLS_FOURCC_ICMS,
  IPATCH_DLS2_COMMENT          = IPATCH_DLS_FOURCC_ICMT,
  IPATCH_DLS2_COPYRIGHT        = IPATCH_DLS_FOURCC_ICOP,
  IPATCH_DLS2_DATE             = IPATCH_DLS_FOURCC_ICRD,
  IPATCH_DLS2_ENGINEER         = IPATCH_DLS_FOURCC_IENG,
  IPATCH_DLS2_GENRE            = IPATCH_DLS_FOURCC_IGNR,
  IPATCH_DLS2_KEYWORDS         = IPATCH_DLS_FOURCC_IKEY,
  IPATCH_DLS2_MEDIUM           = IPATCH_DLS_FOURCC_IMED,
  IPATCH_DLS2_NAME             = IPATCH_DLS_FOURCC_INAM,
  IPATCH_DLS2_PRODUCT          = IPATCH_DLS_FOURCC_IPRD,
  IPATCH_DLS2_SUBJECT          = IPATCH_DLS_FOURCC_ISBJ,
  IPATCH_DLS2_SOFTWARE         = IPATCH_DLS_FOURCC_ISFT,
  IPATCH_DLS2_SOURCE           = IPATCH_DLS_FOURCC_ISRC,
  IPATCH_DLS2_SOURCE_FORM      = IPATCH_DLS_FOURCC_ISRF,
  IPATCH_DLS2_TECHNICIAN       = IPATCH_DLS_FOURCC_ITCH
} IpatchDLS2InfoType;

ipatch_dls2_info_get ()

char *              ipatch_dls2_info_get                (IpatchDLS2Info *info,
                                                         guint32 fourcc);

Gets the value of the info specified by the fourcc ID from an info list.

info :

DLS2 info list

fourcc :

FOURCC info ID

Returns :

Newly allocated info string value or NULL if the specified info is not set. Should be freed when no longer needed.

ipatch_dls2_info_peek ()

const char *        ipatch_dls2_info_peek               (IpatchDLS2Info *info,
                                                         guint32 fourcc);

Gets the value of the info specified by the fourcc ID from an info list. Like ipatch_dls2_info_get but returns the string value without duplicating it.

info :

DLS2 info list

fourcc :

FOURCC info ID

Returns :

Info string value or NULL if the specified info is not set. Value is internal and should not be modified or freed.

ipatch_dls2_info_set ()

void                ipatch_dls2_info_set                (IpatchDLS2Info **info,
                                                         guint32 fourcc,
                                                         const char *value);

Sets the info specified by the fourcc ID in an info list to a string value.

info :

DLS2 info list

fourcc :

FOURCC info ID

value :

String value to set info to or NULL to unset

ipatch_dls2_info_free ()

void                ipatch_dls2_info_free               (IpatchDLS2Info *info);

Free a DLS info list.

info :

DLS2 info list

ipatch_dls2_info_duplicate ()

IpatchDLS2Info *    ipatch_dls2_info_duplicate          (IpatchDLS2Info *info);

Duplicate a DLS2 info list.

info :

DLS2 info list to duplicate

Returns :

Newly created info list or NULL if info was NULL. Free it with ipatch_dls2_info_free() when finished with it.

ipatch_dls2_info_is_defined ()

gboolean            ipatch_dls2_info_is_defined         (guint32 fourcc);

Checks if a FOURCC INFO id is a defined INFO id.

fourcc :

FOURCC INFO id to check if defined

Returns :

TRUE if fourcc INFO id is defined, FALSE otherwise

ipatch_dls2_info_install_class_properties ()

void                ipatch_dls2_info_install_class_properties
                                                        (GObjectClass *obj_class);

Installs INFO properties for the supplied obj_class. Used for class construction of objects implementing IpatchDLS2InfoType properties.

obj_class :

GObjectClass to install INFO properties on

ipatch_dls2_info_set_property ()

gboolean            ipatch_dls2_info_set_property       (IpatchDLS2Info **info_list,
                                                         guint property_id,
                                                         const GValue *value);

A function used by object set_property methods that implement a IpatchDLS2Info list to set an INFO property.

info_list :

Pointer to a list of IpatchDLS2Info structures

property_id :

FOURCC INFO property id to set value of

value :

A string GValue to set INFO value to

Returns :

TRUE if property_id is a valid INFO id, FALSE otherwise

ipatch_dls2_info_get_property ()

gboolean            ipatch_dls2_info_get_property       (IpatchDLS2Info *info_list,
                                                         guint property_id,
                                                         GValue *value);

A function used by object set_property methods that implement a IpatchDLS2Info list to get an INFO property.

info_list :

A list of IpatchDLS2Info structures

property_id :

FOURCC INFO property id to get value of

value :

A string GValue to store the value of the info to

Returns :

TRUE if property_id is a valid INFO id, FALSE otherwise

ipatch_dls2_info_notify ()

void                ipatch_dls2_info_notify             (IpatchItem *item,
                                                         guint32 fourcc,
                                                         const GValue *new_value,
                                                         const GValue *old_value);

Notify a changed INFO property on item for the given fourcc ID. A convenience function to objects that implement a IpatchDLS2Info list.

item :

Item with INFO properties to notify property change on

fourcc :

FOURCC property ID of info that has changed

new_value :

New value assigned to the property

old_value :

Old value of property

ipatch_dls2_info_bag_new ()

IpatchDLS2InfoBag * ipatch_dls2_info_bag_new            (void);

Create a new DLS info bag structure.

Returns :

Newly allocated info bag.

ipatch_dls2_info_bag_free ()

void                ipatch_dls2_info_bag_free           (IpatchDLS2InfoBag *bag);

Free a DLS info bag allocated with ipatch_dls2_info_bag_new().

bag :

Info bag structure to free
libinstpatch-1.0.0/docs/reference/html/IpatchSF2Sample.html0000644000175000017500000007433211461404256020536 00000000000000 IpatchSF2Sample

IpatchSF2Sample

IpatchSF2Sample — SoundFont audio sample

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSF2Sample

Implemented Interfaces

IpatchSF2Sample implements IpatchSample.

Properties

  "channel"                  IpatchSF2SampleChannel  : Read / Write
  "fine-tune"                gint                  : Read / Write
  "linked-sample"            IpatchSF2Sample*      : Read / Write
  "loop-end"                 guint                 : Read / Write
  "loop-start"               guint                 : Read / Write
  "name"                     gchar*                : Read / Write
  "rom"                      gboolean              : Read / Write
  "root-note"                gint                  : Read / Write
  "sample-data"              IpatchSampleData*     : Read / Write
  "sample-rate"              gint                  : Read / Write

Description

SoundFont samples are children of IpatchSF2 objects and are referenced by IpatchSF2IZone objects. They define the audio which is synthesized.

Details

IpatchSF2Sample

typedef struct _IpatchSF2Sample IpatchSF2Sample;

enum IpatchSF2SampleChannel

typedef enum
{
  IPATCH_SF2_SAMPLE_CHANNEL_MONO,
  IPATCH_SF2_SAMPLE_CHANNEL_LEFT,
  IPATCH_SF2_SAMPLE_CHANNEL_RIGHT
} IpatchSF2SampleChannel;

Sample channel orientation.

IPATCH_SF2_SAMPLE_CHANNEL_MONO

Mono sample

IPATCH_SF2_SAMPLE_CHANNEL_LEFT

Left channel of a stereo pair ("linked-sample" will be set to the right channel)

IPATCH_SF2_SAMPLE_CHANNEL_RIGHT

Right channel of a stereo pair ("linked-sample" will be set to the left channel)

IPATCH_SF2_SAMPLE_RATE_MIN

#define IPATCH_SF2_SAMPLE_RATE_MIN	400 /* min sample rate (by standard) */

IPATCH_SF2_SAMPLE_RATE_MAX

#define IPATCH_SF2_SAMPLE_RATE_MAX	50000 /* max rate (by the standard) */

IPATCH_SF2_SAMPLE_LENGTH_MIN

#define IPATCH_SF2_SAMPLE_LENGTH_MIN	32 /* min length (by the standard) */

IPATCH_SF2_SAMPLE_FLAG_ROM

#define IPATCH_SF2_SAMPLE_FLAG_ROM  (1 << IPATCH_ITEM_UNUSED_FLAG_SHIFT)

IPATCH_SAMPLE_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_UNUSED_FLAG_SHIFT

ipatch_sf2_sample_new ()

IpatchSF2Sample *   ipatch_sf2_sample_new               (void);

Create a new SoundFont sample object.

Returns :

New SoundFont sample with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_sf2_sample_first ()

IpatchSF2Sample *   ipatch_sf2_sample_first             (IpatchIter *iter);

Gets the first item in a sample iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchSF2Sample items

Returns :

The first sample in iter or NULL if empty.

ipatch_sf2_sample_next ()

IpatchSF2Sample *   ipatch_sf2_sample_next              (IpatchIter *iter);

Gets the next item in a sample iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchSF2Sample items

Returns :

The next sample in iter or NULL if at the end of the list.

ipatch_sf2_sample_set_name ()

void                ipatch_sf2_sample_set_name          (IpatchSF2Sample *sample,
                                                         const char *name);

Sets the name of a SoundFont sample.

sample :

Sample to set name of

name :

Value to set name to

ipatch_sf2_sample_get_name ()

char *              ipatch_sf2_sample_get_name          (IpatchSF2Sample *sample);

Gets the name of a SoundFont sample.

sample :

Sample to get name of

Returns :

Name of sample or NULL if not set. String value should be freed when finished with it.

ipatch_sf2_sample_set_data ()

void                ipatch_sf2_sample_set_data          (IpatchSF2Sample *sample,
                                                         IpatchSampleData *sampledata);

Set a sample's sample data object.

sample :

Sample to set sample data of

sampledata :

Sample data to set sample to

ipatch_sf2_sample_get_data ()

IpatchSampleData *  ipatch_sf2_sample_get_data          (IpatchSF2Sample *sample);

Get the IpatchSampleData item of a sample. Sample data item is referenced before returning and caller is responsible for unreferencing it with g_object_unref() when finished with it.

sample :

Sample to get sample data from

Returns :

Sample data object of sample or NULL if none. Remember to unreference with g_object_unref() when finished with it.

ipatch_sf2_sample_peek_data ()

IpatchSampleData *  ipatch_sf2_sample_peek_data         (IpatchSF2Sample *sample);

Get the IpatchSampleData item of a sample. Like ipatch_sf2_sample_get_data() but sample data object is not referenced. This function should only be used if a reference of the sample data object is ensured or only the pointer value is of importance.

sample :

Sample to get sample data from

Returns :

Sample data object of sample or NULL if none. Remember that a reference is NOT added.

ipatch_sf2_sample_set_linked ()

void                ipatch_sf2_sample_set_linked        (IpatchSF2Sample *sample,
                                                         IpatchSF2Sample *linked);

Sets the stereo linked sample of a sample item.

sample :

Sample to set linked sample of

linked :

Sample that is stereo linked to sample or NULL to unset.

ipatch_sf2_sample_get_linked ()

IpatchSF2Sample *   ipatch_sf2_sample_get_linked        (IpatchSF2Sample *sample);

Get the stereo linked sample from sample. If a sample is returned the caller owns a reference and should unref it with g_object_unref() when finished with it.

sample :

Sample to get linked sample from

Returns :

The linked stereo sample or NULL if no linked sample. Remember to unref the returned sample with g_object_unref() when finished with it.

ipatch_sf2_sample_peek_linked ()

IpatchSF2Sample *   ipatch_sf2_sample_peek_linked       (IpatchSF2Sample *sample);

Get the stereo linked sample from sample. Like ipatch_sf2_sample_get_linked() but sample object is not referenced. This function should only be used if a reference of the sample object is ensured or only the pointer value is of importance.

sample :

Sample to get linked sample from

Returns :

Linked sample object of sample or NULL if none. Remember that a reference is NOT added.

ipatch_sf2_sample_set_blank ()

void                ipatch_sf2_sample_set_blank         (IpatchSF2Sample *sample);

Set the sample data of a sample item to blank data.

sample :

Sample to set to blank sample data

Property Details

The "channel" property

  "channel"                  IpatchSF2SampleChannel  : Read / Write

Channel orientation.

Default value: IPATCH_SF2_SAMPLE_CHANNEL_MONO


The "fine-tune" property

  "fine-tune"                gint                  : Read / Write

Fine tuning in cents.

Allowed values: [-99,99]

Default value: 0


The "linked-sample" property

  "linked-sample"            IpatchSF2Sample*      : Read / Write

Stereo linked sample object.


The "loop-end" property

  "loop-end"                 guint                 : Read / Write

Loop end in frames (after loop).

Default value: 0


The "loop-start" property

  "loop-start"               guint                 : Read / Write

Start of loop in frames.

Default value: 0


The "name" property

  "name"                     gchar*                : Read / Write

Name.

Default value: NULL


The "rom" property

  "rom"                      gboolean              : Read / Write

ROM sample flag.

Default value: FALSE


The "root-note" property

  "root-note"                gint                  : Read / Write

Root MIDI note.

Allowed values: [0,127]

Default value: 60


The "sample-data" property

  "sample-data"              IpatchSampleData*     : Read / Write

Sample data.


The "sample-rate" property

  "sample-rate"              gint                  : Read / Write

Sampling rate in Hertz.

Allowed values: [8000,192000]

Default value: 44100

See Also

#IpatchSF2, IpatchSF2IZone
libinstpatch-1.0.0/docs/reference/html/api-index-full.html0000644000175000017500000072547711461404256020504 00000000000000 API Index

API Index

I

IpatchBase
IpatchBase:changed
IpatchBase:file
IpatchBase:file-name
IpatchBase:saved
IpatchBaseFlags
IpatchContainer
IpatchContainerCallback
IpatchContainerDisconnect
IpatchConverter
IpatchConverter:progress
IpatchConverterCount
IpatchConverterFlags
IpatchConverterLogType
IpatchConverterPriority
IpatchConverterSF2VoiceCache
IpatchDLS2
IpatchDLS2:archive-location
IpatchDLS2:artist
IpatchDLS2:comment
IpatchDLS2:commissioned
IpatchDLS2:copyright
IpatchDLS2:date
IpatchDLS2:engineer
IpatchDLS2:genre
IpatchDLS2:keywords
IpatchDLS2:medium
IpatchDLS2:name
IpatchDLS2:product
IpatchDLS2:software
IpatchDLS2:source
IpatchDLS2:source-form
IpatchDLS2:subject
IpatchDLS2:technician
IpatchDLS2:version
IpatchDLS2Conn
IpatchDLS2ConnDestType
IpatchDLS2ConnInfo
IpatchDLS2ConnPolarityType
IpatchDLS2ConnSrcType
IpatchDLS2ConnTransformMasks
IpatchDLS2ConnTransformShifts
IpatchDLS2ConnTransformType
IpatchDLS2Flags
IpatchDLS2Info
IpatchDLS2InfoBag
IpatchDLS2InfoType
IpatchDLS2Inst
IpatchDLS2Inst:archive-location
IpatchDLS2Inst:artist
IpatchDLS2Inst:bank
IpatchDLS2Inst:comment
IpatchDLS2Inst:commissioned
IpatchDLS2Inst:copyright
IpatchDLS2Inst:date
IpatchDLS2Inst:engineer
IpatchDLS2Inst:genre
IpatchDLS2Inst:keywords
IpatchDLS2Inst:medium
IpatchDLS2Inst:name
IpatchDLS2Inst:percussion
IpatchDLS2Inst:product
IpatchDLS2Inst:program
IpatchDLS2Inst:software
IpatchDLS2Inst:source
IpatchDLS2Inst:source-form
IpatchDLS2Inst:subject
IpatchDLS2Inst:technician
IpatchDLS2InstFlags
IpatchDLS2Param
IpatchDLS2ParamArray
IpatchDLS2Region
IpatchDLS2Region:archive-location
IpatchDLS2Region:artist
IpatchDLS2Region:channel
IpatchDLS2Region:comment
IpatchDLS2Region:commissioned
IpatchDLS2Region:copyright
IpatchDLS2Region:date
IpatchDLS2Region:engineer
IpatchDLS2Region:fine-tune
IpatchDLS2Region:flags
IpatchDLS2Region:gain
IpatchDLS2Region:genre
IpatchDLS2Region:key-group
IpatchDLS2Region:keywords
IpatchDLS2Region:layer-group
IpatchDLS2Region:link-item
IpatchDLS2Region:loop-end
IpatchDLS2Region:loop-start
IpatchDLS2Region:loop-type
IpatchDLS2Region:medium
IpatchDLS2Region:multi-channel
IpatchDLS2Region:name
IpatchDLS2Region:note-range
IpatchDLS2Region:phase-group
IpatchDLS2Region:phase-master
IpatchDLS2Region:product
IpatchDLS2Region:root-note
IpatchDLS2Region:sample-info-override
IpatchDLS2Region:self-non-exclusive
IpatchDLS2Region:software
IpatchDLS2Region:source
IpatchDLS2Region:source-form
IpatchDLS2Region:subject
IpatchDLS2Region:technician
IpatchDLS2Region:velocity-range
IpatchDLS2RegionChannelType
IpatchDLS2RegionFlags
IpatchDLS2Sample
IpatchDLS2Sample:archive-location
IpatchDLS2Sample:artist
IpatchDLS2Sample:comment
IpatchDLS2Sample:commissioned
IpatchDLS2Sample:copyright
IpatchDLS2Sample:date
IpatchDLS2Sample:engineer
IpatchDLS2Sample:fine-tune
IpatchDLS2Sample:flags
IpatchDLS2Sample:gain
IpatchDLS2Sample:genre
IpatchDLS2Sample:keywords
IpatchDLS2Sample:loop-end
IpatchDLS2Sample:loop-start
IpatchDLS2Sample:loop-type
IpatchDLS2Sample:medium
IpatchDLS2Sample:name
IpatchDLS2Sample:product
IpatchDLS2Sample:root-note
IpatchDLS2Sample:sample-data
IpatchDLS2Sample:sample-rate
IpatchDLS2Sample:software
IpatchDLS2Sample:source
IpatchDLS2Sample:source-form
IpatchDLS2Sample:subject
IpatchDLS2Sample:technician
IpatchDLS2SampleFlags
IpatchDLS2SampleInfo
IpatchDLSFile
IpatchDLSReader
IpatchDLSReaderError
IpatchDLSWriter
IpatchError
IpatchFile
IpatchFile:file-name
IpatchFileFlags
IpatchFileHandle
IpatchFileIdentifyOrder
IpatchFileIOFuncs
IpatchGig
IpatchGigControlType
IpatchGigDimension
IpatchGigDimension:name
IpatchGigDimension:split-count
IpatchGigDimension:type
IpatchGigDimensionType
IpatchGigEffects
IpatchGigFile
IpatchGigFilterType
IpatchGigInst
IpatchGigInstParams
IpatchGigRegion
IpatchGigRegion:channel
IpatchGigRegion:key-group
IpatchGigRegion:layer-group
IpatchGigRegion:multi-channel
IpatchGigRegion:note-range
IpatchGigRegion:phase-group
IpatchGigRegion:phase-master
IpatchGigRegion:self-non-exclusive
IpatchGigRegion:velocity-range
IpatchGigRegionFlags
IpatchGigSample
IpatchGigSample:group-number
IpatchGigSubRegion
IpatchGigSubRegion:fine-tune
IpatchGigSubRegion:flags
IpatchGigSubRegion:gain
IpatchGigSubRegion:link-item
IpatchGigSubRegion:loop-end
IpatchGigSubRegion:loop-start
IpatchGigSubRegion:loop-type
IpatchGigSubRegion:root-note
IpatchGigSubRegion:sample-info-override
IpatchGigSubRegionFlags
IpatchItem
IpatchItem:base
IpatchItem:flags
IpatchItem:parent
IpatchItem:title
IpatchItemCopyLinkFunc
IpatchItemFlags
IpatchItemPropCallback
IpatchItemPropDisconnect
IpatchIter
IpatchIterMethods
IpatchList
IpatchParamSpecRange
IpatchPaste
IpatchPasteChoice
IpatchPasteExecFunc
IpatchPastePriority
IpatchPasteTestFunc
IpatchRange
IpatchRiff
IpatchRiffChunk
IpatchRiffChunkType
IpatchRiffError
IpatchRiffMode
IpatchRiffStatus
IpatchSample
IpatchSample:fine-tune
IpatchSample:loop-end
IpatchSample:loop-start
IpatchSample:loop-type
IpatchSample:root-note
IpatchSample:sample-data
IpatchSample:sample-format
IpatchSample:sample-rate
IpatchSample:sample-size
IpatchSampleChannel
IpatchSampleChannelType
IpatchSampleData
IpatchSampleEndian
IpatchSampleHandle
IpatchSampleHandleCloseFunc
IpatchSampleHandleOpenFunc
IpatchSampleHandleReadFunc
IpatchSampleHandleWriteFunc
IpatchSampleIface
IpatchSampleList
IpatchSampleListItem
IpatchSampleLoopType
IpatchSampleSign
IpatchSampleStore
IpatchSampleStore:sample-format
IpatchSampleStore:sample-rate
IpatchSampleStore:sample-size
IpatchSampleStoreCache
IpatchSampleStoreCache:location
IpatchSampleStoreFile
IpatchSampleStoreFile:file
IpatchSampleStoreFile:location
IpatchSampleStoreRam
IpatchSampleStoreRam:free-data
IpatchSampleStoreRam:location
IpatchSampleStoreRamFlags
IpatchSampleStoreRom
IpatchSampleStoreRom:location
IpatchSampleStoreSndFile
IpatchSampleStoreSndFile:endian
IpatchSampleStoreSndFile:file-format
IpatchSampleStoreSndFile:file-name
IpatchSampleStoreSndFile:fine-tune
IpatchSampleStoreSndFile:loop-end
IpatchSampleStoreSndFile:loop-start
IpatchSampleStoreSndFile:loop-type
IpatchSampleStoreSndFile:root-note
IpatchSampleStoreSndFile:sub-format
IpatchSampleStoreSplit24
IpatchSampleStoreSplit24:location-lsbytes
IpatchSampleStoreSwap
IpatchSampleStoreVirtual
IpatchSampleStoreVirtual:sample-lists
IpatchSampleTransform
IpatchSampleTransformFunc
IpatchSampleWidth
IpatchSF2
IpatchSF2:author
IpatchSF2:comment
IpatchSF2:copyright
IpatchSF2:date
IpatchSF2:engine
IpatchSF2:name
IpatchSF2:product
IpatchSF2:rom-name
IpatchSF2:rom-version
IpatchSF2:samples-24bit
IpatchSF2:software
IpatchSF2:version
IpatchSF2Bag
IpatchSF2File
IpatchSF2File:sample-pos
IpatchSF2File:sample-size
IpatchSF2File:sample24-pos
IpatchSF2FileSampleType
IpatchSF2Flags
IpatchSF2Gen
IpatchSF2GenAmount
IpatchSF2GenArray
IpatchSF2GenInfo
IpatchSF2GenItem
IpatchSF2GenItemIface
IpatchSF2GenPropsType
IpatchSF2GenSampleModes
IpatchSF2GenType
IpatchSF2Ihdr
IpatchSF2InfoType
IpatchSF2Inst
IpatchSF2Inst:attenuation
IpatchSF2Inst:attenuation-set
IpatchSF2Inst:chorus
IpatchSF2Inst:chorus-set
IpatchSF2Inst:coarse-tune
IpatchSF2Inst:coarse-tune-set
IpatchSF2Inst:exclusive-class
IpatchSF2Inst:exclusive-class-set
IpatchSF2Inst:filter-cutoff
IpatchSF2Inst:filter-cutoff-set
IpatchSF2Inst:filter-q
IpatchSF2Inst:filter-q-set
IpatchSF2Inst:fine-tune-override
IpatchSF2Inst:fine-tune-override-set
IpatchSF2Inst:fixed-note
IpatchSF2Inst:fixed-note-set
IpatchSF2Inst:fixed-velocity
IpatchSF2Inst:fixed-velocity-set
IpatchSF2Inst:mod-env-attack
IpatchSF2Inst:mod-env-attack-set
IpatchSF2Inst:mod-env-decay
IpatchSF2Inst:mod-env-decay-set
IpatchSF2Inst:mod-env-delay
IpatchSF2Inst:mod-env-delay-set
IpatchSF2Inst:mod-env-hold
IpatchSF2Inst:mod-env-hold-set
IpatchSF2Inst:mod-env-release
IpatchSF2Inst:mod-env-release-set
IpatchSF2Inst:mod-env-sustain
IpatchSF2Inst:mod-env-sustain-set
IpatchSF2Inst:mod-env-to-filter-cutoff
IpatchSF2Inst:mod-env-to-filter-cutoff-set
IpatchSF2Inst:mod-env-to-pitch
IpatchSF2Inst:mod-env-to-pitch-set
IpatchSF2Inst:mod-lfo-delay
IpatchSF2Inst:mod-lfo-delay-set
IpatchSF2Inst:mod-lfo-freq
IpatchSF2Inst:mod-lfo-freq-set
IpatchSF2Inst:mod-lfo-to-filter-cutoff
IpatchSF2Inst:mod-lfo-to-filter-cutoff-set
IpatchSF2Inst:mod-lfo-to-pitch
IpatchSF2Inst:mod-lfo-to-pitch-set
IpatchSF2Inst:mod-lfo-to-volume
IpatchSF2Inst:mod-lfo-to-volume-set
IpatchSF2Inst:name
IpatchSF2Inst:note-range
IpatchSF2Inst:note-range-set
IpatchSF2Inst:note-to-mod-env-decay
IpatchSF2Inst:note-to-mod-env-decay-set
IpatchSF2Inst:note-to-mod-env-hold
IpatchSF2Inst:note-to-mod-env-hold-set
IpatchSF2Inst:note-to-vol-env-decay
IpatchSF2Inst:note-to-vol-env-decay-set
IpatchSF2Inst:note-to-vol-env-hold
IpatchSF2Inst:note-to-vol-env-hold-set
IpatchSF2Inst:pan
IpatchSF2Inst:pan-set
IpatchSF2Inst:reverb
IpatchSF2Inst:reverb-set
IpatchSF2Inst:root-note-override
IpatchSF2Inst:root-note-override-set
IpatchSF2Inst:sample-coarse-end
IpatchSF2Inst:sample-coarse-end-set
IpatchSF2Inst:sample-coarse-loop-end
IpatchSF2Inst:sample-coarse-loop-end-set
IpatchSF2Inst:sample-coarse-loop-start
IpatchSF2Inst:sample-coarse-loop-start-set
IpatchSF2Inst:sample-coarse-start
IpatchSF2Inst:sample-coarse-start-set
IpatchSF2Inst:sample-end
IpatchSF2Inst:sample-end-set
IpatchSF2Inst:sample-loop-end
IpatchSF2Inst:sample-loop-end-set
IpatchSF2Inst:sample-loop-start
IpatchSF2Inst:sample-loop-start-set
IpatchSF2Inst:sample-start
IpatchSF2Inst:sample-start-set
IpatchSF2Inst:scale-tune
IpatchSF2Inst:scale-tune-set
IpatchSF2Inst:velocity-range
IpatchSF2Inst:velocity-range-set
IpatchSF2Inst:vib-lfo-delay
IpatchSF2Inst:vib-lfo-delay-set
IpatchSF2Inst:vib-lfo-freq
IpatchSF2Inst:vib-lfo-freq-set
IpatchSF2Inst:vib-lfo-to-pitch
IpatchSF2Inst:vib-lfo-to-pitch-set
IpatchSF2Inst:vol-env-attack
IpatchSF2Inst:vol-env-attack-set
IpatchSF2Inst:vol-env-decay
IpatchSF2Inst:vol-env-decay-set
IpatchSF2Inst:vol-env-delay
IpatchSF2Inst:vol-env-delay-set
IpatchSF2Inst:vol-env-hold
IpatchSF2Inst:vol-env-hold-set
IpatchSF2Inst:vol-env-release
IpatchSF2Inst:vol-env-release-set
IpatchSF2Inst:vol-env-sustain
IpatchSF2Inst:vol-env-sustain-set
IpatchSF2IZone
IpatchSF2IZone:attenuation
IpatchSF2IZone:attenuation-set
IpatchSF2IZone:chorus
IpatchSF2IZone:chorus-set
IpatchSF2IZone:coarse-tune
IpatchSF2IZone:coarse-tune-set
IpatchSF2IZone:exclusive-class
IpatchSF2IZone:exclusive-class-set
IpatchSF2IZone:filter-cutoff
IpatchSF2IZone:filter-cutoff-set
IpatchSF2IZone:filter-q
IpatchSF2IZone:filter-q-set
IpatchSF2IZone:fine-tune
IpatchSF2IZone:fine-tune-override
IpatchSF2IZone:fine-tune-override-set
IpatchSF2IZone:fixed-note
IpatchSF2IZone:fixed-note-set
IpatchSF2IZone:fixed-velocity
IpatchSF2IZone:fixed-velocity-set
IpatchSF2IZone:link-item
IpatchSF2IZone:loop-end
IpatchSF2IZone:loop-start
IpatchSF2IZone:loop-type
IpatchSF2IZone:mod-env-attack
IpatchSF2IZone:mod-env-attack-set
IpatchSF2IZone:mod-env-decay
IpatchSF2IZone:mod-env-decay-set
IpatchSF2IZone:mod-env-delay
IpatchSF2IZone:mod-env-delay-set
IpatchSF2IZone:mod-env-hold
IpatchSF2IZone:mod-env-hold-set
IpatchSF2IZone:mod-env-release
IpatchSF2IZone:mod-env-release-set
IpatchSF2IZone:mod-env-sustain
IpatchSF2IZone:mod-env-sustain-set
IpatchSF2IZone:mod-env-to-filter-cutoff
IpatchSF2IZone:mod-env-to-filter-cutoff-set
IpatchSF2IZone:mod-env-to-pitch
IpatchSF2IZone:mod-env-to-pitch-set
IpatchSF2IZone:mod-lfo-delay
IpatchSF2IZone:mod-lfo-delay-set
IpatchSF2IZone:mod-lfo-freq
IpatchSF2IZone:mod-lfo-freq-set
IpatchSF2IZone:mod-lfo-to-filter-cutoff
IpatchSF2IZone:mod-lfo-to-filter-cutoff-set
IpatchSF2IZone:mod-lfo-to-pitch
IpatchSF2IZone:mod-lfo-to-pitch-set
IpatchSF2IZone:mod-lfo-to-volume
IpatchSF2IZone:mod-lfo-to-volume-set
IpatchSF2IZone:note-range
IpatchSF2IZone:note-range-set
IpatchSF2IZone:note-to-mod-env-decay
IpatchSF2IZone:note-to-mod-env-decay-set
IpatchSF2IZone:note-to-mod-env-hold
IpatchSF2IZone:note-to-mod-env-hold-set
IpatchSF2IZone:note-to-vol-env-decay
IpatchSF2IZone:note-to-vol-env-decay-set
IpatchSF2IZone:note-to-vol-env-hold
IpatchSF2IZone:note-to-vol-env-hold-set
IpatchSF2IZone:pan
IpatchSF2IZone:pan-set
IpatchSF2IZone:reverb
IpatchSF2IZone:reverb-set
IpatchSF2IZone:root-note
IpatchSF2IZone:root-note-override
IpatchSF2IZone:root-note-override-set
IpatchSF2IZone:sample-coarse-end
IpatchSF2IZone:sample-coarse-end-set
IpatchSF2IZone:sample-coarse-loop-end
IpatchSF2IZone:sample-coarse-loop-end-set
IpatchSF2IZone:sample-coarse-loop-start
IpatchSF2IZone:sample-coarse-loop-start-set
IpatchSF2IZone:sample-coarse-start
IpatchSF2IZone:sample-coarse-start-set
IpatchSF2IZone:sample-end
IpatchSF2IZone:sample-end-set
IpatchSF2IZone:sample-loop-end
IpatchSF2IZone:sample-loop-end-set
IpatchSF2IZone:sample-loop-start
IpatchSF2IZone:sample-loop-start-set
IpatchSF2IZone:sample-modes
IpatchSF2IZone:sample-modes-set
IpatchSF2IZone:sample-rate
IpatchSF2IZone:sample-start
IpatchSF2IZone:sample-start-set
IpatchSF2IZone:scale-tune
IpatchSF2IZone:scale-tune-set
IpatchSF2IZone:velocity-range
IpatchSF2IZone:velocity-range-set
IpatchSF2IZone:vib-lfo-delay
IpatchSF2IZone:vib-lfo-delay-set
IpatchSF2IZone:vib-lfo-freq
IpatchSF2IZone:vib-lfo-freq-set
IpatchSF2IZone:vib-lfo-to-pitch
IpatchSF2IZone:vib-lfo-to-pitch-set
IpatchSF2IZone:vol-env-attack
IpatchSF2IZone:vol-env-attack-set
IpatchSF2IZone:vol-env-decay
IpatchSF2IZone:vol-env-decay-set
IpatchSF2IZone:vol-env-delay
IpatchSF2IZone:vol-env-delay-set
IpatchSF2IZone:vol-env-hold
IpatchSF2IZone:vol-env-hold-set
IpatchSF2IZone:vol-env-release
IpatchSF2IZone:vol-env-release-set
IpatchSF2IZone:vol-env-sustain
IpatchSF2IZone:vol-env-sustain-set
IpatchSF2Mod
IpatchSF2ModControl
IpatchSF2ModControlPalette
IpatchSF2ModDirection
IpatchSF2ModFieldMasks
IpatchSF2ModFieldShifts
IpatchSF2ModFlags
IpatchSF2ModItem
IpatchSF2ModItemIface
IpatchSF2ModItemIface:modulators
IpatchSF2ModList
IpatchSF2ModPolarity
IpatchSF2ModTransform
IpatchSF2ModType
IpatchSF2Phdr
IpatchSF2Preset
IpatchSF2Preset:attenuation
IpatchSF2Preset:attenuation-set
IpatchSF2Preset:bank
IpatchSF2Preset:chorus
IpatchSF2Preset:chorus-set
IpatchSF2Preset:coarse-tune
IpatchSF2Preset:coarse-tune-set
IpatchSF2Preset:filter-cutoff
IpatchSF2Preset:filter-cutoff-set
IpatchSF2Preset:filter-q
IpatchSF2Preset:filter-q-set
IpatchSF2Preset:fine-tune-override
IpatchSF2Preset:fine-tune-override-set
IpatchSF2Preset:genre
IpatchSF2Preset:library
IpatchSF2Preset:mod-env-attack
IpatchSF2Preset:mod-env-attack-set
IpatchSF2Preset:mod-env-decay
IpatchSF2Preset:mod-env-decay-set
IpatchSF2Preset:mod-env-delay
IpatchSF2Preset:mod-env-delay-set
IpatchSF2Preset:mod-env-hold
IpatchSF2Preset:mod-env-hold-set
IpatchSF2Preset:mod-env-release
IpatchSF2Preset:mod-env-release-set
IpatchSF2Preset:mod-env-sustain
IpatchSF2Preset:mod-env-sustain-set
IpatchSF2Preset:mod-env-to-filter-cutoff
IpatchSF2Preset:mod-env-to-filter-cutoff-set
IpatchSF2Preset:mod-env-to-pitch
IpatchSF2Preset:mod-env-to-pitch-set
IpatchSF2Preset:mod-lfo-delay
IpatchSF2Preset:mod-lfo-delay-set
IpatchSF2Preset:mod-lfo-freq
IpatchSF2Preset:mod-lfo-freq-set
IpatchSF2Preset:mod-lfo-to-filter-cutoff
IpatchSF2Preset:mod-lfo-to-filter-cutoff-set
IpatchSF2Preset:mod-lfo-to-pitch
IpatchSF2Preset:mod-lfo-to-pitch-set
IpatchSF2Preset:mod-lfo-to-volume
IpatchSF2Preset:mod-lfo-to-volume-set
IpatchSF2Preset:morphology
IpatchSF2Preset:name
IpatchSF2Preset:note-range
IpatchSF2Preset:note-range-set
IpatchSF2Preset:note-to-mod-env-decay
IpatchSF2Preset:note-to-mod-env-decay-set
IpatchSF2Preset:note-to-mod-env-hold
IpatchSF2Preset:note-to-mod-env-hold-set
IpatchSF2Preset:note-to-vol-env-decay
IpatchSF2Preset:note-to-vol-env-decay-set
IpatchSF2Preset:note-to-vol-env-hold
IpatchSF2Preset:note-to-vol-env-hold-set
IpatchSF2Preset:pan
IpatchSF2Preset:pan-set
IpatchSF2Preset:percussion
IpatchSF2Preset:program
IpatchSF2Preset:reverb
IpatchSF2Preset:reverb-set
IpatchSF2Preset:scale-tune
IpatchSF2Preset:scale-tune-set
IpatchSF2Preset:velocity-range
IpatchSF2Preset:velocity-range-set
IpatchSF2Preset:vib-lfo-delay
IpatchSF2Preset:vib-lfo-delay-set
IpatchSF2Preset:vib-lfo-freq
IpatchSF2Preset:vib-lfo-freq-set
IpatchSF2Preset:vib-lfo-to-pitch
IpatchSF2Preset:vib-lfo-to-pitch-set
IpatchSF2Preset:vol-env-attack
IpatchSF2Preset:vol-env-attack-set
IpatchSF2Preset:vol-env-decay
IpatchSF2Preset:vol-env-decay-set
IpatchSF2Preset:vol-env-delay
IpatchSF2Preset:vol-env-delay-set
IpatchSF2Preset:vol-env-hold
IpatchSF2Preset:vol-env-hold-set
IpatchSF2Preset:vol-env-release
IpatchSF2Preset:vol-env-release-set
IpatchSF2Preset:vol-env-sustain
IpatchSF2Preset:vol-env-sustain-set
IpatchSF2PZone
IpatchSF2PZone:attenuation
IpatchSF2PZone:attenuation-set
IpatchSF2PZone:chorus
IpatchSF2PZone:chorus-set
IpatchSF2PZone:coarse-tune
IpatchSF2PZone:coarse-tune-set
IpatchSF2PZone:filter-cutoff
IpatchSF2PZone:filter-cutoff-set
IpatchSF2PZone:filter-q
IpatchSF2PZone:filter-q-set
IpatchSF2PZone:fine-tune-override
IpatchSF2PZone:fine-tune-override-set
IpatchSF2PZone:link-item
IpatchSF2PZone:mod-env-attack
IpatchSF2PZone:mod-env-attack-set
IpatchSF2PZone:mod-env-decay
IpatchSF2PZone:mod-env-decay-set
IpatchSF2PZone:mod-env-delay
IpatchSF2PZone:mod-env-delay-set
IpatchSF2PZone:mod-env-hold
IpatchSF2PZone:mod-env-hold-set
IpatchSF2PZone:mod-env-release
IpatchSF2PZone:mod-env-release-set
IpatchSF2PZone:mod-env-sustain
IpatchSF2PZone:mod-env-sustain-set
IpatchSF2PZone:mod-env-to-filter-cutoff
IpatchSF2PZone:mod-env-to-filter-cutoff-set
IpatchSF2PZone:mod-env-to-pitch
IpatchSF2PZone:mod-env-to-pitch-set
IpatchSF2PZone:mod-lfo-delay
IpatchSF2PZone:mod-lfo-delay-set
IpatchSF2PZone:mod-lfo-freq
IpatchSF2PZone:mod-lfo-freq-set
IpatchSF2PZone:mod-lfo-to-filter-cutoff
IpatchSF2PZone:mod-lfo-to-filter-cutoff-set
IpatchSF2PZone:mod-lfo-to-pitch
IpatchSF2PZone:mod-lfo-to-pitch-set
IpatchSF2PZone:mod-lfo-to-volume
IpatchSF2PZone:mod-lfo-to-volume-set
IpatchSF2PZone:note-range
IpatchSF2PZone:note-range-set
IpatchSF2PZone:note-to-mod-env-decay
IpatchSF2PZone:note-to-mod-env-decay-set
IpatchSF2PZone:note-to-mod-env-hold
IpatchSF2PZone:note-to-mod-env-hold-set
IpatchSF2PZone:note-to-vol-env-decay
IpatchSF2PZone:note-to-vol-env-decay-set
IpatchSF2PZone:note-to-vol-env-hold
IpatchSF2PZone:note-to-vol-env-hold-set
IpatchSF2PZone:pan
IpatchSF2PZone:pan-set
IpatchSF2PZone:reverb
IpatchSF2PZone:reverb-set
IpatchSF2PZone:scale-tune
IpatchSF2PZone:scale-tune-set
IpatchSF2PZone:velocity-range
IpatchSF2PZone:velocity-range-set
IpatchSF2PZone:vib-lfo-delay
IpatchSF2PZone:vib-lfo-delay-set
IpatchSF2PZone:vib-lfo-freq
IpatchSF2PZone:vib-lfo-freq-set
IpatchSF2PZone:vib-lfo-to-pitch
IpatchSF2PZone:vib-lfo-to-pitch-set
IpatchSF2PZone:vol-env-attack
IpatchSF2PZone:vol-env-attack-set
IpatchSF2PZone:vol-env-decay
IpatchSF2PZone:vol-env-decay-set
IpatchSF2PZone:vol-env-delay
IpatchSF2PZone:vol-env-delay-set
IpatchSF2PZone:vol-env-hold
IpatchSF2PZone:vol-env-hold-set
IpatchSF2PZone:vol-env-release
IpatchSF2PZone:vol-env-release-set
IpatchSF2PZone:vol-env-sustain
IpatchSF2PZone:vol-env-sustain-set
IpatchSF2Reader
IpatchSF2Sample
IpatchSF2Sample:channel
IpatchSF2Sample:fine-tune
IpatchSF2Sample:linked-sample
IpatchSF2Sample:loop-end
IpatchSF2Sample:loop-start
IpatchSF2Sample:name
IpatchSF2Sample:rom
IpatchSF2Sample:root-note
IpatchSF2Sample:sample-data
IpatchSF2Sample:sample-rate
IpatchSF2SampleChannel
IpatchSF2Shdr
IpatchSF2Voice
IpatchSF2VoiceCache
IpatchSF2VoiceCacheItemFunc
IpatchSF2VoiceCacheUpdateHandler
IpatchSF2VoiceSelInfo
IpatchSF2VoiceSelType
IpatchSF2VoiceUpdate
IpatchSF2Writer
IpatchSF2Writer:migrate-samples
IpatchSF2Zone
IpatchSndFile
IpatchSndFileEndian
IpatchSplitsType
IpatchState
IpatchStateGroup
IpatchStateGroupFlags
IpatchStateItem
IpatchStateItemAdd
IpatchStateItemChange
IpatchStateItemFlags
IpatchStateItemRemove
IpatchStateItemType
IpatchTypePropGetFunc
IpatchUnitClassType
IpatchUnitFlags
IpatchUnitInfo
IpatchUnitType
IpatchValueTransform
IpatchVBank
IpatchVBank:author
IpatchVBank:comment
IpatchVBank:date
IpatchVBank:engine
IpatchVBank:name
IpatchVBank:parser-version
IpatchVBank:require-version
IpatchVBankInst
IpatchVBankInst:bank
IpatchVBankInst:name
IpatchVBankInst:program
IpatchVBankRegion
IpatchVBankRegion:file-index
IpatchVBankRegion:id-props
IpatchVBankRegion:link-item
IpatchVBankRegion:note-range
IpatchVBankRegion:note-range-mode
IpatchVBankRegion:root-note
IpatchVBankRegion:root-note-mode
IpatchVBankRegionNoteRangeMode
IpatchVBankRegionRootNoteMode
IpatchVirtualContainer
IpatchVirtualContainerConformFunc
IpatchXmlAttr
IpatchXmlDecodeFunc
IpatchXmlEncodeFunc
IpatchXmlNode
ipatch_application_name
IPATCH_BASE_DEFAULT_NAME
ipatch_base_find_item_by_midi_locale
ipatch_base_find_unused_midi_locale
ipatch_base_get_file
ipatch_base_get_file_name
ipatch_base_set_file
ipatch_base_set_file_name
IPATCH_BASE_UNUSED_FLAG_SHIFT
ipatch_code_error
ipatch_container_add
ipatch_container_add_connect
ipatch_container_add_disconnect
ipatch_container_add_disconnect_matched
ipatch_container_add_notify
ipatch_container_add_unique
ipatch_container_append
ipatch_container_count
IPATCH_CONTAINER_ERRMSG_INVALID_CHILD_2
ipatch_container_get_children
ipatch_container_get_child_types
ipatch_container_get_virtual_types
ipatch_container_init_iter
ipatch_container_insert
ipatch_container_insert_iter
ipatch_container_make_unique
ipatch_container_prepend
ipatch_container_remove
ipatch_container_remove_all
ipatch_container_remove_connect
ipatch_container_remove_disconnect
ipatch_container_remove_disconnect_matched
ipatch_container_remove_iter
ipatch_container_remove_notify
ipatch_container_type_get_child_types
IPATCH_CONTAINER_UNUSED_FLAG_SHIFT
ipatch_converter_add_input
ipatch_converter_add_inputs
ipatch_converter_add_output
ipatch_converter_add_outputs
ipatch_converter_convert
ipatch_converter_get_input
ipatch_converter_get_inputs
ipatch_converter_get_notes
ipatch_converter_get_output
ipatch_converter_get_outputs
ipatch_converter_init
IPATCH_CONVERTER_INPUT
ipatch_converter_log
IPATCH_CONVERTER_LOG_MSG_ALLOC
ipatch_converter_log_next
ipatch_converter_log_printf
IPATCH_CONVERTER_LOG_TYPE_MASK
IPATCH_CONVERTER_OUTPUT
ipatch_converter_reset
ipatch_converter_set_link_funcs
ipatch_converter_verify
ipatch_convert_objects
ipatch_convert_object_to_type
ipatch_convert_object_to_type_multi
ipatch_convert_object_to_type_multi_set
ipatch_create_converter
IPATCH_DLS2_CONN_ARE_IDENTICAL
ipatch_dls2_conn_duplicate
ipatch_dls2_conn_free
ipatch_dls2_conn_get_type
ipatch_dls2_conn_list_duplicate
ipatch_dls2_conn_list_duplicate_fast
ipatch_dls2_conn_list_free
ipatch_dls2_conn_list_set
ipatch_dls2_conn_list_unset
ipatch_dls2_conn_new
IPATCH_DLS2_CONN_OUTPUT_TRANS_NONE
ipatch_dls2_find_inst
ipatch_dls2_find_sample
ipatch_dls2_get_file
ipatch_dls2_get_info
ipatch_dls2_get_insts
ipatch_dls2_get_region_references
ipatch_dls2_get_samples
ipatch_dls2_info_bag_free
ipatch_dls2_info_bag_new
ipatch_dls2_info_duplicate
ipatch_dls2_info_free
ipatch_dls2_info_get
ipatch_dls2_info_get_property
ipatch_dls2_info_install_class_properties
ipatch_dls2_info_is_defined
ipatch_dls2_info_notify
ipatch_dls2_info_peek
ipatch_dls2_info_set
ipatch_dls2_info_set_property
IPATCH_DLS2_INST_BANK_MAX
ipatch_dls2_inst_compare
ipatch_dls2_inst_conn_count
ipatch_dls2_inst_first
ipatch_dls2_inst_get_conns
ipatch_dls2_inst_get_info
ipatch_dls2_inst_get_midi_locale
ipatch_dls2_inst_get_regions
ipatch_dls2_inst_new
ipatch_dls2_inst_next
ipatch_dls2_inst_set_conn
ipatch_dls2_inst_set_info
ipatch_dls2_inst_set_midi_locale
ipatch_dls2_inst_unset_all_conns
ipatch_dls2_inst_unset_conn
IPATCH_DLS2_INST_UNUSED_FLAG_SHIFT
ipatch_dls2_make_unique_name
ipatch_dls2_new
ipatch_dls2_region_channel_map_stereo
IPATCH_DLS2_REGION_CHANNEL_MONO
ipatch_dls2_region_conn_count
ipatch_dls2_region_first
IPATCH_DLS2_REGION_FLAG_MASK
ipatch_dls2_region_get_conns
ipatch_dls2_region_get_info
ipatch_dls2_region_get_sample
ipatch_dls2_region_in_range
ipatch_dls2_region_new
ipatch_dls2_region_next
ipatch_dls2_region_peek_sample
ipatch_dls2_region_set_conn
ipatch_dls2_region_set_info
ipatch_dls2_region_set_note_range
ipatch_dls2_region_set_param
ipatch_dls2_region_set_param_array
ipatch_dls2_region_set_sample
ipatch_dls2_region_set_velocity_range
ipatch_dls2_region_unset_all_conns
ipatch_dls2_region_unset_conn
IPATCH_DLS2_REGION_UNUSED_FLAG_SHIFT
ipatch_dls2_sample_first
IPATCH_DLS2_SAMPLE_FLAGS_MASK
ipatch_dls2_sample_get_data
ipatch_dls2_sample_info_duplicate
IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID
ipatch_dls2_sample_info_free
ipatch_dls2_sample_info_get_property
IPATCH_DLS2_SAMPLE_INFO_INIT
ipatch_dls2_sample_info_init
ipatch_dls2_sample_info_install_class_properties
ipatch_dls2_sample_info_is_property_id_valid
ipatch_dls2_sample_info_new
ipatch_dls2_sample_info_notify_changes
IPATCH_DLS2_SAMPLE_INFO_PROPERTY_COUNT
ipatch_dls2_sample_info_set_property
IPATCH_DLS2_SAMPLE_LOOP_MASK
ipatch_dls2_sample_new
ipatch_dls2_sample_next
ipatch_dls2_sample_peek_data
ipatch_dls2_sample_set_blank
ipatch_dls2_sample_set_data
ipatch_dls2_set_file
ipatch_dls2_set_info
IPATCH_DLS2_UNUSED_FLAG_SHIFT
IPATCH_DLS_ART_HEADER_SIZE
IPATCH_DLS_CONN_SIZE
IPATCH_DLS_DLID_SIZE
ipatch_dls_file_new
IPATCH_DLS_FOURCC_ART1
IPATCH_DLS_FOURCC_ART2
IPATCH_DLS_FOURCC_CDL
IPATCH_DLS_FOURCC_COLH
IPATCH_DLS_FOURCC_DATA
IPATCH_DLS_FOURCC_DLID
IPATCH_DLS_FOURCC_DLS
IPATCH_DLS_FOURCC_DWPL
IPATCH_DLS_FOURCC_FMT
IPATCH_DLS_FOURCC_IARL
IPATCH_DLS_FOURCC_IART
IPATCH_DLS_FOURCC_ICMS
IPATCH_DLS_FOURCC_ICMT
IPATCH_DLS_FOURCC_ICOP
IPATCH_DLS_FOURCC_ICRD
IPATCH_DLS_FOURCC_IENG
IPATCH_DLS_FOURCC_IGNR
IPATCH_DLS_FOURCC_IKEY
IPATCH_DLS_FOURCC_IMED
IPATCH_DLS_FOURCC_INAM
IPATCH_DLS_FOURCC_INFO
IPATCH_DLS_FOURCC_INS
IPATCH_DLS_FOURCC_INSH
IPATCH_DLS_FOURCC_IPRD
IPATCH_DLS_FOURCC_ISBJ
IPATCH_DLS_FOURCC_ISFT
IPATCH_DLS_FOURCC_ISRC
IPATCH_DLS_FOURCC_ISRF
IPATCH_DLS_FOURCC_ITCH
IPATCH_DLS_FOURCC_LAR2
IPATCH_DLS_FOURCC_LART
IPATCH_DLS_FOURCC_LINS
IPATCH_DLS_FOURCC_LRGN
IPATCH_DLS_FOURCC_PATH
IPATCH_DLS_FOURCC_PTBL
IPATCH_DLS_FOURCC_RGN
IPATCH_DLS_FOURCC_RGN2
IPATCH_DLS_FOURCC_RGNH
IPATCH_DLS_FOURCC_VERS
IPATCH_DLS_FOURCC_WAVE
IPATCH_DLS_FOURCC_WLNK
IPATCH_DLS_FOURCC_WSMP
IPATCH_DLS_FOURCC_WVPL
IPATCH_DLS_INSH_BANK_MASK
IPATCH_DLS_INSH_BANK_PERCUSSION
IPATCH_DLS_INSH_SIZE
ipatch_dls_load_connection
ipatch_dls_load_dlid
ipatch_dls_load_info
ipatch_dls_load_pool_table
ipatch_dls_load_region_header
ipatch_dls_load_sample_format
ipatch_dls_load_sample_info
ipatch_dls_load_wave_link
IPATCH_DLS_POOLCUE_SIZE
IPATCH_DLS_PTBL_HEADER_SIZE
IPATCH_DLS_READER_ERROR
ipatch_dls_reader_fixup
ipatch_dls_reader_load
ipatch_dls_reader_load_art_list
ipatch_dls_reader_load_inst_list
ipatch_dls_reader_load_level_0
ipatch_dls_reader_load_region_list
ipatch_dls_reader_load_wave_pool
ipatch_dls_reader_new
ipatch_dls_reader_set_pool_table
ipatch_dls_reader_start
IPATCH_DLS_RGNH_LAYER_SIZE
IPATCH_DLS_RGNH_OPTION_SELF_NON_EXCLUSIVE
IPATCH_DLS_RGNH_SIZE
IPATCH_DLS_VERS_SIZE
IPATCH_DLS_WAVE_FMT_SIZE
IPATCH_DLS_WLNK_MULTI_CHANNEL
IPATCH_DLS_WLNK_PHASE_MASTER
IPATCH_DLS_WLNK_SIZE
ipatch_dls_writer_new
ipatch_dls_writer_save
ipatch_dls_writer_set_file_handle
ipatch_dls_writer_set_patch
IPATCH_DLS_WSMP_HEADER_SIZE
IPATCH_DLS_WSMP_LOOP_FORWARD
IPATCH_DLS_WSMP_LOOP_RELEASE
IPATCH_DLS_WSMP_LOOP_SIZE
IPATCH_DLS_WSMP_NO_COMPRESSION
IPATCH_DLS_WSMP_NO_TRUNCATION
ipatch_dump_object
IPATCH_ERROR
ipatch_error_quark
ipatch_file_assign_fd
ipatch_file_assign_io_channel
IPATCH_FILE_BIG_ENDIAN
ipatch_file_buf_commit
ipatch_file_buf_load
ipatch_file_buf_memset
ipatch_file_buf_read
ipatch_file_buf_read_s16
ipatch_file_buf_read_s32
ipatch_file_buf_read_s64
ipatch_file_buf_read_s8
ipatch_file_buf_read_u16
ipatch_file_buf_read_u32
ipatch_file_buf_read_u64
ipatch_file_buf_read_u8
ipatch_file_buf_seek
ipatch_file_buf_skip
ipatch_file_buf_write
ipatch_file_buf_write_s16
ipatch_file_buf_write_s32
ipatch_file_buf_write_s64
ipatch_file_buf_write_s8
ipatch_file_buf_write_u16
ipatch_file_buf_write_u32
ipatch_file_buf_write_u64
ipatch_file_buf_write_u8
ipatch_file_buf_zero
ipatch_file_close
ipatch_file_default_close_method
ipatch_file_default_getfd_method
ipatch_file_default_get_size_method
ipatch_file_default_open_method
ipatch_file_default_read_method
ipatch_file_default_seek_method
ipatch_file_default_write_method
ipatch_file_get_fd
ipatch_file_get_iofuncs
ipatch_file_get_io_channel
ipatch_file_get_name
ipatch_file_get_position
ipatch_file_get_size
ipatch_file_identify
ipatch_file_identify_by_ext
ipatch_file_identify_open
IPATCH_FILE_NEED_SWAP
ipatch_file_new
ipatch_file_open
ipatch_file_read
ipatch_file_read_eof
ipatch_file_read_s16
ipatch_file_read_s32
ipatch_file_read_s64
ipatch_file_read_s8
ipatch_file_read_u16
ipatch_file_read_u32
ipatch_file_read_u64
ipatch_file_read_u8
ipatch_file_seek
ipatch_file_seek_eof
ipatch_file_set_big_endian
ipatch_file_set_iofuncs
ipatch_file_set_iofuncs_null
ipatch_file_set_iofuncs_static
ipatch_file_set_little_endian
ipatch_file_set_name
ipatch_file_skip
IPATCH_FILE_SWAP16
IPATCH_FILE_SWAP32
IPATCH_FILE_SWAP64
IPATCH_FILE_UNUSED_FLAG_SHIFT
ipatch_file_update_position
ipatch_file_write
ipatch_file_write_s16
ipatch_file_write_s32
ipatch_file_write_s64
ipatch_file_write_s8
ipatch_file_write_u16
ipatch_file_write_u32
ipatch_file_write_u64
ipatch_file_write_u8
ipatch_find_converter
IPATCH_FOURCC
IPATCH_FOURCC_LIST
IPATCH_FOURCC_RIFF
IPATCH_FOURCC_RIFX
ipatch_gerror_message
ipatch_get_sample_data_list
IPATCH_GIG_3DDP_SIZE
IPATCH_GIG_3EWA_SIZE
IPATCH_GIG_3EWG_SIZE
IPATCH_GIG_3GIX_SIZE
IPATCH_GIG_3GNM_SIZE
IPATCH_GIG_3LNK_SIZE
IPATCH_GIG_DEFAULT_SAMPLE_GROUP_NAME
ipatch_gig_dimension_first
ipatch_gig_dimension_new
ipatch_gig_dimension_next
IPATCH_GIG_DIMENSION_TYPE_MAX
ipatch_gig_effects_init
ipatch_gig_effects_to_gen_array
ipatch_gig_file_new
IPATCH_GIG_FOURCC_3DDP
IPATCH_GIG_FOURCC_3DNL
IPATCH_GIG_FOURCC_3EWA
IPATCH_GIG_FOURCC_3EWG
IPATCH_GIG_FOURCC_3EWL
IPATCH_GIG_FOURCC_3GIX
IPATCH_GIG_FOURCC_3GNL
IPATCH_GIG_FOURCC_3GNM
IPATCH_GIG_FOURCC_3GRI
IPATCH_GIG_FOURCC_3LNK
IPATCH_GIG_FOURCC_3PRG
IPATCH_GIG_FOURCC_EINF
IPATCH_GIG_FOURCC_SMPL
IPATCH_GIG_IARL_INFO_SIZE
IPATCH_GIG_ICMT_INFO_SIZE
ipatch_gig_inst_first
IPATCH_GIG_INST_ISFT_VAL
ipatch_gig_inst_new
ipatch_gig_inst_next
IPATCH_GIG_ITEM_INAM_SIZE
ipatch_gig_load_dimension_info
ipatch_gig_load_dimension_names
ipatch_gig_load_group_names
ipatch_gig_load_region_header
ipatch_gig_load_sample_info
IPATCH_GIG_MOST_INFO_SIZE
ipatch_gig_new
ipatch_gig_parse_effects
ipatch_gig_reader_load_inst_lart
ipatch_gig_reader_load_region_list
ipatch_gig_reader_load_sub_regions
ipatch_gig_region_first
IPATCH_GIG_REGION_FLAG_MASK
ipatch_gig_region_new
ipatch_gig_region_new_dimension
ipatch_gig_region_next
ipatch_gig_region_remove_dimension
ipatch_gig_region_set_note_range
ipatch_gig_region_set_velocity_range
IPATCH_GIG_REGION_UNUSED_FLAG_SHIFT
ipatch_gig_sample_first
ipatch_gig_sample_new
ipatch_gig_sample_next
IPATCH_GIG_SMPL_SIZE
ipatch_gig_store_effects
ipatch_gig_sub_region_first
ipatch_gig_sub_region_get_sample
ipatch_gig_sub_region_new
ipatch_gig_sub_region_next
ipatch_gig_sub_region_set_sample
IPATCH_GIG_SUB_REGION_UNUSED_FLAG_SHIFT
ipatch_gig_to_sf2_timecents
ipatch_gig_volsust_to_sf2_centibels
ipatch_init
IPATCH_IS_FILE_HANDLE
ipatch_is_paste_possible
IPATCH_IS_STATE_ITEM_CHANGE
IPATCH_IS_STATE_ITEM_CHANGE_CLASS
IPATCH_IS_STATE_ITEM_REMOVE
IPATCH_IS_STATE_ITEM_REMOVE_CLASS
IPATCH_IS_VIRTUAL_DLS2_PERCUSSION
IPATCH_IS_VIRTUAL_DLS2_SAMPLES
IPATCH_IS_VIRTUAL_GIG_MELODIC
IPATCH_IS_VIRTUAL_GIG_PERCUSSION
IPATCH_IS_VIRTUAL_GIG_SAMPLES
IPATCH_IS_VIRTUAL_SF2_INST
IPATCH_IS_VIRTUAL_SF2_MELODIC
IPATCH_IS_VIRTUAL_SF2_PERCUSSION
IPATCH_IS_VIRTUAL_SF2_ROM
IPATCH_IS_VIRTUAL_SF2_SAMPLES
ipatch_item_changed
ipatch_item_copy
IPATCH_ITEM_COPY_LINK_FUNC
ipatch_item_copy_link_func
ipatch_item_copy_link_func_deep
ipatch_item_copy_link_func_hash
ipatch_item_copy_replace
ipatch_item_duplicate
ipatch_item_duplicate_deep
ipatch_item_duplicate_link_func
ipatch_item_duplicate_replace
ipatch_item_first
ipatch_item_get_ancestor_by_type
ipatch_item_get_atomic
ipatch_item_get_base
ipatch_item_get_parent
ipatch_item_get_property_fast
ipatch_item_get_unique_props
ipatch_item_next
ipatch_item_peek_ancestor_by_type
ipatch_item_peek_base
ipatch_item_peek_parent
ipatch_item_prop_connect
ipatch_item_prop_connect_by_name
ipatch_item_prop_disconnect
ipatch_item_prop_disconnect_by_name
ipatch_item_prop_disconnect_matched
ipatch_item_prop_notify
ipatch_item_prop_notify_by_name
IPATCH_ITEM_PROP_NOTIFY_SET_EVENT
ipatch_item_pspec_title
ipatch_item_remove
IPATCH_ITEM_RLOCK
IPATCH_ITEM_RUNLOCK
ipatch_item_set_atomic
ipatch_item_set_parent
ipatch_item_test_conflict
ipatch_item_type_can_conflict
ipatch_item_type_get_unique_specs
ipatch_item_unparent
IPATCH_ITEM_UNUSED_FLAG_SHIFT
IPATCH_ITEM_WLOCK
IPATCH_ITEM_WUNLOCK
ipatch_iter_alloc
ipatch_iter_array_count
ipatch_iter_array_first
ipatch_iter_array_get
IPATCH_ITER_ARRAY_GET_ARRAY
IPATCH_ITER_ARRAY_GET_POS
IPATCH_ITER_ARRAY_GET_SIZE
ipatch_iter_array_index
ipatch_iter_array_init
ipatch_iter_array_insert
ipatch_iter_array_last
ipatch_iter_array_next
ipatch_iter_array_remove
IPATCH_ITER_ARRAY_SET_ARRAY
IPATCH_ITER_ARRAY_SET_POS
IPATCH_ITER_ARRAY_SET_SIZE
ipatch_iter_count
ipatch_iter_duplicate
ipatch_iter_first
ipatch_iter_free
ipatch_iter_get
ipatch_iter_get_type
ipatch_iter_GList_count
ipatch_iter_GList_first
ipatch_iter_GList_get
IPATCH_ITER_GLIST_GET_LIST
IPATCH_ITER_GLIST_GET_POS
ipatch_iter_GList_index
ipatch_iter_GList_init
ipatch_iter_GList_insert
ipatch_iter_GList_last
ipatch_iter_GList_next
ipatch_iter_GList_remove
IPATCH_ITER_GLIST_SET_LIST
IPATCH_ITER_GLIST_SET_POS
ipatch_iter_GSList_count
ipatch_iter_GSList_first
ipatch_iter_GSList_get
IPATCH_ITER_GSLIST_GET_LIST
IPATCH_ITER_GSLIST_GET_POS
ipatch_iter_GSList_index
ipatch_iter_GSList_init
ipatch_iter_GSList_insert
ipatch_iter_GSList_last
ipatch_iter_GSList_next
ipatch_iter_GSList_remove
IPATCH_ITER_GSLIST_SET_LIST
IPATCH_ITER_GSLIST_SET_POS
ipatch_iter_index
ipatch_iter_insert
ipatch_iter_last
ipatch_iter_next
ipatch_iter_remove
ipatch_list_duplicate
ipatch_list_init_iter
ipatch_list_new
ipatch_lookup_converter_info
ipatch_md5_final
ipatch_md5_init
ipatch_md5_update
ipatch_param_find_property
ipatch_param_get
ipatch_param_get_property
ipatch_param_get_valist
ipatch_param_install_property
ipatch_param_list_properties
ipatch_param_set
ipatch_param_set_property
ipatch_param_set_valist
ipatch_param_spec_range
ipatch_param_spec_range_get_type
IPATCH_PARAM_USER_SHIFT
ipatch_paste_default_exec_func
ipatch_paste_default_test_func
ipatch_paste_finish
IPATCH_PASTE_FLAGS_PRIORITY_MASK
ipatch_paste_get_add_list
ipatch_paste_new
ipatch_paste_objects
ipatch_paste_object_add
ipatch_paste_object_add_convert
ipatch_paste_object_add_duplicate
ipatch_paste_object_add_duplicate_deep
ipatch_paste_object_link
ipatch_paste_resolve
ipatch_range_copy
ipatch_range_free
ipatch_range_new
IPATCH_RANGE_SET_NULL
IPATCH_RANGE_SET_VALUES
ipatch_register_converter_map
ipatch_register_paste_handler
IPATCH_RIFF_BIG_ENDIAN
ipatch_riff_close_chunk
ipatch_riff_end_chunk
IPATCH_RIFF_ERROR
ipatch_riff_error_quark
IPATCH_RIFF_FOURCC_SIZE
ipatch_riff_get_chunk
ipatch_riff_get_chunk_array
ipatch_riff_get_chunk_level
ipatch_riff_get_error
ipatch_riff_get_file_handle
ipatch_riff_get_position
ipatch_riff_get_total_size
IPATCH_RIFF_HEADER_SIZE
IPATCH_RIFF_LIST_HEADER_SIZE
ipatch_riff_message_detail
IPATCH_RIFF_NEED_SWAP
ipatch_riff_new
ipatch_riff_pop_state
ipatch_riff_push_state
ipatch_riff_read_chunk
ipatch_riff_read_chunk_verify
ipatch_riff_set_file_handle
ipatch_riff_skip_chunk
ipatch_riff_skip_chunks
ipatch_riff_start_read
ipatch_riff_start_read_chunk
IPATCH_RIFF_WAVE_FMT_FLOAT
IPATCH_RIFF_WAVE_FMT_PCM
ipatch_riff_write_chunk
ipatch_riff_write_list_chunk
ipatch_riff_write_sub_chunk
ipatch_sample_cache_clean
IPATCH_SAMPLE_CHANNEL_MASK
IPATCH_SAMPLE_CHANNEL_SHIFT
ipatch_sample_copy
ipatch_sample_data_add
ipatch_sample_data_get_blank
ipatch_sample_data_get_cache_sample
ipatch_sample_data_get_native_format
ipatch_sample_data_get_native_sample
ipatch_sample_data_get_samples
ipatch_sample_data_get_size
ipatch_sample_data_lookup_cache_sample
ipatch_sample_data_new
ipatch_sample_data_open_cache_sample
ipatch_sample_data_open_native_sample
ipatch_sample_data_remove
ipatch_sample_data_replace_native_sample
IPATCH_SAMPLE_DATA_UNUSED_FLAG_SHIFT
IPATCH_SAMPLE_ENDIAN_HOST
IPATCH_SAMPLE_ENDIAN_MASK
IPATCH_SAMPLE_ENDIAN_SHIFT
IPATCH_SAMPLE_FORMAT_BITCOUNT
ipatch_sample_format_bit_width
IPATCH_SAMPLE_FORMAT_DEFAULT
IPATCH_SAMPLE_FORMAT_GET_CHANNELS
IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT
IPATCH_SAMPLE_FORMAT_GET_WIDTH
IPATCH_SAMPLE_FORMAT_IS_BENDIAN
IPATCH_SAMPLE_FORMAT_IS_LENDIAN
IPATCH_SAMPLE_FORMAT_IS_SIGNED
IPATCH_SAMPLE_FORMAT_IS_UNSIGNED
IPATCH_SAMPLE_FORMAT_MASK
ipatch_sample_format_size
ipatch_sample_format_transform_verify
ipatch_sample_format_verify
ipatch_sample_format_width
ipatch_sample_get_format
ipatch_sample_get_frame_size
ipatch_sample_get_loop_types
ipatch_sample_get_sample_data
ipatch_sample_get_size
ipatch_sample_get_transform_funcs
ipatch_sample_handle_cascade_open
ipatch_sample_handle_close
IPATCH_SAMPLE_HANDLE_FORMAT
ipatch_sample_handle_get_format
ipatch_sample_handle_get_frame_size
ipatch_sample_handle_get_max_frames
ipatch_sample_handle_get_transform
ipatch_sample_handle_open
ipatch_sample_handle_read
ipatch_sample_handle_set_transform
ipatch_sample_handle_write
ipatch_sample_install_property
ipatch_sample_install_property_readonly
ipatch_sample_list_append
ipatch_sample_list_cut
ipatch_sample_list_duplicate
ipatch_sample_list_free
ipatch_sample_list_get_type
ipatch_sample_list_insert
ipatch_sample_list_insert_index
ipatch_sample_list_item_duplicate
ipatch_sample_list_item_free
ipatch_sample_list_item_new
ipatch_sample_list_item_new_init
ipatch_sample_list_new
ipatch_sample_list_prepend
ipatch_sample_list_render
IPATCH_SAMPLE_LOOP_TYPE_TERM
IPATCH_SAMPLE_MAP_CHANNEL
IPATCH_SAMPLE_MAP_GET_CHANNEL
IPATCH_SAMPLE_MAX_CHANNELS
IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS
ipatch_sample_new_property_param_spec
IPATCH_SAMPLE_RATE_DEFAULT
IPATCH_SAMPLE_RATE_MAX
IPATCH_SAMPLE_RATE_MIN
ipatch_sample_read
ipatch_sample_read_transform
IPATCH_SAMPLE_ROOT_NOTE_DEFAULT
ipatch_sample_save_to_file
ipatch_sample_set_format
ipatch_sample_set_sample_data
ipatch_sample_set_size
IPATCH_SAMPLE_SIGN_MASK
IPATCH_SAMPLE_SIGN_SHIFT
ipatch_sample_store_cache_close
ipatch_sample_store_cache_get_channel_map
ipatch_sample_store_cache_get_location
ipatch_sample_store_cache_get_open_count
ipatch_sample_store_cache_new
ipatch_sample_store_cache_open
IPATCH_SAMPLE_STORE_CACHE_UNUSED_FLAG_SHIFT
ipatch_sample_store_file_new
IPATCH_SAMPLE_STORE_FILE_UNUSED_FLAG_SHIFT
ipatch_sample_store_first
IPATCH_SAMPLE_STORE_FORMAT_SHIFT
ipatch_sample_store_get_format
ipatch_sample_store_get_rate
ipatch_sample_store_get_size
ipatch_sample_store_get_size_bytes
ipatch_sample_store_next
ipatch_sample_store_ram_get_blank
ipatch_sample_store_ram_new
IPATCH_SAMPLE_STORE_RAM_UNUSED_FLAG_SHIFT
ipatch_sample_store_rom_new
ipatch_sample_store_snd_file_init_read
ipatch_sample_store_snd_file_init_write
ipatch_sample_store_snd_file_new
IPATCH_SAMPLE_STORE_SND_FILE_UNUSED_FLAG_SHIFT
ipatch_sample_store_split24_new
ipatch_sample_store_swap_get_unused_size
ipatch_sample_store_swap_new
IPATCH_SAMPLE_STORE_SWAP_UNUSED_FLAG_SHIFT
IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT
ipatch_sample_store_virtual_get_list
ipatch_sample_store_virtual_new
ipatch_sample_store_virtual_set_list
ipatch_sample_transform_alloc
ipatch_sample_transform_alloc_size
ipatch_sample_transform_convert
ipatch_sample_transform_convert_single
ipatch_sample_transform_free
ipatch_sample_transform_free_buffers
ipatch_sample_transform_get_buffers
ipatch_sample_transform_get_frame_sizes
ipatch_sample_transform_get_max_frames
ipatch_sample_transform_init
ipatch_sample_transform_new
ipatch_sample_transform_pool_acquire
ipatch_sample_transform_pool_release
ipatch_sample_transform_set_buffers_size
ipatch_sample_transform_set_formats
ipatch_sample_type_get_loop_types
IPATCH_SAMPLE_UNITY_CHANNEL_MAP
IPATCH_SAMPLE_UNUSED_FLAG_SHIFT
IPATCH_SAMPLE_WIDTH_MASK
IPATCH_SAMPLE_WIDTH_SHIFT
ipatch_sample_write
ipatch_sample_write_transform
ipatch_set_application_name
IPATCH_SF2_DEFAULT_ENGINE
ipatch_sf2_file_get_sample24_pos
ipatch_sf2_file_get_sample_pos
ipatch_sf2_file_get_sample_size
ipatch_sf2_file_new
ipatch_sf2_file_set_sample24_pos
ipatch_sf2_file_set_sample_pos
ipatch_sf2_file_set_sample_size
ipatch_sf2_find_inst
ipatch_sf2_find_preset
ipatch_sf2_find_sample
ipatch_sf2_free_info_array
IPATCH_SF2_GENID_SET
ipatch_sf2_gen_abs_array
ipatch_sf2_gen_abs_valid_mask
ipatch_sf2_gen_add_mask
ipatch_sf2_gen_amount_to_value
IPATCH_SF2_GEN_ARRAY_CLEAR_FLAG
ipatch_sf2_gen_array_count_set
ipatch_sf2_gen_array_duplicate
ipatch_sf2_gen_array_free
ipatch_sf2_gen_array_get_type
ipatch_sf2_gen_array_init
ipatch_sf2_gen_array_intersect_test
ipatch_sf2_gen_array_new
ipatch_sf2_gen_array_offset
IPATCH_SF2_GEN_ARRAY_SET_FLAG
IPATCH_SF2_GEN_ARRAY_TEST_FLAG
ipatch_sf2_gen_clamp
IPATCH_SF2_GEN_COUNT
ipatch_sf2_gen_default_value
ipatch_sf2_gen_get_prop_name
ipatch_sf2_gen_is_valid
ipatch_sf2_gen_item_class_get_pspec
ipatch_sf2_gen_item_class_get_pspec_set
ipatch_sf2_gen_item_copy_all
ipatch_sf2_gen_item_copy_set
ipatch_sf2_gen_item_count_set
IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID
IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID
IPATCH_SF2_GEN_ITEM_FIRST_PROP_USER_ID
ipatch_sf2_gen_item_get_amount
ipatch_sf2_gen_item_iface_get_property
ipatch_sf2_gen_item_iface_install_properties
ipatch_sf2_gen_item_iface_set_property
ipatch_sf2_gen_item_intersect_test
ipatch_sf2_gen_item_in_range
ipatch_sf2_gen_item_set_amount
ipatch_sf2_gen_item_set_gen_flag
ipatch_sf2_gen_item_set_note_range
ipatch_sf2_gen_item_set_velocity_range
ipatch_sf2_gen_offset
ipatch_sf2_gen_ofs_array
ipatch_sf2_gen_ofs_valid_mask
IPATCH_SF2_GEN_PROPS_GLOBAL_FLAG
IPATCH_SF2_GEN_PROPS_MASK
ipatch_sf2_gen_range_intersect
ipatch_sf2_gen_range_intersect_test
ipatch_sf2_get_file
ipatch_sf2_get_info
ipatch_sf2_get_info_array
ipatch_sf2_get_info_max_size
ipatch_sf2_get_insts
ipatch_sf2_get_presets
ipatch_sf2_get_samples
ipatch_sf2_get_zone_references
IPATCH_SF2_INFO_COUNT
ipatch_sf2_info_id_is_valid
ipatch_sf2_inst_first
ipatch_sf2_inst_get_name
ipatch_sf2_inst_get_zones
ipatch_sf2_inst_new
ipatch_sf2_inst_new_zone
ipatch_sf2_inst_next
ipatch_sf2_inst_set_name
ipatch_sf2_izone_first
ipatch_sf2_izone_get_sample
ipatch_sf2_izone_get_stereo_link
ipatch_sf2_izone_new
ipatch_sf2_izone_next
ipatch_sf2_izone_set_sample
IPATCH_SF2_IZONE_UNUSED_FLAG_SHIFT
ipatch_sf2_load_bag
ipatch_sf2_load_gen
ipatch_sf2_load_ihdr
ipatch_sf2_load_mod
ipatch_sf2_load_phdr
ipatch_sf2_load_shdr
ipatch_sf2_make_unique_name
IPATCH_SF2_MOD_ARE_IDENTICAL
IPATCH_SF2_MOD_ARE_IDENTICAL_AMOUNT
ipatch_sf2_mod_duplicate
ipatch_sf2_mod_free
ipatch_sf2_mod_get_type
ipatch_sf2_mod_item_add
ipatch_sf2_mod_item_change
ipatch_sf2_mod_item_count
ipatch_sf2_mod_item_get_mods
ipatch_sf2_mod_item_insert
ipatch_sf2_mod_item_remove
ipatch_sf2_mod_item_set_mods
ipatch_sf2_mod_list_boxed_free
ipatch_sf2_mod_list_change
ipatch_sf2_mod_list_duplicate
ipatch_sf2_mod_list_free
ipatch_sf2_mod_list_get_default
ipatch_sf2_mod_list_get_type
ipatch_sf2_mod_list_insert
ipatch_sf2_mod_list_offset
ipatch_sf2_mod_list_override
ipatch_sf2_mod_list_remove
ipatch_sf2_mod_new
ipatch_sf2_new
ipatch_sf2_preset_compare
ipatch_sf2_preset_first
ipatch_sf2_preset_get_midi_locale
ipatch_sf2_preset_get_name
ipatch_sf2_preset_get_zones
ipatch_sf2_preset_new
ipatch_sf2_preset_new_zone
ipatch_sf2_preset_next
ipatch_sf2_preset_set_midi_locale
ipatch_sf2_preset_set_name
ipatch_sf2_pzone_first
ipatch_sf2_pzone_get_inst
ipatch_sf2_pzone_new
ipatch_sf2_pzone_next
ipatch_sf2_pzone_set_inst
ipatch_sf2_reader_load
ipatch_sf2_reader_new
ipatch_sf2_reader_set_file_handle
ipatch_sf2_sample_first
IPATCH_SF2_SAMPLE_FLAG_ROM
ipatch_sf2_sample_get_data
ipatch_sf2_sample_get_linked
ipatch_sf2_sample_get_name
IPATCH_SF2_SAMPLE_LENGTH_MIN
ipatch_sf2_sample_new
ipatch_sf2_sample_next
ipatch_sf2_sample_peek_data
ipatch_sf2_sample_peek_linked
IPATCH_SF2_SAMPLE_RATE_MAX
IPATCH_SF2_SAMPLE_RATE_MIN
ipatch_sf2_sample_set_blank
ipatch_sf2_sample_set_data
ipatch_sf2_sample_set_linked
ipatch_sf2_sample_set_name
ipatch_sf2_set_file
ipatch_sf2_set_info
IPATCH_SF2_UNUSED_FLAG_SHIFT
ipatch_sf2_voice_cache_add_voice
ipatch_sf2_voice_cache_declare_item
IPATCH_SF2_VOICE_CACHE_GET_VOICE
IPATCH_SF2_VOICE_CACHE_MAX_SEL_VALUES
ipatch_sf2_voice_cache_new
ipatch_sf2_voice_cache_optimize
ipatch_sf2_voice_cache_sample_data
ipatch_sf2_voice_cache_select
ipatch_sf2_voice_cache_set_default_mods
ipatch_sf2_voice_cache_set_voice_range
ipatch_sf2_voice_cache_update
ipatch_sf2_voice_copy
IPATCH_SF2_VOICE_SEL_WILDCARD
ipatch_sf2_voice_set_sample_data
ipatch_sf2_writer_new
ipatch_sf2_writer_save
ipatch_sf2_writer_set_file_handle
ipatch_sf2_writer_set_patch
ipatch_sf2_write_bag
ipatch_sf2_write_gen
ipatch_sf2_write_ihdr
ipatch_sf2_write_mod
ipatch_sf2_write_phdr
ipatch_sf2_write_shdr
ipatch_sf2_zone_first
IPATCH_SF2_ZONE_GEN_AMT
IPATCH_SF2_ZONE_GEN_CLEAR_FLAG
IPATCH_SF2_ZONE_GEN_SET_FLAG
IPATCH_SF2_ZONE_GEN_TEST_FLAG
ipatch_sf2_zone_get_link_item
ipatch_sf2_zone_next
ipatch_sf2_zone_peek_link_item
ipatch_sf2_zone_set_link_item
ipatch_sf2_zone_set_link_item_no_notify
IPATCH_SF2_ZONE_UNUSED_FLAG_SHIFT
IPATCH_SFONT_BAG_SIZE
IPATCH_SFONT_FOURCC_IBAG
IPATCH_SFONT_FOURCC_ICMT
IPATCH_SFONT_FOURCC_ICOP
IPATCH_SFONT_FOURCC_ICRD
IPATCH_SFONT_FOURCC_IENG
IPATCH_SFONT_FOURCC_IFIL
IPATCH_SFONT_FOURCC_IGEN
IPATCH_SFONT_FOURCC_IMOD
IPATCH_SFONT_FOURCC_INAM
IPATCH_SFONT_FOURCC_INFO
IPATCH_SFONT_FOURCC_INST
IPATCH_SFONT_FOURCC_IPRD
IPATCH_SFONT_FOURCC_IROM
IPATCH_SFONT_FOURCC_ISFT
IPATCH_SFONT_FOURCC_ISNG
IPATCH_SFONT_FOURCC_IVER
IPATCH_SFONT_FOURCC_PBAG
IPATCH_SFONT_FOURCC_PDTA
IPATCH_SFONT_FOURCC_PGEN
IPATCH_SFONT_FOURCC_PHDR
IPATCH_SFONT_FOURCC_PMOD
IPATCH_SFONT_FOURCC_SDTA
IPATCH_SFONT_FOURCC_SFBK
IPATCH_SFONT_FOURCC_SHDR
IPATCH_SFONT_FOURCC_SM24
IPATCH_SFONT_FOURCC_SMPL
IPATCH_SFONT_GEN_SIZE
IPATCH_SFONT_INST_SIZE
IPATCH_SFONT_MOD_SIZE
IPATCH_SFONT_NAME_SIZE
IPATCH_SFONT_PHDR_SIZE
IPATCH_SFONT_SHDR_SIZE
IPATCH_SFONT_VERSION_SIZE
ipatch_simple_paste
IPATCH_SND_FILE_DEFAULT_ENDIAN
IPATCH_SND_FILE_DEFAULT_FORMAT
IPATCH_SND_FILE_DEFAULT_SUB_FORMAT
ipatch_snd_file_format_get_sub_formats
ipatch_snd_file_format_get_type
ipatch_snd_file_new
ipatch_snd_file_sample_format_to_sub_format
ipatch_snd_file_sub_format_get_type
ipatch_state_begin_group
ipatch_state_end_group
ipatch_state_get_active_group
IPATCH_STATE_ITEM_CHANGE
IPATCH_STATE_ITEM_CHANGE_CLASS
IPATCH_STATE_ITEM_CHANGE_GET_CLASS
ipatch_state_item_change_get_type
ipatch_state_item_conflict
ipatch_state_item_depend
ipatch_state_item_describe
IPATCH_STATE_ITEM_REMOVE
IPATCH_STATE_ITEM_REMOVE_CLASS
IPATCH_STATE_ITEM_REMOVE_GET_CLASS
ipatch_state_item_remove_get_type
ipatch_state_item_restore
IPATCH_STATE_ITEM_UNUSED_FLAG_SHIFT
ipatch_state_new
ipatch_state_record
ipatch_state_record_item
ipatch_state_redo
ipatch_state_retract
ipatch_state_set_active_group
ipatch_state_undo
ipatch_strconcat_num
IPATCH_TYPE_DLS2_CONN
ipatch_type_find_property
ipatch_type_find_types_with_property
ipatch_type_get
ipatch_type_get_dynamic_func
ipatch_type_get_property
ipatch_type_get_valist
ipatch_type_install_property
IPATCH_TYPE_ITER
ipatch_type_list_properties
ipatch_type_object_get
ipatch_type_object_get_property
ipatch_type_object_get_valist
IPATCH_TYPE_PARAM_RANGE
IPATCH_TYPE_RANGE
IPATCH_TYPE_SAMPLE_LIST
ipatch_type_set
ipatch_type_set_dynamic_func
ipatch_type_set_property
ipatch_type_set_valist
IPATCH_TYPE_SF2_GEN_ARRAY
IPATCH_TYPE_SF2_MOD
IPATCH_TYPE_SF2_MOD_LIST
IPATCH_TYPE_SND_FILE_FORMAT
IPATCH_TYPE_SND_FILE_SUB_FORMAT
IPATCH_TYPE_STATE_ITEM_CHANGE
IPATCH_TYPE_STATE_ITEM_REMOVE
IPATCH_TYPE_VIRTUAL_DLS2_PERCUSSION
IPATCH_TYPE_VIRTUAL_DLS2_SAMPLES
IPATCH_TYPE_VIRTUAL_GIG_MELODIC
IPATCH_TYPE_VIRTUAL_GIG_PERCUSSION
IPATCH_TYPE_VIRTUAL_GIG_SAMPLES
IPATCH_TYPE_VIRTUAL_SF2_INST
IPATCH_TYPE_VIRTUAL_SF2_MELODIC
IPATCH_TYPE_VIRTUAL_SF2_PERCUSSION
IPATCH_TYPE_VIRTUAL_SF2_ROM
IPATCH_TYPE_VIRTUAL_SF2_SAMPLES
ipatch_unit_centibels_to_decibels
ipatch_unit_centibels_to_dls_gain
ipatch_unit_cents_to_dls_rel_pitch
ipatch_unit_cents_to_hertz
ipatch_unit_class_lookup_map
ipatch_unit_class_register_map
ipatch_unit_conversion_lookup
ipatch_unit_conversion_register
ipatch_unit_convert
ipatch_unit_decibels_to_centibels
ipatch_unit_decibels_to_dls_gain
ipatch_unit_dls_abs_pitch_to_hertz
ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch
IPATCH_UNIT_DLS_ABS_TIME_0SECS
ipatch_unit_dls_abs_time_to_seconds
ipatch_unit_dls_abs_time_to_sf2_abs_time
ipatch_unit_dls_class_convert
ipatch_unit_dls_gain_to_centibels
ipatch_unit_dls_gain_to_decibels
ipatch_unit_dls_percent_to_percent
ipatch_unit_dls_rel_pitch_to_cents
ipatch_unit_dls_rel_time_to_time_cents
ipatch_unit_hertz_to_cents
ipatch_unit_hertz_to_dls_abs_pitch
ipatch_unit_hertz_to_sf2_abs_pitch
ipatch_unit_info_free
ipatch_unit_info_new
ipatch_unit_lookup
ipatch_unit_lookup_by_name
ipatch_unit_multiplier_to_sf2_ofs_pitch
ipatch_unit_multiplier_to_sf2_ofs_time
ipatch_unit_percent_to_dls_percent
ipatch_unit_percent_to_tenth_percent
ipatch_unit_register
ipatch_unit_seconds_to_dls_abs_time
ipatch_unit_seconds_to_sf2_abs_time
ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch
ipatch_unit_sf2_abs_pitch_to_hertz
ipatch_unit_sf2_abs_time_to_dls_abs_time
ipatch_unit_sf2_abs_time_to_seconds
ipatch_unit_sf2_ofs_pitch_to_multiplier
ipatch_unit_sf2_ofs_time_to_multiplier
ipatch_unit_tenth_percent_to_percent
ipatch_unit_time_cents_to_dls_rel_time
IPATCH_UNIT_TYPE_FIRST_DYNAMIC_ID
ipatch_unit_user_class_convert
ipatch_util_file_size
ipatch_util_value_array_hash
IPATCH_UTIL_VALUE_BOOL
ipatch_util_value_bool_false
ipatch_util_value_bool_true
ipatch_util_value_hash
ipatch_value_get_range
IPATCH_VALUE_HOLDS_RANGE
ipatch_value_set_range
ipatch_value_set_static_range
ipatch_vbank_find_inst
ipatch_vbank_get_insts
IPATCH_VBANK_INFO_COUNT
ipatch_vbank_inst_compare
ipatch_vbank_inst_first
ipatch_vbank_inst_get_midi_locale
ipatch_vbank_inst_get_regions
IPATCH_VBANK_INST_NAME_SIZE
ipatch_vbank_inst_new
ipatch_vbank_inst_new_region
ipatch_vbank_inst_next
ipatch_vbank_inst_set_midi_locale
ipatch_vbank_make_unique_name
ipatch_vbank_new
IPATCH_VBANK_PARSER_VERSION
ipatch_vbank_region_first
ipatch_vbank_region_get_id_props
ipatch_vbank_region_new
ipatch_vbank_region_next
ipatch_vbank_region_set_id_props
IPATCH_VERSION
ipatch_version
IPATCH_VERSION_MAJOR
IPATCH_VERSION_MICRO
IPATCH_VERSION_MINOR
IPATCH_VIRTUAL_CONTAINER_CREATE
ipatch_virtual_dls2_percussion_get_type
ipatch_virtual_dls2_samples_get_type
ipatch_virtual_gig_melodic_get_type
ipatch_virtual_gig_percussion_get_type
ipatch_virtual_gig_samples_get_type
ipatch_virtual_sf2_inst_get_type
ipatch_virtual_sf2_melodic_get_type
ipatch_virtual_sf2_percussion_get_type
ipatch_virtual_sf2_rom_get_type
ipatch_virtual_sf2_samples_get_type
ipatch_xml_attr_duplicate
ipatch_xml_attr_free
ipatch_xml_attr_new
ipatch_xml_copy
ipatch_xml_decode_object
ipatch_xml_decode_property
ipatch_xml_decode_property_by_name
ipatch_xml_decode_value
ipatch_xml_default_decode_object_func
ipatch_xml_default_decode_property_func
ipatch_xml_default_decode_value_func
ipatch_xml_default_encode_object_func
ipatch_xml_default_encode_property_func
ipatch_xml_default_encode_value_func
ipatch_xml_destroy
ipatch_xml_dup_value
ipatch_xml_encode_object
ipatch_xml_encode_property
ipatch_xml_encode_property_by_name
ipatch_xml_encode_value
ipatch_xml_find_by_path
ipatch_xml_find_child
ipatch_xml_from_str
ipatch_xml_get_attribute
ipatch_xml_get_data
ipatch_xml_get_name
ipatch_xml_get_qdata
ipatch_xml_get_value
ipatch_xml_load_from_file
ipatch_xml_lookup_handler
ipatch_xml_lookup_handler_by_prop_name
ipatch_xml_new_node
ipatch_xml_new_node_strv
ipatch_xml_node_duplicate
ipatch_xml_node_free
ipatch_xml_node_new
ipatch_xml_register_handler
ipatch_xml_save_to_file
ipatch_xml_set_attribute
ipatch_xml_set_attributes
ipatch_xml_set_data
ipatch_xml_set_data_full
ipatch_xml_set_name
ipatch_xml_set_qdata
ipatch_xml_set_qdata_full
ipatch_xml_set_value
ipatch_xml_set_value_printf
ipatch_xml_steal_data
ipatch_xml_steal_qdata
ipatch_xml_take_name
ipatch_xml_take_value
ipatch_xml_test_attribute
ipatch_xml_test_name
ipatch_xml_test_value
ipatch_xml_to_str
libinstpatch-1.0.0/docs/reference/html/IpatchDLS2Region.html0000644000175000017500000016725611461404256020662 00000000000000 IpatchDLS2Region

IpatchDLS2Region

IpatchDLS2Region — DLS region object

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchDLS2ParamArray;
enum                IpatchDLS2Param;
                    IpatchDLS2Region;
enum                IpatchDLS2RegionChannelType;
#define             IPATCH_DLS2_REGION_CHANNEL_MONO
enum                IpatchDLS2RegionFlags;
#define             IPATCH_DLS2_REGION_FLAG_MASK
#define             IPATCH_DLS2_REGION_UNUSED_FLAG_SHIFT
IpatchDLS2Region *  ipatch_dls2_region_new              (void);
IpatchDLS2Region *  ipatch_dls2_region_first            (IpatchIter *iter);
IpatchDLS2Region *  ipatch_dls2_region_next             (IpatchIter *iter);
char *              ipatch_dls2_region_get_info         (IpatchDLS2Region *region,
                                                         guint32 fourcc);
void                ipatch_dls2_region_set_info         (IpatchDLS2Region *region,
                                                         guint32 fourcc,
                                                         const char *val);
void                ipatch_dls2_region_set_sample       (IpatchDLS2Region *region,
                                                         IpatchDLS2Sample *sample);
IpatchDLS2Sample *  ipatch_dls2_region_get_sample       (IpatchDLS2Region *region);
IpatchDLS2Sample *  ipatch_dls2_region_peek_sample      (IpatchDLS2Region *region);
void                ipatch_dls2_region_set_note_range   (IpatchDLS2Region *region,
                                                         int low,
                                                         int high);
void                ipatch_dls2_region_set_velocity_range
                                                        (IpatchDLS2Region *region,
                                                         int low,
                                                         int high);
gboolean            ipatch_dls2_region_in_range         (IpatchDLS2Region *region,
                                                         int note,
                                                         int velocity);
void                ipatch_dls2_region_set_param        (IpatchDLS2Region *region,
                                                         IpatchDLS2Param param,
                                                         gint32 val);
void                ipatch_dls2_region_set_param_array  (IpatchDLS2Region *region,
                                                         IpatchDLS2ParamArray *array);
GSList *            ipatch_dls2_region_get_conns        (IpatchDLS2Region *region);
void                ipatch_dls2_region_set_conn         (IpatchDLS2Region *region,
                                                         const IpatchDLS2Conn *conn);
void                ipatch_dls2_region_unset_conn       (IpatchDLS2Region *region,
                                                         const IpatchDLS2Conn *conn);
void                ipatch_dls2_region_unset_all_conns  (IpatchDLS2Region *region);
guint               ipatch_dls2_region_conn_count       (IpatchDLS2Region *region);
int                 ipatch_dls2_region_channel_map_stereo
                                                        (IpatchDLS2RegionChannelType chan);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchDLS2Region

Implemented Interfaces

IpatchDLS2Region implements IpatchSample.

Properties

  "archive-location"         gchar*                : Read / Write
  "artist"                   gchar*                : Read / Write
  "channel"                  gint                  : Read / Write
  "comment"                  gchar*                : Read / Write
  "commissioned"             gchar*                : Read / Write
  "copyright"                gchar*                : Read / Write
  "date"                     gchar*                : Read / Write
  "engineer"                 gchar*                : Read / Write
  "fine-tune"                gint                  : Read / Write
  "flags"                    IpatchDLS2SampleFlags  : Read / Write
  "gain"                     gint                  : Read / Write
  "genre"                    gchar*                : Read / Write
  "key-group"                gint                  : Read / Write
  "keywords"                 gchar*                : Read / Write
  "layer-group"              gint                  : Read / Write
  "link-item"                IpatchDLS2Sample*     : Read / Write
  "loop-end"                 guint                 : Read / Write
  "loop-start"               guint                 : Read / Write
  "loop-type"                IpatchSampleLoopType  : Read / Write
  "medium"                   gchar*                : Read / Write
  "multi-channel"            gboolean              : Read / Write
  "name"                     gchar*                : Read / Write
  "note-range"               IpatchRange*          : Read / Write
  "phase-group"              gint                  : Read / Write
  "phase-master"             gboolean              : Read / Write
  "product"                  gchar*                : Read / Write
  "root-note"                gint                  : Read / Write
  "sample-info-override"     gboolean              : Read / Write
  "self-non-exclusive"       gboolean              : Read / Write
  "software"                 gchar*                : Read / Write
  "source"                   gchar*                : Read / Write
  "source-form"              gchar*                : Read / Write
  "subject"                  gchar*                : Read / Write
  "technician"               gchar*                : Read / Write
  "velocity-range"           IpatchRange*          : Read / Write

Description

DLS regions are child items of IpatchDLSInst objects and define how an individual audio sample is synthesized in an instrument.

Details

IpatchDLS2ParamArray

typedef struct {
  gint32 values[IPATCH_DLS2_PARAM_COUNT];
} IpatchDLS2ParamArray;

enum IpatchDLS2Param

typedef enum
{
  IPATCH_DLS2_PARAM_MOD_LFO_FREQ,
  IPATCH_DLS2_PARAM_MOD_LFO_DELAY,

  IPATCH_DLS2_PARAM_VIB_LFO_FREQ,
  IPATCH_DLS2_PARAM_VIB_LFO_DELAY,

  IPATCH_DLS2_PARAM_VOL_EG_DELAY,
  IPATCH_DLS2_PARAM_VOL_EG_ATTACK,
  IPATCH_DLS2_PARAM_VOL_EG_HOLD,
  IPATCH_DLS2_PARAM_VOL_EG_DECAY,
  IPATCH_DLS2_PARAM_VOL_EG_SUSTAIN,
  IPATCH_DLS2_PARAM_VOL_EG_RELEASE,
  IPATCH_DLS2_PARAM_VOL_EG_SHUTDOWN,
  IPATCH_DLS2_PARAM_VOL_EG_VELOCITY_TO_ATTACK,
  IPATCH_DLS2_PARAM_VOL_EG_NOTE_TO_DECAY,
  IPATCH_DLS2_PARAM_VOL_EG_NOTE_TO_HOLD,

  IPATCH_DLS2_PARAM_MOD_EG_DELAY,
  IPATCH_DLS2_PARAM_MOD_EG_ATTACK,
  IPATCH_DLS2_PARAM_MOD_EG_HOLD,
  IPATCH_DLS2_PARAM_MOD_EG_DECAY,
  IPATCH_DLS2_PARAM_MOD_EG_SUSTAIN,
  IPATCH_DLS2_PARAM_MOD_EG_RELEASE,
  IPATCH_DLS2_PARAM_MOD_EG_VELOCITY_TO_ATTACK,
  IPATCH_DLS2_PARAM_MOD_EG_NOTE_TO_DECAY,
  IPATCH_DLS2_PARAM_MOD_EG_NOTE_TO_HOLD,

  IPATCH_DLS2_PARAM_SCALE_TUNE,
  IPATCH_DLS2_PARAM_RPN2_TO_NOTE,

  IPATCH_DLS2_PARAM_FILTER_CUTOFF,
  IPATCH_DLS2_PARAM_FILTER_Q,
  IPATCH_DLS2_PARAM_MOD_LFO_TO_FILTER_CUTOFF,
  IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_FILTER_CUTOFF,
  IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_FILTER_CUTOFF,
  IPATCH_DLS2_PARAM_MOD_EG_TO_FILTER_CUTOFF,
  IPATCH_DLS2_PARAM_VELOCITY_TO_FILTER_CUTOFF,
  IPATCH_DLS2_PARAM_NOTE_TO_FILTER_CUTOFF,
  IPATCH_DLS2_PARAM_MOD_LFO_TO_GAIN,
  IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_GAIN,
  IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_GAIN,
  IPATCH_DLS2_PARAM_VELOCITY_TO_GAIN,
  IPATCH_DLS2_PARAM_CC7_TO_GAIN,
  IPATCH_DLS2_PARAM_CC11_TO_GAIN,

  IPATCH_DLS2_PARAM_TUNE,
  IPATCH_DLS2_PARAM_PITCH_WHEEL_RPN0_TO_PITCH,
  IPATCH_DLS2_PARAM_NOTE_NUMBER_TO_PITCH,
  IPATCH_DLS2_PARAM_RPN1_TO_PITCH,
  IPATCH_DLS2_PARAM_VIB_LFO_TO_PITCH,
  IPATCH_DLS2_PARAM_VIB_LFO_CC1_TO_PITCH,
  IPATCH_DLS2_PARAM_VIB_LFO_CHANNEL_PRESS_TO_PITCH,
  IPATCH_DLS2_PARAM_MOD_LFO_TO_PITCH,
  IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_PITCH,
  IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_PITCH,
  IPATCH_DLS2_PARAM_MOD_EG_TO_PITCH,

  IPATCH_DLS2_PARAM_PAN,
  IPATCH_DLS2_PARAM_CC10_TO_PAN,
  IPATCH_DLS2_PARAM_CC91_TO_REVERB_SEND,
  IPATCH_DLS2_PARAM_REVERB_SEND,
  IPATCH_DLS2_PARAM_CC93_TO_CHORUS_SEND,
  IPATCH_DLS2_PARAM_CHORUS_SEND,
  IPATCH_DLS2_PARAM_COUNT
} IpatchDLS2Param;

IpatchDLS2Region

typedef struct _IpatchDLS2Region IpatchDLS2Region;

enum IpatchDLS2RegionChannelType

typedef enum
{
  IPATCH_DLS2_REGION_CHANNEL_LEFT = 0,
  IPATCH_DLS2_REGION_CHANNEL_RIGHT = 1,
  IPATCH_DLS2_REGION_CHANNEL_CENTER = 2,
  IPATCH_DLS2_REGION_CHANNEL_LOW_FREQ = 3,
  IPATCH_DLS2_REGION_CHANNEL_SURROUND_LEFT = 4,
  IPATCH_DLS2_REGION_CHANNEL_SURROUND_RIGHT = 5,
  IPATCH_DLS2_REGION_CHANNEL_LEFT_OF_CENTER = 6,
  IPATCH_DLS2_REGION_CHANNEL_RIGHT_OF_CENTER = 7,
  IPATCH_DLS2_REGION_CHANNEL_SURROUND_CENTER = 8,
  IPATCH_DLS2_REGION_CHANNEL_SIDE_LEFT = 9,
  IPATCH_DLS2_REGION_CHANNEL_SIDE_RIGHT = 10,
  IPATCH_DLS2_REGION_CHANNEL_TOP = 11,
  IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_LEFT = 12,
  IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_CENTER = 13,
  IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_RIGHT = 14,
  IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_LEFT = 15,
  IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_CENTER = 16,
  IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_RIGHT = 17
} IpatchDLS2RegionChannelType;

IPATCH_DLS2_REGION_CHANNEL_MONO

#define IPATCH_DLS2_REGION_CHANNEL_MONO  IPATCH_DLS2_REGION_CHANNEL_LEFT

enum IpatchDLS2RegionFlags

typedef enum
{
  IPATCH_DLS2_REGION_SELF_NON_EXCLUSIVE = 1 << IPATCH_ITEM_UNUSED_FLAG_SHIFT,
  IPATCH_DLS2_REGION_PHASE_MASTER = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 1),
  IPATCH_DLS2_REGION_MULTI_CHANNEL = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 2),
  IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE=1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT+3)
} IpatchDLS2RegionFlags;

IPATCH_DLS2_REGION_FLAG_MASK

#define IPATCH_DLS2_REGION_FLAG_MASK  (0x0F << IPATCH_ITEM_UNUSED_FLAG_SHIFT)

IPATCH_DLS2_REGION_UNUSED_FLAG_SHIFT

#define IPATCH_DLS2_REGION_UNUSED_FLAG_SHIFT (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 6)

ipatch_dls2_region_new ()

IpatchDLS2Region *  ipatch_dls2_region_new              (void);

Create a new DLS region object.

Returns :

Newly created DLS region with a ref count of 1 which the caller owns.

ipatch_dls2_region_first ()

IpatchDLS2Region *  ipatch_dls2_region_first            (IpatchIter *iter);

Gets the first item in a region iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchDLS2Region items

Returns :

The first region in iter or NULL if empty.

ipatch_dls2_region_next ()

IpatchDLS2Region *  ipatch_dls2_region_next             (IpatchIter *iter);

Gets the next item in a region iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchDLS2Region items

Returns :

The next region in iter or NULL if at the end of the list.

ipatch_dls2_region_get_info ()

char *              ipatch_dls2_region_get_info         (IpatchDLS2Region *region,
                                                         guint32 fourcc);

Get a DLS region info string by FOURCC integer ID (integer representation of a 4 character RIFF chunk ID, see IpatchRiff).

region :

DLS region to get info from

fourcc :

FOURCC integer id of INFO to get

Returns :

New allocated info string value or NULL if no info with the given fourcc ID. String should be freed when finished with it.

ipatch_dls2_region_set_info ()

void                ipatch_dls2_region_set_info         (IpatchDLS2Region *region,
                                                         guint32 fourcc,
                                                         const char *val);

Sets an INFO value in a DLS region object. Emits changed signal.

region :

DLS region to set info of

fourcc :

FOURCC integer ID of INFO to set

val :

Value to set info to or NULL to unset (clear) info.

ipatch_dls2_region_set_sample ()

void                ipatch_dls2_region_set_sample       (IpatchDLS2Region *region,
                                                         IpatchDLS2Sample *sample);

Sets the referenced sample of a region.

region :

Region to set sample of

sample :

Sample to set region to

ipatch_dls2_region_get_sample ()

IpatchDLS2Sample *  ipatch_dls2_region_get_sample       (IpatchDLS2Region *region);

Gets the referenced sample from a region. The returned item's reference count is incremented and the caller is responsible for unrefing it with g_object_unref().

region :

Region to get referenced sample from

Returns :

Region's referenced sample or NULL if not set yet. Remember to unreference the item with g_object_unref() when done with it.

ipatch_dls2_region_peek_sample ()

IpatchDLS2Sample *  ipatch_dls2_region_peek_sample      (IpatchDLS2Region *region);

Like ipatch_dls2_region_get_sample() but does not add a reference to the returned item. This function should only be used if a reference of the returned item is ensured or only the pointer value is of interest.

region :

Region to get referenced sample from

Returns :

Region's referenced sample or NULL if not set yet. Remember that the item has NOT been referenced.

ipatch_dls2_region_set_note_range ()

void                ipatch_dls2_region_set_note_range   (IpatchDLS2Region *region,
                                                         int low,
                                                         int high);

Set the MIDI note range that a region is active on.

region :

Region to set note range of

low :

Low value of range (MIDI note # between 0 and 127)

high :

High value of range (MIDI note # between 0 and 127)

ipatch_dls2_region_set_velocity_range ()

void                ipatch_dls2_region_set_velocity_range
                                                        (IpatchDLS2Region *region,
                                                         int low,
                                                         int high);

Set the MIDI velocity range that a region is active on.

region :

Region to set velocity range of

low :

Low value of range (MIDI velocity # between 0 and 127)

high :

High value of range (MIDI velocity # between 0 and 127)

ipatch_dls2_region_in_range ()

gboolean            ipatch_dls2_region_in_range         (IpatchDLS2Region *region,
                                                         int note,
                                                         int velocity);

Check if a note and velocity falls in a region's ranges

region :

Region to check if in range

note :

MIDI note number or -1 for wildcard

velocity :

MIDI velocity or -1 for wildcard

Returns :

TRUE if region is in note and velocity range, FALSE otherwise

ipatch_dls2_region_set_param ()

void                ipatch_dls2_region_set_param        (IpatchDLS2Region *region,
                                                         IpatchDLS2Param param,
                                                         gint32 val);

Sets an effect parameter of a DLS2 Region. DLS2 defines a standard set of connections (effect parameters). Any non-standard connections can be manipulated with the connection related functions.

region :

Region to set parameter of

param :

Parameter to set

val :

Value for parameter

ipatch_dls2_region_set_param_array ()

void                ipatch_dls2_region_set_param_array  (IpatchDLS2Region *region,
                                                         IpatchDLS2ParamArray *array);

ipatch_dls2_region_get_conns ()

GSList *            ipatch_dls2_region_get_conns        (IpatchDLS2Region *region);

Gets a list of connections from a DLS region. List should be freed with ipatch_dls2_conn_list_free() (free_conns set to TRUE) when finished with it.

region :

Region to get connections from

Returns :

New list of connections (IpatchDLS2Conn) in region or NULL if no connections. Remember to free it when finished.

ipatch_dls2_region_set_conn ()

void                ipatch_dls2_region_set_conn         (IpatchDLS2Region *region,
                                                         const IpatchDLS2Conn *conn);

Set a DLS connection in a region. See ipatch_dls2_conn_list_set() for more details.

region :

DLS region

conn :

Connection

ipatch_dls2_region_unset_conn ()

void                ipatch_dls2_region_unset_conn       (IpatchDLS2Region *region,
                                                         const IpatchDLS2Conn *conn);

Remove a DLS connection from a region. See ipatch_dls2_conn_list_unset() for more details.

region :

DLS region

conn :

Connection

ipatch_dls2_region_unset_all_conns ()

void                ipatch_dls2_region_unset_all_conns  (IpatchDLS2Region *region);

Remove all connections in a region.

region :

DLS region

ipatch_dls2_region_conn_count ()

guint               ipatch_dls2_region_conn_count       (IpatchDLS2Region *region);

Count number of connections in a region

region :

Region to count connections in

Returns :

Count of connections

ipatch_dls2_region_channel_map_stereo ()

int                 ipatch_dls2_region_channel_map_stereo
                                                        (IpatchDLS2RegionChannelType chan);

Map a DLS2 channel steering enumeration (surround sound capable) to stereo steering.

chan :

Channel steering enum

Returns :

-1 = left, 0 = center, 1 = right

Property Details

The "archive-location" property

  "archive-location"         gchar*                : Read / Write

Location where subject is archived.

Default value: NULL


The "artist" property

  "artist"                   gchar*                : Read / Write

Original artist.

Default value: NULL


The "channel" property

  "channel"                  gint                  : Read / Write

DLS audio channel identifier.

Allowed values: [0,262143]

Default value: 0


The "comment" property

  "comment"                  gchar*                : Read / Write

Comments.

Default value: NULL


The "commissioned" property

  "commissioned"             gchar*                : Read / Write

Who commissioned the material.

Default value: NULL


The "copyright" property

  "copyright"                gchar*                : Read / Write

Copyright.

Default value: NULL


The "date" property

  "date"                     gchar*                : Read / Write

Creation date (YYYY-MM-DD).

Default value: NULL


The "engineer" property

  "engineer"                 gchar*                : Read / Write

Engineers separated by "; ".

Default value: NULL


The "fine-tune" property

  "fine-tune"                gint                  : Read / Write

Fine tuning in cents.

Allowed values: [-99,99]

Default value: 0


The "flags" property

  "flags"                    IpatchDLS2SampleFlags  : Read / Write

Sample flags.


The "gain" property

  "gain"                     gint                  : Read / Write

Gain in DLS relative gain units.

Default value: 0


The "genre" property

  "genre"                    gchar*                : Read / Write

Genre.

Default value: NULL


The "key-group" property

  "key-group"                gint                  : Read / Write

Percussion key group.

Allowed values: [0,15]

Default value: 0


The "keywords" property

  "keywords"                 gchar*                : Read / Write

Keywords (separated by "; ").

Default value: NULL


The "layer-group" property

  "layer-group"              gint                  : Read / Write

Layer group.

Allowed values: [0,65535]

Default value: 0


The "link-item" property

  "link-item"                IpatchDLS2Sample*     : Read / Write

Link item.


The "loop-end" property

  "loop-end"                 guint                 : Read / Write

Loop end in frames (after loop).

Default value: 0


The "loop-start" property

  "loop-start"               guint                 : Read / Write

Start of loop in frames.

Default value: 0


The "loop-type" property

  "loop-type"                IpatchSampleLoopType  : Read / Write

Loop method type.

Default value: IPATCH_SAMPLE_LOOP_NONE


The "medium" property

  "medium"                   gchar*                : Read / Write

Original medium of the material (record, CD, etc).

Default value: NULL


The "multi-channel" property

  "multi-channel"            gboolean              : Read / Write

Multi channel.

Default value: FALSE


The "name" property

  "name"                     gchar*                : Read / Write

Name.

Default value: "untitled"


The "note-range" property

  "note-range"               IpatchRange*          : Read / Write

MIDI note range.


The "phase-group" property

  "phase-group"              gint                  : Read / Write

Phase locked sample group.

Allowed values: [0,65535]

Default value: 0


The "phase-master" property

  "phase-master"             gboolean              : Read / Write

Multi channel phase lock master.

Default value: FALSE


The "product" property

  "product"                  gchar*                : Read / Write

Product intended for.

Default value: NULL


The "root-note" property

  "root-note"                gint                  : Read / Write

Root MIDI note.

Allowed values: [0,127]

Default value: 60


The "sample-info-override" property

  "sample-info-override"     gboolean              : Read / Write

Override sample info.

Default value: FALSE


The "self-non-exclusive" property

  "self-non-exclusive"       gboolean              : Read / Write

Self non exclusive.

Default value: FALSE


The "software" property

  "software"                 gchar*                : Read / Write

Editor software used.

Default value: NULL


The "source" property

  "source"                   gchar*                : Read / Write

Source of the original material.

Default value: NULL


The "source-form" property

  "source-form"              gchar*                : Read / Write

Original source that was digitized.

Default value: NULL


The "subject" property

  "subject"                  gchar*                : Read / Write

Subject of the material.

Default value: NULL


The "technician" property

  "technician"               gchar*                : Read / Write

Technician who sampled the material.

Default value: NULL


The "velocity-range" property

  "velocity-range"           IpatchRange*          : Read / Write

MIDI velocity range.

See Also

#IpatchDLSInst
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchIter.html0000644000175000017500000014744111461404256022371 00000000000000 IpatchIter

IpatchIter

IpatchIter — Iterator instance

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchIter;
                    IpatchIterMethods;
#define             IPATCH_TYPE_ITER
GType               ipatch_iter_get_type                (void);
IpatchIter *        ipatch_iter_alloc                   (void);
void                ipatch_iter_free                    (IpatchIter *iter);
IpatchIter *        ipatch_iter_duplicate               (IpatchIter *iter);
#define             ipatch_iter_get                     (iter)
#define             ipatch_iter_next                    (iter)
#define             ipatch_iter_first                   (iter)
#define             ipatch_iter_last                    (iter)
#define             ipatch_iter_index                   (iter, pos)
#define             ipatch_iter_insert                  (iter, item)
#define             ipatch_iter_remove                  (iter)
#define             ipatch_iter_count                   (iter)
#define             IPATCH_ITER_GSLIST_GET_LIST         (iter)
#define             IPATCH_ITER_GSLIST_GET_POS          (iter)
#define             IPATCH_ITER_GSLIST_SET_LIST         (iter, list)
#define             IPATCH_ITER_GSLIST_SET_POS          (iter, pos)
void                ipatch_iter_GSList_init             (IpatchIter *iter,
                                                         GSList **list);
gpointer            ipatch_iter_GSList_get              (IpatchIter *iter);
gpointer            ipatch_iter_GSList_next             (IpatchIter *iter);
gpointer            ipatch_iter_GSList_first            (IpatchIter *iter);
gpointer            ipatch_iter_GSList_last             (IpatchIter *iter);
gpointer            ipatch_iter_GSList_index            (IpatchIter *iter,
                                                         int index);
void                ipatch_iter_GSList_insert           (IpatchIter *iter,
                                                         gpointer item);
void                ipatch_iter_GSList_remove           (IpatchIter *iter);
int                 ipatch_iter_GSList_count            (IpatchIter *iter);
#define             IPATCH_ITER_GLIST_GET_LIST          (iter)
#define             IPATCH_ITER_GLIST_GET_POS           (iter)
#define             IPATCH_ITER_GLIST_SET_LIST          (iter, list)
#define             IPATCH_ITER_GLIST_SET_POS           (iter, pos)
void                ipatch_iter_GList_init              (IpatchIter *iter,
                                                         GList **list);
gpointer            ipatch_iter_GList_get               (IpatchIter *iter);
gpointer            ipatch_iter_GList_next              (IpatchIter *iter);
gpointer            ipatch_iter_GList_first             (IpatchIter *iter);
gpointer            ipatch_iter_GList_last              (IpatchIter *iter);
gpointer            ipatch_iter_GList_index             (IpatchIter *iter,
                                                         int index);
void                ipatch_iter_GList_insert            (IpatchIter *iter,
                                                         gpointer item);
void                ipatch_iter_GList_remove            (IpatchIter *iter);
int                 ipatch_iter_GList_count             (IpatchIter *iter);
#define             IPATCH_ITER_ARRAY_GET_ARRAY         (iter)
#define             IPATCH_ITER_ARRAY_GET_SIZE          (iter)
#define             IPATCH_ITER_ARRAY_GET_POS           (iter)
#define             IPATCH_ITER_ARRAY_SET_ARRAY         (iter, array)
#define             IPATCH_ITER_ARRAY_SET_SIZE          (iter, size)
#define             IPATCH_ITER_ARRAY_SET_POS           (iter, pos)
void                ipatch_iter_array_init              (IpatchIter *iter,
                                                         gpointer *array,
                                                         guint size);
gpointer            ipatch_iter_array_get               (IpatchIter *iter);
gpointer            ipatch_iter_array_next              (IpatchIter *iter);
gpointer            ipatch_iter_array_first             (IpatchIter *iter);
gpointer            ipatch_iter_array_last              (IpatchIter *iter);
gpointer            ipatch_iter_array_index             (IpatchIter *iter,
                                                         int index);
void                ipatch_iter_array_insert            (IpatchIter *iter,
                                                         gpointer item);
void                ipatch_iter_array_remove            (IpatchIter *iter);
int                 ipatch_iter_array_count             (IpatchIter *iter);

Description

A boxed type (structure) used for abstracting manipulation of object lists.

Details

IpatchIter

typedef struct {
} IpatchIter;

IpatchIterMethods

typedef struct {
  gpointer (*get)(IpatchIter *iter); /* get item method */
  gpointer (*next)(IpatchIter *iter); /* next item method */
  gpointer (*first)(IpatchIter *iter);	/* first item method */
  gpointer (*last)(IpatchIter *iter); /* last item method */
  gpointer (*index)(IpatchIter *iter, int index); /* index item method */
  void (*insert)(IpatchIter *iter, gpointer item); /* insert item method */
  void (*remove)(IpatchIter *iter); /* remove current item method */
  int (*count)(IpatchIter *iter); /* count items method */
} IpatchIterMethods;

IPATCH_TYPE_ITER

#define IPATCH_TYPE_ITER   (ipatch_iter_get_type ())

ipatch_iter_get_type ()

GType               ipatch_iter_get_type                (void);

Gets the GBoxed derived type for IpatchIter structures.

Returns :

GType of IpatchIter structures.

ipatch_iter_alloc ()

IpatchIter *        ipatch_iter_alloc                   (void);

Allocates an item iterator. This function is seldom used since IpatchIter structures are usually allocated on the stack.

Returns :

Newly allocated item iterator. Should be freed with ipatch_iter_free() when finished with it.

ipatch_iter_free ()

void                ipatch_iter_free                    (IpatchIter *iter);

Frees an item iterator that was allocated with ipatch_iter_alloc(). Seldom used since IpatchIter structures are usually allocated on the stack.

iter :

Item iterator

ipatch_iter_duplicate ()

IpatchIter *        ipatch_iter_duplicate               (IpatchIter *iter);

Duplicates a patch iterator. Seldom used since IpatchIter structures are usually allocated on the stack and can be copied directly.

iter :

Patch iterator to duplicate

Returns :

Newly allocated patch iter identical to iter. Free it with ipatch_iter_free() when finished.

ipatch_iter_get()

#define ipatch_iter_get(iter) (((iter)->methods->get)(iter))

ipatch_iter_next()

#define ipatch_iter_next(iter) (((iter)->methods->next)(iter))

ipatch_iter_first()

#define ipatch_iter_first(iter) (((iter)->methods->first)(iter))

ipatch_iter_last()

#define ipatch_iter_last(iter) (((iter)->methods->last)(iter))

ipatch_iter_index()

#define ipatch_iter_index(iter, pos) (((iter)->methods->index)(iter, pos))

ipatch_iter_insert()

#define ipatch_iter_insert(iter, item) (((iter)->methods->insert)(iter, item))

ipatch_iter_remove()

#define ipatch_iter_remove(iter) (((iter)->methods->remove)(iter))

ipatch_iter_count()

#define ipatch_iter_count(iter) (((iter)->methods->count)(iter))

IPATCH_ITER_GSLIST_GET_LIST()

#define IPATCH_ITER_GSLIST_GET_LIST(iter) ((GSList **)(iter->data))

IPATCH_ITER_GSLIST_GET_POS()

#define IPATCH_ITER_GSLIST_GET_POS(iter) ((GSList *)(iter->data2))

IPATCH_ITER_GSLIST_SET_LIST()

#define IPATCH_ITER_GSLIST_SET_LIST(iter, list) (iter->data = list)

IPATCH_ITER_GSLIST_SET_POS()

#define IPATCH_ITER_GSLIST_SET_POS(iter, pos) (iter->data2 = pos)

ipatch_iter_GSList_init ()

void                ipatch_iter_GSList_init             (IpatchIter *iter,
                                                         GSList **list);

Initialize an iterator to iterate over a GSList.

iter :

Iterator to initialize

list :

Pointer to root GSList pointer to initialize iterator to

ipatch_iter_GSList_get ()

gpointer            ipatch_iter_GSList_get              (IpatchIter *iter);

GSList item iterator method to get the current item.

iter :

Item iterator initialized with a GSList

Returns :

Current item or NULL if no current item.

ipatch_iter_GSList_next ()

gpointer            ipatch_iter_GSList_next             (IpatchIter *iter);

GSList item iterator method to get the next item and advance the iterator's position.

iter :

Item iterator initialized with a GSList

Returns :

Next item or NULL if no more items.

ipatch_iter_GSList_first ()

gpointer            ipatch_iter_GSList_first            (IpatchIter *iter);

GSList item iterator method to get the first item and set the iterator's position to it.

iter :

Item iterator initialized with a GSList

Returns :

First item or NULL if GSList is empty.

ipatch_iter_GSList_last ()

gpointer            ipatch_iter_GSList_last             (IpatchIter *iter);

GSList item iterator method to get the last item and set the iterator's position to it.

iter :

Item iterator initialized with a GSList

Returns :

Last item or NULL if GSList is empty.

ipatch_iter_GSList_index ()

gpointer            ipatch_iter_GSList_index            (IpatchIter *iter,
                                                         int index);

GSList item iterator method to get an item at a given index and set the iterator's position to it.

iter :

Item iterator initialized with a GSList

index :

Index, from 0, of item to get

Returns :

item at the index position or NULL if index is off the end of the GSList.

ipatch_iter_GSList_insert ()

void                ipatch_iter_GSList_insert           (IpatchIter *iter,
                                                         gpointer item);

GSList item iterator method to insert an item pointer.

iter :

Item iterator initialized with a GSList

item :

Pointer to insert

ipatch_iter_GSList_remove ()

void                ipatch_iter_GSList_remove           (IpatchIter *iter);

GSList item iterator method to remove the current item and advance the current position.

iter :

Item iterator initialized with a GSList

ipatch_iter_GSList_count ()

int                 ipatch_iter_GSList_count            (IpatchIter *iter);

GSList item iterator method to get the count of items.

iter :

Item iterator initialized with a GSList

Returns :

Count of items in GSList iterator.

IPATCH_ITER_GLIST_GET_LIST()

#define IPATCH_ITER_GLIST_GET_LIST(iter) ((GList **)(iter->data))

IPATCH_ITER_GLIST_GET_POS()

#define IPATCH_ITER_GLIST_GET_POS(iter) ((GList *)(iter->data2))

IPATCH_ITER_GLIST_SET_LIST()

#define IPATCH_ITER_GLIST_SET_LIST(iter, list) (iter->data = list)

IPATCH_ITER_GLIST_SET_POS()

#define IPATCH_ITER_GLIST_SET_POS(iter, pos) (iter->data2 = pos)

ipatch_iter_GList_init ()

void                ipatch_iter_GList_init              (IpatchIter *iter,
                                                         GList **list);

Initialize an iterator to iterate over a GList.

iter :

Iterator to initialize

list :

Pointer to root GList pointer to initialize iterator to

ipatch_iter_GList_get ()

gpointer            ipatch_iter_GList_get               (IpatchIter *iter);

GList item iterator method to get the current item.

iter :

Item iterator initialized with a GList

Returns :

Current item or NULL if no current item.

ipatch_iter_GList_next ()

gpointer            ipatch_iter_GList_next              (IpatchIter *iter);

GList item iterator method to get the next item and advance the iterator's position.

iter :

Item iterator initialized with a GList

Returns :

Next item or NULL if no more items.

ipatch_iter_GList_first ()

gpointer            ipatch_iter_GList_first             (IpatchIter *iter);

GList item iterator method to get the first item and set the iterator's position to it.

iter :

Item iterator initialized with a GList

Returns :

First item or NULL if GList is empty.

ipatch_iter_GList_last ()

gpointer            ipatch_iter_GList_last              (IpatchIter *iter);

GList item iterator method to get the last item and set the iterator's position to it.

iter :

Item iterator initialized with a GList

Returns :

Last item or NULL if GList is empty.

ipatch_iter_GList_index ()

gpointer            ipatch_iter_GList_index             (IpatchIter *iter,
                                                         int index);

GList item iterator method to get an item at a given index and set the iterator's position to it.

iter :

Item iterator initialized with a GList

index :

Index, from 0, of item to get

Returns :

item at the index position or NULL if index is off the end of the GList.

ipatch_iter_GList_insert ()

void                ipatch_iter_GList_insert            (IpatchIter *iter,
                                                         gpointer item);

GList item iterator method to insert an item pointer.

iter :

Item iterator initialized with a GList

item :

Pointer to insert

ipatch_iter_GList_remove ()

void                ipatch_iter_GList_remove            (IpatchIter *iter);

GList item iterator method to remove the current item and advance the current position.

iter :

Item iterator initialized with a GList

ipatch_iter_GList_count ()

int                 ipatch_iter_GList_count             (IpatchIter *iter);

GList item iterator method to get the count of items.

iter :

Item iterator initialized with a GList

Returns :

Count of items in GList iterator.

IPATCH_ITER_ARRAY_GET_ARRAY()

#define IPATCH_ITER_ARRAY_GET_ARRAY(iter) ((gpointer *)(iter->data))

IPATCH_ITER_ARRAY_GET_SIZE()

#define IPATCH_ITER_ARRAY_GET_SIZE(iter) (GPOINTER_TO_UINT (iter->data2))

IPATCH_ITER_ARRAY_GET_POS()

#define IPATCH_ITER_ARRAY_GET_POS(iter) (GPOINTER_TO_INT (iter->data3))

IPATCH_ITER_ARRAY_SET_ARRAY()

#define IPATCH_ITER_ARRAY_SET_ARRAY(iter, array) (iter->data = array)

IPATCH_ITER_ARRAY_SET_SIZE()

#define             IPATCH_ITER_ARRAY_SET_SIZE(iter, size)

IPATCH_ITER_ARRAY_SET_POS()

#define             IPATCH_ITER_ARRAY_SET_POS(iter, pos)

ipatch_iter_array_init ()

void                ipatch_iter_array_init              (IpatchIter *iter,
                                                         gpointer *array,
                                                         guint size);

Initialize an iterator to iterate over an array (read only).

iter :

Iterator to initialize

array :

Pointer to an array of pointers

size :

Count of elements in array.

ipatch_iter_array_get ()

gpointer            ipatch_iter_array_get               (IpatchIter *iter);

Array item iterator method to get the current item.

iter :

Item iterator initialized with an array

Returns :

Current item or NULL if no current item.

ipatch_iter_array_next ()

gpointer            ipatch_iter_array_next              (IpatchIter *iter);

Array item iterator method to get the next item and advance the iterator's position.

iter :

Item iterator initialized with an array

Returns :

Next item or NULL if no more items.

ipatch_iter_array_first ()

gpointer            ipatch_iter_array_first             (IpatchIter *iter);

Array item iterator method to get the first item and set the iterator's position to it.

iter :

Item iterator initialized with an array

Returns :

First item or NULL if array is empty.

ipatch_iter_array_last ()

gpointer            ipatch_iter_array_last              (IpatchIter *iter);

Array item iterator method to get the last item and set the iterator's position to it.

iter :

Item iterator initialized with an array

Returns :

Last item or NULL if array is empty.

ipatch_iter_array_index ()

gpointer            ipatch_iter_array_index             (IpatchIter *iter,
                                                         int index);

Array item iterator method to get an item at a given index and set the iterator's position to it.

iter :

Item iterator initialized with an array

index :

Index, from 0, of item to get

Returns :

item at the index position or NULL if index is off the end of the array.

ipatch_iter_array_insert ()

void                ipatch_iter_array_insert            (IpatchIter *iter,
                                                         gpointer item);

array item iterator method to insert an item pointer.

iter :

Item iterator initialized with a array

item :

Pointer to insert

ipatch_iter_array_remove ()

void                ipatch_iter_array_remove            (IpatchIter *iter);

array item iterator method to remove the current item and advance the current position.

iter :

Item iterator initialized with a array

ipatch_iter_array_count ()

int                 ipatch_iter_array_count             (IpatchIter *iter);

array item iterator method to get the count of items.

iter :

Item iterator initialized with a array

Returns :

Count of items in array iterator.
libinstpatch-1.0.0/docs/reference/html/libinstpatch-sample.html0000644000175000017500000010775511461404256021622 00000000000000 sample

sample

sample — Audio sample format conversion functions and defines.

Stability Level

Stable, unless otherwise indicated

Synopsis

#define             IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS
#define             IPATCH_SAMPLE_FORMAT_MASK
#define             IPATCH_SAMPLE_FORMAT_BITCOUNT
#define             IPATCH_SAMPLE_WIDTH_MASK
#define             IPATCH_SAMPLE_CHANNEL_MASK
#define             IPATCH_SAMPLE_SIGN_MASK
#define             IPATCH_SAMPLE_ENDIAN_MASK
#define             IPATCH_SAMPLE_WIDTH_SHIFT
#define             IPATCH_SAMPLE_CHANNEL_SHIFT
#define             IPATCH_SAMPLE_SIGN_SHIFT
#define             IPATCH_SAMPLE_ENDIAN_SHIFT
enum                IpatchSampleWidth;
enum                IpatchSampleChannel;
enum                IpatchSampleChannelType;
#define             IPATCH_SAMPLE_MAX_CHANNELS
enum                IpatchSampleSign;
enum                IpatchSampleEndian;
#define             IPATCH_SAMPLE_ENDIAN_HOST
#define             IPATCH_SAMPLE_FORMAT_GET_WIDTH      (format)
#define             IPATCH_SAMPLE_FORMAT_GET_CHANNELS   (format)
#define             IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT(format)
#define             IPATCH_SAMPLE_FORMAT_IS_SIGNED      (format)
#define             IPATCH_SAMPLE_FORMAT_IS_UNSIGNED    (format)
#define             IPATCH_SAMPLE_FORMAT_IS_LENDIAN     (format)
#define             IPATCH_SAMPLE_FORMAT_IS_BENDIAN     (format)
#define             ipatch_sample_format_size           (format)
#define             ipatch_sample_format_width          (format)
#define             IPATCH_SAMPLE_MAP_CHANNEL           (dest, src)
#define             IPATCH_SAMPLE_MAP_GET_CHANNEL       (map, dest)
#define             IPATCH_SAMPLE_UNITY_CHANNEL_MAP
int                 ipatch_sample_format_bit_width      (int format);
gboolean            ipatch_sample_format_verify         (int format);
gboolean            ipatch_sample_format_transform_verify
                                                        (int src_format,
                                                         int dest_format,
                                                         guint32 channel_map);
guint               ipatch_sample_get_transform_funcs   (int src_format,
                                                         int dest_format,
                                                         guint32 channel_map,
                                                         guint *buf1_max_frame,
                                                         guint *buf2_max_frame,
                                                         IpatchSampleTransformFunc *funcs);

Description

This module provides functions for converting audio formats as well as a system for defining audio formats with a single integer composed of multiple fields for sample width, channel count, sign and endian byte order.

Details

IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS

#define IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS	16

Maximum number of transform functions returned by ipatch_sample_get_transform_funcs(). Is larger than current actual maximum to allow for future backwards compatible expansion (8 is the real current maximum).


IPATCH_SAMPLE_FORMAT_MASK

#define IPATCH_SAMPLE_FORMAT_MASK   0x1FF

Mask for all fields of sample format integers (width, sign, endian, channel).


IPATCH_SAMPLE_FORMAT_BITCOUNT

#define IPATCH_SAMPLE_FORMAT_BITCOUNT  9

Number of bits used for sample format integers.


IPATCH_SAMPLE_WIDTH_MASK

#define IPATCH_SAMPLE_WIDTH_MASK    0x00F  /* total of 16 formats (8 reserved) */

IPATCH_SAMPLE_CHANNEL_MASK

#define IPATCH_SAMPLE_CHANNEL_MASK  0x070  /* channel count (8 channels max) */

IPATCH_SAMPLE_SIGN_MASK

#define IPATCH_SAMPLE_SIGN_MASK     0x080  /* sign or unsigned (for PCM formats) */

IPATCH_SAMPLE_ENDIAN_MASK

#define IPATCH_SAMPLE_ENDIAN_MASK   0x100  /* endian byte order */

IPATCH_SAMPLE_WIDTH_SHIFT

#define IPATCH_SAMPLE_WIDTH_SHIFT   0

IPATCH_SAMPLE_CHANNEL_SHIFT

#define IPATCH_SAMPLE_CHANNEL_SHIFT 4

IPATCH_SAMPLE_SIGN_SHIFT

#define IPATCH_SAMPLE_SIGN_SHIFT    7

IPATCH_SAMPLE_ENDIAN_SHIFT

#define IPATCH_SAMPLE_ENDIAN_SHIFT  8

enum IpatchSampleWidth

typedef enum
{
  IPATCH_SAMPLE_INVALID = 0,
  IPATCH_SAMPLE_8BIT  = 1,
  IPATCH_SAMPLE_16BIT = 2,
  IPATCH_SAMPLE_24BIT = 3,
  IPATCH_SAMPLE_32BIT = 4,
  IPATCH_SAMPLE_FLOAT = 5,
  IPATCH_SAMPLE_DOUBLE = 6,
  IPATCH_SAMPLE_REAL24BIT = 7
} IpatchSampleWidth;

Sample data widths/formats.

IPATCH_SAMPLE_INVALID

Invalid format (so 0 can be used to indicate a NULL state)

IPATCH_SAMPLE_8BIT

8 bit integer PCM

IPATCH_SAMPLE_16BIT

16 bit integer PCM

IPATCH_SAMPLE_24BIT

24 bit integer PCM (32 bit ints)

IPATCH_SAMPLE_32BIT

32 bit integer PCM

IPATCH_SAMPLE_FLOAT

32 bit IEEE float (-1.0 - 1.0)

IPATCH_SAMPLE_DOUBLE

64 bit IEEE double (-1.0 - 1.0)

IPATCH_SAMPLE_REAL24BIT

Real 3 byte 24 bit data (not padded to 32 bits)

enum IpatchSampleChannel

typedef enum
{
  IPATCH_SAMPLE_MONO    = 0 << IPATCH_SAMPLE_CHANNEL_SHIFT,
  IPATCH_SAMPLE_STEREO  = 1 << IPATCH_SAMPLE_CHANNEL_SHIFT
} IpatchSampleChannel;

Descriptive enums for common audio channel configurations. These values are actually channel count - 1 (0 = mono, 1 = stereo, etc) and can be compared with the macro IPATCH_SAMPLE_FORMAT_GET_CHANNELS().

IPATCH_SAMPLE_MONO

Mono audio

IPATCH_SAMPLE_STEREO

Stereo audio

enum IpatchSampleChannelType

typedef enum
{
  IPATCH_SAMPLE_LEFT =  0,
  IPATCH_SAMPLE_RIGHT = 1
} IpatchSampleChannelType;

Channel designation. Currently there are only 2 designated channels, though the remaining 6 supported channels may be defined to be surround sound channels in the future.

IPATCH_SAMPLE_LEFT

Left channel comes first

IPATCH_SAMPLE_RIGHT

Right channel comes second

IPATCH_SAMPLE_MAX_CHANNELS

#define IPATCH_SAMPLE_MAX_CHANNELS      8

Maximum number of audio channels handled by libInstPatch.


enum IpatchSampleSign

typedef enum
{
  IPATCH_SAMPLE_SIGNED   = 0 << IPATCH_SAMPLE_SIGN_SHIFT,
  IPATCH_SAMPLE_UNSIGNED = 1 << IPATCH_SAMPLE_SIGN_SHIFT
} IpatchSampleSign;

Defines the sign of PCM integer audio data.

IPATCH_SAMPLE_SIGNED

Signed PCM audio data.

IPATCH_SAMPLE_UNSIGNED

Unsigned PCM audio data.

enum IpatchSampleEndian

typedef enum
{
  IPATCH_SAMPLE_LENDIAN = 0 << IPATCH_SAMPLE_ENDIAN_SHIFT,
  IPATCH_SAMPLE_BENDIAN = 1 << IPATCH_SAMPLE_ENDIAN_SHIFT
} IpatchSampleEndian;

Defines the byte order of multi-byte audio data.

IPATCH_SAMPLE_LENDIAN

Little endian byte order

IPATCH_SAMPLE_BENDIAN

Big endian byte order

IPATCH_SAMPLE_ENDIAN_HOST

#define             IPATCH_SAMPLE_ENDIAN_HOST

Host byte order value (IPATCH_SAMPLE_LENDIAN or IPATCH_SAMPLE_BENDIAN).


IPATCH_SAMPLE_FORMAT_GET_WIDTH()

#define             IPATCH_SAMPLE_FORMAT_GET_WIDTH(format)

Get IpatchSampleWidth enum from a sample format integer.

format :

Sample format integer

Returns :

Format field of sample format integer.

IPATCH_SAMPLE_FORMAT_GET_CHANNELS()

#define             IPATCH_SAMPLE_FORMAT_GET_CHANNELS(format)

Get the channel field from a sample format integer.

format :

Sample format integer

Returns :

Channel field value (see IpatchSampleChannel)

IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT()

#define             IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT(format)

Get the channel count from a sample format integer.

format :

Sample format integer

Returns :

Channel count (starting at 1 for mono).

IPATCH_SAMPLE_FORMAT_IS_SIGNED()

#define             IPATCH_SAMPLE_FORMAT_IS_SIGNED(format)

Check if a sample format integer defines signed audio.

format :

Sample format integer

Returns :

TRUE if sample format is signed.

IPATCH_SAMPLE_FORMAT_IS_UNSIGNED()

#define             IPATCH_SAMPLE_FORMAT_IS_UNSIGNED(format)

Check if a sample format integer defines unsigned audio.

format :

Sample format integer

Returns :

TRUE if sample format is unsigned.

IPATCH_SAMPLE_FORMAT_IS_LENDIAN()

#define             IPATCH_SAMPLE_FORMAT_IS_LENDIAN(format)

Check if a sample format integer defines little endian audio.

format :

Sample format integer

Returns :

TRUE if sample format is little endian.

IPATCH_SAMPLE_FORMAT_IS_BENDIAN()

#define             IPATCH_SAMPLE_FORMAT_IS_BENDIAN(format)

Check if a sample format integer defines big endian audio.

format :

Sample format integer

Returns :

TRUE if sample format is big endian.

ipatch_sample_format_size()

#define             ipatch_sample_format_size(format)

Get frame byte size for a given sample format (sample byte size * channels).

format :

Sample format integer

Returns :

Size in bytes of a single sample frame.

ipatch_sample_format_width()

#define             ipatch_sample_format_width(format)

Gets the number of bytes used for storing a single sample for format. Doesn't take into account channels. This is the number of bytes used to store the samples, not the effective bit width. For example: IPATCH_SAMPLE_24BIT uses 4 bytes for each sample.

format :

Sample format

Returns :

Byte width of a single sample (not including channels).

IPATCH_SAMPLE_MAP_CHANNEL()

#define IPATCH_SAMPLE_MAP_CHANNEL(dest, src)   ((src) << (3 * (dest)))

Macro to calculate a channel mapping value for a given destination and source. A channel mapping is composed of up to 24 bits (3 bits * 8 channels = 24). Channel mappings are used for sample conversions to route channels from a source format to a destination format. Multiple channel map values should be OR'd together.

dest :

Destination channel in mapping bit field (0-7)

src :

Source channel (0-7)

IPATCH_SAMPLE_MAP_GET_CHANNEL()

#define IPATCH_SAMPLE_MAP_GET_CHANNEL(map, dest)   (((map) >> ((dest) * 3)) & 0x07)

Macro to get a source channel value given a destination channel.

map :

Channel map value (guint32 - only 24 bits are used)

dest :

Destination channel in map bit field (0-7)

Returns :

Source channel for dest (0-7)

IPATCH_SAMPLE_UNITY_CHANNEL_MAP

#define IPATCH_SAMPLE_UNITY_CHANNEL_MAP   0xFAC688

Unity channel mapping which routes each input channel to the same output channel.


ipatch_sample_format_bit_width ()

int                 ipatch_sample_format_bit_width      (int format);

Like ipatch_sample_format_width() but gets the effective bit width of the format. Of note is this is not always equivelant to the format width * 8. For example: IPATCH_SAMPLE_FLOAT has an effective bit width of 23, IPATCH_SAMPLE_24BIT has an effective bit width of 24 but is stored in 32 bits. This function is really only useful for comparing the relative "quality" of formats, and the actual returned values may change in the future.

format :

Sample format

Returns :

Effective bit width of format.

ipatch_sample_format_verify ()

gboolean            ipatch_sample_format_verify         (int format);

Verify a sample format integer.

format :

Sample format (IpatchSampleWidth | IpatchSampleSign | IpatchSampleEndian | IpatchSampleChannel).

Returns :

TRUE if valid, FALSE otherwise

ipatch_sample_format_transform_verify ()

gboolean            ipatch_sample_format_transform_verify
                                                        (int src_format,
                                                         int dest_format,
                                                         guint32 channel_map);

Verify source and destination sample formats and channel map for a sample transform operation.

src_format :

Source sample format

dest_format :

Destination sample format

channel_map :

Channel mapping (use IPATCH_SAMPLE_UNITY_CHANNEL_MAP to map all input channels to the same output channels, see IPATCH_SAMPLE_MAP_CHANNEL macro for constructing channel map values)

Returns :

TRUE on success, FALSE otherwise

ipatch_sample_get_transform_funcs ()

guint               ipatch_sample_get_transform_funcs   (int src_format,
                                                         int dest_format,
                                                         guint32 channel_map,
                                                         guint *buf1_max_frame,
                                                         guint *buf2_max_frame,
                                                         IpatchSampleTransformFunc *funcs);

Get transform function array for converting from src_format to dest_format.

func_count: Count of function pointers stored to funcs. Can be 0 if no transform is required.

src_format :

Source audio format to convert from

dest_format :

Destination audio format to convert to

channel_map :

Channel mapping (use IPATCH_SAMPLE_UNITY_CHANNEL_MAP to map all input channels to the same output channels, 3 bits times IPATCH_SAMPLE_MAX_CHANNELS (8) = 24 bits total, see IPATCH_SAMPLE_MAP_CHANNEL macro for constructing channel map values)

buf1_max_frame :

Output - maximum sample frame size for first buffer

buf2_max_frame :

Output - maximum sample frame size for second buffer

funcs :

Caller provided array to store transform functions to. It should have at least IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS elements.
libinstpatch-1.0.0/docs/reference/html/index.html0000644000175000017500000003610511461404256016754 00000000000000 libinstpatch Reference Manual

For libinstpatch 1.0.0. The latest version of this documentation can be found on-line at http://swami.sourceforge.net/api/libinstpatch/.


Base objects and functions
IpatchItem — Abstract base item object
IpatchContainer — Abstract object type used for items containing other child items.
IpatchBase — Base instrument file object type
IpatchFile — File abstraction object
IpatchVirtualContainer — Virtual container object
Utility objects and functions
IpatchIter — Iterator instance
IpatchList — An object containing a list of object pointers
IpatchConverter — Base class for object conversion handlers
IpatchConverterSF2VoiceCache — Base object type used for IpatchSF2Voice cache converters
IpatchRiff — RIFF file parser/composer object
IpatchSF2VoiceCache — SoundFont voice cache object
IpatchParamProp — GParamSpec extended properties
IpatchTypeProp — GObject style properties for GTypes
IpatchPaste — Object paste instance
IpatchUnit — Unit conversion system
IpatchUnit_generic — Generic unit types and conversions
IpatchXml — XML tree functions
IpatchXmlObject — GObject related XML tree functions
IpatchRange — A boxed type which defines a number range
md5 — MD5 hashing functions
misc — Miscellaneous stuff
util — Utility functions
version
Sample data objects and functions
IpatchSample — Sample audio interface
IpatchSampleData — Sample data proxy object.
IpatchSampleStore — Abstract sample storage object
IpatchSampleTransform — Audio format conversion instance
sample — Audio sample format conversion functions and defines.
IpatchSampleList — Sample list data types and functions
IpatchSndFile — libsndfile file object
IpatchSampleStoreCache — Sample store object for cached samples in RAM
IpatchSampleStoreFile — Sample store object type for audio in files on disk
IpatchSampleStoreRam — Sample store object for audio data in RAM
IpatchSampleStoreRom — Sample storage object for audio in ROM of a sound card
IpatchSampleStoreSndFile — Sample store object type which uses libsndfile to access audio in sound files
IpatchSampleStoreSplit24 — Sample storage object for 24 bit audio in 16 and 8 bit segments
IpatchSampleStoreSwap — Sample storage object for audio in a temporary swap file
IpatchSampleStoreVirtual — Virtual sample storage object
DLS patches
IpatchDLS2 — DLS version 2 instrument file object
IpatchDLSFile — DLS file object and functions
IpatchDLS2Info — DLS version 2 info functions and structure
IpatchDLSReader — DLS version 2 file reader
IpatchDLSWriter — DLS instrument file writer
IpatchDLS2Inst — DLS instrument object
IpatchDLS2Region — DLS region object
IpatchDLS2Conn — DLS version 2 connection structures and functions
IpatchDLS2Sample — DLS audio sample object
IpatchUnit_DLS — Unit types and conversions for DLS
SoundFont patches
IpatchSF2 — SoundFont instrument file object
IpatchSF2File — SoundFont file object
IpatchSF2Reader — SoundFont file reader
IpatchSF2Writer — SoundFont writer object
IpatchSF2Preset — SoundFont preset object
IpatchSF2Inst — SoundFont instrument object
IpatchSF2Zone — Abstract base class for SoundFont zones
IpatchSF2Gen — SoundFont generator functions and definitions
IpatchSF2GenItem — SoundFont generator item interface
IpatchSF2Mod — SoundFont modulators
IpatchSF2ModItem — SoundFont modulator item interface
IpatchSF2PZone — SoundFont preset zone object
IpatchSF2IZone — SoundFont instrument zone object
IpatchSF2Sample — SoundFont audio sample
IpatchUnit_SF2 — Unit types and conversions for SoundFont
GigaSampler patches
IpatchGig — GigaSampler instrument file object
IpatchGigFile — GigaSampler file object
IpatchGigInst — GigaSampler instrument object
IpatchGigRegion — GigaSampler region object
IpatchGigDimension — GigaSampler dimension object
IpatchGigSubRegion — GigaSampler sub region object
IpatchGigEffects — GigaSampler instrument parameters and effects
IpatchGigSample — GigaSampler sample object
Virtual banks
IpatchVBank — Virtual bank object
IpatchVBankInst — VBank instrument item
IpatchVBankRegion — Virtual bank instrument region
Object Hierarchy
API Index
libinstpatch-1.0.0/docs/reference/html/IpatchSampleData.html0000644000175000017500000010175611461404256021016 00000000000000 IpatchSampleData

IpatchSampleData

IpatchSampleData — Sample data proxy object.

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSampleData

Implemented Interfaces

IpatchSampleData implements IpatchSample.

Description

An object which acts as a proxy for sample data and one or more cached versions of the same audio but potentially differing in sample format and/or storage media. IpatchSampleStore is used instead of the IpatchSample interface, for increased performance.

Details

IpatchSampleData

typedef struct _IpatchSampleData IpatchSampleData;

IPATCH_SAMPLE_DATA_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_DATA_UNUSED_FLAG_SHIFT

ipatch_get_sample_data_list ()

IpatchList *        ipatch_get_sample_data_list         (void);

Creates an object list copy of the master sample data list (all existing sample data objects).

Returns :

New object list populated with all IpatchSampleData objects with a reference count of 1 which the caller owns, removing the reference will free the list.

ipatch_sample_data_new ()

IpatchSampleData *  ipatch_sample_data_new              (void);

Create a new sample data object.

Returns :

New sample data with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_sample_data_add ()

void                ipatch_sample_data_add              (IpatchSampleData *sampledata,
                                                         IpatchSampleStore *store);

Add a sample to a sample data object. If no samples have yet been added, then the added sample becomes the native sample. All samples added to a given sampledata object must have the same frame count and should also have the same sample rate. This is not enforced though and is left to the caller to ensure.

sampledata :

Sample data object

store :

Sample store to add

ipatch_sample_data_remove ()

void                ipatch_sample_data_remove           (IpatchSampleData *sampledata,
                                                         IpatchSampleStore *store);

Remove a sample from a sample data object. The native sample should not be removed from an active sample data object. Use ipatch_sample_data_replace_native_sample() if replacement is desired.

sampledata :

Sample data object

store :

Sample store to remove

ipatch_sample_data_replace_native_sample ()

void                ipatch_sample_data_replace_native_sample
                                                        (IpatchSampleData *sampledata,
                                                         IpatchSampleStore *store);

Replace the native sample of a sample data object. This function can be used even if there are no samples yet, in which case it behaves just like ipatch_sample_data_add().

sampledata :

Sample data object

store :

Sample store object

ipatch_sample_data_get_samples ()

IpatchList *        ipatch_sample_data_get_samples      (IpatchSampleData *sampledata);

Get an object list of samples in a sample data object. The first sample is the native sample.

sampledata :

Sample data object

Returns :

Newly created list of IpatchSampleStore objects with a refcount of 1 which the caller owns.

ipatch_sample_data_get_size ()

guint               ipatch_sample_data_get_size         (IpatchSampleData *sampledata);

Get the size in frames of the samples in the sampledata object.

sampledata :

Sample data to get size of

Returns :

Size in frames of stores in sample data.

ipatch_sample_data_get_native_sample ()

IpatchSampleStore * ipatch_sample_data_get_native_sample
                                                        (IpatchSampleData *sampledata);

Get the native sample of a sample data object.

sampledata :

Sample data object

Returns :

Native sample, or NULL if no native sample in the sample data object, caller owns a reference.

ipatch_sample_data_get_native_format ()

int                 ipatch_sample_data_get_native_format
                                                        (IpatchSampleData *sampledata);

Convenience function to get the sample format of the native sample in a sample data object. See ipatch_sample_get_format() for more info.

sampledata :

Sample data object

Returns :

Sample format or 0 if sampledata has no native sample.

ipatch_sample_data_open_native_sample ()

gboolean            ipatch_sample_data_open_native_sample
                                                        (IpatchSampleData *sampledata,
                                                         IpatchSampleHandle *handle,
                                                         char mode,
                                                         int format,
                                                         guint32 channel_map,
                                                         GError **err);

A convenience function to open a handle to a sampledata object's native sample. See ipatch_sample_handle_open() for more details. This is identical to calling ipatch_sample_data_get_native_sample() and then ipatch_sample_handle_open() on the returned sample.

sampledata :

Sample data

handle :

Caller supplied structure to initialize

mode :

Access mode to sample, 'r' for reading and 'w' for writing

format :

Sample format to convert to/from (0 for no conversion or to assign a transform object with ipatch_sample_handle_set_transform()).

channel_map :

Channel mapping if format is set (set to 0 otherwise), use IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel mapping (see ipatch_sample_get_transform_funcs() for details).

err :

Location to store error information

Returns :

TRUE on success, FALSE on failure (in which case err may be set)

ipatch_sample_data_get_cache_sample ()

IpatchSampleStore * ipatch_sample_data_get_cache_sample (IpatchSampleData *sampledata,
                                                         int format,
                                                         guint32 channel_map,
                                                         GError **err);

Get a cached version, in RAM, of a sample. If an existing cached sample already exists with the given format and channel map, it is used. Otherwise a new IpatchSampleStoreCache sample is created and the native sample is converted as necessary. If a matching cached sample is currently being created by another thread, this function will block until it is created and return it.

sampledata :

Sample data object

format :

Sample format of cached sample to convert native sample to

channel_map :

Channel mapping to use for new cached sample when converting from native format, use IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel mapping (see ipatch_sample_get_transform_funcs() for details).

err :

Location to store error information

Returns :

Cached sample with the given format for which the caller owns a reference or NULL if sampledata contains no samples or a sample conversion error occurred (I/O error for example).

ipatch_sample_data_lookup_cache_sample ()

IpatchSampleStore * ipatch_sample_data_lookup_cache_sample
                                                        (IpatchSampleData *sampledata,
                                                         int format,
                                                         guint32 channel_map);

Like ipatch_sample_data_get_cache_sample() but does not create a new cache sample if it doesn't exist.

sampledata :

Sample data object

format :

Sample format

channel_map :

Channel mapping of cached sample relative to native sample format.

Returns :

Cached sample store with the given format and channel_map for which the caller owns a reference or NULL if sampledata does not contain a matching cached sample.

ipatch_sample_data_open_cache_sample ()

gboolean            ipatch_sample_data_open_cache_sample
                                                        (IpatchSampleData *sampledata,
                                                         IpatchSampleHandle *handle,
                                                         int format,
                                                         guint32 channel_map,
                                                         GError **err);

Like ipatch_sample_data_get_cache_sample() but opens the resulting cached sample as a convenience.

sampledata :

Sample data object

handle :

Caller supplied sample handle to initialize

format :

Sample format

err :

Location to store error information

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_sample_cache_clean ()

void                ipatch_sample_cache_clean           (guint64 max_unused_size,
                                                         guint max_unused_age);

ipatch_sample_data_get_blank ()

IpatchSampleData *  ipatch_sample_data_get_blank        (void);

Get blank sample data object. Return's a sample data structure with the minimum amount of data which is blank. Only creates it on the first call, subsequent calls return the same sample data object. Therefore it should not be modified. The blank sample data's reference count has been incremented and should be removed by the caller with g_object_unref() when finished with it.

Returns :

The blank sample data object. Remember to unref it when not using it anymore with g_object_unref().

See Also

#IpatchSampleStore
libinstpatch-1.0.0/docs/reference/html/IpatchSF2Zone.html0000644000175000017500000004231611461404256020225 00000000000000 IpatchSF2Zone

IpatchSF2Zone

IpatchSF2Zone — Abstract base class for SoundFont zones

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSF2Zone
               +----IpatchSF2IZone
               +----IpatchSF2PZone

Implemented Interfaces

IpatchSF2Zone implements IpatchSF2ModItemIface.

Description

Zones are children of IpatchSF2Preset and IpatchSF2Inst and define synthesis parameters and a linked item (IpatchSF2Inst in the case of IpatchSF2PZone and IpatchSF2Sample in the case of IpatchSF2IZone).

Details

IpatchSF2Zone

typedef struct _IpatchSF2Zone IpatchSF2Zone;

IPATCH_SF2_ZONE_UNUSED_FLAG_SHIFT

#define IPATCH_SF2_ZONE_UNUSED_FLAG_SHIFT  (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 2)

IPATCH_SF2_ZONE_GEN_AMT()

#define             IPATCH_SF2_ZONE_GEN_AMT(zone, genid)

IPATCH_SF2_ZONE_GEN_TEST_FLAG()

#define             IPATCH_SF2_ZONE_GEN_TEST_FLAG(zone, genid)

IPATCH_SF2_ZONE_GEN_SET_FLAG()

#define             IPATCH_SF2_ZONE_GEN_SET_FLAG(zone, genid)

IPATCH_SF2_ZONE_GEN_CLEAR_FLAG()

#define             IPATCH_SF2_ZONE_GEN_CLEAR_FLAG(zone, genid)

ipatch_sf2_zone_first ()

IpatchSF2Zone *     ipatch_sf2_zone_first               (IpatchIter *iter);

Gets the first item in a zone iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchSF2Zone items

Returns :

The first zone in iter or NULL if empty.

ipatch_sf2_zone_next ()

IpatchSF2Zone *     ipatch_sf2_zone_next                (IpatchIter *iter);

Gets the next item in a zone iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchSF2Zone items

Returns :

The next zone in iter or NULL if at the end of the list.

ipatch_sf2_zone_set_link_item ()

void                ipatch_sf2_zone_set_link_item       (IpatchSF2Zone *zone,
                                                         IpatchItem *item);

Sets the referenced item of a zone (a IpatchSF2Inst for preset zones, IpatchSF2Sample for instrument zones). The type specific item set routines for each zone type may be preferred, as this one doesn't do strict type checking.

zone :

Zone to set zone item of

item :

New item for zone to use

ipatch_sf2_zone_set_link_item_no_notify ()

gboolean            ipatch_sf2_zone_set_link_item_no_notify
                                                        (IpatchSF2Zone *zone,
                                                         IpatchItem *item,
                                                         IpatchItem **olditem);

Like ipatch_sf2_zone_set_link_item() but performs no property or item change notifications (shouldn't normally be used outside of derived types), and the old value can be retrieved with the olditem parameter.

zone :

Zone to set zone item of

item :

New item for zone to use

olditem :

Pointer to store old item pointer or NULL to ignore. Caller owns reference if specified.

Returns :

TRUE if property was changed, FALSE otherwise (invalid inputs)

ipatch_sf2_zone_get_link_item ()

IpatchItem *        ipatch_sf2_zone_get_link_item       (IpatchSF2Zone *zone);

Gets the referenced item from a zone (a IpatchSF2Inst for preset zones, IpatchSF2Sample for instrument zones). The type specific item set routines for each zone type may be preferred, as this one doesn't do strict type checking. The returned item's reference count is incremented and the caller is responsible for unrefing it with g_object_unref().

zone :

Zone to get referenced item of

Returns :

Zone's referenced item or NULL if global zone. Remember to unreference the item with g_object_unref() when done with it.

ipatch_sf2_zone_peek_link_item ()

IpatchItem *        ipatch_sf2_zone_peek_link_item      (IpatchSF2Zone *zone);

Like ipatch_sf2_zone_get_link_item() but does not add a reference to the returned item. This function should only be used if a reference of the returned item is ensured or only the pointer value is of interest.

zone :

Zone to get referenced item of

Returns :

Zone's linked item. Remember that the item has NOT been referenced.
libinstpatch-1.0.0/docs/reference/html/IpatchGigRegion.html0000644000175000017500000005410311461404256020646 00000000000000 IpatchGigRegion

IpatchGigRegion

IpatchGigRegion — GigaSampler region object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchGigRegion

Properties

  "channel"                  gint                  : Read / Write
  "key-group"                gint                  : Read / Write
  "layer-group"              gint                  : Read / Write
  "multi-channel"            gboolean              : Read / Write
  "note-range"               IpatchRange*          : Read / Write
  "phase-group"              gint                  : Read / Write
  "phase-master"             gboolean              : Read / Write
  "self-non-exclusive"       gboolean              : Read / Write
  "velocity-range"           IpatchRange*          : Read / Write

Description

GigaSampler region objects are children of IpatchGigInst objects.

Details

IpatchGigRegion

typedef struct _IpatchGigRegion IpatchGigRegion;

enum IpatchGigRegionFlags

typedef enum
{
  IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE = 1 << IPATCH_CONTAINER_UNUSED_FLAG_SHIFT,
  IPATCH_GIG_REGION_PHASE_MASTER = 1 << (IPATCH_CONTAINER_UNUSED_FLAG_SHIFT + 1),
  IPATCH_GIG_REGION_MULTI_CHANNEL = 1 << (IPATCH_CONTAINER_UNUSED_FLAG_SHIFT + 2)
} IpatchGigRegionFlags;

IPATCH_GIG_REGION_FLAG_MASK

#define IPATCH_GIG_REGION_FLAG_MASK  (0x0F << IPATCH_CONTAINER_UNUSED_FLAG_SHIFT)

IPATCH_GIG_REGION_UNUSED_FLAG_SHIFT

#define             IPATCH_GIG_REGION_UNUSED_FLAG_SHIFT

ipatch_gig_region_new ()

IpatchGigRegion *   ipatch_gig_region_new               (void);

Create a new GigaSampler instrument region.

Returns :

New GigaSampler region with a ref count of 1 which the caller owns.

ipatch_gig_region_first ()

IpatchGigRegion *   ipatch_gig_region_first             (IpatchIter *iter);

Gets the first item in a region iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchGigRegion items

Returns :

The first region in iter or NULL if empty.

ipatch_gig_region_next ()

IpatchGigRegion *   ipatch_gig_region_next              (IpatchIter *iter);

Gets the next item in a region iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchGigRegion items

Returns :

The next region in iter or NULL if at the end of the list.

ipatch_gig_region_set_note_range ()

void                ipatch_gig_region_set_note_range    (IpatchGigRegion *region,
                                                         int low,
                                                         int high);

Set the MIDI note range that a region is active on.

region :

Region to set note range of

low :

Low value of range (MIDI note # between 0 and 127)

high :

High value of range (MIDI note # between 0 and 127)

ipatch_gig_region_set_velocity_range ()

void                ipatch_gig_region_set_velocity_range
                                                        (IpatchGigRegion *region,
                                                         int low,
                                                         int high);

Set the MIDI velocity range that a region is active on.

region :

Region to set velocity range of

low :

Low value of range (MIDI velocity # between 0 and 127)

high :

High value of range (MIDI velocity # between 0 and 127)

ipatch_gig_region_new_dimension ()

void                ipatch_gig_region_new_dimension     (IpatchGigRegion *region,
                                                         IpatchGigDimensionType type,
                                                         int split_count);

Adds a new dimension to a GigaSampler region. The dimension is allocated split_count number of dimension bits which means the total number of sub regions will be multiplied by a factor of 2 to the power of split_count. There can be a maximum of 32 sub regions for a total of 5 used split bits.

region :

GigaSampler region

type :

Type of dimension to add

split_count :

Split bit count

ipatch_gig_region_remove_dimension ()

void                ipatch_gig_region_remove_dimension  (IpatchGigRegion *region,
                                                         int dim_index,
                                                         int split_index);

Removes a dimension from a GigaSampler region, including all related sub regions (except those that correspond to the split_index), and re-organizes sub regions for new dimension map.

region :

GigaSampler region

dim_index :

Index of an existing dimension to remove (0-4)

split_index :

Split index to use in the dimension to remove

Property Details

The "channel" property

  "channel"                  gint                  : Read / Write

DLS audio channel identifier.

Allowed values: [0,262143]

Default value: 0


The "key-group" property

  "key-group"                gint                  : Read / Write

Percussion key group.

Allowed values: [0,15]

Default value: 0


The "layer-group" property

  "layer-group"              gint                  : Read / Write

Layer group.

Allowed values: [0,65535]

Default value: 0


The "multi-channel" property

  "multi-channel"            gboolean              : Read / Write

Multi channel.

Default value: FALSE


The "note-range" property

  "note-range"               IpatchRange*          : Read / Write

MIDI note range.


The "phase-group" property

  "phase-group"              gint                  : Read / Write

Phase locked sample group.

Allowed values: [0,65535]

Default value: 0


The "phase-master" property

  "phase-master"             gboolean              : Read / Write

Multi channel phase lock master.

Default value: FALSE


The "self-non-exclusive" property

  "self-non-exclusive"       gboolean              : Read / Write

Self non exclusive.

Default value: FALSE


The "velocity-range" property

  "velocity-range"           IpatchRange*          : Read / Write

MIDI velocity range.

See Also

#IpatchGigInst, IpatchGig
libinstpatch-1.0.0/docs/reference/html/IpatchGigSubRegion.html0000644000175000017500000004374511461404256021332 00000000000000 IpatchGigSubRegion

IpatchGigSubRegion

IpatchGigSubRegion — GigaSampler sub region object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchGigSubRegion

Implemented Interfaces

IpatchGigSubRegion implements IpatchSample.

Properties

  "fine-tune"                gint                  : Read / Write
  "flags"                    IpatchDLS2SampleFlags  : Read / Write
  "gain"                     gint                  : Read / Write
  "link-item"                IpatchGigSample*      : Read / Write
  "loop-end"                 guint                 : Read / Write
  "loop-start"               guint                 : Read / Write
  "loop-type"                IpatchSampleLoopType  : Read / Write
  "root-note"                gint                  : Read / Write
  "sample-info-override"     gboolean              : Read / Write

Description

Defines a GigaSampler sub region object which are children of IpatchGigRegion objects and define how a referenced IpatchGigSample is synthesized in a IpatchGigInst.

Details

IpatchGigSubRegion

typedef struct _IpatchGigSubRegion IpatchGigSubRegion;

enum IpatchGigSubRegionFlags

typedef enum
{
  IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE = 1 << IPATCH_ITEM_UNUSED_FLAG_SHIFT
} IpatchGigSubRegionFlags;

IPATCH_GIG_SUB_REGION_UNUSED_FLAG_SHIFT

#define             IPATCH_GIG_SUB_REGION_UNUSED_FLAG_SHIFT

ipatch_gig_sub_region_new ()

IpatchGigSubRegion * ipatch_gig_sub_region_new          (void);

Create a new GigaSampler sub region.

Returns :

New GigaSampler sub region with a ref count of 1 which the caller owns.

ipatch_gig_sub_region_first ()

IpatchGigSubRegion * ipatch_gig_sub_region_first        (IpatchIter *iter);

Gets the first item in a sub region iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchGigSubRegion items

Returns :

The first sub region in iter or NULL if empty.

ipatch_gig_sub_region_next ()

IpatchGigSubRegion * ipatch_gig_sub_region_next         (IpatchIter *iter);

Gets the next item in a sub region iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchGigSubRegion items

Returns :

The next sub region in iter or NULL if at the end of the list.

ipatch_gig_sub_region_get_sample ()

IpatchGigSample *   ipatch_gig_sub_region_get_sample    (IpatchGigSubRegion *subregion);

subregion :

GigaSampler sub region to get sample of

Returns :

The sub region's sample, referenced for the caller, unref it when finished.

ipatch_gig_sub_region_set_sample ()

void                ipatch_gig_sub_region_set_sample    (IpatchGigSubRegion *subregion,
                                                         IpatchGigSample *sample);

Set the referenced sample of a sub region.

subregion :

GigaSampler sub region to set sample of

sample :

Sample to assign to the sub region

Property Details

The "fine-tune" property

  "fine-tune"                gint                  : Read / Write

Fine tuning in cents.

Allowed values: [-99,99]

Default value: 0


The "flags" property

  "flags"                    IpatchDLS2SampleFlags  : Read / Write

Sample flags.


The "gain" property

  "gain"                     gint                  : Read / Write

Gain in DLS relative gain units.

Default value: 0


The "link-item" property

  "link-item"                IpatchGigSample*      : Read / Write

Link item.


The "loop-end" property

  "loop-end"                 guint                 : Read / Write

Loop end in frames (after loop).

Default value: 0


The "loop-start" property

  "loop-start"               guint                 : Read / Write

Start of loop in frames.

Default value: 0


The "loop-type" property

  "loop-type"                IpatchSampleLoopType  : Read / Write

Loop method type.

Default value: IPATCH_SAMPLE_LOOP_NONE


The "root-note" property

  "root-note"                gint                  : Read / Write

Root MIDI note.

Allowed values: [0,127]

Default value: 60


The "sample-info-override" property

  "sample-info-override"     gboolean              : Read / Write

Override sample info.

Default value: FALSE

See Also

#IpatchGigRegion
libinstpatch-1.0.0/docs/reference/html/right.png0000644000175000017500000000073011461404255016574 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME2 I%=eIDATx!o@.'**M0$$?1~vIeEuLl&4䝠Bݛ|>$ݶoc IpatchSF2GenItem

IpatchSF2GenItem

IpatchSF2GenItem — SoundFont generator item interface

Stability Level

Stable, unless otherwise indicated

Synopsis

#define             IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID
#define             IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID
#define             IPATCH_SF2_GEN_ITEM_FIRST_PROP_USER_ID
typedef             IpatchSF2GenItem;
                    IpatchSF2GenItemIface;
gboolean            ipatch_sf2_gen_item_get_amount      (IpatchSF2GenItem *item,
                                                         guint genid,
                                                         IpatchSF2GenAmount *out_amt);
void                ipatch_sf2_gen_item_set_amount      (IpatchSF2GenItem *item,
                                                         guint genid,
                                                         IpatchSF2GenAmount *amt);
void                ipatch_sf2_gen_item_set_gen_flag    (IpatchSF2GenItem *item,
                                                         guint genid,
                                                         gboolean setflag);
guint               ipatch_sf2_gen_item_count_set       (IpatchSF2GenItem *item);
void                ipatch_sf2_gen_item_copy_all        (IpatchSF2GenItem *item,
                                                         IpatchSF2GenArray *array);
void                ipatch_sf2_gen_item_copy_set        (IpatchSF2GenItem *item,
                                                         IpatchSF2GenArray *array);
void                ipatch_sf2_gen_item_set_note_range  (IpatchSF2GenItem *item,
                                                         int low,
                                                         int high);
void                ipatch_sf2_gen_item_set_velocity_range
                                                        (IpatchSF2GenItem *item,
                                                         int low,
                                                         int high);
gboolean            ipatch_sf2_gen_item_in_range        (IpatchSF2GenItem *item,
                                                         int note,
                                                         int velocity);
gboolean            ipatch_sf2_gen_item_intersect_test  (IpatchSF2GenItem *item,
                                                         const IpatchSF2GenArray *genarray);
GParamSpec *        ipatch_sf2_gen_item_class_get_pspec (GObjectClass *klass,
                                                         guint genid);
GParamSpec *        ipatch_sf2_gen_item_class_get_pspec_set
                                                        (GObjectClass *klass,
                                                         guint genid);
void                ipatch_sf2_gen_item_iface_install_properties
                                                        (GObjectClass *klass,
                                                         IpatchSF2GenPropsType propstype,
                                                         GParamSpec ***specs,
                                                         GParamSpec ***setspecs);
gboolean            ipatch_sf2_gen_item_iface_set_property
                                                        (IpatchSF2GenItem *item,
                                                         guint property_id,
                                                         const GValue *value);
gboolean            ipatch_sf2_gen_item_iface_get_property
                                                        (IpatchSF2GenItem *item,
                                                         guint property_id,
                                                         GValue *value);

Object Hierarchy

  GInterface
   +----IpatchSF2GenItemIface

Prerequisites

IpatchSF2GenItemIface requires IpatchItem.

Known Implementations

IpatchSF2GenItemIface is implemented by IpatchSF2Inst, IpatchSF2PZone, IpatchSF2IZone and IpatchSF2Preset.

Description

Provides an interface for items which have SoundFont generator properties. SoundFont generators are synthesis parameters used by IpatchSF2Preset, IpatchSF2Inst, IpatchSF2PZone and IpatchSF2IZone objects.

Details

IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID

#define IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID	1	/* first gen prop */

IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID

#define IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID	80	/* first gen-set prop */

IPATCH_SF2_GEN_ITEM_FIRST_PROP_USER_ID

#define IPATCH_SF2_GEN_ITEM_FIRST_PROP_USER_ID	160	/* first ID usable for other properties */

IpatchSF2GenItem

typedef IpatchItem IpatchSF2GenItem;

IpatchSF2GenItemIface

typedef struct {
  IpatchSF2GenPropsType propstype;	/* gen properties type for this class */
  guint genarray_ofs;	/* offset in item instance to generator array pointer */
  GParamSpec *specs[IPATCH_SF2_GEN_COUNT];  /* genid -> prop pspec array */
  GParamSpec *setspecs[IPATCH_SF2_GEN_COUNT];  /* genid -> "-set" prop pspec array */
} IpatchSF2GenItemIface;

ipatch_sf2_gen_item_get_amount ()

gboolean            ipatch_sf2_gen_item_get_amount      (IpatchSF2GenItem *item,
                                                         guint genid,
                                                         IpatchSF2GenAmount *out_amt);

Get a generator amount from an item with generator properties.

item :

Item with generators to get value from

genid :

Generator ID (IpatchSF2GenType) of value to get

out_amt :

Output: Pointer to store generator amount to

Returns :

TRUE if generator value is set, FALSE if not set, in which case the value stored to output_amt is the default value for the given generator ID.

ipatch_sf2_gen_item_set_amount ()

void                ipatch_sf2_gen_item_set_amount      (IpatchSF2GenItem *item,
                                                         guint genid,
                                                         IpatchSF2GenAmount *amt);

Set a generator amount for an item with generators.

IpatchItem property notify is done for the property and possibly the "-set" property if it was unset before.

item :

Item with generators to set value in

genid :

Generator ID (IpatchSF2GenType) of generator to set

amt :

Value to set generator to

ipatch_sf2_gen_item_set_gen_flag ()

void                ipatch_sf2_gen_item_set_gen_flag    (IpatchSF2GenItem *item,
                                                         guint genid,
                                                         gboolean setflag);

Sets the value of a generator "set" flag in an item with generators.

IpatchItem property notify is done for the property and possibly the "-set" property if it was set before.

item :

Item with generator properties to set value of a gen "set" flag of

genid :

Generator ID (IpatchSF2GenType) of generator to set "set" flag value of

setflag :

If TRUE then generatore amount is assigned, FALSE will cause the amount to be unset (and revert to its default value)

ipatch_sf2_gen_item_count_set ()

guint               ipatch_sf2_gen_item_count_set       (IpatchSF2GenItem *item);

Get count of "set" generators in an item with generators.

item :

Item with generators

Returns :

Count of "set" generators.

ipatch_sf2_gen_item_copy_all ()

void                ipatch_sf2_gen_item_copy_all        (IpatchSF2GenItem *item,
                                                         IpatchSF2GenArray *array);

Copies an item's generators to a caller supplied generator array.

item :

Item with generators

array :

Destination generator array to store to

ipatch_sf2_gen_item_copy_set ()

void                ipatch_sf2_gen_item_copy_set        (IpatchSF2GenItem *item,
                                                         IpatchSF2GenArray *array);

Copies a item's "set" generators to a caller supplied generator array. This function differs from ipatch_sf2_gen_item_copy_all() in that it only copies generators that are set. It can be used to override values in one array with set values in another. Note that this doesn't change any generators in item, despite "set" being in the name.

item :

Item with generators

array :

Destination generator array to store to

ipatch_sf2_gen_item_set_note_range ()

void                ipatch_sf2_gen_item_set_note_range  (IpatchSF2GenItem *item,
                                                         int low,
                                                         int high);

Set the MIDI note range that an item with generators is active on. Only a convenience function really.

item :

Item with generators

low :

Low value of range (MIDI note # between 0 and 127)

high :

High value of range (MIDI note # between 0 and 127)

ipatch_sf2_gen_item_set_velocity_range ()

void                ipatch_sf2_gen_item_set_velocity_range
                                                        (IpatchSF2GenItem *item,
                                                         int low,
                                                         int high);

Set the MIDI velocity range that an item with generators is active on. Only a convenience function really.

item :

Item with generators

low :

Low value of range (MIDI velocity # between 0 and 127)

high :

High value of range (MIDI velocity # between 0 and 127)

ipatch_sf2_gen_item_in_range ()

gboolean            ipatch_sf2_gen_item_in_range        (IpatchSF2GenItem *item,
                                                         int note,
                                                         int velocity);

Check if a note and velocity falls in the ranges of an item with generators

item :

Item with generators

note :

MIDI note number or -1 for wildcard

velocity :

MIDI velocity or -1 for wildcard

Returns :

TRUE if item is in note and velocity range, FALSE otherwise

ipatch_sf2_gen_item_intersect_test ()

gboolean            ipatch_sf2_gen_item_intersect_test  (IpatchSF2GenItem *item,
                                                         const IpatchSF2GenArray *genarray);

Check if a given item's note and velocity ranges intersect with those in a generator array.

item :

Item with generators

genarray :

Generator array to test note and velocity ranges against

Returns :

TRUE if both note and velocity ranges intersect, FALSE if one or both do not.

ipatch_sf2_gen_item_class_get_pspec ()

GParamSpec *        ipatch_sf2_gen_item_class_get_pspec (GObjectClass *klass,
                                                         guint genid);

Get the parameter specification for a given generator ID and object class.

genid :

Generator ID

klass :

Class with an IpatchSF2GenItem interface

Returns :

The parameter specification for the generator or NULL if the given genid for klass is not valid.

ipatch_sf2_gen_item_class_get_pspec_set ()

GParamSpec *        ipatch_sf2_gen_item_class_get_pspec_set
                                                        (GObjectClass *klass,
                                                         guint genid);

Get a "-set" property parameter specification for a given generator ID and object class.

genid :

Generator ID

klass :

Class with an IpatchSF2GenItem interface

Returns :

The "-set" property parameter specification for the generator or NULL if the given genid or klass are not valid.

ipatch_sf2_gen_item_iface_install_properties ()

void                ipatch_sf2_gen_item_iface_install_properties
                                                        (GObjectClass *klass,
                                                         IpatchSF2GenPropsType propstype,
                                                         GParamSpec ***specs,
                                                         GParamSpec ***setspecs);

Installs generator item properties on the provided klass. Used internally in IpatchSF2GenItemIface init functions.

klass :

Object class to install properties on

propstype :

Type of properties to install (instrument/preset)

specs :

Location to store a pointer to an allocated array of parameter specs which should get copied to the interface's specs field and then freed

setspecs :

Location to store a pointer to an allocated array of parameter specs which should get copied to the interface's setspecs field and then freed

ipatch_sf2_gen_item_iface_set_property ()

gboolean            ipatch_sf2_gen_item_iface_set_property
                                                        (IpatchSF2GenItem *item,
                                                         guint property_id,
                                                         const GValue *value);

Used internally for classes with generators, to set values thereof.

item :

IpatchItem instance with generator properties

property_id :

Property id to set

value :

Value to set property to

Returns :

TRUE if property_id handled, FALSE otherwise

ipatch_sf2_gen_item_iface_get_property ()

gboolean            ipatch_sf2_gen_item_iface_get_property
                                                        (IpatchSF2GenItem *item,
                                                         guint property_id,
                                                         GValue *value);

Used internally for classes with generator properties, to get values thereof.

item :

IpatchItem instance with generators

property_id :

Property id to set

value :

Value to set property to

Returns :

TRUE if property_id handled, FALSE otherwise

See Also

#IpatchSF2Preset, IpatchSF2Inst, IpatchSF2PZone, IpatchSF2IZone
libinstpatch-1.0.0/docs/reference/html/IpatchDLS2Sample.html0000644000175000017500000014001711461404256020642 00000000000000 IpatchDLS2Sample

IpatchDLS2Sample

IpatchDLS2Sample — DLS audio sample object

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchDLS2SampleInfo;
                    IpatchDLS2Sample;
#define             IPATCH_DLS2_SAMPLE_INFO_INIT
#define             IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID
#define             IPATCH_DLS2_SAMPLE_INFO_PROPERTY_COUNT
enum                IpatchDLS2SampleFlags;
#define             IPATCH_DLS2_SAMPLE_LOOP_MASK
#define             IPATCH_DLS2_SAMPLE_FLAGS_MASK
IpatchDLS2Sample *  ipatch_dls2_sample_new              (void);
IpatchDLS2Sample *  ipatch_dls2_sample_first            (IpatchIter *iter);
IpatchDLS2Sample *  ipatch_dls2_sample_next             (IpatchIter *iter);
void                ipatch_dls2_sample_set_data         (IpatchDLS2Sample *sample,
                                                         IpatchSampleData *sampledata);
IpatchSampleData *  ipatch_dls2_sample_get_data         (IpatchDLS2Sample *sample);
IpatchSampleData *  ipatch_dls2_sample_peek_data        (IpatchDLS2Sample *sample);
void                ipatch_dls2_sample_set_blank        (IpatchDLS2Sample *sample);
IpatchDLS2SampleInfo * ipatch_dls2_sample_info_new      (void);
void                ipatch_dls2_sample_info_free        (IpatchDLS2SampleInfo *sample_info);
IpatchDLS2SampleInfo * ipatch_dls2_sample_info_duplicate
                                                        (IpatchDLS2SampleInfo *sample_info);
void                ipatch_dls2_sample_info_init        (IpatchDLS2SampleInfo *sample_info);
void                ipatch_dls2_sample_info_install_class_properties
                                                        (GObjectClass *obj_class);
gboolean            ipatch_dls2_sample_info_is_property_id_valid
                                                        (guint property_id);
gboolean            ipatch_dls2_sample_info_set_property
                                                        (IpatchDLS2SampleInfo **sample_info,
                                                         guint property_id,
                                                         const GValue *value);
gboolean            ipatch_dls2_sample_info_get_property
                                                        (IpatchDLS2SampleInfo *sample_info,
                                                         guint property_id,
                                                         GValue *value);
void                ipatch_dls2_sample_info_notify_changes
                                                        (IpatchItem *item,
                                                         IpatchDLS2SampleInfo *newinfo,
                                                         IpatchDLS2SampleInfo *oldinfo);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchDLS2Sample
               +----IpatchGigSample

Implemented Interfaces

IpatchDLS2Sample implements IpatchSample.

Properties

  "archive-location"         gchar*                : Read / Write
  "artist"                   gchar*                : Read / Write
  "comment"                  gchar*                : Read / Write
  "commissioned"             gchar*                : Read / Write
  "copyright"                gchar*                : Read / Write
  "date"                     gchar*                : Read / Write
  "engineer"                 gchar*                : Read / Write
  "fine-tune"                gint                  : Read / Write
  "flags"                    IpatchDLS2SampleFlags  : Read / Write
  "gain"                     gint                  : Read / Write
  "genre"                    gchar*                : Read / Write
  "keywords"                 gchar*                : Read / Write
  "loop-end"                 guint                 : Read / Write
  "loop-start"               guint                 : Read / Write
  "loop-type"                IpatchSampleLoopType  : Read / Write
  "medium"                   gchar*                : Read / Write
  "name"                     gchar*                : Read / Write
  "product"                  gchar*                : Read / Write
  "root-note"                gint                  : Read / Write
  "sample-data"              IpatchSampleData*     : Read / Write
  "sample-rate"              gint                  : Read / Write
  "software"                 gchar*                : Read / Write
  "source"                   gchar*                : Read / Write
  "source-form"              gchar*                : Read / Write
  "subject"                  gchar*                : Read / Write
  "technician"               gchar*                : Read / Write

Description

Object which defines a DLS audio sample. These objects are contained in IpatchDLS objects and linked (referenced) from IpatchDLSRegion objects.

Details

IpatchDLS2SampleInfo

typedef struct {
  guint8 options; /* IpatchSampleLoopType and IpatchDLS2SampleFlags */
  guint8 root_note;		/* root MIDI note number */
  gint16 fine_tune;		/* fine tuning */
  gint32 gain;			/* gain to apply to sample */

  guint32 loop_start;		/* loop start offset (in samples) */
  guint32 loop_end;		/* loop end offset (in samples) */
} IpatchDLS2SampleInfo;

IpatchDLS2Sample

typedef struct _IpatchDLS2Sample IpatchDLS2Sample;

IPATCH_DLS2_SAMPLE_INFO_INIT

#define IPATCH_DLS2_SAMPLE_INFO_INIT  { 0, 60, 0, 0, 0, 0 }

IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID

#define IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID   256

IPATCH_DLS2_SAMPLE_INFO_PROPERTY_COUNT

#define IPATCH_DLS2_SAMPLE_INFO_PROPERTY_COUNT      7

enum IpatchDLS2SampleFlags

typedef enum
{
  IPATCH_DLS2_SAMPLE_NO_TRUNCATION = 1 << 6,
  IPATCH_DLS2_SAMPLE_NO_COMPRESSION = 1 << 7
} IpatchDLS2SampleFlags;

IPATCH_DLS2_SAMPLE_LOOP_MASK

#define IPATCH_DLS2_SAMPLE_LOOP_MASK   0x03

IPATCH_DLS2_SAMPLE_FLAGS_MASK

#define IPATCH_DLS2_SAMPLE_FLAGS_MASK  0x0C0

ipatch_dls2_sample_new ()

IpatchDLS2Sample *  ipatch_dls2_sample_new              (void);

Create a new DLS sample object.

Returns :

New DLS sample with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_dls2_sample_first ()

IpatchDLS2Sample *  ipatch_dls2_sample_first            (IpatchIter *iter);

Gets the first item in a sample iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchDLS2Sample items

Returns :

The first sample in iter or NULL if empty.

ipatch_dls2_sample_next ()

IpatchDLS2Sample *  ipatch_dls2_sample_next             (IpatchIter *iter);

Gets the next item in a sample iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchDLS2Sample items

Returns :

The next sample in iter or NULL if at the end of the list.

ipatch_dls2_sample_set_data ()

void                ipatch_dls2_sample_set_data         (IpatchDLS2Sample *sample,
                                                         IpatchSampleData *sampledata);

Set a sample's sample data object.

sample :

Sample to set sample data of

sampledata :

Sample data to set sample to

ipatch_dls2_sample_get_data ()

IpatchSampleData *  ipatch_dls2_sample_get_data         (IpatchDLS2Sample *sample);

Get the IpatchSampleData item of a sample. Sample data item is referenced before returning and caller is responsible for unreferencing it with g_object_unref() when finished with it.

sample :

Sample to get sample data from

Returns :

Sample data object of sample or NULL if none. Remember to unreference with g_object_unref() when finished with it.

ipatch_dls2_sample_peek_data ()

IpatchSampleData *  ipatch_dls2_sample_peek_data        (IpatchDLS2Sample *sample);

Get the IpatchSampleData item of a sample. Like ipatch_dls2_sample_get_data() but sample data object is not referenced. This function should only be used if a reference of the sample data object is ensured or only the pointer value is of importance.

sample :

Sample to get sample data from

Returns :

Sample data object of sample or NULL if none. Remember that a reference is NOT added.

ipatch_dls2_sample_set_blank ()

void                ipatch_dls2_sample_set_blank        (IpatchDLS2Sample *sample);

Set the sample data of a sample item to blank data.

sample :

Sample to set to blank sample data

ipatch_dls2_sample_info_new ()

IpatchDLS2SampleInfo * ipatch_dls2_sample_info_new      (void);

Allocates a new sample info structure.

Returns :

New sample info structure, free it with ipatch_dls2_sample_info_free() when finished.

ipatch_dls2_sample_info_free ()

void                ipatch_dls2_sample_info_free        (IpatchDLS2SampleInfo *sample_info);

Free a sample info structure allocated with ipatch_dls2_sample_info_new().

sample_info :

Sample info structure

ipatch_dls2_sample_info_duplicate ()

IpatchDLS2SampleInfo * ipatch_dls2_sample_info_duplicate
                                                        (IpatchDLS2SampleInfo *sample_info);

Duplicate a sample info structure.

sample_info :

Sample info structure to duplicate

Returns :

Newly allocated sample info structure which should be freed with ipatch_dls2_sample_info_free() when done with it.

ipatch_dls2_sample_info_init ()

void                ipatch_dls2_sample_info_init        (IpatchDLS2SampleInfo *sample_info);

Initialize a sample info structure to defaults.

sample_info :

Sample info structure to initialize

ipatch_dls2_sample_info_install_class_properties ()

void                ipatch_dls2_sample_info_install_class_properties
                                                        (GObjectClass *obj_class);

Installs sample info properties for the given obj_class. Useful for objects that implement IpatchDLS2SampleInfo properties.

obj_class :

GObjectClass to install properties for

ipatch_dls2_sample_info_is_property_id_valid ()

gboolean            ipatch_dls2_sample_info_is_property_id_valid
                                                        (guint property_id);

Check if a property ID is a valid sample info property ID.

property_id :

Property ID to test

Returns :

TRUE if property_id is a sample info property ID, FALSE otherwise.

ipatch_dls2_sample_info_set_property ()

gboolean            ipatch_dls2_sample_info_set_property
                                                        (IpatchDLS2SampleInfo **sample_info,
                                                         guint property_id,
                                                         const GValue *value);

A function used by set_property methods that implement IpatchDLS2SampleInfo properties.

sample_info :

Pointer to pointer to sample info

property_id :

Property ID

value :

Value for property

Returns :

TRUE if property_id was handled, FALSE otherwise

ipatch_dls2_sample_info_get_property ()

gboolean            ipatch_dls2_sample_info_get_property
                                                        (IpatchDLS2SampleInfo *sample_info,
                                                         guint property_id,
                                                         GValue *value);

A function used by get_property methods that implement IpatchDLS2SampleInfo properties.

sample_info :

Pointer to sample info

property_id :

Property ID

value :

Value to set

Returns :

TRUE if property_id was handled, FALSE otherwise

ipatch_dls2_sample_info_notify_changes ()

void                ipatch_dls2_sample_info_notify_changes
                                                        (IpatchItem *item,
                                                         IpatchDLS2SampleInfo *newinfo,
                                                         IpatchDLS2SampleInfo *oldinfo);

Sends IpatchItem property notifies for changed sample info parameters.

item :

Item to send IpatchItem property notifies on

newinfo :

New sample info values

oldinfo :

Old sample info values

Property Details

The "archive-location" property

  "archive-location"         gchar*                : Read / Write

Location where subject is archived.

Default value: NULL


The "artist" property

  "artist"                   gchar*                : Read / Write

Original artist.

Default value: NULL


The "comment" property

  "comment"                  gchar*                : Read / Write

Comments.

Default value: NULL


The "commissioned" property

  "commissioned"             gchar*                : Read / Write

Who commissioned the material.

Default value: NULL


The "copyright" property

  "copyright"                gchar*                : Read / Write

Copyright.

Default value: NULL


The "date" property

  "date"                     gchar*                : Read / Write

Creation date (YYYY-MM-DD).

Default value: NULL


The "engineer" property

  "engineer"                 gchar*                : Read / Write

Engineers separated by "; ".

Default value: NULL


The "fine-tune" property

  "fine-tune"                gint                  : Read / Write

Fine tuning in cents.

Allowed values: [-99,99]

Default value: 0


The "flags" property

  "flags"                    IpatchDLS2SampleFlags  : Read / Write

Sample flags.


The "gain" property

  "gain"                     gint                  : Read / Write

Gain in DLS relative gain units.

Default value: 0


The "genre" property

  "genre"                    gchar*                : Read / Write

Genre.

Default value: NULL


The "keywords" property

  "keywords"                 gchar*                : Read / Write

Keywords (separated by "; ").

Default value: NULL


The "loop-end" property

  "loop-end"                 guint                 : Read / Write

Loop end in frames (after loop).

Default value: 0


The "loop-start" property

  "loop-start"               guint                 : Read / Write

Start of loop in frames.

Default value: 0


The "loop-type" property

  "loop-type"                IpatchSampleLoopType  : Read / Write

Loop method type.

Default value: IPATCH_SAMPLE_LOOP_NONE


The "medium" property

  "medium"                   gchar*                : Read / Write

Original medium of the material (record, CD, etc).

Default value: NULL


The "name" property

  "name"                     gchar*                : Read / Write

Name.

Default value: "untitled"


The "product" property

  "product"                  gchar*                : Read / Write

Product intended for.

Default value: NULL


The "root-note" property

  "root-note"                gint                  : Read / Write

Root MIDI note.

Allowed values: [0,127]

Default value: 60


The "sample-data" property

  "sample-data"              IpatchSampleData*     : Read / Write

Sample data.


The "sample-rate" property

  "sample-rate"              gint                  : Read / Write

Sampling rate in Hertz.

Allowed values: [8000,192000]

Default value: 44100


The "software" property

  "software"                 gchar*                : Read / Write

Editor software used.

Default value: NULL


The "source" property

  "source"                   gchar*                : Read / Write

Source of the original material.

Default value: NULL


The "source-form" property

  "source-form"              gchar*                : Read / Write

Original source that was digitized.

Default value: NULL


The "subject" property

  "subject"                  gchar*                : Read / Write

Subject of the material.

Default value: NULL


The "technician" property

  "technician"               gchar*                : Read / Write

Technician who sampled the material.

Default value: NULL

See Also

#IpatchDLS, IpatchDLSRegion
libinstpatch-1.0.0/docs/reference/html/IpatchPaste.html0000644000175000017500000012520511461404256020052 00000000000000 IpatchPaste

IpatchPaste

IpatchPaste — Object paste instance

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchPaste;
enum                IpatchPasteChoice;
gboolean            (*IpatchPasteTestFunc)              (IpatchItem *dest,
                                                         IpatchItem *src);
gboolean            (*IpatchPasteExecFunc)              (IpatchPaste *paste,
                                                         IpatchItem *dest,
                                                         IpatchItem *src,
                                                         GError **err);
enum                IpatchPastePriority;
#define             IPATCH_PASTE_FLAGS_PRIORITY_MASK
void                ipatch_register_paste_handler       (IpatchPasteTestFunc test_func,
                                                         IpatchPasteExecFunc exec_func,
                                                         int flags);
gboolean            ipatch_is_paste_possible            (IpatchItem *dest,
                                                         IpatchItem *src);
gboolean            ipatch_simple_paste                 (IpatchItem *dest,
                                                         IpatchItem *src,
                                                         GError **err);
IpatchPaste *       ipatch_paste_new                    (void);
gboolean            ipatch_paste_objects                (IpatchPaste *paste,
                                                         IpatchItem *dest,
                                                         IpatchItem *src,
                                                         GError **err);
gboolean            ipatch_paste_resolve                (IpatchPaste *paste,
                                                         IpatchPasteResolveFunc resolve_func,
                                                         gpointer user_data);
gboolean            ipatch_paste_finish                 (IpatchPaste *paste,
                                                         GError **err);
IpatchList *        ipatch_paste_get_add_list           (IpatchPaste *paste);
void                ipatch_paste_object_add             (IpatchPaste *paste,
                                                         IpatchItem *additem,
                                                         IpatchContainer *parent,
                                                         IpatchItem *orig);
IpatchItem *        ipatch_paste_object_add_duplicate   (IpatchPaste *paste,
                                                         IpatchItem *item,
                                                         IpatchContainer *parent);
IpatchItem *        ipatch_paste_object_add_duplicate_deep
                                                        (IpatchPaste *paste,
                                                         IpatchItem *item,
                                                         IpatchContainer *parent);
gboolean            ipatch_paste_object_add_convert     (IpatchPaste *paste,
                                                         GType conv_type,
                                                         IpatchItem *item,
                                                         IpatchContainer *parent,
                                                         IpatchList **item_list,
                                                         GError **err);
void                ipatch_paste_object_link            (IpatchPaste *paste,
                                                         IpatchItem *from,
                                                         IpatchItem *to);
gboolean            ipatch_paste_default_test_func      (IpatchItem *dest,
                                                         IpatchItem *src);
gboolean            ipatch_paste_default_exec_func      (IpatchPaste *paste,
                                                         IpatchItem *dest,
                                                         IpatchItem *src,
                                                         GError **err);

Object Hierarchy

  GObject
   +----IpatchPaste

Description

This object provides a system and instance for doing cut/paste operations on instrument items.

Details

IpatchPaste

typedef struct _IpatchPaste IpatchPaste;

enum IpatchPasteChoice

typedef enum
{
  IPATCH_PASTE_CHOICE_IGNORE,	/* item will be pasted (conflict remains) */
  IPATCH_PASTE_CHOICE_REPLACE,	/* replace item */
  IPATCH_PASTE_CHOICE_KEEP,	/* keep existing item (reverse replace) */
  IPATCH_PASTE_CHOICE_CANCEL	/* cancel the current operation */
} IpatchPasteChoice;

IpatchPasteTestFunc ()

gboolean            (*IpatchPasteTestFunc)              (IpatchItem *dest,
                                                         IpatchItem *src);

Test if a paste handler can handle the paste operation.

dest :

Destination item of paste operation

src :

Source item of paste operation

Returns :

TRUE if paste supported by this handler, FALSE otherwise

IpatchPasteExecFunc ()

gboolean            (*IpatchPasteExecFunc)              (IpatchPaste *paste,
                                                         IpatchItem *dest,
                                                         IpatchItem *src,
                                                         GError **err);

Perform the construction phase of the paste operation. This includes every action up to the point of actually adding/linking objects. All object addition and linking operations are stored in paste instance to be executed after resolving conflicts, etc.

paste :

Paste object

dest :

Destination item of paste operation

src :

Source item of paste operation

err :

Location to store error information

Returns :

TRUE on success, FALSE on error (in which case err may be set).

enum IpatchPastePriority

typedef enum
{
  /* 0 value is an alias for IPATCH_PASTE_PRIORITY_DEFAULT */

  IPATCH_PASTE_PRIORITY_LOWEST  = 1,
  IPATCH_PASTE_PRIORITY_LOW     = 25,
  IPATCH_PASTE_PRIORITY_DEFAULT = 50,
  IPATCH_PASTE_PRIORITY_HIGH    = 75,
  IPATCH_PASTE_PRIORITY_HIGHEST = 100
} IpatchPastePriority;

IPATCH_PASTE_FLAGS_PRIORITY_MASK

#define IPATCH_PASTE_FLAGS_PRIORITY_MASK   0x7F

ipatch_register_paste_handler ()

void                ipatch_register_paste_handler       (IpatchPasteTestFunc test_func,
                                                         IpatchPasteExecFunc exec_func,
                                                         int flags);

Registers a handler function to paste objects for which test_func returns TRUE.

test_func :

Callback function to test if a paste operation is handled

exec_func :

Paste execution function

flags :

Currently just a value from IpatchPastePriority or 0 for default priority.

ipatch_is_paste_possible ()

gboolean            ipatch_is_paste_possible            (IpatchItem *dest,
                                                         IpatchItem *src);

Check if the given items can be pasted from src to dest.

dest :

Destination item

src :

Source item

Returns :

TRUE if paste is possible, FALSE otherwise

ipatch_simple_paste ()

gboolean            ipatch_simple_paste                 (IpatchItem *dest,
                                                         IpatchItem *src,
                                                         GError **err);

Simple paste of a single src item to dest item. Any conflicts are ignored which means that conflicts will remain and should be resolved.

dest :

Destination item to paste to

src :

Source item

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise in which case err should be set.

ipatch_paste_new ()

IpatchPaste *       ipatch_paste_new                    (void);

ipatch_paste_objects ()

gboolean            ipatch_paste_objects                (IpatchPaste *paste,
                                                         IpatchItem *dest,
                                                         IpatchItem *src,
                                                         GError **err);

Setup a paste operation. Multiple item pastes can occur for the same paste instance. Existing duplicated items are used if present (example: if multiple instruments are pasted between different IpatchBase objects and they link to the same sample, they will both use the same sample in the final paste operation).

paste :

Paste object

dest :

Destination item of paste

src :

Source item of paste

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set)

ipatch_paste_resolve ()

gboolean            ipatch_paste_resolve                (IpatchPaste *paste,
                                                         IpatchPasteResolveFunc resolve_func,
                                                         gpointer user_data);

This function is used to make choices as to how conflicts are resolved. Conflicting objects are those with identical unique property values. For each conflicting object that would result from a paste, the resolve_func is called allowing a choice to be made as to how it is handled. The default choice is to ignore the duplicate, resulting in conflicting objects. This function can be executed multiple times, the choices are only executed once ipatch_paste_finish() is called.

paste :

Paste object

resolve_func :

Resolve callback function which is invoked for each conflict.

user_data :

User defined data to pass to resolve_func.

Returns :

TRUE on success, FALSE if operation was canceled (resolve_func returned IPATCH_PASTE_CHOICE_CANCEL).

ipatch_paste_finish ()

gboolean            ipatch_paste_finish                 (IpatchPaste *paste,
                                                         GError **err);

Complete the paste operation(s) (add/link objects). Conflicts are handled for the choices made with ipatch_paste_resolve() (defaults to ignore which will result in conflicts).

paste :

Paste object

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_paste_get_add_list ()

IpatchList *        ipatch_paste_get_add_list           (IpatchPaste *paste);

Get list of objects to add with paste operation. This can be called after ipatch_paste_objects() or after ipatch_paste_finish(). In the first case the objects have not yet been added, in the second case the paste operation has been completed. The list of objects returned are only those which are not conflicting or a choice of IPATCH_PASTE_CHOICE_IGNORE or IPATCH_PASTE_CHOICE_REPLACE was selected.

paste :

Paste object

Returns :

List of objects being added with paste operation or NULL if none. Returned list has a refcount of 1 which the caller owns, unref when done.

ipatch_paste_object_add ()

void                ipatch_paste_object_add             (IpatchPaste *paste,
                                                         IpatchItem *additem,
                                                         IpatchContainer *parent,
                                                         IpatchItem *orig);

Used by IpatchPasteExecFunc handlers. Adds an object addition operation to a paste instance.

paste :

Paste object

additem :

New item to add.

parent :

Container to parent additem to.

orig :

Original item associated with additem (if duplicated for example). If supplied then an association between the orig object and the additem will be made, and any references to orig of subsequent deep duplications will use the new additem instead.

ipatch_paste_object_add_duplicate ()

IpatchItem *        ipatch_paste_object_add_duplicate   (IpatchPaste *paste,
                                                         IpatchItem *item,
                                                         IpatchContainer *parent);

Used by IpatchPasteExecFunc handlers. Duplicates an item and adds an addition operation to a paste instance. Useful for duplicating an object within the same IpatchBase parent. For this reason the duplicated item is automatically forced to be unique and no association is added for item to the new duplicate.

paste :

Paste object

item :

Item to duplicate and add

parent :

Container to parent duplicated item to.

Returns :

The new duplicate of item (no reference added for caller).

ipatch_paste_object_add_duplicate_deep ()

IpatchItem *        ipatch_paste_object_add_duplicate_deep
                                                        (IpatchPaste *paste,
                                                         IpatchItem *item,
                                                         IpatchContainer *parent);

Used by IpatchPasteExecFunc handlers. Deep duplicates item and registers it as an add to parent in the paste operation, also registers all new duplicated dependencies of item. Any existing matching duplicate items in the paste instance are used rather than duplicating them again.

paste :

Paste object

item :

Item to deep duplicate and add.

parent :

Container to parent item to.

Returns :

The new duplicate of item (no reference added for caller).

ipatch_paste_object_add_convert ()

gboolean            ipatch_paste_object_add_convert     (IpatchPaste *paste,
                                                         GType conv_type,
                                                         IpatchItem *item,
                                                         IpatchContainer *parent,
                                                         IpatchList **item_list,
                                                         GError **err);

Used by IpatchPasteExecFunc handlers. Converts item using an IpatchConverter of type conv_type and registers it as an add to parent in the paste operation, also registers all new dependencies of item. Any existing matching converted item dependencies in the paste instance are used rather than duplicating them again.

paste :

Paste object

conv_type :

IpatchConverter derived type to use for conversion.

item :

Item to convert and add.

parent :

Container to parent converted item to.

item_list :

Location to store pointer to the list of added items or NULL to ignore. Caller owns a reference to the list.

err :

Location to store error info or NULL to ignore.

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).

ipatch_paste_object_link ()

void                ipatch_paste_object_link            (IpatchPaste *paste,
                                                         IpatchItem *from,
                                                         IpatchItem *to);

Used by IpatchPasteExecFunc handlers. Registers a link operation.

paste :

Paste object

from :

Item to link from

to :

Item to link to

ipatch_paste_default_test_func ()

gboolean            ipatch_paste_default_test_func      (IpatchItem *dest,
                                                         IpatchItem *src);

Default IpatchPasteTestFunc. Useful for alternative paste implementations which would like to chain to the default function (to override only specific object types for example).

dest :

Destination item of paste operation

src :

Source item of paste operation

Returns :

TRUE if paste supported by this handler, FALSE otherwise

ipatch_paste_default_exec_func ()

gboolean            ipatch_paste_default_exec_func      (IpatchPaste *paste,
                                                         IpatchItem *dest,
                                                         IpatchItem *src,
                                                         GError **err);

Default IpatchPasteExecFunc. Useful for alternative paste implementations which would like to chain to the default function (to override only specific object types for example).

paste :

Paste object

src :

Source object of paste

dest :

Destination object of paste

err :

Location to store error info or NULL

Returns :

TRUE on success, FALSE otherwise (in which case err may be set).
libinstpatch-1.0.0/docs/reference/html/IpatchVBankInst.html0000644000175000017500000004230511461404256020634 00000000000000 IpatchVBankInst

IpatchVBankInst

IpatchVBankInst — VBank instrument item

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchVBankInst

Properties

  "bank"                     gint                  : Read / Write
  "name"                     gchar*                : Read / Write
  "program"                  gint                  : Read / Write

Description

VBank instruments are children of IpatchVBank objects and define individual instruments mapped to MIDI bank/program numbers and which reference items in other instrument files.

Details

IpatchVBankInst

typedef struct _IpatchVBankInst IpatchVBankInst;

IPATCH_VBANK_INST_NAME_SIZE

#define IPATCH_VBANK_INST_NAME_SIZE	64

Maximum length of a virtual bank instrument name.


ipatch_vbank_inst_new ()

IpatchVBankInst *   ipatch_vbank_inst_new               (void);

Create a new virtual bank instrument object.

Returns :

New VBank instrument with a reference count of 1. Caller owns the reference and removing it will destroy the item.

ipatch_vbank_inst_get_regions()

#define             ipatch_vbank_inst_get_regions(inst)

ipatch_vbank_inst_first ()

IpatchVBankInst *   ipatch_vbank_inst_first             (IpatchIter *iter);

Gets the first item in an instrument iterator. A convenience wrapper for ipatch_iter_first().

iter :

Patch item iterator containing IpatchVBankInst items

Returns :

The first instrument in iter or NULL if empty.

ipatch_vbank_inst_next ()

IpatchVBankInst *   ipatch_vbank_inst_next              (IpatchIter *iter);

Gets the next item in an instrument iterator. A convenience wrapper for ipatch_iter_next().

iter :

Patch item iterator containing IpatchVBankInst items

Returns :

The next instrument in iter or NULL if at the end of the list.

ipatch_vbank_inst_new_region ()

void                ipatch_vbank_inst_new_region        (IpatchVBankInst *inst,
                                                         IpatchItem *item);

A convenience function for creating a new virtual bank region, adding it to inst and setting the region's referenced item to item.

inst :

VBank instrument

item :

Referenced item for new region

ipatch_vbank_inst_set_midi_locale ()

void                ipatch_vbank_inst_set_midi_locale   (IpatchVBankInst *inst,
                                                         int bank,
                                                         int program);

Sets the MIDI locale of an instrument (bank and program numbers).

inst :

Virtual bank instrument to set MIDI locale of

bank :

MIDI bank number to assign to instrument

program :

MIDI program number to assign to instrument

ipatch_vbank_inst_get_midi_locale ()

void                ipatch_vbank_inst_get_midi_locale   (IpatchVBankInst *inst,
                                                         int *bank,
                                                         int *program);

Gets the MIDI locale of a virtual bank instrument (bank and program numbers).

inst :

Virtual bank instrument to get MIDI locale from

bank :

Location to store instrument's MIDI bank number or NULL

program :

Location to store instrument's MIDI program number or NULL

ipatch_vbank_inst_compare ()

int                 ipatch_vbank_inst_compare           (const IpatchVBankInst *p1,
                                                         const IpatchVBankInst *p2);

Virtual bank instrument comparison function for sorting. Compare two instruments by their MIDI bank:program numbers. Note that this function is compatible with GCompareFunc and can therefore be used with g_list_sort, etc.

p1 :

First instrument in comparison

p2 :

Second instrument in comparison

Returns :

Comparison result that is less than, equal to, or greater than zero if p1 is found, respectively, to be less than, to match, or be greater than p2.

Property Details

The "bank" property

  "bank"                     gint                  : Read / Write

MIDI bank number.

Allowed values: [0,128]

Default value: 0


The "name" property

  "name"                     gchar*                : Read / Write

Name.

Default value: NULL


The "program" property

  "program"                  gint                  : Read / Write

MIDI program number.

Allowed values: [0,127]

Default value: 0

See Also

#IpatchVBank
libinstpatch-1.0.0/docs/reference/html/libinstpatch-IpatchGigEffects.html0000644000175000017500000004013111461404256023460 00000000000000 IpatchGigEffects

IpatchGigEffects

IpatchGigEffects — GigaSampler instrument parameters and effects

Stability Level

Stable, unless otherwise indicated

Description

Functions and types for GigaSampler instrument parameters and effects.

Details

IpatchGigEffects

typedef struct {
  guint32 unknown1;		/* byte 0-3, always 0x0000008C? */
  guint32 unknown7;		/* byte 44-47 */
  guint32 unknown14;		/* byte 100-103 */

  guint16 unknown2;		/* byte 12-13 */
  guint16 unknown3;		/* byte 16-17 */
  guint16 unknown4;		/* byte 20-21 */
  guint16 unknown5;		/* byte 24-25 */
  guint16 unknown6;		/* byte 36-37 */
  guint16 unknown8;		/* byte 60-61 */
  guint16 unknown9;		/* byte 68-69 */
  guint16 unknown10;		/* byte 76-77 */
  guint16 unknown11;		/* byte 84-85 */
  guint16 unknown13;		/* byte 98-99 */
  guint16 unknown15;		/* byte 106-107 */
  guint16 unknown17;		/* byte 116-117 */
  guint16 unknown18;		/* byte 122-123 */
  guint16 unknown20;		/* byte 126-127 */

  guint8 unknown12;		/* byte 93 */
  guint8 unknown16;		/* byte 111 */
  guint8 unknown19;		/* byte 125 */
  guint8 unknown21;		/* byte 129 */
  guint8 unknown22;		/* byte 130 */
  guint8 unknown23;		/* byte 135 */

  /* EG1 - Volume envelope */
  guint16 eg1_pre_attack;	/* 10th percent */
  guint16 eg1_sustain;		/* 10th percent */
  guint32 eg1_attack;		/* timecents */
  guint32 eg1_decay;		/* timecents */
  guint32 eg1_decay2;		/* timecents (where is the "inf" flag?) */
  guint32 eg1_release;		/* timecents */
  guint8 eg1_hold;		/* bit 8=1:true */

  /* EG2 - Filter envelope */
  guint16 eg2_pre_attack;	/* 10th percent */
  guint16 eg2_sustain;		/* 10th percent */
  guint32 eg2_attack;		/* timecents */
  guint32 eg2_decay;		/* timecents */
  guint32 eg2_decay2;		/* timecents */
  guint32 eg2_release;		/* timecents */

  /* EG3 - Pitch envelope */
  guint32 eg3_attack;		/* timecents */
  guint16 eg3_depth;		/* 12 bit signed (cents) */

  /* LFO1 - Volume LFO */
  guint16 lfo1_internal_depth;	/* 0-1200 */
  guint32 lfo1_freq;		/* pitch cents */
  guint16 lfo1_ctrl_depth;	/* 0-1200 */
  guint8 lfo1_ctrl;
  /* 0=internal, 1=mod wheel, 2=breath ctrl, 3=internal/mod wheel,
     4=internal/breath ctrl */
  /* bit 8=1:flip phase */
  /* bit 7=1:synch */
  /* bits 5 en 6: Res midictrl: 0=18, 1=19, 2=80, 3=81 */

  /* LFO2 - Filter LFO */
  guint8 lfo2_ctrl;
  /* 0=internal, 1=mod wheel, 2=breath ctrl, 3=internal/mod wheel,
     4=internal/breath ctrl */
  /* bit 6=1:synch */
  /* bit 8=1:flip phase */
  /* bit 7=1:Resonance midi ctrl */

  guint32 lfo2_freq;		/* pitch cents */
  guint16 lfo2_internal_depth;	/* 0-1200 */
  guint16 lfo2_ctrl_depth;	/* 0-1200 */

  /* LFO3 - Pitch LFO */
  guint32 lfo3_freq;		/* pitch cents */
  guint16 lfo3_internal_depth;	/* cents */
  guint16 lfo3_ctrl_depth;	/* cents */
  guint8 lfo3_ctrl; /* bit 6: LFO3 synch  bit 8:invert attentuation ctrl */


  /* filter parameters */
  guint8 filter_type; /* 0=lowpass, 1=bandpass, 2=highpass, 3=bandreject */
  guint8 turbo_lowpass; /* bit 7=0: on */
  guint8 filter_cutoff; /* bit 8=1:on */
  guint8 filter_midi_ctrl; /* bit 8=1:use ctrl  rest 0:aftertouch */
  guint8 filter_vel_scale;
  guint8 filter_resonance; /* bit 8=0:dynamic */
  guint8 filter_breakpoint; /* bit 8=1:keyboard tracking */

  /* velocity parameters */
  guint8 vel_response; /* 0-4 = nonlinear, 5-9 = linear, 10-14 = special */
  guint8 vel_dyn_range;

  /* release velocity paramaters */
  guint8 release_vel_response; /* 0-4 = nonlinear, 5-9 = linear, 10-14 = special */
  /* release velocity dynamic range? */

  guint8 release_trigger_decay;

  guint8 attn_ctrl;	      /* bit 1:on, rest=ctrl, 0xFF=velocity */
  guint8 max_velocity;		/* Used for velocity split */

  guint16 sample_offset;
  guint8 pitch_track_dim_bypass; /* bit 0=0: pitch track */
				/* 0x10/0x20=dim bypass ctrl 94/95 */
  guint8 layer_pan;		/* 7-bit signed */
  guint8 self_mask;		/* 1=true */
  guint8 channel_offset;	/* (*4) */
  guint8 sust_defeat;		/* 2=on */
} IpatchGigEffects;

enum IpatchGigFilterType

typedef enum
{
  IPATCH_GIG_FILTER_LOWPASS = 0,
  IPATCH_GIG_FILTER_BANDPASS = 1,
  IPATCH_GIG_FILTER_HIGHPASS = 2,
  IPATCH_GIG_FILTER_BANDREJECT = 3
} IpatchGigFilterType;

enum IpatchGigControlType

typedef enum
{
  IPATCH_GIG_CTRL_MOD_WHEEL       = 0x01,
  IPATCH_GIG_CTRL_BREATH          = 0x02,
  IPATCH_GIG_CTRL_FOOT            = 0x04,
  IPATCH_GIG_CTRL_PORTAMENTO_TIME = 0x05,
  IPATCH_GIG_CTRL_EFFECT_1        = 0x0C,
  IPATCH_GIG_CTRL_EFFECT_2        = 0x0D,
  IPATCH_GIG_CTRL_GEN_PURPOSE_1   = 0x10,
  IPATCH_GIG_CTRL_GEN_PURPOSE_2   = 0x11,
  IPATCH_GIG_CTRL_GEN_PURPOSE_3   = 0x12,
  IPATCH_GIG_CTRL_GEN_PURPOSE_4   = 0x13,
  IPATCH_GIG_CTRL_SUSTAIN_PEDAL   = 0x40,
  IPATCH_GIG_CTRL_PORTAMENTO      = 0x41,
  IPATCH_GIG_CTRL_SOSTENUTO       = 0x42,
  IPATCH_GIG_CTRL_SOFT_PEDAL      = 0x43,
  IPATCH_GIG_CTRL_GEN_PURPOSE_5   = 0x50,
  IPATCH_GIG_CTRL_GEN_PURPOSE_6   = 0x51,
  IPATCH_GIG_CTRL_GEN_PURPOSE_7   = 0x52,
  IPATCH_GIG_CTRL_GEN_PURPOSE_8   = 0x53,
  IPATCH_GIG_CTRL_EFFECT_DEPTH_1  = 0x5B,
  IPATCH_GIG_CTRL_EFFECT_DEPTH_2  = 0x5C,
  IPATCH_GIG_CTRL_EFFECT_DEPTH_3  = 0x5D,
  IPATCH_GIG_CTRL_EFFECT_DEPTH_4  = 0x5E,
  IPATCH_GIG_CTRL_EFFECT_DEPTH_5  = 0x5F
} IpatchGigControlType;

ipatch_gig_parse_effects ()

void                ipatch_gig_parse_effects            (IpatchFileHandle *handle,
                                                         IpatchGigEffects *effects);

Parse an 3ewa GigaSampler effects chunk into a structure.

handle :

File handle containing buffered 3ewa data

effects :

Pointer to a user supplied GigaSampler effects structure to fill

ipatch_gig_store_effects ()

void                ipatch_gig_store_effects            (IpatchFileHandle *handle,
                                                         IpatchGigEffects *effects);

ipatch_gig_effects_init ()

void                ipatch_gig_effects_init             (IpatchGigEffects *effects);

Initialize GigaSampler effects structure to default values.

effects :

GigaSampler effects structure

ipatch_gig_effects_to_gen_array ()

void                ipatch_gig_effects_to_gen_array     (IpatchGigEffects *effects,
                                                         IpatchSF2GenArray *array);

Convert GigaSampler effects structure to SoundFont generator array

effects :

GigaSampler effects structure

array :

SoundFont generator array

ipatch_gig_to_sf2_timecents ()

guint16             ipatch_gig_to_sf2_timecents         (gint32 gig_tc);

Convert GigaSampler timecents to SoundFont timecents.

gig_tc :

Amount in GigaSampler timecents

Returns :

SoundFont timecent value

ipatch_gig_volsust_to_sf2_centibels ()

guint16             ipatch_gig_volsust_to_sf2_centibels (guint gig_tperc);

Convert GigaSampler volume sustain (tenth percent units) to centibels (10th of a decibel).

gig_tperc :

Tenth percent sustain level

Returns :

SoundFont centibels value
libinstpatch-1.0.0/docs/reference/html/IpatchSndFile.html0000644000175000017500000003257411461404256020330 00000000000000 IpatchSndFile

IpatchSndFile

IpatchSndFile — libsndfile file object

Stability Level

Stable, unless otherwise indicated

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchFile
               +----IpatchSndFile

Description

Object type for libsndfile audio file identification.

Details

IPATCH_TYPE_SND_FILE_FORMAT

#define             IPATCH_TYPE_SND_FILE_FORMAT

IPATCH_TYPE_SND_FILE_SUB_FORMAT

#define             IPATCH_TYPE_SND_FILE_SUB_FORMAT

enum IpatchSndFileEndian

typedef enum
{
  IPATCH_SND_FILE_ENDIAN_FILE,
  IPATCH_SND_FILE_ENDIAN_LITTLE,
  IPATCH_SND_FILE_ENDIAN_BIG,
  IPATCH_SND_FILE_ENDIAN_CPU
} IpatchSndFileEndian;

Endian byte order libsndfile enum.

IPATCH_SND_FILE_ENDIAN_FILE

Use the default endian for the file format

IPATCH_SND_FILE_ENDIAN_LITTLE

Little endian byte order

IPATCH_SND_FILE_ENDIAN_BIG

Big endian byte order

IPATCH_SND_FILE_ENDIAN_CPU

Native CPU byte order

IPATCH_SND_FILE_DEFAULT_FORMAT

#define IPATCH_SND_FILE_DEFAULT_FORMAT     SF_FORMAT_WAV

Default file format enum for IPATCH_TYPE_SND_FILE_FORMAT.


IPATCH_SND_FILE_DEFAULT_SUB_FORMAT

#define IPATCH_SND_FILE_DEFAULT_SUB_FORMAT SF_FORMAT_PCM_16

Default file sub format enum for IPATCH_TYPE_SND_FILE_SUB_FORMAT.


IPATCH_SND_FILE_DEFAULT_ENDIAN

#define IPATCH_SND_FILE_DEFAULT_ENDIAN     IPATCH_SND_FILE_ENDIAN_FILE

Default endian byte order from enum IPATCH_TYPE_SND_FILE_ENDIAN.


IpatchSndFile

typedef struct _IpatchSndFile IpatchSndFile;

ipatch_snd_file_new ()

IpatchSndFile *     ipatch_snd_file_new                 (void);

Create a new libsndfile file object.

Returns :

New libsndfile file object (derived from IpatchFile) with a reference count of 1. Caller owns the reference and removing it will destroy the item.

ipatch_snd_file_format_get_type ()

GType               ipatch_snd_file_format_get_type     (void);

ipatch_snd_file_sub_format_get_type ()

GType               ipatch_snd_file_sub_format_get_type (void);

ipatch_snd_file_format_get_sub_formats ()

int *               ipatch_snd_file_format_get_sub_formats
                                                        (int format,
                                                         guint *size);

Get supported sub formats of a given libsndfile format.

format :

"IpatchSndFileFormat" GEnum to get sub formats of

size :

Location to store size of returned sub formats array

Returns :

Newly allocated list of sub format enum values or NULL if format is invalid

ipatch_snd_file_sample_format_to_sub_format ()

int                 ipatch_snd_file_sample_format_to_sub_format
                                                        (int sample_format,
                                                         int file_format);

Get the optimal libsndfile sub format for a libinstpatch sample format. The returned value may not be an exact equivalent, in the case of unsigned sample data with bit widths greater than 8, but will return the optimal format in those cases. If file_format is not -1 then the resulting sub format is guaranteed to be valid for it.

sample_format :

libinstpatch sample format (see sample)

file_format :

libsndfile format GEnum "IpatchSndFileFormat" value or -1 to not limit sub formats to a given file format.

Returns :

Optimal libsndfile sub format enum value or -1 on error (invalid sample_format).
libinstpatch-1.0.0/docs/reference/libinstpatch.types0000644000175000017500000000333111461404255017557 00000000000000#include #include #include ipatch_base_get_type ipatch_container_get_type ipatch_converter_get_type ipatch_dls2_conn_get_type ipatch_dls2_get_type ipatch_dls2_inst_get_type ipatch_dls2_region_get_type ipatch_dls2_sample_get_type ipatch_dls_file_get_type ipatch_dls_reader_get_type ipatch_dls_writer_get_type ipatch_file_get_type ipatch_gig_dimension_get_type ipatch_gig_file_get_type ipatch_gig_get_type ipatch_gig_inst_get_type ipatch_gig_region_get_type ipatch_gig_sample_get_type ipatch_gig_sub_region_get_type ipatch_item_get_type ipatch_iter_get_type ipatch_list_get_type ipatch_param_spec_range_get_type ipatch_paste_get_type ipatch_range_get_type ipatch_riff_get_type ipatch_sample_data_get_type ipatch_sample_get_type ipatch_sample_list_get_type ipatch_sample_store_cache_get_type ipatch_sample_store_file_get_type ipatch_sample_store_get_type ipatch_sample_store_ram_get_type ipatch_sample_store_rom_get_type ipatch_sample_store_snd_file_get_type ipatch_sample_store_split24_get_type ipatch_sample_store_swap_get_type ipatch_sample_store_virtual_get_type ipatch_sf2_file_get_type ipatch_sf2_gen_array_get_type ipatch_sf2_gen_item_get_type ipatch_sf2_get_type ipatch_sf2_inst_get_type ipatch_sf2_izone_get_type ipatch_sf2_mod_get_type ipatch_sf2_mod_item_get_type ipatch_sf2_mod_list_get_type ipatch_sf2_preset_get_type ipatch_sf2_pzone_get_type ipatch_sf2_reader_get_type ipatch_sf2_sample_get_type ipatch_sf2_voice_cache_get_type ipatch_sf2_writer_get_type ipatch_sf2_zone_get_type ipatch_snd_file_format_get_type ipatch_snd_file_get_type ipatch_snd_file_sub_format_get_type ipatch_vbank_get_type ipatch_vbank_inst_get_type ipatch_vbank_region_get_type ipatch_virtual_container_get_type libinstpatch-1.0.0/docs/Makefile.in0000644000175000017500000004450511461360570014125 00000000000000# Makefile.in generated by automake 1.11 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 = docs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/python.m4 \ $(top_srcdir)/acinclude.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)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ IPATCH_BINARY_AGE = @IPATCH_BINARY_AGE@ IPATCH_INTERFACE_AGE = @IPATCH_INTERFACE_AGE@ IPATCH_VERSION = @IPATCH_VERSION@ IPATCH_VERSION_MAJOR = @IPATCH_VERSION_MAJOR@ IPATCH_VERSION_MICRO = @IPATCH_VERSION_MICRO@ IPATCH_VERSION_MINOR = @IPATCH_VERSION_MINOR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ 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@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ PYGTK_CODEGEN_DIR = @PYGTK_CODEGEN_DIR@ PYGTK_LIBS = @PYGTK_LIBS@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ SNDFILE_LIBS = @SNDFILE_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ 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@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ 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@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = reference MAINTAINERCLEANFILES = Makefile.in all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(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 docs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docs/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ 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: ctags-recursive $(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 distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean distclean-generic \ distclean-libtool distclean-tags distdir 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-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # 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: libinstpatch-1.0.0/docs/Makefile.am0000644000175000017500000000016211456655761014120 00000000000000## Process this file with automake to produce Makefile.in SUBDIRS = reference MAINTAINERCLEANFILES = Makefile.in libinstpatch-1.0.0/install-sh0000755000175000017500000003253711456655763013155 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libinstpatch-1.0.0/ltmain.sh0000755000175000017500000073337411461360425012763 00000000000000# Generated from ltmain.m4sh. # ltmain.sh (GNU libtool) 2.2.6 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print informational messages (default) # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.2.6 Debian-2.2.6a-4 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . PROGRAM=ltmain.sh PACKAGE=libtool VERSION="2.2.6 Debian-2.2.6a-4" TIMESTAMP="" package_revision=1.3012 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # NLS nuisances: We save the old values to restore during execute mode. # Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done $lt_unset CDPATH : ${CP="cp -f"} : ${ECHO="echo"} : ${EGREP="/bin/grep -E"} : ${FGREP="/bin/grep -F"} : ${GREP="/bin/grep"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SED="/bin/sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } # Generated shell functions inserted here. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: # In the unlikely event $progname began with a '-', it would play havoc with # func_echo (imagine progname=-n), so we prepend ./ in that case: func_dirname_and_basename "$progpath" progname=$func_basename_result case $progname in -*) progname=./$progname ;; esac # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=: for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname${mode+: }$mode: $*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` done my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "X$my_tmpdir" | $Xsed } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "X$1" | $Xsed \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_version # Echo version message to standard output and exit. func_version () { $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED -n '/^# Usage:/,/# -h/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" $ECHO $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help # Echo long help message to standard output and exit. func_help () { $SED -n '/^# Usage:/,/# Report bugs to/ { s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p }' < "$progpath" exit $? } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } exit_cmd=: # Check that we have a working $ECHO. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then # Yippee, $ECHO works! : else # Restart under the correct shell, and then maybe $ECHO will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" opt_debug='set -x' $opt_debug ;; -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" shift ;; --dry-run | -n) opt_dry_run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; relink) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" opt_silent=: ;; --verbose| -v) preserve_args="$preserve_args $opt" opt_silent=false ;; --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: -dlopen=*|--mode=*|--tag=*) func_opt_split "$opt" set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} shift ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } ## ----------- ## ## Main. ## ## ----------- ## $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." } # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_ltwrapper_scriptname_result="" if func_ltwrapper_executable_p "$1"; then func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" fi } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_quote_for_eval "$arg" CC_quoted="$CC_quoted $func_quote_for_eval_result" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_quote_for_eval "$arg" CC_quoted="$CC_quoted $func_quote_for_eval_result" done case "$@ " in " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T <?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi removelist="$removelist $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist removelist="$removelist $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir command="$command -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" fi # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $ECHO $ECHO "Try \`$progname --help' for more information about other modes." exit $? } # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $execute_dlfiles; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_quote_for_eval "$file" args="$args $func_quote_for_eval_result" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" $ECHO "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS $ECHO "X----------------------------------------------------------------------" | $Xsed $ECHO "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done $ECHO $ECHO "If you ever happen to want to link against installed libraries" $ECHO "in a given directory, LIBDIR, you must either use libtool, and" $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" $ECHO "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" $ECHO " during execution" fi if test -n "$runpath_var"; then $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" $ECHO " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $ECHO $ECHO "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" $ECHO "pages." ;; *) $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac $ECHO "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS } test "$mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $ECHO "X$nonopt" | $GREP shtool >/dev/null; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" install_prog="$install_prog$func_quote_for_eval_result" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" install_prog="$install_prog $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do func_verbose "extracting global C symbols from \`$progfile'" $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" } done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $ECHO >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; " case $host in *cygwin* | *mingw* | *cegcc* ) $ECHO >> "$output_objdir/$my_dlsyms" "\ /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */" lt_dlsym_const= ;; *osf5*) echo >> "$output_objdir/$my_dlsyms" "\ /* This system does not cope well with relocations in const data */" lt_dlsym_const= ;; *) lt_dlsym_const=const ;; esac $ECHO >> "$output_objdir/$my_dlsyms" "\ extern $lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; $lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac $ECHO >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) symtab_cflags="$symtab_cflags $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper_part1 [arg=no] # # Emit the first part of a libtool wrapper script on stdout. # For more information, see the description associated with # func_emit_wrapper(), below. func_emit_wrapper_part1 () { func_emit_wrapper_part1_arg1=no if test -n "$1" ; then func_emit_wrapper_part1_arg1=$1 fi $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then ECHO=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then # Yippee, \$ECHO works! : else # Restart under the correct shell, and then maybe \$ECHO will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $ECHO "\ # Find the directory that this script lives in. thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done " } # end: func_emit_wrapper_part1 # func_emit_wrapper_part2 [arg=no] # # Emit the second part of a libtool wrapper script on stdout. # For more information, see the description associated with # func_emit_wrapper(), below. func_emit_wrapper_part2 () { func_emit_wrapper_part2_arg1=no if test -n "$1" ; then func_emit_wrapper_part2_arg1=$1 fi $ECHO "\ # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # end: func_emit_wrapper_part2 # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=no if test -n "$1" ; then func_emit_wrapper_arg1=$1 fi # split this up so that func_emit_cwrapperexe_src # can call each part independently. func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" } # func_to_host_path arg # # Convert paths to host format when used with build tools. # Intended for use with "native" mingw (where libtool itself # is running under the msys shell), or in the following cross- # build environments: # $build $host # mingw (msys) mingw [e.g. native] # cygwin mingw # *nix + wine mingw # where wine is equipped with the `winepath' executable. # In the native mingw case, the (msys) shell automatically # converts paths for any non-msys applications it launches, # but that facility isn't available from inside the cwrapper. # Similar accommodations are necessary for $host mingw and # $build cygwin. Calling this function does no harm for other # $host/$build combinations not listed above. # # ARG is the path (on $build) that should be converted to # the proper representation for $host. The result is stored # in $func_to_host_path_result. func_to_host_path () { func_to_host_path_result="$1" if test -n "$1" ; then case $host in *mingw* ) lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' case $build in *mingw* ) # actually, msys # awkward: cmd appends spaces to result lt_sed_strip_trailing_spaces="s/[ ]*\$//" func_to_host_path_tmp1=`( cmd //c echo "$1" |\ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` ;; *cygwin* ) func_to_host_path_tmp1=`cygpath -w "$1"` func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` ;; * ) # Unfortunately, winepath does not exit with a non-zero # error code, so we are forced to check the contents of # stdout. On the other hand, if the command is not # found, the shell will set an exit code of 127 and print # *an error message* to stdout. So we must check for both # error code of zero AND non-empty stdout, which explains # the odd construction: func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` else # Allow warning below. func_to_host_path_result="" fi ;; esac if test -z "$func_to_host_path_result" ; then func_error "Could not determine host path corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_path_result="$1" fi ;; esac fi } # end: func_to_host_path # func_to_host_pathlist arg # # Convert pathlists to host format when used with build tools. # See func_to_host_path(), above. This function supports the # following $build/$host combinations (but does no harm for # combinations not listed here): # $build $host # mingw (msys) mingw [e.g. native] # cygwin mingw # *nix + wine mingw # # Path separators are also converted from $build format to # $host format. If ARG begins or ends with a path separator # character, it is preserved (but converted to $host format) # on output. # # ARG is a pathlist (on $build) that should be converted to # the proper representation on $host. The result is stored # in $func_to_host_pathlist_result. func_to_host_pathlist () { func_to_host_pathlist_result="$1" if test -n "$1" ; then case $host in *mingw* ) lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_to_host_pathlist_tmp2="$1" # Once set for this call, this variable should not be # reassigned. It is used in tha fallback case. func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e 's|^:*||' -e 's|:*$||'` case $build in *mingw* ) # Actually, msys. # Awkward: cmd appends spaces to result. lt_sed_strip_trailing_spaces="s/[ ]*\$//" func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e "$lt_sed_naive_backslashify"` ;; *cygwin* ) func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e "$lt_sed_naive_backslashify"` ;; * ) # unfortunately, winepath doesn't convert pathlists func_to_host_pathlist_result="" func_to_host_pathlist_oldIFS=$IFS IFS=: for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do IFS=$func_to_host_pathlist_oldIFS if test -n "$func_to_host_pathlist_f" ; then func_to_host_path "$func_to_host_pathlist_f" if test -n "$func_to_host_path_result" ; then if test -z "$func_to_host_pathlist_result" ; then func_to_host_pathlist_result="$func_to_host_path_result" else func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" fi fi fi IFS=: done IFS=$func_to_host_pathlist_oldIFS ;; esac if test -z "$func_to_host_pathlist_result" ; then func_error "Could not determine the host path(s) corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This may break if $1 contains DOS-style drive # specifications. The fix is not to complicate the expression # below, but for the user to provide a working wine installation # with winepath so that path translation in the cross-to-mingw # case works properly. lt_replace_pathsep_nix_to_dos="s|:|;|g" func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ $SED -e "$lt_replace_pathsep_nix_to_dos"` fi # Now, add the leading and trailing path separators back case "$1" in :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" ;; esac case "$1" in *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" ;; esac ;; esac fi } # end: func_to_host_pathlist # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include # define setmode _setmode #else # include # include # ifdef __CYGWIN__ # include # define HAVE_SETENV # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif # endif #endif #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif #ifdef _MSC_VER # define S_IXUSR _S_IEXEC # define stat _stat # ifndef _INTPTR_T_DEFINED # define intptr_t int # endif #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifdef __CYGWIN__ # define FOPEN_WB "wb" #endif #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #undef LTWRAPPER_DEBUGPRINTF #if defined DEBUGWRAPPER # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args static void ltwrapper_debugprintf (const char *fmt, ...) { va_list args; va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } #else # define LTWRAPPER_DEBUGPRINTF(args) #endif const char *program_name = NULL; void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_fatal (const char *message, ...); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_opt_process_env_set (const char *arg); void lt_opt_process_env_prepend (const char *arg); void lt_opt_process_env_append (const char *arg); int lt_split_name_value (const char *arg, char** name, char** value); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); static const char *script_text_part1 = EOF func_emit_wrapper_part1 yes | $SED -e 's/\([\\"]\)/\\\1/g' \ -e 's/^/ "/' -e 's/$/\\n"/' echo ";" cat <"))); for (i = 0; i < newargc; i++) { LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); } EOF case $host_os in mingw*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); if (rval == -1) { /* failed to start process */ LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); return 127; } return rval; EOF ;; *) cat <<"EOF" execv (lt_argv_zero, newargz); return rval; /* =127, but avoids unused variable warning */ EOF ;; esac cat <<"EOF" } void * xmalloc (size_t num) { void *p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char) name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable (const char *path) { struct stat st; LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!")); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!")); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", tmp_pathspec)); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { char *errstr = strerror (errno); lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal ("Could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } void lt_setenv (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", (name ? name : ""), (value ? value : ""))); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } int lt_split_name_value (const char *arg, char** name, char** value) { const char *p; int len; if (!arg || !*arg) return 1; p = strchr (arg, (int)'='); if (!p) return 1; *value = xstrdup (++p); len = strlen (arg) - strlen (*value); *name = XMALLOC (char, len); strncpy (*name, arg, len-1); (*name)[len - 1] = '\0'; return 0; } void lt_opt_process_env_set (const char *arg) { char *name = NULL; char *value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); } lt_setenv (name, value); XFREE (name); XFREE (value); } void lt_opt_process_env_prepend (const char *arg) { char *name = NULL; char *value = NULL; char *new_value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); } new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); XFREE (name); XFREE (value); } void lt_opt_process_env_append (const char *arg) { char *name = NULL; char *value = NULL; char *new_value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); } new_value = lt_extend_str (getenv (name), value, 1); lt_setenv (name, new_value); XFREE (new_value); XFREE (name); XFREE (value); } void lt_update_exe_path (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", (name ? name : ""), (value ? value : ""))); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", (name ? name : ""), (value ? value : ""))); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF } # end: func_emit_cwrapperexe_src # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname '-L' '' "$arg" dir=$func_stripname_result if test -z "$dir"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot) compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" arg="$arg $wl$func_quote_for_eval_result" compiler_flags="$compiler_flags $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" arg="$arg $wl$func_quote_for_eval_result" compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" linker_flags="$linker_flags $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -F/path gives path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" compiler_flags="$compiler_flags $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *.la) func_source "$lib" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" dir=$func_stripname_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $ECHO $ECHO "*** Warning: Trying to link with static lib archive $deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because the file extensions .$libext of this argument makes me believe" $ECHO "*** that it is just a static archive that I should not use here." else $ECHO $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) temp_rpath="$temp_rpath$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded notinst_deplibs="$notinst_deplibs $lib" need_relink=no ;; *) if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $ECHO if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $ECHO $ECHO "*** And there doesn't seem to be a static archive available" $ECHO "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $ECHO $ECHO "*** Warning: This system can not link to static lib archive $lib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $ECHO "*** But as you try to build a module library, libtool will still create " $ECHO "*** a static module, that should work as long as the dlopening application" $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $ECHO $ECHO "*** However, this would only work if libtool was able to extract symbol" $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" $ECHO "*** not find such a program. So, this module is probably useless." $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_dirname "$deplib" "" "." dir="$func_dirname_result" # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $ECHO $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $ECHO $ECHO "*** Warning: linker path does not have real file for library $a_deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $ECHO $ECHO "*** Warning: linker path does not have real file for library $a_deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` done fi if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $ECHO if test "X$deplibs_check_method" = "Xnone"; then $ECHO "*** Warning: inter-library dependencies are not supported in this platform." else $ECHO "*** Warning: inter-library dependencies are not known to be supported." fi $ECHO "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $ECHO $ECHO "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" $ECHO "*** a static module, that should work as long as the dlopening" $ECHO "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $ECHO $ECHO "*** However, this would only work if libtool was able to extract symbol" $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" $ECHO "*** not find such a program. So, this module is probably useless." $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $ECHO "*** The inter-library dependencies that have been dropped here will be" $ECHO "*** automatically added whenever a program is linked with this library" $ECHO "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $ECHO $ECHO "*** Since this library must not contain undefined symbols," $ECHO "*** because either the platform does not support them or" $ECHO "*** it was explicitly requested with -no-undefined," $ECHO "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" delfiles="$delfiles $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" func_len " $cmd" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then func_show_eval "$cmd" 'exit $?' skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$ECHO "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" $ECHO 'INPUT (' > $output for obj in $save_libobjs do $ECHO "$obj" >> $output done $ECHO ')' >> $output delfiles="$delfiles $output" elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do $ECHO "$obj" >> $output done delfiles="$delfiles $output" output=$firstobj\"$file_list_spec$output\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=$obj func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi delfiles="$delfiles $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *cegcc) # Disable wrappers for cegcc, we are cross compiling anyway. wrappers_required=no ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $ECHO for shipping. if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else $ECHO "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$mode" = link || test "$mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) RM="$RM $arg"; rmforce=yes ;; -*) RM="$RM $arg" ;; *) files="$files $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then objdir="$origobjdir" else objdir="$dir/$origobjdir" fi func_basename "$file" name="$func_basename_result" test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result rmfiles="$rmfiles $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$mode" = uninstall || test "$mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 libinstpatch-1.0.0/depcomp0000755000175000017500000004426711456655763012531 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free # Software Foundation, Inc. # 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, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libinstpatch-1.0.0/compile0000755000175000017500000000532611456655763012523 00000000000000#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. # Copyright 1999, 2000 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: # compile PROGRAM [ARGS]... # `-o FOO.o' is removed from the args passed to the actual compile. prog=$1 shift ofile= cfile= args= while test $# -gt 0; do case "$1" in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we do something ugly here. ofile=$2 shift case "$ofile" in *.o | *.obj) ;; *) args="$args -o $ofile" ofile= ;; esac ;; *.c) cfile=$1 args="$args $1" ;; *) args="$args $1" ;; esac shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$prog" $args fi # Name of file we expect compiler to create. cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d while true; do if mkdir $lockdir > /dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir $lockdir; exit 1" 1 2 15 # Run the compile. "$prog" $args status=$? if test -f "$cofile"; then mv "$cofile" "$ofile" fi rmdir $lockdir exit $status libinstpatch-1.0.0/ABOUT-NLS0000644000175000017500000013023511456655763012372 00000000000000Notes on the Free Translation Project ************************************* Free software is going international! The Free Translation Project is a way to get maintainers of free software, translators, and users all together, so that will gradually become able to speak many languages. A few packages already provide translations for their messages. If you found this `ABOUT-NLS' file inside a distribution, you may assume that the distributed package does use GNU `gettext' internally, itself available at your nearest GNU archive site. But you do _not_ need to install GNU `gettext' prior to configuring, installing or using this package with messages translated. Installers will find here some useful hints. These notes also explain how users should proceed for getting the programs to use the available translations. They tell how people wanting to contribute and work at translations should contact the appropriate team. When reporting bugs in the `intl/' directory or bugs which may be related to internationalization, you should tell about the version of `gettext' which is used. The information can be found in the `intl/VERSION' file, in internationalized packages. Quick configuration advice ========================== If you want to exploit the full power of internationalization, you should configure it using ./configure --with-included-gettext to force usage of internationalizing routines provided within this package, despite the existence of internationalizing capabilities in the operating system where this package is being installed. So far, only the `gettext' implementation in the GNU C library version 2 provides as many features (such as locale alias, message inheritance, automatic charset conversion or plural form handling) as the implementation here. It is also not possible to offer this additional functionality on top of a `catgets' implementation. Future versions of GNU `gettext' will very likely convey even more functionality. So it might be a good idea to change to GNU `gettext' as soon as possible. So you need _not_ provide this option if you are using GNU libc 2 or you have installed a recent copy of the GNU gettext package with the included `libintl'. INSTALL Matters =============== Some packages are "localizable" when properly installed; the programs they contain can be made to speak your own native language. Most such packages use GNU `gettext'. Other packages have their own ways to internationalization, predating GNU `gettext'. By default, this package will be installed to allow translation of messages. It will automatically detect whether the system already provides the GNU `gettext' functions. If not, the GNU `gettext' own library will be used. This library is wholly contained within this package, usually in the `intl/' subdirectory, so prior installation of the GNU `gettext' package is _not_ required. Installers may use special options at configuration time for changing the default behaviour. The commands: ./configure --with-included-gettext ./configure --disable-nls will respectively bypass any pre-existing `gettext' to use the internationalizing routines provided within this package, or else, _totally_ disable translation of messages. When you already have GNU `gettext' installed on your system and run configure without an option for your new package, `configure' will probably detect the previously built and installed `libintl.a' file and will decide to use this. This might be not what is desirable. You should use the more recent version of the GNU `gettext' library. I.e. if the file `intl/VERSION' shows that the library which comes with this package is more recent, you should use ./configure --with-included-gettext to prevent auto-detection. The configuration process will not test for the `catgets' function and therefore it will not be used. The reason is that even an emulation of `gettext' on top of `catgets' could not provide all the extensions of the GNU `gettext' library. Internationalized packages have usually many `po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. Unless translations have been forbidden at `configure' time by using the `--disable-nls' switch, all available translations are installed together with the package. However, the environment variable `LINGUAS' may be set, prior to configuration, to limit the installed set. `LINGUAS' should then contain a space separated list of two-letter codes, stating which languages are allowed. Using This Package ================== As a user, if your language has been installed for this package, you only have to set the `LANG' environment variable to the appropriate `LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, and `CC' is an ISO 3166 two-letter country code. For example, let's suppose that you speak German and live in Germany. At the shell prompt, merely execute `setenv LANG de_DE' (in `csh'), `export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). This can be done from your `.login' or `.profile' file, once and for all. You might think that the country code specification is redundant. But in fact, some languages have dialects in different countries. For example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The country code serves to distinguish the dialects. The locale naming convention of `LL_CC', with `LL' denoting the language and `CC' denoting the country, is the one use on systems based on GNU libc. On other systems, some variations of this scheme are used, such as `LL' or `LL_CC.ENCODING'. You can get the list of locales supported by your system for your country by running the command `locale -a | grep '^LL''. Not all programs have translations for all languages. By default, an English message is shown in place of a nonexistent translation. If you understand other languages, you can set up a priority list of languages. This is done through a different environment variable, called `LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' for the purpose of message handling, but you still need to have `LANG' set to the primary language; this is required by other parts of the system libraries. For example, some Swedish users who would rather read translations in German than English for when Swedish is not available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. In the `LANGUAGE' environment variable, but not in the `LANG' environment variable, `LL_CC' combinations can be abbreviated as `LL' to denote the language's main dialect. For example, `de' is equivalent to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' (Portuguese as spoken in Portugal) in this context. Translating Teams ================= For the Free Translation Project to be a success, we need interested people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. Each translation team has its own mailing list. The up-to-date list of teams can be found at the Free Translation Project's homepage, `http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" area. If you'd like to volunteer to _work_ at translating messages, you should become a member of the translating team for your own language. The subscribing address is _not_ the same as the list itself, it has `-request' appended. For example, speakers of Swedish can send a message to `sv-request@li.org', having this message body: subscribe Keep in mind that team members are expected to participate _actively_ in translations, or at solving translational difficulties, rather than merely lurking around. If your team does not exist yet and you want to start one, or if you are unsure about what to do or how to get started, please write to `translation@iro.umontreal.ca' to reach the coordinator for all translator teams. The English team is special. It works at improving and uniformizing the terminology in use. Proven linguistic skill are praised more than programming skill, here. Available Packages ================== Languages are not equally supported in all packages. The following matrix shows the current state of internationalization, as of December 2003. The matrix shows, in regard of each package, for which languages PO files have been submitted to translation coordination, with a translation percentage of at least 50%. Ready PO files am az be bg ca cs da de el en en_GB eo es +-------------------------------------------+ a2ps | [] [] [] [] | aegis | () | ant-phone | () | anubis | | ap-utils | | bash | [] [] [] [] | batchelor | | bfd | [] [] | binutils | [] [] | bison | [] [] [] | bluez-pin | [] [] | clisp | | clisp | [] [] [] | coreutils | [] [] [] [] | cpio | [] [] [] | darkstat | [] () [] | diffutils | [] [] [] [] [] [] [] | e2fsprogs | [] [] | enscript | [] [] [] [] | error | [] [] [] [] [] | fetchmail | [] () [] [] [] [] | fileutils | [] [] [] | findutils | [] [] [] [] [] [] [] | flex | [] [] [] [] | fslint | | gas | [] | gawk | [] [] [] [] | gbiff | [] | gcal | [] | gcc | [] [] | gettext | [] [] [] [] [] | gettext-examples | [] [] [] | gettext-runtime | [] [] [] [] [] | gettext-tools | [] [] [] | gimp-print | [] [] [] [] [] | gliv | | glunarclock | [] [] | gnubiff | [] | gnucash | [] () [] [] | gnucash-glossary | [] () [] | gnupg | [] () [] [] [] [] | gpe-aerial | [] | gpe-beam | [] [] | gpe-calendar | [] [] | gpe-clock | [] [] | gpe-conf | [] [] | gpe-contacts | [] [] | gpe-edit | [] | gpe-go | [] | gpe-login | [] [] | gpe-ownerinfo | [] [] | gpe-sketchbook | [] [] | gpe-su | [] [] | gpe-taskmanager | [] [] | gpe-timesheet | [] | gpe-today | [] [] | gpe-todo | [] [] | gphoto2 | [] [] [] [] | gprof | [] [] [] | gpsdrive | () () () | gramadoir | [] | grep | [] [] [] [] [] [] | gretl | [] | gtick | () | hello | [] [] [] [] [] [] | id-utils | [] [] | indent | [] [] [] [] | jpilot | [] [] [] | jtag | | jwhois | [] | kbd | [] [] [] [] [] | latrine | () | ld | [] [] | libc | [] [] [] [] [] [] | libgpewidget | [] [] | libiconv | [] [] [] [] [] | lifelines | [] () | lilypond | [] | lingoteach | | lingoteach_lessons | () () | lynx | [] [] [] [] | m4 | [] [] [] [] | mailutils | [] [] | make | [] [] [] | man-db | [] () [] [] () | minicom | [] [] [] | mysecretdiary | [] [] [] | nano | [] () [] [] [] | nano_1_0 | [] () [] [] [] | opcodes | [] | parted | [] [] [] [] [] | ptx | [] [] [] [] [] | python | | radius | [] | recode | [] [] [] [] [] [] [] | rpm | [] [] | screem | | scrollkeeper | [] [] [] [] [] [] | sed | [] [] [] [] [] | sh-utils | [] [] [] | shared-mime-info | | sharutils | [] [] [] [] [] [] | silky | () | skencil | [] () [] | sketch | [] () [] | soundtracker | [] [] [] | sp | [] | tar | [] [] [] [] | texinfo | [] [] [] | textutils | [] [] [] [] | tin | () () | tuxpaint | [] [] [] [] [] [] [] | util-linux | [] [] [] [] [] | vorbis-tools | [] [] [] [] | wastesedge | () | wdiff | [] [] [] [] | wget | [] [] [] [] [] [] | xchat | [] [] [] [] | xfree86_xkb_xml | [] | xpad | [] | +-------------------------------------------+ am az be bg ca cs da de el en en_GB eo es 0 0 8 3 37 38 56 73 15 1 5 12 64 et fa fi fr ga gl he hr hu id is it ja +----------------------------------------+ a2ps | [] [] [] () | aegis | | ant-phone | | anubis | [] | ap-utils | [] | bash | [] [] | batchelor | [] | bfd | [] | binutils | [] [] | bison | [] [] [] [] | bluez-pin | [] [] [] [] [] | clisp | | clisp | [] | coreutils | [] [] [] [] [] [] | cpio | [] [] [] | darkstat | () [] [] [] | diffutils | [] [] [] [] [] [] [] | e2fsprogs | | enscript | [] [] | error | [] [] [] [] | fetchmail | [] | fileutils | [] [] [] [] [] [] | findutils | [] [] [] [] [] [] [] [] [] [] | flex | [] [] | fslint | | gas | [] | gawk | [] [] [] | gbiff | | gcal | [] | gcc | [] | gettext | [] [] | gettext-examples | [] [] | gettext-runtime | [] [] [] [] | gettext-tools | [] [] | gimp-print | [] [] | gliv | () | glunarclock | [] [] [] [] | gnubiff | | gnucash | () [] | gnucash-glossary | [] | gnupg | [] [] [] [] [] [] [] | gpe-aerial | [] | gpe-beam | [] | gpe-calendar | [] [] [] | gpe-clock | [] | gpe-conf | [] | gpe-contacts | [] [] | gpe-edit | [] [] | gpe-go | [] | gpe-login | [] [] | gpe-ownerinfo | [] [] [] | gpe-sketchbook | [] | gpe-su | [] | gpe-taskmanager | [] | gpe-timesheet | [] [] [] | gpe-today | [] [] | gpe-todo | [] [] | gphoto2 | [] [] [] | gprof | [] [] | gpsdrive | () [] () () | gramadoir | [] | grep | [] [] [] [] [] [] [] [] [] [] [] | gretl | [] | gtick | [] [] | hello | [] [] [] [] [] [] [] [] [] [] [] [] | id-utils | [] [] [] [] | indent | [] [] [] [] [] [] [] [] [] | jpilot | [] () | jtag | | jwhois | [] [] [] [] | kbd | [] | latrine | | ld | [] | libc | [] [] [] [] [] | libgpewidget | [] [] [] [] | libiconv | [] [] [] [] [] [] [] [] [] | lifelines | () | lilypond | [] | lingoteach | [] [] | lingoteach_lessons | | lynx | [] [] [] [] | m4 | [] [] [] [] | mailutils | | make | [] [] [] [] [] | man-db | () () | minicom | [] [] [] [] | mysecretdiary | [] [] | nano | [] [] [] [] | nano_1_0 | [] [] [] [] | opcodes | [] | parted | [] [] [] | ptx | [] [] [] [] [] [] [] | python | | radius | [] | recode | [] [] [] [] [] [] | rpm | | screem | | scrollkeeper | [] | sed | [] [] [] [] [] [] [] [] [] | sh-utils | [] [] [] [] [] [] [] | shared-mime-info | [] | sharutils | [] [] [] [] [] | silky | [] () | skencil | [] | sketch | [] | soundtracker | [] [] [] [] | sp | [] () | tar | [] [] [] [] [] [] [] [] [] | texinfo | [] [] [] [] | textutils | [] [] [] [] [] | tin | [] () | tuxpaint | [] [] [] [] [] [] [] [] | util-linux | [] [] [] [] () [] | vorbis-tools | [] | wastesedge | () | wdiff | [] [] [] [] [] [] | wget | [] [] [] [] [] [] [] | xchat | [] [] [] | xfree86_xkb_xml | | xpad | [] | +----------------------------------------+ et fa fi fr ga gl he hr hu id is it ja 21 1 25 86 24 24 8 10 38 31 1 23 32 ko lg lt lv ms nb nl nn no pl pt pt_BR ro +-------------------------------------------+ a2ps | () [] [] () () [] [] | aegis | () () | ant-phone | [] [] | anubis | [] [] [] [] [] | ap-utils | [] () [] | bash | [] [] | batchelor | [] | bfd | [] | binutils | | bison | [] [] [] [] | bluez-pin | [] [] [] | clisp | | clisp | [] | coreutils | [] | cpio | [] [] [] [] [] | darkstat | [] [] [] [] | diffutils | [] [] [] [] | e2fsprogs | [] | enscript | [] [] [] | error | [] [] [] | fetchmail | [] [] () | fileutils | [] [] | findutils | [] [] [] [] [] | flex | [] [] [] [] | fslint | [] [] | gas | | gawk | [] [] [] | gbiff | [] [] | gcal | | gcc | | gettext | [] [] [] | gettext-examples | [] [] | gettext-runtime | [] [] [] | gettext-tools | [] [] [] | gimp-print | [] | gliv | [] [] [] | glunarclock | [] [] [] | gnubiff | | gnucash | [] [] () | gnucash-glossary | [] [] | gnupg | [] | gpe-aerial | [] [] [] | gpe-beam | [] [] [] | gpe-calendar | [] [] [] | gpe-clock | [] [] [] | gpe-conf | [] [] [] | gpe-contacts | [] [] [] | gpe-edit | [] [] [] | gpe-go | [] [] | gpe-login | [] [] [] | gpe-ownerinfo | [] [] [] | gpe-sketchbook | [] [] [] | gpe-su | [] [] [] | gpe-taskmanager | [] [] [] | gpe-timesheet | [] [] [] | gpe-today | [] [] [] | gpe-todo | [] [] [] | gphoto2 | [] | gprof | [] [] | gpsdrive | () () () [] | gramadoir | [] | grep | [] [] [] [] | gretl | | gtick | [] [] | hello | [] [] [] [] [] [] [] [] [] [] | id-utils | [] [] [] | indent | [] [] [] | jpilot | () () | jtag | | jwhois | [] [] [] [] | kbd | [] [] [] | latrine | [] | ld | | libc | [] [] [] [] [] | libgpewidget | [] [] [] | libiconv | [] [] [] [] | lifelines | | lilypond | | lingoteach | | lingoteach_lessons | | lynx | [] [] | m4 | [] [] [] [] | mailutils | [] [] | make | [] [] [] [] | man-db | [] | minicom | [] [] [] | mysecretdiary | [] [] [] | nano | [] [] [] [] | nano_1_0 | [] [] [] [] [] | opcodes | [] [] | parted | [] [] [] [] | ptx | [] [] [] [] [] [] [] | python | | radius | [] | recode | [] [] [] | rpm | [] [] | screem | | scrollkeeper | [] [] [] [] | sed | [] [] [] | sh-utils | [] | shared-mime-info | [] | sharutils | [] | silky | | skencil | [] [] | sketch | [] [] | soundtracker | | sp | | tar | [] [] [] [] [] [] | texinfo | [] [] [] | textutils | [] [] | tin | | tuxpaint | [] [] [] [] [] [] [] [] [] | util-linux | [] [] | vorbis-tools | [] [] | wastesedge | | wdiff | [] [] [] [] | wget | [] [] | xchat | [] [] | xfree86_xkb_xml | [] | xpad | [] [] | +-------------------------------------------+ ko lg lt lv ms nb nl nn no pl pt pt_BR ro 12 0 1 2 12 10 60 4 4 38 25 35 76 ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW +-------------------------------------------+ a2ps | [] [] [] [] [] | 16 aegis | () | 0 ant-phone | | 2 anubis | [] [] [] | 9 ap-utils | () | 3 bash | [] | 9 batchelor | | 2 bfd | [] [] | 6 binutils | [] [] [] | 7 bison | [] [] [] | 14 bluez-pin | [] [] [] | 13 clisp | | 0 clisp | | 5 coreutils | [] [] [] [] [] | 16 cpio | [] [] [] | 14 darkstat | [] [] [] () () | 12 diffutils | [] [] [] [] | 22 e2fsprogs | [] [] | 5 enscript | [] [] [] | 12 error | [] [] [] | 15 fetchmail | [] [] [] | 11 fileutils | [] [] [] [] [] [] | 17 findutils | [] [] [] [] [] [] [] | 29 flex | [] [] [] | 13 fslint | | 2 gas | [] | 3 gawk | [] [] | 12 gbiff | | 3 gcal | [] [] | 4 gcc | [] | 4 gettext | [] [] [] [] [] [] | 16 gettext-examples | [] [] [] [] | 11 gettext-runtime | [] [] [] [] [] [] [] [] [] | 21 gettext-tools | [] [] [] [] [] [] | 14 gimp-print | [] [] | 10 gliv | | 3 glunarclock | [] [] [] [] | 13 gnubiff | | 1 gnucash | [] [] [] | 9 gnucash-glossary | [] [] [] | 8 gnupg | [] [] [] [] | 17 gpe-aerial | [] [] | 7 gpe-beam | [] [] | 8 gpe-calendar | [] [] [] [] [] | 13 gpe-clock | [] [] [] [] | 10 gpe-conf | [] [] [] | 9 gpe-contacts | [] [] [] [] | 11 gpe-edit | [] [] [] [] [] [] | 12 gpe-go | [] | 5 gpe-login | [] [] [] [] [] [] | 13 gpe-ownerinfo | [] [] [] [] [] | 13 gpe-sketchbook | [] [] [] | 9 gpe-su | [] [] [] [] | 10 gpe-taskmanager | [] [] [] [] | 10 gpe-timesheet | [] [] [] [] [] | 12 gpe-today | [] [] [] [] [] [] | 13 gpe-todo | [] [] [] [] [] | 12 gphoto2 | [] [] [] | 11 gprof | [] [] | 9 gpsdrive | [] [] | 4 gramadoir | | 3 grep | [] [] [] [] [] | 26 gretl | | 2 gtick | [] | 5 hello | [] [] [] [] [] | 33 id-utils | [] [] [] | 12 indent | [] [] [] [] [] | 21 jpilot | [] [] [] [] [] | 9 jtag | [] | 1 jwhois | () () [] [] | 11 kbd | [] [] | 11 latrine | | 1 ld | [] [] | 5 libc | [] [] [] [] | 20 libgpewidget | [] [] [] [] | 13 libiconv | [] [] [] [] [] [] [] [] [] | 27 lifelines | [] | 2 lilypond | [] | 3 lingoteach | | 2 lingoteach_lessons | () | 0 lynx | [] [] [] [] | 14 m4 | [] [] [] | 15 mailutils | [] | 5 make | [] [] [] [] | 16 man-db | [] | 5 minicom | [] | 11 mysecretdiary | [] [] | 10 nano | [] [] [] [] [] | 17 nano_1_0 | [] [] [] [] | 17 opcodes | [] [] | 6 parted | [] [] [] | 15 ptx | [] [] [] | 22 python | | 0 radius | [] | 4 recode | [] [] [] [] | 20 rpm | [] [] [] | 7 screem | [] [] | 2 scrollkeeper | [] [] [] [] | 15 sed | [] [] [] [] [] [] | 23 sh-utils | [] [] [] | 14 shared-mime-info | [] [] | 4 sharutils | [] [] [] [] [] | 17 silky | () | 2 skencil | [] | 6 sketch | [] | 6 soundtracker | [] [] | 9 sp | [] | 3 tar | [] [] [] [] [] | 24 texinfo | [] [] [] [] | 14 textutils | [] [] [] [] [] | 16 tin | | 1 tuxpaint | [] [] [] [] [] | 29 util-linux | [] [] [] | 15 vorbis-tools | [] | 8 wastesedge | | 0 wdiff | [] [] [] [] | 18 wget | [] [] [] [] [] [] [] [] | 23 xchat | [] [] [] [] [] | 14 xfree86_xkb_xml | [] [] [] [] [] [] | 8 xpad | | 4 +-------------------------------------------+ 51 teams ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW 120 domains 59 42 16 25 81 0 56 12 1 10 21 22 1260 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are used for implementing regional variants of languages, or language dialects. For a PO file in the matrix above to be effective, the package to which it applies should also have been internationalized and distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. If December 2003 seems to be old, you may fetch a more recent copy of this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date matrix with full percentage details can be found at `http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. Using `gettext' in new packages =============================== If you are writing a freely available program and want to internationalize it you are welcome to use GNU `gettext' in your package. Of course you have to respect the GNU Library General Public License which covers the use of the GNU `gettext' library. This means in particular that even non-free programs can use `libintl' as a shared library, whereas only free software can use `libintl' as a static library or use modified versions of `libintl'. Once the sources are changed appropriately and the setup can handle the use of `gettext' the only thing missing are the translations. The Free Translation Project is also available for packages which are not developed inside the GNU project. Therefore the information given above applies also for every other Free Software Project. Contact `translation@iro.umontreal.ca' to make the `.pot' files available to the translation teams. libinstpatch-1.0.0/CVS-HOWTO0000644000175000017500000000036111456655763012413 00000000000000If you got libInstPatch from CVS, then run ./autogen.sh. You need autoconf and automake installed in order for this to work. Once this is done, you can compile like you normally would (see INSTALL for details): ./configure make make install libinstpatch-1.0.0/missing0000755000175000017500000002623311456655763012544 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libinstpatch-1.0.0/COPYING0000644000175000017500000004313111456655763012174 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. libinstpatch-1.0.0/intltool-update.in0000644000175000017500000000000011456655763014601 00000000000000libinstpatch-1.0.0/intltool-merge.in0000644000175000017500000000000011456655763014416 00000000000000libinstpatch-1.0.0/m4/0000777000175000017500000000000011461404252011520 500000000000000libinstpatch-1.0.0/m4/inttypes-pri.m40000644000175000017500000000222711456655754014373 00000000000000# inttypes-pri.m4 serial 1 (gettext-0.11.4) dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. # Define PRI_MACROS_BROKEN if exists and defines the PRI* # macros to non-string values. This is the case on AIX 4.3.3. AC_DEFUN([gt_INTTYPES_PRI], [ AC_REQUIRE([gt_HEADER_INTTYPES_H]) if test $gt_cv_header_inttypes_h = yes; then AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], gt_cv_inttypes_pri_broken, [ AC_TRY_COMPILE([#include #ifdef PRId32 char *p = PRId32; #endif ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) ]) fi if test "$gt_cv_inttypes_pri_broken" = yes; then AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, [Define if exists and defines unusable PRI* macros.]) fi ]) libinstpatch-1.0.0/m4/lib-prefix.m40000644000175000017500000001250711456655754013767 00000000000000# lib-prefix.m4 serial 3 (gettext-0.13) dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't dnl require excessive bracketing. ifdef([AC_HELP_STRING], [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed dnl with the same --prefix option. dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate dnl libraries, but is otherwise very convenient. AC_DEFUN([AC_LIB_PREFIX], [ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib-prefix], [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi ]) if test $use_additional = yes; then dnl Potentially add $additional_includedir to $CPPFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $CPPFLAGS. CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi fi dnl Potentially add $additional_libdir to $LDFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/lib"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LDFLAGS. LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" fi fi fi fi fi ]) dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and dnl $exec_prefix will expand at the end of the configure script. AC_DEFUN([AC_LIB_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" ]) dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the dnl variables prefix and exec_prefix bound to the values they will have dnl at the end of the configure script. AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], [ acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" $1 exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" ]) libinstpatch-1.0.0/m4/ChangeLog0000644000175000017500000000156011456655754013233 000000000000002003-08-29 gettextize * codeset.m4: New file, from gettext-0.11.5. * gettext.m4: New file, from gettext-0.11.5. * glibc21.m4: New file, from gettext-0.11.5. * iconv.m4: New file, from gettext-0.11.5. * intdiv0.m4: New file, from gettext-0.11.5. * inttypes.m4: New file, from gettext-0.11.5. * inttypes_h.m4: New file, from gettext-0.11.5. * inttypes-pri.m4: New file, from gettext-0.11.5. * isc-posix.m4: New file, from gettext-0.11.5. * lcmessage.m4: New file, from gettext-0.11.5. * lib-ld.m4: New file, from gettext-0.11.5. * lib-link.m4: New file, from gettext-0.11.5. * lib-prefix.m4: New file, from gettext-0.11.5. * progtest.m4: New file, from gettext-0.11.5. * stdint_h.m4: New file, from gettext-0.11.5. * uintmax_t.m4: New file, from gettext-0.11.5. * ulonglong.m4: New file, from gettext-0.11.5. * Makefile.am: New file. libinstpatch-1.0.0/m4/intdiv0.m40000644000175000017500000000356511456655754013307 00000000000000# intdiv0.m4 serial 1 (gettext-0.11.3) dnl Copyright (C) 2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. AC_DEFUN([gt_INTDIV0], [ AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], gt_cv_int_divbyzero_sigfpe, [ AC_TRY_RUN([ #include #include static void #ifdef __cplusplus sigfpe_handler (int sig) #else sigfpe_handler (sig) int sig; #endif { /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ exit (sig != SIGFPE); } int x = 1; int y = 0; int z; int nan; int main () { signal (SIGFPE, sigfpe_handler); /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) signal (SIGTRAP, sigfpe_handler); #endif /* Linux/SPARC yields signal SIGILL. */ #if defined (__sparc__) && defined (__linux__) signal (SIGILL, sigfpe_handler); #endif z = x / y; nan = y / y; exit (1); } ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, [ # Guess based on the CPU. case "$host_cpu" in alpha* | i[34567]86 | m68k | s390*) gt_cv_int_divbyzero_sigfpe="guessing yes";; *) gt_cv_int_divbyzero_sigfpe="guessing no";; esac ]) ]) case "$gt_cv_int_divbyzero_sigfpe" in *yes) value=1;; *) value=0;; esac AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, [Define if integer division by zero raises signal SIGFPE.]) ]) libinstpatch-1.0.0/m4/inttypes.m40000644000175000017500000000171711456655754013606 00000000000000# inttypes.m4 serial 1 (gettext-0.11.4) dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Paul Eggert. # Define HAVE_INTTYPES_H if exists and doesn't clash with # . AC_DEFUN([gt_HEADER_INTTYPES_H], [ AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, [ AC_TRY_COMPILE( [#include #include ], [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) ]) if test $gt_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, [Define if exists and doesn't clash with .]) fi ]) libinstpatch-1.0.0/m4/wint_t.m40000644000175000017500000000153111456655754013225 00000000000000# wint_t.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. dnl Test whether has the 'wint_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WINT_T], [ AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, [AC_TRY_COMPILE([#include wint_t foo = (wchar_t)'\0';], , gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) if test $gt_cv_c_wint_t = yes; then AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) fi ]) libinstpatch-1.0.0/m4/size_max.m40000644000175000017500000000407211456655754013543 00000000000000# size_max.m4 serial 2 dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. AC_DEFUN([gl_SIZE_MAX], [ AC_CHECK_HEADERS(stdint.h) dnl First test whether the system already has SIZE_MAX. AC_MSG_CHECKING([for SIZE_MAX]) result= AC_EGREP_CPP([Found it], [ #include #if HAVE_STDINT_H #include #endif #ifdef SIZE_MAX Found it #endif ], result=yes) if test -z "$result"; then dnl Define it ourselves. Here we assume that the type 'size_t' is not wider dnl than the type 'unsigned long'. dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', dnl which is guaranteed to work from LONG_MIN to LONG_MAX. _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi, [#include ], result=?) _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo, [#include ], result=?) _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, [#include ], result=?) if test "$fits_in_uint" = 1; then dnl Even though SIZE_MAX fits in an unsigned int, it must be of type dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. AC_TRY_COMPILE([#include extern size_t foo; extern unsigned long foo; ], [], fits_in_uint=0) fi if test -z "$result"; then if test "$fits_in_uint" = 1; then result="$res_hi$res_lo"U else result="$res_hi$res_lo"UL fi else dnl Shouldn't happen, but who knows... result='~(size_t)0' fi fi AC_MSG_RESULT([$result]) if test "$result" != yes; then AC_DEFINE_UNQUOTED([SIZE_MAX], [$result], [Define as the maximum value of type 'size_t', if the system doesn't define it.]) fi ]) libinstpatch-1.0.0/m4/printf-posix.m40000644000175000017500000000310611456655754014363 00000000000000# printf-posix.m4 serial 2 (gettext-0.13.1) dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. dnl Test whether the printf() function supports POSIX/XSI format strings with dnl positions. AC_DEFUN([gt_PRINTF_POSIX], [ AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings], gt_cv_func_printf_posix, [ AC_TRY_RUN([ #include #include /* The string "%2$d %1$d", with dollar characters protected from the shell's dollar expansion (possibly an autoconf bug). */ static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; static char buf[100]; int main () { sprintf (buf, format, 33, 55); return (strcmp (buf, "55 33") != 0); }], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, [ AC_EGREP_CPP(notposix, [ #if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ notposix #endif ], gt_cv_func_printf_posix="guessing no", gt_cv_func_printf_posix="guessing yes") ]) ]) case $gt_cv_func_printf_posix in *yes) AC_DEFINE(HAVE_POSIX_PRINTF, 1, [Define if your printf() function supports format strings with positions.]) ;; esac ]) libinstpatch-1.0.0/m4/longdouble.m40000644000175000017500000000230011456655754014046 00000000000000# longdouble.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. dnl Test whether the compiler supports the 'long double' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_LONGDOUBLE], [ AC_CACHE_CHECK([for long double], gt_cv_c_long_double, [if test "$GCC" = yes; then gt_cv_c_long_double=yes else AC_TRY_COMPILE([ /* The Stardent Vistra knows sizeof(long double), but does not support it. */ long double foo = 0.0; /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ int array [2*(sizeof(long double) >= sizeof(double)) - 1]; ], , gt_cv_c_long_double=yes, gt_cv_c_long_double=no) fi]) if test $gt_cv_c_long_double = yes; then AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) fi ]) libinstpatch-1.0.0/m4/ltversion.m40000644000175000017500000000127511461360426013734 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file 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. # Generated from ltversion.in. # serial 3012 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.2.6]) m4_define([LT_PACKAGE_REVISION], [1.3012]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.2.6' macro_revision='1.3012' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) libinstpatch-1.0.0/m4/Makefile.in0000644000175000017500000002677411461360570013525 00000000000000# Makefile.in generated by automake 1.11 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 = m4 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/python.m4 \ $(top_srcdir)/acinclude.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)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ IPATCH_BINARY_AGE = @IPATCH_BINARY_AGE@ IPATCH_INTERFACE_AGE = @IPATCH_INTERFACE_AGE@ IPATCH_VERSION = @IPATCH_VERSION@ IPATCH_VERSION_MAJOR = @IPATCH_VERSION_MAJOR@ IPATCH_VERSION_MICRO = @IPATCH_VERSION_MICRO@ IPATCH_VERSION_MINOR = @IPATCH_VERSION_MINOR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ 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@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ PYGTK_CODEGEN_DIR = @PYGTK_CODEGEN_DIR@ PYGTK_LIBS = @PYGTK_LIBS@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ SNDFILE_LIBS = @SNDFILE_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ 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@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ 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@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = intmax.m4 longdouble.m4 longlong.m4 nls.m4 po.m4 \ printf-posix.m4 signed.m4 size_max.m4 wchar_t.m4 wint_t.m4 \ xsize.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 \ inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 \ lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 stdint_h.m4 \ uintmax_t.m4 ulonglong.m4 python.m4 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(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 m4/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu m4/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: 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 mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic 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-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 -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir 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-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # 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: libinstpatch-1.0.0/m4/inttypes_h.m40000644000175000017500000000210311456655754014103 00000000000000# inttypes_h.m4 serial 5 (gettext-0.12) dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Paul Eggert. # Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, # doesn't clash with , and declares uintmax_t. AC_DEFUN([jm_AC_HEADER_INTTYPES_H], [ AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1;], jm_ac_cv_header_inttypes_h=yes, jm_ac_cv_header_inttypes_h=no)]) if test $jm_ac_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, [Define if exists, doesn't clash with , and declares uintmax_t. ]) fi ]) libinstpatch-1.0.0/m4/stdint_h.m40000644000175000017500000000205311456655754013535 00000000000000# stdint_h.m4 serial 3 (gettext-0.12) dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Paul Eggert. # Define HAVE_STDINT_H_WITH_UINTMAX if exists, # doesn't clash with , and declares uintmax_t. AC_DEFUN([jm_AC_HEADER_STDINT_H], [ AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1;], jm_ac_cv_header_stdint_h=yes, jm_ac_cv_header_stdint_h=no)]) if test $jm_ac_cv_header_stdint_h = yes; then AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, [Define if exists, doesn't clash with , and declares uintmax_t. ]) fi ]) libinstpatch-1.0.0/m4/glibc21.m40000644000175000017500000000172711456655754013153 00000000000000# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. # Test for the GNU C Library, version 2.1 or newer. # From Bruno Haible. AC_DEFUN([jm_GLIBC21], [ AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, ac_cv_gnu_library_2_1, [AC_EGREP_CPP([Lucky GNU user], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) Lucky GNU user #endif #endif ], ac_cv_gnu_library_2_1=yes, ac_cv_gnu_library_2_1=no) ] ) AC_SUBST(GLIBC21) GLIBC21="$ac_cv_gnu_library_2_1" ] ) libinstpatch-1.0.0/m4/ltsugar.m40000644000175000017500000001042411461360426013364 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file 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. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) libinstpatch-1.0.0/m4/libtool.m40000644000175000017500000077437411461360425013373 00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file 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. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 56 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl _LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Fix-up fallback echo if it was mangled by the above quoting rules. case \$lt_ECHO in *'\\\[$]0 --fallback-echo"')dnl " lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` ;; esac _LT_OUTPUT_LIBTOOL_INIT ]) # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) cat >"$CONFIG_LT" <<_LTEOF #! $SHELL # Generated by $as_me. # Run this file to recreate a libtool stub with the current configuration. lt_cl_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2008 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. if test "$no_create" != yes; then lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) fi ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_XSI_SHELLFNS sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(whole_archive_flag_spec, $1)='' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX # ----------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl AC_LINK_IFELSE(AC_LANG_PROGRAM,[ lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. m4_defun([_LT_PROG_ECHO_BACKSLASH], [_LT_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$lt_ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac ECHO=${lt_ECHO-echo} if test "X[$]1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then # Yippee, $ECHO works! : else # Restart under the correct shell. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat <<_LT_EOF [$]* _LT_EOF exit 0 fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$lt_ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if { echo_test_string=`eval $cmd`; } 2>/dev/null && { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null then break fi done fi if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$ECHO" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. ECHO='print -r' elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} else # Try using printf. ECHO='printf %s\n' if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL ECHO="$CONFIG_SHELL [$]0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$CONFIG_SHELL [$]0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "[$]0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. ECHO=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. lt_ECHO=$ECHO if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(lt_ECHO) ]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that does not interpret backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [AC_CHECK_TOOL(AR, ar, false) test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1]) AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line __oline__ "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method == "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ const struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC*) # IBM XL 8.0 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl*) # IBM XL C 8.0/Fortran 10.1 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' ;; linux* | k*bsd*-gnu) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE(int foo(void) {}, _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' ) LDFLAGS="$save_LDFLAGS" else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then _LT_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [fix_srcfile_path], [1], [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_PROG_CXX # ------------ # Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ # compiler, we have our own version here. m4_defun([_LT_PROG_CXX], [ pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) AC_PROG_CXX if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_CXX dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_CXX], []) # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [AC_REQUIRE([_LT_PROG_CXX])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 will use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; xl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=echo else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_PROG_F77 # ------------ # Since AC_PROG_F77 is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_F77], [ pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) AC_PROG_F77 if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_F77 dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_F77], []) # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_REQUIRE([_LT_PROG_F77])dnl AC_LANG_PUSH(Fortran 77) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${F77-"f77"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_PROG_FC # ----------- # Since AC_PROG_FC is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_FC], [ pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) AC_PROG_FC if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_FC dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_FC], []) # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_REQUIRE([_LT_PROG_FC])dnl AC_LANG_PUSH(Fortran) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${FC-"f95"} compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC="$lt_save_CC" ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC= CC=${RC-"windres"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC="$lt_save_CC" ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_XSI_SHELLFNS # --------------------- # Bourne and XSI compatible variants of some useful shell functions. m4_defun([_LT_PROG_XSI_SHELLFNS], [case $xsi_shell in yes) cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac } # func_basename file func_basename () { func_basename_result="${1##*/}" } # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}" } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). func_stripname () { # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"} } # func_opt_split func_opt_split () { func_opt_split_opt=${1%%=*} func_opt_split_arg=${1#*=} } # func_lo2o object func_lo2o () { case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac } # func_xform libobj-or-source func_xform () { func_xform_result=${1%.*}.lo } # func_arith arithmetic-term... func_arith () { func_arith_result=$(( $[*] )) } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=${#1} } _LT_EOF ;; *) # Bourne compatible functions. cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_basename file func_basename () { func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } dnl func_dirname_and_basename dnl A portable version of this function is already defined in general.m4sh dnl so there is no need for it here. # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; esac } # sed scripts: my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' my_sed_long_arg='1s/^-[[^=]]*=//' # func_opt_split func_opt_split () { func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` } # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` } # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$[@]"` } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` } _LT_EOF esac case $lt_shell_append in yes) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]+=\$[2]" } _LT_EOF ;; *) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]=\$$[1]\$[2]" } _LT_EOF ;; esac ]) libinstpatch-1.0.0/m4/wchar_t.m40000644000175000017500000000155311456655754013354 00000000000000# wchar_t.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. dnl Test whether has the 'wchar_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WCHAR_T], [ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, [AC_TRY_COMPILE([#include wchar_t foo = (wchar_t)'\0';], , gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) if test $gt_cv_c_wchar_t = yes; then AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) fi ]) libinstpatch-1.0.0/m4/ltoptions.m40000644000175000017500000002724211461360425013743 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file 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. # serial 6 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [0], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) libinstpatch-1.0.0/m4/isc-posix.m40000644000175000017500000000213311456655754013636 00000000000000# isc-posix.m4 serial 2 (gettext-0.11.2) dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. # This file is not needed with autoconf-2.53 and newer. Remove it in 2005. # This test replaces the one in autoconf. # Currently this macro should have the same name as the autoconf macro # because gettext's gettext.m4 (distributed in the automake package) # still uses it. Otherwise, the use in gettext.m4 makes autoheader # give these diagnostics: # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX undefine([AC_ISC_POSIX]) AC_DEFUN([AC_ISC_POSIX], [ dnl This test replaces the obsolescent AC_ISC_POSIX kludge. AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) ] ) libinstpatch-1.0.0/m4/xsize.m40000644000175000017500000000103111456655754013056 00000000000000# xsize.m4 serial 2 dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. AC_DEFUN([gl_XSIZE], [ dnl Prerequisites of lib/xsize.h. AC_REQUIRE([gl_SIZE_MAX]) AC_CHECK_HEADERS(stdint.h) ]) libinstpatch-1.0.0/m4/lib-link.m40000644000175000017500000005534311456655754013434 00000000000000# lib-link.m4 serial 4 (gettext-0.12) dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and dnl augments the CPPFLAGS variable. AC_DEFUN([AC_LIB_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ac_cv_lib[]Name[]_libs="$LIB[]NAME" ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" ac_cv_lib[]Name[]_cppflags="$INC[]NAME" ]) LIB[]NAME="$ac_cv_lib[]Name[]_libs" LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" INC[]NAME="$ac_cv_lib[]Name[]_cppflags" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the dnl results of this search when this library appears as a dependency. HAVE_LIB[]NAME=yes undefine([Name]) undefine([NAME]) ]) dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) dnl searches for libname and the libraries corresponding to explicit and dnl implicit dependencies, together with the specified include files and dnl the ability to compile and link the specified testcode. If found, it dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME dnl accordingly. AC_LIB_LINKFLAGS_BODY([$1], [$2]) dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, dnl because if the user has installed lib[]Name and not disabled its use dnl via --without-lib[]Name-prefix, he wants to use it. ac_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ ac_save_LIBS="$LIBS" LIBS="$LIBS $LIB[]NAME" AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) LIBS="$ac_save_LIBS" ]) if test "$ac_cv_lib[]Name" = yes; then HAVE_LIB[]NAME=yes AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) AC_MSG_CHECKING([how to link with lib[]$1]) AC_MSG_RESULT([$LIB[]NAME]) else HAVE_LIB[]NAME=no dnl If $LIB[]NAME didn't lead to a usable library, we don't need dnl $INC[]NAME either. CPPFLAGS="$ac_save_CPPFLAGS" LIB[]NAME= LTLIB[]NAME= fi AC_SUBST([HAVE_LIB]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) undefine([Name]) undefine([NAME]) ]) dnl Determine the platform dependent parameters needed to use rpath: dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, dnl hardcode_direct, hardcode_minus_L. AC_DEFUN([AC_LIB_RPATH], [ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ]) wl="$acl_cv_wl" libext="$acl_cv_libext" shlibext="$acl_cv_shlibext" hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" hardcode_direct="$acl_cv_hardcode_direct" hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. AC_ARG_ENABLE(rpath, [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib$1-prefix], [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib --without-lib$1-prefix don't search for lib$1 in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi ]) dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= LTLIB[]NAME= INC[]NAME= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. : fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= found_a= if test $use_additional = yes; then if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi else if test -f "$additional_libdir/lib$name.$libext"; then found_dir="$additional_libdir" found_a="$additional_libdir/lib$name.$libext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi else if test -f "$dir/lib$name.$libext"; then found_dir="$dir" found_a="$dir/lib$name.$libext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then dnl Found the library. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. if test "$hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else dnl Rely on "-L$found_dir". dnl But don't add it if it's already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi if test "$hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in */lib | */lib/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi fi fi dnl Look for dependencies. if test -n "$found_la"; then dnl Read the .la file. It defines the variables dnl dlname, library_names, old_library, dependency_libs, current, dnl age, revision, installed, dlopen, dlpreopen, libdir. save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" dnl We use only dependency_libs. for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/lib"; then haveit= if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LTLIBNAME. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dnl Handle this in the next round. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) dnl Handle this in the next round. Throw away the .la's dnl directory; it is already contained in a preceding -L dnl option. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done fi else dnl Didn't find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" done dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else dnl The -rpath options are cumulative. for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then dnl When using libtool, the option that works for both libraries and dnl executables is -R. The -R options are cumulative. for found_dir in $ltrpathdirs; do LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, dnl unless already present in VAR. dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes dnl contains two or three consecutive elements that belong together. AC_DEFUN([AC_LIB_APPENDTOVAR], [ for element in [$2]; do haveit= for x in $[$1]; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then [$1]="${[$1]}${[$1]:+ }$element" fi done ]) libinstpatch-1.0.0/m4/gettext.m40000644000175000017500000004513011456655754013410 00000000000000# gettext.m4 serial 28 (gettext-0.13) dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. dnl Macro to add for using GNU gettext. dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The dnl default (if it is not specified or empty) is 'no-libtool'. dnl INTLSYMBOL should be 'external' for packages with no intl directory, dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. dnl If INTLSYMBOL is 'use-libtool', then a libtool library dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, dnl depending on --{enable,disable}-{shared,static} and on the presence of dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library dnl $(top_builddir)/intl/libintl.a will be created. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext dnl implementations (in libc or libintl) without the ngettext() function dnl will be ignored. If NEEDSYMBOL is specified and is dnl 'need-formatstring-macros', then GNU gettext implementations that don't dnl support the ISO C 99 formatstring macros will be ignored. dnl INTLDIR is used to find the intl libraries. If empty, dnl the value `$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled dnl and used. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 2) GNU gettext has been found in the system's C library. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 3) No internationalization, always use English msgid. dnl Catalog format: none dnl Catalog extension: none dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. dnl The use of .gmo is historical (it was needed to avoid overwriting the dnl GNU format catalogs when building on a platform with an X/Open gettext), dnl but we keep it in order not to force irrelevant filename changes on the dnl maintainers. dnl AC_DEFUN([AM_GNU_GETTEXT], [ dnl Argument checking. ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT ])])])])]) ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT ])])])]) define(gt_included_intl, ifelse([$1], [external], [no], [yes])) define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) AC_REQUIRE([AM_PO_SUBDIRS])dnl ifelse(gt_included_intl, yes, [ AC_REQUIRE([AM_INTL_SUBDIR])dnl ]) dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Sometimes libintl requires libiconv, so first search for libiconv. dnl Ideally we would do this search only after the dnl if test "$USE_NLS" = "yes"; then dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT dnl the configure script would need to contain the same shell code dnl again, outside any 'if'. There are two solutions: dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not dnl documented, we avoid it. ifelse(gt_included_intl, yes, , [ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) dnl Set USE_NLS. AM_NLS ifelse(gt_included_intl, yes, [ BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no ]) LIBINTL= LTLIBINTL= POSUB= dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no ifelse(gt_included_intl, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH(included-gettext, [ --with-included-gettext use the GNU gettext library included here], nls_cv_force_use_gnu_gettext=$withval, nls_cv_force_use_gnu_gettext=no) AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then ]) dnl User does not insist on using GNU NLS library. Figure out what dnl to use. If GNU gettext is available we use this. Else we have dnl to fall back to GNU NLS library. dnl Add a version number to the cache macros. define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, [AC_TRY_LINK([#include ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ], [])[extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings;], [bindtextdomain ("", ""); return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no)]) if test "$gt_cv_func_gnugettext_libc" != "yes"; then dnl Sometimes libintl requires libiconv, so first search for libiconv. ifelse(gt_included_intl, yes, , [ AM_ICONV_LINK ]) dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) dnl because that would add "-liconv" to LIBINTL and LTLIBINTL dnl even if libiconv doesn't exist. AC_LIB_LINKFLAGS_BODY([intl]) AC_CACHE_CHECK([for GNU gettext in libintl], gt_cv_func_gnugettext_libintl, [gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" dnl Now see whether libintl exists and does not depend on libiconv. AC_TRY_LINK([#include ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ], [])[extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias ();], [bindtextdomain ("", ""); return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], gt_cv_func_gnugettext_libintl=yes, gt_cv_func_gnugettext_libintl=no) dnl Now see whether libintl exists and depends on libiconv. if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ], [])[extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias ();], [bindtextdomain ("", ""); return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], [LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" gt_cv_func_gnugettext_libintl=yes ]) fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) fi dnl If an already present or preinstalled GNU gettext() is found, dnl use it. But if this macro is used in GNU gettext, and GNU dnl gettext is already preinstalled in libintl, we update this dnl libintl. (Cf. the install rule in intl/Makefile.in.) if test "$gt_cv_func_gnugettext_libc" = "yes" \ || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else dnl Reset the values set by searching for libintl. LIBINTL= LTLIBINTL= INCINTL= fi ifelse(gt_included_intl, yes, [ if test "$gt_use_preinstalled_gnugettext" != "yes"; then dnl GNU gettext is not found in the C library. dnl Fall back on included GNU gettext library. nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions to use GNU gettext tools. CATOBJEXT=.gmo fi ]) if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.]) else USE_NLS=no fi fi AC_MSG_CHECKING([whether to use NLS]) AC_MSG_RESULT([$USE_NLS]) if test "$USE_NLS" = "yes"; then AC_MSG_CHECKING([where the gettext function comes from]) if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext_libintl" = "yes"; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi AC_MSG_RESULT([$gt_source]) fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext_libintl" = "yes"; then AC_MSG_CHECKING([how to link with libintl]) AC_MSG_RESULT([$LIBINTL]) AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) fi dnl For backward compatibility. Some packages may be using this. AC_DEFINE(HAVE_GETTEXT, 1, [Define if the GNU gettext() function is already present or preinstalled.]) AC_DEFINE(HAVE_DCGETTEXT, 1, [Define if the GNU dcgettext() function is already present or preinstalled.]) fi dnl We need to process the po/ directory. POSUB=po fi ifelse(gt_included_intl, yes, [ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL dnl to 'yes' because some of the testsuite requires it. if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then BUILD_INCLUDED_LIBINTL=yes fi dnl Make all variables we use known to autoconf. AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) AC_SUBST(CATOBJEXT) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= nls_cv_header_libgt= dnl For backward compatibility. Some Makefiles may be using this. DATADIRNAME=share AC_SUBST(DATADIRNAME) dnl For backward compatibility. Some Makefiles may be using this. INSTOBJEXT=.mo AC_SUBST(INSTOBJEXT) dnl For backward compatibility. Some Makefiles may be using this. GENCAT=gencat AC_SUBST(GENCAT) dnl For backward compatibility. Some Makefiles may be using this. if test "$USE_INCLUDED_LIBINTL" = yes; then INTLOBJS="\$(GETTOBJS)" fi AC_SUBST(INTLOBJS) dnl Enable libtool support if the surrounding package wishes it. INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) dnl For backward compatibility. Some Makefiles may be using this. INTLLIBS="$LIBINTL" AC_SUBST(INTLLIBS) dnl Make all documented variables known to autoconf. AC_SUBST(LIBINTL) AC_SUBST(LTLIBINTL) AC_SUBST(POSUB) ]) dnl Checks for all prerequisites of the intl subdirectory, dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. AC_DEFUN([AM_INTL_SUBDIR], [ AC_REQUIRE([AC_PROG_INSTALL])dnl AC_REQUIRE([AM_MKINSTALLDIRS])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_ISC_POSIX])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_C_CONST])dnl AC_REQUIRE([bh_C_SIGNED])dnl AC_REQUIRE([AC_C_INLINE])dnl AC_REQUIRE([AC_TYPE_OFF_T])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl AC_REQUIRE([gt_TYPE_WCHAR_T])dnl AC_REQUIRE([gt_TYPE_WINT_T])dnl AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) AC_REQUIRE([jm_AC_HEADER_STDINT_H]) AC_REQUIRE([gt_TYPE_INTMAX_T]) AC_REQUIRE([gt_PRINTF_POSIX]) AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl AC_REQUIRE([jm_GLIBC21])dnl AC_REQUIRE([gt_INTDIV0])dnl AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl AC_REQUIRE([gt_INTTYPES_PRI])dnl AC_REQUIRE([gl_XSIZE])dnl AC_CHECK_TYPE([ptrdiff_t], , [AC_DEFINE([ptrdiff_t], [long], [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) ]) AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h]) AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \ mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ __fsetlocking]) dnl Use the _snprintf function only if it is declared (because on NetBSD it dnl is defined as a weak alias of snprintf; we prefer to use the latter). gt_CHECK_DECL(_snprintf, [#include ]) gt_CHECK_DECL(_snwprintf, [#include ]) dnl Use the *_unlocked functions only if they are declared. dnl (because some of them were defined without being declared in Solaris dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built dnl on Solaris 2.5.1 to run on Solaris 2.6). dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. gt_CHECK_DECL(feof_unlocked, [#include ]) gt_CHECK_DECL(fgets_unlocked, [#include ]) gt_CHECK_DECL(getc_unlocked, [#include ]) case $gt_cv_func_printf_posix in *yes) HAVE_POSIX_PRINTF=1 ;; *) HAVE_POSIX_PRINTF=0 ;; esac AC_SUBST([HAVE_POSIX_PRINTF]) if test "$ac_cv_func_asprintf" = yes; then HAVE_ASPRINTF=1 else HAVE_ASPRINTF=0 fi AC_SUBST([HAVE_ASPRINTF]) if test "$ac_cv_func_snprintf" = yes; then HAVE_SNPRINTF=1 else HAVE_SNPRINTF=0 fi AC_SUBST([HAVE_SNPRINTF]) if test "$ac_cv_func_wprintf" = yes; then HAVE_WPRINTF=1 else HAVE_WPRINTF=0 fi AC_SUBST([HAVE_WPRINTF]) AM_ICONV AM_LANGINFO_CODESET if test $ac_cv_header_locale_h = yes; then AM_LC_MESSAGES fi dnl intl/plural.c is generated from intl/plural.y. It requires bison, dnl because plural.y uses bison specific features. It requires at least dnl bison-1.26 because earlier versions generate a plural.c that doesn't dnl compile. dnl bison is only needed for the maintainer (who touches plural.y). But in dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put dnl the rule in general Makefile. Now, some people carelessly touch the dnl files or have a broken "make" program, hence the plural.c rule will dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not dnl present or too old. AC_CHECK_PROGS([INTLBISON], [bison]) if test -z "$INTLBISON"; then ac_verc_fail=yes else dnl Found it, now check the version. AC_MSG_CHECKING([version of bison]) changequote(<<,>>)dnl ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) changequote([,])dnl ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; esac AC_MSG_RESULT([$ac_prog_version]) fi if test $ac_verc_fail = yes; then INTLBISON=: fi ]) dnl gt_CHECK_DECL(FUNC, INCLUDES) dnl Check whether a function is declared. AC_DEFUN([gt_CHECK_DECL], [ AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, [AC_TRY_COMPILE([$2], [ #ifndef $1 char *p = (char *) $1; #endif ], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) if test $ac_cv_have_decl_$1 = yes; then gt_value=1 else gt_value=0 fi AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) ]) dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) libinstpatch-1.0.0/m4/progtest.m40000644000175000017500000000563411456655754013600 00000000000000# progtest.m4 serial 3 (gettext-0.12) dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1996. # Search path for a program which passes the given test. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN([AM_PATH_PROG_WITH_TEST], [ # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in [[\\/]]* | ?:[[\\/]]*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in ifelse([$5], , $PATH, [$5]); do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) libinstpatch-1.0.0/m4/nls.m40000644000175000017500000000350511456655754012520 00000000000000# nls.m4 serial 1 (gettext-0.12) dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. AC_DEFUN([AM_NLS], [ AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT($USE_NLS) AC_SUBST(USE_NLS) ]) AC_DEFUN([AM_MKINSTALLDIRS], [ dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly dnl find the mkinstalldirs script in another subdir but $(top_srcdir). dnl Try to locate it. MKINSTALLDIRS= if test -n "$ac_aux_dir"; then case "$ac_aux_dir" in /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; esac fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi AC_SUBST(MKINSTALLDIRS) ]) libinstpatch-1.0.0/m4/intmax.m40000644000175000017500000000217211456655754013223 00000000000000# intmax.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. dnl Test whether the system has the 'intmax_t' type, but don't attempt to dnl find a replacement if it is lacking. AC_DEFUN([gt_TYPE_INTMAX_T], [ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) AC_REQUIRE([jm_AC_HEADER_STDINT_H]) AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, [AC_TRY_COMPILE([ #include #include #if HAVE_STDINT_H_WITH_UINTMAX #include #endif #if HAVE_INTTYPES_H_WITH_UINTMAX #include #endif ], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) if test $gt_cv_c_intmax_t = yes; then AC_DEFINE(HAVE_INTMAX_T, 1, [Define if you have the 'intmax_t' type in or .]) fi ]) libinstpatch-1.0.0/m4/uintmax_t.m40000644000175000017500000000235011456655754013731 00000000000000# uintmax_t.m4 serial 7 (gettext-0.12) dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Paul Eggert. AC_PREREQ(2.13) # Define uintmax_t to 'unsigned long' or 'unsigned long long' # if it is not already defined in or . AC_DEFUN([jm_AC_TYPE_UINTMAX_T], [ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) AC_REQUIRE([jm_AC_HEADER_STDINT_H]) if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) test $ac_cv_type_unsigned_long_long = yes \ && ac_type='unsigned long long' \ || ac_type='unsigned long' AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, [Define to unsigned long or unsigned long long if and don't define.]) else AC_DEFINE(HAVE_UINTMAX_T, 1, [Define if you have the 'uintmax_t' type in or .]) fi ]) libinstpatch-1.0.0/m4/signed.m40000644000175000017500000000140111456655754013166 00000000000000# signed.m4 serial 1 (gettext-0.10.40) dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. AC_DEFUN([bh_C_SIGNED], [ AC_CACHE_CHECK([for signed], bh_cv_c_signed, [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)]) if test $bh_cv_c_signed = no; then AC_DEFINE(signed, , [Define to empty if the C compiler doesn't support this keyword.]) fi ]) libinstpatch-1.0.0/m4/po.m40000644000175000017500000004060111456655754012340 00000000000000# po.m4 serial 2 (gettext-0.13) dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. dnl Checks for all prerequisites of the po subdirectory. AC_DEFUN([AM_PO_SUBDIRS], [ AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl AC_REQUIRE([AM_MKINSTALLDIRS])dnl AC_REQUIRE([AM_NLS])dnl dnl Perform the following tests also if --disable-nls has been given, dnl because they are needed for "make dist" to work. dnl Search for GNU msgfmt in the PATH. dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. dnl The second test excludes FreeBSD msgfmt. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) dnl Search for GNU xgettext 0.12 or newer in the PATH. dnl The first test excludes Solaris xgettext and early GNU xgettext versions. dnl The second test excludes FreeBSD xgettext. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) dnl Remove leftover from FreeBSD xgettext call. rm -f messages.po dnl Search for GNU msgmerge 0.11 or newer in the PATH. AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. dnl Test whether we really found GNU msgfmt. if test "$GMSGFMT" != ":"; then dnl If it is no GNU msgfmt we define it as : so that the dnl Makefiles still can work. if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then : ; else GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` AC_MSG_RESULT( [found $GMSGFMT program is not GNU msgfmt; ignore it]) GMSGFMT=":" fi fi dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is no GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then : ; else AC_MSG_RESULT( [found xgettext program is not GNU xgettext; ignore it]) XGETTEXT=":" fi dnl Remove leftover from FreeBSD xgettext call. rm -f messages.po fi AC_OUTPUT_COMMANDS([ for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assigment from automake. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done], [# Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" ]) ]) dnl Postprocesses a Makefile in a directory containing PO files. AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], [ # When this code is run, in config.status, two variables have already been # set: # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, # - LINGUAS is the value of the environment variable LINGUAS at configure # time. changequote(,)dnl # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Find a way to echo strings without interpreting backslash. if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then gt_echo='echo' else if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then gt_echo='printf %s\n' else echo_func () { cat < "$ac_file.tmp" if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` cat >> "$ac_file.tmp" <> "$ac_file.tmp" < #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_func_iconv=yes) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_lib_iconv=yes am_cv_func_iconv=yes) LIBS="$am_save_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) fi if test "$am_cv_lib_iconv" = yes; then AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV dnl either. CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi AC_SUBST(LIBICONV) AC_SUBST(LTLIBICONV) ]) AC_DEFUN([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL(am_cv_proto_iconv, [ AC_TRY_COMPILE([ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` AC_MSG_RESULT([$]{ac_t:- }[$]am_cv_proto_iconv) AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, [Define as const if the declaration of iconv() needs const.]) fi ]) libinstpatch-1.0.0/m4/ulonglong.m40000644000175000017500000000204211456655754013723 00000000000000# ulonglong.m4 serial 3 dnl Copyright (C) 1999-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Paul Eggert. # Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], [ AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;], [unsigned long long ullmax = (unsigned long long) -1; return ull << i | ull >> i | ullmax / ull | ullmax % ull;], ac_cv_type_unsigned_long_long=yes, ac_cv_type_unsigned_long_long=no)]) if test $ac_cv_type_unsigned_long_long = yes; then AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, [Define if you have the 'unsigned long long' type.]) fi ]) libinstpatch-1.0.0/m4/lcmessage.m40000644000175000017500000000261611456655754013671 00000000000000# lcmessage.m4 serial 3 (gettext-0.11.3) dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995. # Check whether LC_MESSAGES is available in . AC_DEFUN([AM_LC_MESSAGES], [ AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your file defines LC_MESSAGES.]) fi ]) libinstpatch-1.0.0/m4/Makefile.am0000644000175000017500000000056011456655754013514 00000000000000EXTRA_DIST = intmax.m4 longdouble.m4 longlong.m4 nls.m4 po.m4 \ printf-posix.m4 signed.m4 size_max.m4 wchar_t.m4 wint_t.m4 \ xsize.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 \ inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 \ lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 stdint_h.m4 \ uintmax_t.m4 ulonglong.m4 python.m4 libinstpatch-1.0.0/m4/gtk-doc.m40000644000175000017500000000245411461360414013234 00000000000000dnl -*- mode: autoconf -*- # serial 1 dnl Usage: dnl GTK_DOC_CHECK([minimum-gtk-doc-version]) AC_DEFUN([GTK_DOC_CHECK], [ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first dnl for overriding the documentation installation directory AC_ARG_WITH([html-dir], AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),, [with_html_dir='${datadir}/gtk-doc/html']) HTML_DIR="$with_html_dir" AC_SUBST([HTML_DIR]) dnl enable/disable documentation building AC_ARG_ENABLE([gtk-doc], AS_HELP_STRING([--enable-gtk-doc], [use gtk-doc to build documentation [[default=no]]]),, [enable_gtk_doc=no]) if test x$enable_gtk_doc = xyes; then ifelse([$1],[], [PKG_CHECK_EXISTS([gtk-doc],, AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))], [PKG_CHECK_EXISTS([gtk-doc >= $1],, AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build gtk-doc]))]) fi AC_MSG_CHECKING([whether to build gtk-doc documentation]) AC_MSG_RESULT($enable_gtk_doc) AC_PATH_PROGS(GTKDOC_CHECK,gtkdoc-check,) AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes]) AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"]) ]) libinstpatch-1.0.0/m4/lib-ld.m40000644000175000017500000000675611456655754013102 00000000000000# lib-ld.m4 serial 3 (gettext-0.13) dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl Subroutines of libtool.m4, dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision dnl with libtool.m4. dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. case `$LD -v 2>&1 conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]* | [A-Za-z]:[\\/]*)] [re_direlt='/[^/][^/]*/\.\./'] # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(acl_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$ac_save_ifs" else acl_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$acl_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_LIB_PROG_LD_GNU ]) libinstpatch-1.0.0/m4/longlong.m40000644000175000017500000000164311456655754013544 00000000000000# longlong.m4 serial 4 dnl Copyright (C) 1999-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Paul Eggert. # Define HAVE_LONG_LONG if 'long long' works. AC_DEFUN([jm_AC_TYPE_LONG_LONG], [ AC_CACHE_CHECK([for long long], ac_cv_type_long_long, [AC_TRY_LINK([long long ll = 1LL; int i = 63;], [long long llmax = (long long) -1; return ll << i | ll >> i | llmax / ll | llmax % ll;], ac_cv_type_long_long=yes, ac_cv_type_long_long=no)]) if test $ac_cv_type_long_long = yes; then AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have the 'long long' type.]) fi ]) libinstpatch-1.0.0/m4/codeset.m40000644000175000017500000000157611456655754013360 00000000000000# codeset.m4 serial AM1 (gettext-0.10.40) dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, [AC_TRY_LINK([#include ], [char* cs = nl_langinfo(CODESET);], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) ]) if test $am_cv_langinfo_codeset = yes; then AC_DEFINE(HAVE_LANGINFO_CODESET, 1, [Define if you have and nl_langinfo(CODESET).]) fi ]) libinstpatch-1.0.0/m4/python.m40000644000175000017500000000404511456655754013245 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_python_devel.html dnl AC_DEFUN([AC_PYTHON_DEVEL],[ AC_REQUIRE([AM_PATH_PYTHON]) # Check for Python include path AC_MSG_CHECKING([for Python include path]) python_path=`echo $PYTHON | sed "s,/bin.*$,,"` for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do python_path=`find $i -type f -name Python.h -print | sed "1q"` if test -n "$python_path" ; then break fi done python_path=`echo $python_path | sed "s,/Python.h$,,"` AC_MSG_RESULT([$python_path]) if test -z "$python_path" ; then AC_MSG_ERROR([cannot find Python include path]) fi AC_SUBST([PYTHON_CFLAGS],[-I$python_path]) # Check for Python library path AC_MSG_CHECKING([for Python library path]) python_path=`echo $PYTHON | sed "s,/bin.*$,,"` for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"` if test -n "$python_path" ; then break fi done python_path=`echo $python_path | sed "s,/libpython.*$,,"` AC_MSG_RESULT([$python_path]) if test -z "$python_path" ; then AC_MSG_ERROR([cannot find Python library path]) fi python_libs="-L$python_path -lpython$PYTHON_VERSION" # What a pain case $host_os in darwin*) python_libs="${python_libs} -lSystem" ;; *) python_libs="${python_libs} -lutil" ;; esac AC_SUBST([PYTHON_LIBS],[$python_libs]) # python_site=`echo $python_path | sed "s/config/site-packages/"` AC_SUBST([PYTHON_SITE_PKG],[$python_site]) # # libraries which must be linked in when embedding # AC_MSG_CHECKING(python extra libraries) PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print conf('LOCALMODLIBS')+' '+conf('LIBS')" AC_MSG_RESULT($PYTHON_EXTRA_LIBS)` AC_SUBST(PYTHON_EXTRA_LIBS) ]) libinstpatch-1.0.0/m4/lt~obsolete.m40000644000175000017500000001311311461360426014253 00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file 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. # serial 4 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) libinstpatch-1.0.0/autogen.sh0000755000175000017500000000126411461360261013121 00000000000000#!/bin/sh echo "Initializing libInstPatch build..." error=0 for prog in aclocal autoheader autoconf automake libtoolize gtkdocize; do which $prog 2>&1 >/dev/null || { echo "*** The program '$prog' was not found and is required to initialize build." exit 1 } done gtkdocize --copy --flavour no-tmpl && aclocal -I . -I m4 && autoheader && autoconf \ && automake --add-missing -c && libtoolize -c -f \ || error=1 if [ error = "1" ]; then echo "*** An error occurred while initializing the build environment." echo "*** Make sure you have recent versions of autoconf, automake, and" echo "*** libtool installed when building from CVS or regenerating build." exit 1 fi libinstpatch-1.0.0/Makefile.in0000644000175000017500000006462311461360571013201 00000000000000# Makefile.in generated by automake 1.11 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 = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/libinstpatch-1.0.pc.in $(top_srcdir)/configure \ ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS compile \ config.guess config.rpath config.sub depcomp install-sh \ ltmain.sh missing mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/python.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = libinstpatch-1.0.pc CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive 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)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ IPATCH_BINARY_AGE = @IPATCH_BINARY_AGE@ IPATCH_INTERFACE_AGE = @IPATCH_INTERFACE_AGE@ IPATCH_VERSION = @IPATCH_VERSION@ IPATCH_VERSION_MAJOR = @IPATCH_VERSION_MAJOR@ IPATCH_VERSION_MICRO = @IPATCH_VERSION_MICRO@ IPATCH_VERSION_MINOR = @IPATCH_VERSION_MINOR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ 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@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ PYGTK_CODEGEN_DIR = @PYGTK_CODEGEN_DIR@ PYGTK_LIBS = @PYGTK_LIBS@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ SNDFILE_LIBS = @SNDFILE_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ 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@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ 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@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = m4 libinstpatch python utils examples po docs tests EXTRA_DIST = \ autogen.sh \ ABOUT-NLS \ config.guess \ config.sub \ CVS-HOWTO \ intltool-extract.in \ intltool-merge.in \ intltool-update.in pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libinstpatch-1.0.pc ACLOCAL_AMFLAGS = -I m4 DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 libinstpatch-1.0.pc: $(top_builddir)/config.status $(srcdir)/libinstpatch-1.0.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(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: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(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 distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-pkgconfigDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-hdr \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck 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-pdf install-pdf-am install-pkgconfigDATA install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-pkgconfigDATA rpms: dist cd package && ./rpmpkg.sh ../${PACKAGE}-${VERSION}.tar.gz # 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: libinstpatch-1.0.0/intltool-extract.in0000644000175000017500000000000011456655763014771 00000000000000libinstpatch-1.0.0/INSTALL0000644000175000017500000000335111456655763012172 00000000000000If compiling from CVS --------------------- You need to run "./autogen.sh" in the toplevel directory. You'll need autoconf, automake, libtool and perhaps other libraries and there development packages in order for this to work. Configure build system ---------------------- Change to toplevel libInstPatch source directory and execute: ./configure Run "./configure --help" to get a list of configure options, you likely wont need to specify any. TIPS in using the configure script ---------------------------------- Support for external libraries is for the most part auto detected. So you probably won't need to supply any switches to the configure script. If the configure script does something unexpected or fails it is often useful to look at the config.log file. If you install or remove a library used by libInstPatch and you want to re-run configure, you may want to delete config.cache first. Required libraries ------------------ libInstPatch requires a sound file library to load sample files (WAV, AU etc). Currently only libsndfile is suppored (audiofile support will be added sometime). libsndfile homepage: http://www.zip.com.au/~erikd/libsndfile/ audiofile homepage: http://www.68k.org/~michael/audiofile/ glib/gobject 2.x, most newer Linux distributions come with this. GTK/glib homepage: http://www.gtk.org Optional stuff ----------------- If you have gtk-doc the programmers API documentation will be built in docs/reference/html. The Python binding will be built if you have pygtk 2.x installed. Compile and install ------------------- To compile the package execute: make To install libInstPatch: make install Please contact me, Josh Green , if you have problems or suggestions with the build process. libinstpatch-1.0.0/libinstpatch-1.0.pc.in0000644000175000017500000000043011456655763015045 00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: libInstPatch Description: MIDI instrument patch library Version: @VERSION@ Requires: glib-2.0 gobject-2.0 audiofile Libs: -L${libdir} -linstpatch-1.0 Cflags: -I${includedir}/libinstpatch-1.0 libinstpatch-1.0.0/configure.ac0000644000175000017500000001265711456655763013440 00000000000000dnl -------------------------------------------------- dnl configure.ac for libInstPatch dnl -------------------------------------------------- AC_INIT(libinstpatch/misc.c) # Making releases: # IPATCH_VERSION_MICRO += 1; # IPATCH_INTERFACE_AGE += 1; # IPATCH_BINARY_AGE += 1; # if any functions have been added, set IPATCH_INTERFACE_AGE to 0. # if backwards compatibility has been broken (removed or changed functions), # set IPATCH_BINARY_AGE and IPATCH_INTERFACE_AGE to 0. # IPATCH_VERSION_MAJOR=1 IPATCH_VERSION_MINOR=0 IPATCH_VERSION_MICRO=0 IPATCH_INTERFACE_AGE=0 IPATCH_BINARY_AGE=0 IPATCH_VERSION=$IPATCH_VERSION_MAJOR.$IPATCH_VERSION_MINOR.$IPATCH_VERSION_MICRO AC_SUBST(IPATCH_VERSION_MAJOR) AC_SUBST(IPATCH_VERSION_MINOR) AC_SUBST(IPATCH_VERSION_MICRO) AC_SUBST(IPATCH_INTERFACE_AGE) AC_SUBST(IPATCH_BINARY_AGE) AC_SUBST(IPATCH_VERSION) LT_CURRENT=`expr 100 '*' $IPATCH_VERSION_MINOR + $IPATCH_VERSION_MICRO - $IPATCH_INTERFACE_AGE` LT_REVISION=$IPATCH_INTERFACE_AGE LT_AGE=`expr $IPATCH_BINARY_AGE - $IPATCH_INTERFACE_AGE` AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) # Extra m4 macro directory AC_CONFIG_MACRO_DIR(m4) # Check build environment AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(libinstpatch, $IPATCH_VERSION) AM_CONFIG_HEADER(config.h) IPATCH_VERSION="\"$VERSION\"" # Check for debugging flags (before AC_PROG_CC to override defaults) AC_DEBUGGING # Program checks AC_PROG_CC # Set this after AC_PROG_CC so that we inherit the defaults from it CFLAGS="$CFLAGS -Wall" # International language support AM_GNU_GETTEXT([external]) AC_PROG_INTLTOOL AC_PROG_INSTALL AC_HEADER_STDC AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL dnl - Check for mingw Win32 gcc environment AC_MINGW32 if test "${MINGW32}" == "yes" ; then AC_DEFINE(MINGW32, 1, [Define if using the mingw environment]) fi AC_MSG_CHECKING([for native Win32]) case "$host" in *-*-mingw*) native_win32=yes ;; *) native_win32=no ;; esac AC_MSG_RESULT([$native_win32]) AM_CONDITIONAL(OS_WIN32, test "$native_win32" = yes) AC_MSG_CHECKING([for Win32 platform in general]) case "$host" in *-*-mingw*|*-*-cygwin*) platform_win32=yes ;; *) platform_win32=no ;; esac AC_MSG_RESULT($platform_win32) AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = yes) # Ensure MSVC-compatible struct packing convention is used when # compiling for Win32 with gcc. GTK+ uses this convention, so we must, too. # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while # gcc2 uses "-fnative-struct". if test x"$native_win32" = xyes; then if test x"$GCC" = xyes; then msnative_struct='' AC_MSG_CHECKING([how to get MSVC-compatible struct packing]) if test -z "$ac_cv_prog_CC"; then our_gcc="$CC" else our_gcc="$ac_cv_prog_CC" fi case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in 2.) if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then msnative_struct='-fnative-struct' fi ;; *) if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then msnative_struct='-mms-bitfields' fi ;; esac if test x"$msnative_struct" = x ; then AC_MSG_RESULT([no way]) AC_MSG_WARN([produced libraries will be incompatible with prebuilt GTK+ DLLs]) else CFLAGS="$CFLAGS $msnative_struct" AC_MSG_RESULT([${msnative_struct}]) fi fi fi PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= 2.14 glib-2.0 >= 2.14 gthread-2.0 >= 2.14) AC_SUBST(GOBJECT_CFLAGS) AC_SUBST(GOBJECT_LIBS) # Do libsndfile check PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0) AC_SUBST(SNDFILE_CFLAGS) AC_SUBST(SNDFILE_LIBS) # Check for python 2.2 (defines PYTHON_CFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG, # PYTHON_EXTRA_LIBS) AC_PYTHON_DEVEL # Try for pygobject first (removes gtk dependency) PKG_CHECK_MODULES(PYGTK, pygobject-2.0, PYGTK_SUPPORT=1, PYGTK_SUPPORT=0) # If no pygobject check for full pygtk if test ! "$PYGTK_SUPPORT" = "1" ; then PKG_CHECK_MODULES(PYGTK, pygtk-2.0, PYGTK_SUPPORT=1, PYGTK_SUPPORT=0) PYGTK_CODEGEN_DIR=`pkg-config pygtk-2.0 --variable=codegendir` else PYGTK_CODEGEN_DIR=`pkg-config pygobject-2.0 --variable=codegendir` fi AC_SUBST(PYGTK_CFLAGS) AC_SUBST(PYGTK_LIBS) AC_ARG_ENABLE(python, AS_HELP_STRING([--disable-python], [disable python binding]), enable_python=$enableval, enable_python="yes") if test "x${enable_python}" = "xyes" -a "$PYGTK_SUPPORT" = "1" ; then AC_DEFINE(PYTHON_SUPPORT, 1, [Define to build Python binding]) if test "x$PYGTK_CODEGEN_DIR" = "x" ; then PYGTK_CODEGEN_DIR=/usr/share/pygtk/2.0/codegen fi AC_SUBST(PYGTK_CODEGEN_DIR) else enable_python="no" fi AM_CONDITIONAL(PYTHON_SUPPORT, test "x$enable_python" = "xyes") # Check for gtk-doc. GTK_DOC_CHECK(1.9) AC_OUTPUT([ Makefile docs/Makefile docs/reference/Makefile examples/Makefile libinstpatch/libinstpatch.h libinstpatch/Makefile libinstpatch/version.h libinstpatch-1.0.pc m4/Makefile po/Makefile.in python/Makefile tests/Makefile utils/Makefile]) _SUMMARY_ENABLED= _SUMMARY_DISABLED= FEATURE_SUMMARY([ Python support], ["x${enable_python}" = "xyes"]) FEATURE_SUMMARY([ Generate gtk-doc API docs], ["x${enable_gtk_doc}" == "xyes"]) FEATURE_SUMMARY([ Debugging], ["${enable_debug}" == "yes"]) echo echo "**************************************************************" echo "Enabled features:" echo -e -n "$_SUMMARY_ENABLED" echo echo "Disabled features:" echo -e -n "$_SUMMARY_DISABLED" echo echo "**************************************************************" echo libinstpatch-1.0.0/gtk-doc.make0000644000175000017500000001262711461360414013314 00000000000000# -*- mode: makefile -*- #################################### # Everything below here is generic # #################################### if GTK_DOC_USE_LIBTOOL GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) GTKDOC_RUN = $(LIBTOOL) --mode=execute else GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) GTKDOC_RUN = sh -c endif # We set GPATH here; this gives us semantics for GNU make # which are more like other make's VPATH, when it comes to # whether a source that is a target of one rule is then # searched for in VPATH/GPATH. # GPATH = $(srcdir) TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) EXTRA_DIST = \ $(content_files) \ $(HTML_IMAGES) \ $(DOC_MAIN_SGML_FILE) \ $(DOC_MODULE)-sections.txt \ $(DOC_MODULE)-overrides.txt DOC_STAMPS=scan-build.stamp sgml-build.stamp html-build.stamp \ $(srcdir)/sgml.stamp $(srcdir)/html.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ $(DOC_MODULE).hierarchy \ $(DOC_MODULE).interfaces \ $(DOC_MODULE).prerequisites \ $(DOC_MODULE).signals REPORT_FILES = \ $(DOC_MODULE)-undocumented.txt \ $(DOC_MODULE)-undeclared.txt \ $(DOC_MODULE)-unused.txt CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) if ENABLE_GTK_DOC all-local: html-build.stamp else all-local: endif docs: html-build.stamp $(REPORT_FILES): sgml-build.stamp #### scan #### scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) @echo 'gtk-doc: Scanning header files' @-chmod -R u+w $(srcdir) cd $(srcdir) && \ gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ else \ cd $(srcdir) ; \ for i in $(SCANOBJ_FILES) ; do \ test -f $$i || touch $$i ; \ done \ fi touch scan-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp @true #### xml #### sgml-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) @echo 'gtk-doc: Building XML' @-chmod -R u+w $(srcdir) cd $(srcdir) && \ gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS) touch sgml-build.stamp sgml.stamp: sgml-build.stamp @true #### html #### html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) @echo 'gtk-doc: Building HTML' @-chmod -R u+w $(srcdir) rm -rf $(srcdir)/html mkdir $(srcdir)/html mkhtml_options=""; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ if test "$(?)" = "0"; then \ mkhtml_options=--path="$(srcdir)"; \ fi cd $(srcdir)/html && gtkdoc-mkhtml $(mkhtml_options) $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) @echo 'gtk-doc: Fixing cross-references' cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) touch html-build.stamp ############## clean-local: rm -f *~ *.bak rm -rf .libs distclean-local: cd $(srcdir) && \ rm -rf xml $(REPORT_FILES) \ $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt maintainer-clean-local: clean cd $(srcdir) && rm -rf html install-data-local: installfiles=`echo $(srcdir)/html/*`; \ if test "$$installfiles" = '$(srcdir)/html/*'; \ then echo '-- Nothing to install' ; \ else \ if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ else \ installdir="$(DESTDIR)$(TARGET_DIR)"; \ fi; \ $(mkinstalldirs) $${installdir} ; \ for i in $$installfiles; do \ echo '-- Installing '$$i ; \ $(INSTALL_DATA) $$i $${installdir}; \ done; \ if test -n "$(DOC_MODULE_VERSION)"; then \ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ mv -f $${installdir}/$(DOC_MODULE).devhelp \ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \ fi; \ ! which gtkdoc-rebase >/dev/null 2>&1 || \ gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir} ; \ fi uninstall-local: if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ else \ installdir="$(DESTDIR)$(TARGET_DIR)"; \ fi; \ rm -rf $${installdir} # # Require gtk-doc when making dist # if ENABLE_GTK_DOC dist-check-gtkdoc: else dist-check-gtkdoc: @echo "*** gtk-doc must be installed and enabled in order to make dist" @false endif dist-hook: dist-check-gtkdoc dist-hook-local mkdir $(distdir)/html cp $(srcdir)/html/* $(distdir)/html -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/ -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/ cd $(distdir) && rm -f $(DISTCLEANFILES) ! which gtkdoc-rebase >/dev/null 2>&1 || \ gtkdoc-rebase --online --relative --html-dir=$(distdir)/html .PHONY : dist-hook-local docs libinstpatch-1.0.0/configure0000755000175000017500000170141211461360571013036 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.64. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software # Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error ERROR [LINENO LOG_FD] # --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with status $?, using 1 if that was 0. as_fn_error () { as_status=$?; test $as_status -eq 0 && as_status=1 if test "$3"; then as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$lt_ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac ECHO=${lt_ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then # Yippee, $ECHO works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <<_LT_EOF $* _LT_EOF exit 0 fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$lt_ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if { echo_test_string=`eval $cmd`; } 2>/dev/null && { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null then break fi done fi if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$ECHO" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. ECHO='print -r' elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. ECHO='printf %s\n' if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL ECHO="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. ECHO=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. lt_ECHO=$ECHO if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="libinstpatch/misc.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS GTK_DOC_USE_LIBTOOL_FALSE GTK_DOC_USE_LIBTOOL_TRUE ENABLE_GTK_DOC_FALSE ENABLE_GTK_DOC_TRUE GTKDOC_CHECK HTML_DIR PYTHON_SUPPORT_FALSE PYTHON_SUPPORT_TRUE PYGTK_CODEGEN_DIR PYGTK_LIBS PYGTK_CFLAGS PYTHON_EXTRA_LIBS PYTHON_SITE_PKG PYTHON_LIBS PYTHON_CFLAGS pkgpyexecdir pyexecdir pkgpythondir pythondir PYTHON_PLATFORM PYTHON_EXEC_PREFIX PYTHON_PREFIX PYTHON_VERSION PYTHON SNDFILE_LIBS SNDFILE_CFLAGS GOBJECT_LIBS GOBJECT_CFLAGS PKG_CONFIG PLATFORM_WIN32_FALSE PLATFORM_WIN32_TRUE OS_WIN32_FALSE OS_WIN32_TRUE OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL lt_ECHO RANLIB AR LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED LIBTOOL OBJDUMP DLLTOOL AS EGREP GREP CPP DATADIRNAME ALL_LINGUAS INTLTOOL_PERL INTLTOOL_POLICY_RULE INTLTOOL_SERVICE_RULE INTLTOOL_THEME_RULE INTLTOOL_SCHEMAS_RULE INTLTOOL_CAVES_RULE INTLTOOL_XML_NOMERGE_RULE INTLTOOL_XML_RULE INTLTOOL_KBD_RULE INTLTOOL_XAM_RULE INTLTOOL_UI_RULE INTLTOOL_SOUNDLIST_RULE INTLTOOL_SHEET_RULE INTLTOOL_SERVER_RULE INTLTOOL_PONG_RULE INTLTOOL_OAF_RULE INTLTOOL_PROP_RULE INTLTOOL_KEYS_RULE INTLTOOL_DIRECTORY_RULE INTLTOOL_DESKTOP_RULE INTLTOOL_EXTRACT INTLTOOL_MERGE INTLTOOL_UPDATE POSUB LTLIBINTL LIBINTL INTLLIBS LTLIBICONV LIBICONV MSGMERGE XGETTEXT GMSGFMT MSGFMT USE_NLS MKINSTALLDIRS am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build LT_AGE LT_REVISION LT_CURRENT IPATCH_VERSION IPATCH_BINARY_AGE IPATCH_INTERFACE_AGE IPATCH_VERSION_MICRO IPATCH_VERSION_MINOR IPATCH_VERSION_MAJOR target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_debug enable_dependency_tracking enable_nls with_gnu_ld enable_rpath with_libiconv_prefix with_libintl_prefix enable_shared enable_static with_pic enable_fast_install enable_libtool_lock enable_python with_html_dir enable_gtk_doc ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG GOBJECT_CFLAGS GOBJECT_LIBS SNDFILE_CFLAGS SNDFILE_LIBS PYGTK_CFLAGS PYGTK_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error "unrecognized option: \`$ac_option' Try \`$0 --help' for more information." ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug enable debugging compiler options --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-nls do not use Native Language Support --disable-rpath do not hardcode runtime library paths --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-python disable python binding --enable-gtk-doc use gtk-doc to build documentation [default=no] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-html-dir=PATH path to installed docs Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility GOBJECT_CFLAGS C compiler flags for GOBJECT, overriding pkg-config GOBJECT_LIBS linker flags for GOBJECT, overriding pkg-config SNDFILE_CFLAGS C compiler flags for SNDFILE, overriding pkg-config SNDFILE_LIBS linker flags for SNDFILE, overriding pkg-config PYGTK_CFLAGS C compiler flags for PYGTK, overriding pkg-config PYGTK_LIBS linker flags for PYGTK, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.64 Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} return $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} return $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} return $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} return $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.64. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Making releases: # IPATCH_VERSION_MICRO += 1; # IPATCH_INTERFACE_AGE += 1; # IPATCH_BINARY_AGE += 1; # if any functions have been added, set IPATCH_INTERFACE_AGE to 0. # if backwards compatibility has been broken (removed or changed functions), # set IPATCH_BINARY_AGE and IPATCH_INTERFACE_AGE to 0. # IPATCH_VERSION_MAJOR=1 IPATCH_VERSION_MINOR=0 IPATCH_VERSION_MICRO=0 IPATCH_INTERFACE_AGE=0 IPATCH_BINARY_AGE=0 IPATCH_VERSION=$IPATCH_VERSION_MAJOR.$IPATCH_VERSION_MINOR.$IPATCH_VERSION_MICRO LT_CURRENT=`expr 100 '*' $IPATCH_VERSION_MINOR + $IPATCH_VERSION_MICRO - $IPATCH_INTERFACE_AGE` LT_REVISION=$IPATCH_INTERFACE_AGE LT_AGE=`expr $IPATCH_BINARY_AGE - $IPATCH_INTERFACE_AGE` # Extra m4 macro directory # Check build environment ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do for ac_t in install-sh install.sh shtool; do if test -f "$ac_dir/$ac_t"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/$ac_t -c" break 2 fi done done if test -z "$ac_aux_dir"; then as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if test "${ac_cv_target+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=libinstpatch VERSION=$IPATCH_VERSION cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ac_config_headers="$ac_config_headers config.h" IPATCH_VERSION="\"$VERSION\"" # Check for debugging flags (before AC_PROG_CC to override defaults) # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; enable_debug=$enableval else enable_debug="no" fi if test "$enable_debug" = "yes" ; then $as_echo "#define IPATCH_DEBUG 1" >>confdefs.h CFLAGS="-g -O0" fi # Program checks ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "no acceptable C compiler found in \$PATH See \`config.log' for more details." "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 rm -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } if test -z "$ac_file"; then : $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "C compiler cannot create executables See \`config.log' for more details." "$LINENO" 5; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of object files: cannot compile See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # Set this after AC_PROG_CC so that we inherit the defaults from it CFLAGS="$CFLAGS -Wall" # International language support MKINSTALLDIRS= if test -n "$ac_aux_dir"; then case "$ac_aux_dir" in /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; esac fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 $as_echo_n "checking whether NLS is requested... " >&6; } # Check whether --enable-nls was given. if test "${enable_nls+set}" = set; then : enableval=$enable_nls; USE_NLS=$enableval else USE_NLS=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 $as_echo "$USE_NLS" >&6; } # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_MSGFMT+set}" = set; then : $as_echo_n "(cached) " >&6 else case "$MSGFMT" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 $as_echo "$MSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_GMSGFMT+set}" = set; then : $as_echo_n "(cached) " >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 $as_echo "$GMSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_XGETTEXT+set}" = set; then : $as_echo_n "(cached) " >&6 else case "$XGETTEXT" in [\\/]* | ?:[\\/]*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 $as_echo "$XGETTEXT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f messages.po # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgmerge", so it can be a program name with args. set dummy msgmerge; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_MSGMERGE+set}" = set; then : $as_echo_n "(cached) " >&6 else case "$MSGMERGE" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" ;; esac fi MSGMERGE="$ac_cv_path_MSGMERGE" if test "$MSGMERGE" != ":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 $as_echo "$MSGMERGE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$GMSGFMT" != ":"; then if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then : ; else GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 $as_echo "found $GMSGFMT program is not GNU msgfmt; ignore it" >&6; } GMSGFMT=":" fi fi if test "$XGETTEXT" != ":"; then if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then : ; else { $as_echo "$as_me:${as_lineno-$LINENO}: result: found xgettext program is not GNU xgettext; ignore it" >&5 $as_echo "found xgettext program is not GNU xgettext; ignore it" >&6; } XGETTEXT=":" fi rm -f messages.po fi ac_config_commands="$ac_config_commands default-1" if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5 $as_echo_n "checking for ld used by GCC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if test "${acl_cv_path_LD+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$ac_save_ifs" else acl_cv_path_LD="$LD" # Let the user override the test with a path. fi fi LD="$acl_cv_path_LD" if test -n "$LD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${acl_cv_prog_gnu_ld+set}" = set; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. case `$LD -v 2>&1 &5 $as_echo "$acl_cv_prog_gnu_ld" >&6; } with_gnu_ld=$acl_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 $as_echo_n "checking for shared library run path origin... " >&6; } if test "${acl_cv_rpath+set}" = set; then : $as_echo_n "(cached) " >&6 else CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 $as_echo "$acl_cv_rpath" >&6; } wl="$acl_cv_wl" libext="$acl_cv_libext" shlibext="$acl_cv_shlibext" hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" hardcode_direct="$acl_cv_hardcode_direct" hardcode_minus_L="$acl_cv_hardcode_minus_L" # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then : enableval=$enable_rpath; : else enable_rpath=yes fi use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libiconv-prefix was given. if test "${with_libiconv_prefix+set}" = set; then : withval=$with_libiconv_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi fi LIBICONV= LTLIBICONV= INCICONV= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='iconv ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" else : fi else found_dir= found_la= found_so= found_a= if test $use_additional = yes; then if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi else if test -f "$additional_libdir/lib$name.$libext"; then found_dir="$additional_libdir" found_a="$additional_libdir/lib$name.$libext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi else if test -f "$dir/lib$name.$libext"; then found_dir="$dir" found_a="$dir/lib$name.$libext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$hardcode_direct" = yes; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" fi if test "$hardcode_minus_L" != no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" else LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */lib | */lib/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$additional_libdir" != "X/usr/lib"; then haveit= if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" ;; esac done fi else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 $as_echo_n "checking whether NLS is requested... " >&6; } # Check whether --enable-nls was given. if test "${enable_nls+set}" = set; then : enableval=$enable_nls; USE_NLS=$enableval else USE_NLS=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 $as_echo "$USE_NLS" >&6; } LIBINTL= LTLIBINTL= POSUB= if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 $as_echo_n "checking for GNU gettext in libc... " >&6; } if test "${gt_cv_func_gnugettext1_libc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings; int main () { bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_gnugettext1_libc=yes else gt_cv_func_gnugettext1_libc=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext1_libc" >&5 $as_echo "$gt_cv_func_gnugettext1_libc" >&6; } if test "$gt_cv_func_gnugettext1_libc" != "yes"; then am_save_CPPFLAGS="$CPPFLAGS" for element in $INCICONV; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 $as_echo_n "checking for iconv... " >&6; } if test "${am_cv_func_iconv+set}" = set; then : $as_echo_n "(cached) " >&6 else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 $as_echo "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then $as_echo "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 $as_echo_n "checking how to link with libiconv... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 $as_echo "$LIBICONV" >&6; } else CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libintl-prefix was given. if test "${with_libintl_prefix+set}" = set; then : withval=$with_libintl_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi fi LIBINTL= LTLIBINTL= INCINTL= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='intl ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" else : fi else found_dir= found_la= found_so= found_a= if test $use_additional = yes; then if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi else if test -f "$additional_libdir/lib$name.$libext"; then found_dir="$additional_libdir" found_a="$additional_libdir/lib$name.$libext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi else if test -f "$dir/lib$name.$libext"; then found_dir="$dir" found_a="$dir/lib$name.$libext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$hardcode_direct" = yes; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" fi if test "$hardcode_minus_L" != no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" else LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */lib | */lib/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$additional_libdir" != "X/usr/lib"; then haveit= if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" ;; esac done fi else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 $as_echo_n "checking for GNU gettext in libintl... " >&6; } if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then : $as_echo_n "(cached) " >&6 else gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (); int main () { bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_gnugettext1_libintl=yes else gt_cv_func_gnugettext1_libintl=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (); int main () { bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" gt_cv_func_gnugettext1_libintl=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext1_libintl" >&5 $as_echo "$gt_cv_func_gnugettext1_libintl" >&6; } fi if test "$gt_cv_func_gnugettext1_libc" = "yes" \ || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else LIBINTL= LTLIBINTL= INCINTL= fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then $as_echo "#define ENABLE_NLS 1" >>confdefs.h else USE_NLS=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 $as_echo_n "checking whether to use NLS... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 $as_echo "$USE_NLS" >&6; } if test "$USE_NLS" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 $as_echo_n "checking where the gettext function comes from... " >&6; } if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 $as_echo "$gt_source" >&6; } fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 $as_echo_n "checking how to link with libintl... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 $as_echo "$LIBINTL" >&6; } for element in $INCINTL; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done fi $as_echo "#define HAVE_GETTEXT 1" >>confdefs.h $as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h fi POSUB=po fi INTLLIBS="$LIBINTL" case "$am__api_version" in 1.01234) as_fn_error "Automake 1.5 or newer is required to use intltool" "$LINENO" 5 ;; *) ;; esac if test -n ""; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intltool >= " >&5 $as_echo_n "checking for intltool >= ... " >&6; } INTLTOOL_REQUIRED_VERSION_AS_INT=`echo | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_APPLIED_VERSION found" >&5 $as_echo "$INTLTOOL_APPLIED_VERSION found" >&6; } test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || as_fn_error "Your intltool is too old. You need intltool or later." "$LINENO" 5 fi # Extract the first word of "intltool-update", so it can be a program name with args. set dummy intltool-update; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_INTLTOOL_UPDATE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $INTLTOOL_UPDATE in [\\/]* | ?:[\\/]*) ac_cv_path_INTLTOOL_UPDATE="$INTLTOOL_UPDATE" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_INTLTOOL_UPDATE="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi INTLTOOL_UPDATE=$ac_cv_path_INTLTOOL_UPDATE if test -n "$INTLTOOL_UPDATE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_UPDATE" >&5 $as_echo "$INTLTOOL_UPDATE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "intltool-merge", so it can be a program name with args. set dummy intltool-merge; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_INTLTOOL_MERGE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $INTLTOOL_MERGE in [\\/]* | ?:[\\/]*) ac_cv_path_INTLTOOL_MERGE="$INTLTOOL_MERGE" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_INTLTOOL_MERGE="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi INTLTOOL_MERGE=$ac_cv_path_INTLTOOL_MERGE if test -n "$INTLTOOL_MERGE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_MERGE" >&5 $as_echo "$INTLTOOL_MERGE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "intltool-extract", so it can be a program name with args. set dummy intltool-extract; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_INTLTOOL_EXTRACT+set}" = set; then : $as_echo_n "(cached) " >&6 else case $INTLTOOL_EXTRACT in [\\/]* | ?:[\\/]*) ac_cv_path_INTLTOOL_EXTRACT="$INTLTOOL_EXTRACT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_INTLTOOL_EXTRACT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi INTLTOOL_EXTRACT=$ac_cv_path_INTLTOOL_EXTRACT if test -n "$INTLTOOL_EXTRACT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_EXTRACT" >&5 $as_echo "$INTLTOOL_EXTRACT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then as_fn_error "The intltool scripts were not found. Please install intltool." "$LINENO" 5 fi INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< $@' INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< $@' INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' # Check the gettext tools to make sure they are GNU # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_XGETTEXT+set}" = set; then : $as_echo_n "(cached) " >&6 else case $XGETTEXT in [\\/]* | ?:[\\/]*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_XGETTEXT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi XGETTEXT=$ac_cv_path_XGETTEXT if test -n "$XGETTEXT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 $as_echo "$XGETTEXT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "msgmerge", so it can be a program name with args. set dummy msgmerge; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_MSGMERGE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MSGMERGE in [\\/]* | ?:[\\/]*) ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_MSGMERGE="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi MSGMERGE=$ac_cv_path_MSGMERGE if test -n "$MSGMERGE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 $as_echo "$MSGMERGE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_MSGFMT+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_MSGFMT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi MSGFMT=$ac_cv_path_MSGFMT if test -n "$MSGFMT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 $as_echo "$MSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_GMSGFMT+set}" = set; then : $as_echo_n "(cached) " >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 $as_echo "$GMSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then as_fn_error "GNU gettext tools not found; required for intltool" "$LINENO" 5 fi xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`" mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`" mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`" if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then as_fn_error "GNU gettext tools not found; required for intltool" "$LINENO" 5 fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_INTLTOOL_PERL+set}" = set; then : $as_echo_n "(cached) " >&6 else case $INTLTOOL_PERL in [\\/]* | ?:[\\/]*) ac_cv_path_INTLTOOL_PERL="$INTLTOOL_PERL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_INTLTOOL_PERL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi INTLTOOL_PERL=$ac_cv_path_INTLTOOL_PERL if test -n "$INTLTOOL_PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_PERL" >&5 $as_echo "$INTLTOOL_PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$INTLTOOL_PERL"; then as_fn_error "perl not found" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl >= 5.8.1" >&5 $as_echo_n "checking for perl >= 5.8.1... " >&6; } $INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1 if test $? -ne 0; then as_fn_error "perl 5.8.1 is required for intltool" "$LINENO" 5 else IT_PERL_VERSION="`$INTLTOOL_PERL -e \"printf '%vd', $^V\"`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IT_PERL_VERSION" >&5 $as_echo "$IT_PERL_VERSION" >&6; } fi if test "x" != "xno-xml"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML::Parser" >&5 $as_echo_n "checking for XML::Parser... " >&6; } if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } else as_fn_error "XML::Parser perl module is required for intltool" "$LINENO" 5 fi fi # Substitute ALL_LINGUAS so we can use it in po/Makefile # Set DATADIRNAME correctly if it is not set yet # (copied from glib-gettext.m4) if test -z "$DATADIRNAME"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : DATADIRNAME=share else case $host in *-*-solaris*) ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" if test "x$ac_cv_func_bind_textdomain_codeset" = x""yes; then : DATADIRNAME=share else DATADIRNAME=lib fi ;; *) DATADIRNAME=lib ;; esac fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AS+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_AS+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 $as_echo "$ac_ct_AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_DLLTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.2.6' macro_revision='1.3012' ltmain="$ac_aux_dir/ltmain.sh" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if test "${ac_cv_path_SED+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if test "${ac_cv_path_FGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if test "${lt_cv_path_LD+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if test "${lt_cv_path_NM+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$ac_tool_prefix"; then for ac_prog in "dumpbin -symbols" "link -dump -symbols" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_DUMPBIN+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in "dumpbin -symbols" "link -dump -symbols" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if test "${lt_cv_nm_interface+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:7240: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:7243: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:7246: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if test "${lt_cv_sys_max_cmd_len+set}" = set; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if test "${lt_cv_ld_reload_flag+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if test "${lt_cv_deplibs_check_method+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ const struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 8448 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if test "${lt_cv_cc_needs_belf+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_NMEDIT+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_LIPO+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OTOOL64+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if test "${lt_cv_apple_cc_single_mod+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " eval as_val=\$$as_ac_Header if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if test "${lt_cv_objdir+set}" = set; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:9726: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:9730: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl*) # IBM XL C 8.0/Fortran 10.1 on PPC lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 $as_echo "$lt_prog_compiler_pic" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:10065: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:10069: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test "${lt_cv_prog_compiler_static_works+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:10170: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:10174: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:10225: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:10229: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu) link_all_deplibs=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo(void) {} _ACEOF if ac_fn_c_try_link "$LINENO"; then : archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 $as_echo "$archive_cmds_need_lc" >&6; } ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = x""yes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if test "${ac_cv_lib_dld_shl_load+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if test "${ac_cv_lib_svld_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if test "${ac_cv_lib_dld_dld_link+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if test "${lt_cv_dlopen_self+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line 12608 "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if test "${lt_cv_dlopen_self_static+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line 12704 "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: case $host_os in *mingw32* ) MINGW32=yes;; * ) MINGW32=no;; esac if test "${MINGW32}" == "yes" ; then $as_echo "#define MINGW32 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for native Win32" >&5 $as_echo_n "checking for native Win32... " >&6; } case "$host" in *-*-mingw*) native_win32=yes ;; *) native_win32=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $native_win32" >&5 $as_echo "$native_win32" >&6; } if test "$native_win32" = yes; then OS_WIN32_TRUE= OS_WIN32_FALSE='#' else OS_WIN32_TRUE='#' OS_WIN32_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Win32 platform in general" >&5 $as_echo_n "checking for Win32 platform in general... " >&6; } case "$host" in *-*-mingw*|*-*-cygwin*) platform_win32=yes ;; *) platform_win32=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform_win32" >&5 $as_echo "$platform_win32" >&6; } if test "$platform_win32" = yes; then PLATFORM_WIN32_TRUE= PLATFORM_WIN32_FALSE='#' else PLATFORM_WIN32_TRUE='#' PLATFORM_WIN32_FALSE= fi # Ensure MSVC-compatible struct packing convention is used when # compiling for Win32 with gcc. GTK+ uses this convention, so we must, too. # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while # gcc2 uses "-fnative-struct". if test x"$native_win32" = xyes; then if test x"$GCC" = xyes; then msnative_struct='' { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to get MSVC-compatible struct packing" >&5 $as_echo_n "checking how to get MSVC-compatible struct packing... " >&6; } if test -z "$ac_cv_prog_CC"; then our_gcc="$CC" else our_gcc="$ac_cv_prog_CC" fi case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in 2.) if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then msnative_struct='-fnative-struct' fi ;; *) if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then msnative_struct='-mms-bitfields' fi ;; esac if test x"$msnative_struct" = x ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no way" >&5 $as_echo "no way" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: produced libraries will be incompatible with prebuilt GTK+ DLLs" >&5 $as_echo "$as_me: WARNING: produced libraries will be incompatible with prebuilt GTK+ DLLs" >&2;} else CFLAGS="$CFLAGS $msnative_struct" { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${msnative_struct}" >&5 $as_echo "${msnative_struct}" >&6; } fi fi fi if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GOBJECT" >&5 $as_echo_n "checking for GOBJECT... " >&6; } if test -n "$PKG_CONFIG"; then if test -n "$GOBJECT_CFLAGS"; then pkg_cv_GOBJECT_CFLAGS="$GOBJECT_CFLAGS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-2.0 >= 2.14 glib-2.0 >= 2.14 gthread-2.0 >= 2.14\""; } >&5 ($PKG_CONFIG --exists --print-errors "gobject-2.0 >= 2.14 glib-2.0 >= 2.14 gthread-2.0 >= 2.14") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GOBJECT_CFLAGS=`$PKG_CONFIG --cflags "gobject-2.0 >= 2.14 glib-2.0 >= 2.14 gthread-2.0 >= 2.14" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$GOBJECT_LIBS"; then pkg_cv_GOBJECT_LIBS="$GOBJECT_LIBS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-2.0 >= 2.14 glib-2.0 >= 2.14 gthread-2.0 >= 2.14\""; } >&5 ($PKG_CONFIG --exists --print-errors "gobject-2.0 >= 2.14 glib-2.0 >= 2.14 gthread-2.0 >= 2.14") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GOBJECT_LIBS=`$PKG_CONFIG --libs "gobject-2.0 >= 2.14 glib-2.0 >= 2.14 gthread-2.0 >= 2.14" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GOBJECT_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "gobject-2.0 >= 2.14 glib-2.0 >= 2.14 gthread-2.0 >= 2.14"` else GOBJECT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gobject-2.0 >= 2.14 glib-2.0 >= 2.14 gthread-2.0 >= 2.14"` fi # Put the nasty error message in config.log where it belongs echo "$GOBJECT_PKG_ERRORS" >&5 as_fn_error "Package requirements (gobject-2.0 >= 2.14 glib-2.0 >= 2.14 gthread-2.0 >= 2.14) were not met: $GOBJECT_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables GOBJECT_CFLAGS and GOBJECT_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables GOBJECT_CFLAGS and GOBJECT_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." "$LINENO" 5; } else GOBJECT_CFLAGS=$pkg_cv_GOBJECT_CFLAGS GOBJECT_LIBS=$pkg_cv_GOBJECT_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : fi # Do libsndfile check pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SNDFILE" >&5 $as_echo_n "checking for SNDFILE... " >&6; } if test -n "$PKG_CONFIG"; then if test -n "$SNDFILE_CFLAGS"; then pkg_cv_SNDFILE_CFLAGS="$SNDFILE_CFLAGS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndfile >= 1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "sndfile >= 1.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SNDFILE_CFLAGS=`$PKG_CONFIG --cflags "sndfile >= 1.0" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$SNDFILE_LIBS"; then pkg_cv_SNDFILE_LIBS="$SNDFILE_LIBS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndfile >= 1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "sndfile >= 1.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SNDFILE_LIBS=`$PKG_CONFIG --libs "sndfile >= 1.0" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then SNDFILE_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "sndfile >= 1.0"` else SNDFILE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "sndfile >= 1.0"` fi # Put the nasty error message in config.log where it belongs echo "$SNDFILE_PKG_ERRORS" >&5 as_fn_error "Package requirements (sndfile >= 1.0) were not met: $SNDFILE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables SNDFILE_CFLAGS and SNDFILE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables SNDFILE_CFLAGS and SNDFILE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." "$LINENO" 5; } else SNDFILE_CFLAGS=$pkg_cv_SNDFILE_CFLAGS SNDFILE_LIBS=$pkg_cv_SNDFILE_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : fi # Check for python 2.2 (defines PYTHON_CFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG, # PYTHON_EXTRA_LIBS) # Find any Python interpreter. if test -z "$PYTHON"; then for ac_prog in python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PYTHON" && break done test -n "$PYTHON" || PYTHON=":" fi am_display_PYTHON=python if test "$PYTHON" = :; then as_fn_error "no suitable Python interpreter found" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 $as_echo_n "checking for $am_display_PYTHON version... " >&6; } if test "${am_cv_python_version+set}" = set; then : $as_echo_n "(cached) " >&6 else am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 $as_echo "$am_cv_python_version" >&6; } PYTHON_VERSION=$am_cv_python_version PYTHON_PREFIX='${prefix}' PYTHON_EXEC_PREFIX='${exec_prefix}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 $as_echo_n "checking for $am_display_PYTHON platform... " >&6; } if test "${am_cv_python_platform+set}" = set; then : $as_echo_n "(cached) " >&6 else am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 $as_echo "$am_cv_python_platform" >&6; } PYTHON_PLATFORM=$am_cv_python_platform { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 $as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } if test "${am_cv_python_pythondir+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$prefix" = xNONE then am_py_prefix=$ac_default_prefix else am_py_prefix=$prefix fi am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 $as_echo "$am_cv_python_pythondir" >&6; } pythondir=$am_cv_python_pythondir pkgpythondir=\${pythondir}/$PACKAGE { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 $as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } if test "${am_cv_python_pyexecdir+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$exec_prefix" = xNONE then am_py_exec_prefix=$am_py_prefix else am_py_exec_prefix=$exec_prefix fi am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 $as_echo "$am_cv_python_pyexecdir" >&6; } pyexecdir=$am_cv_python_pyexecdir pkgpyexecdir=\${pyexecdir}/$PACKAGE fi # Check for Python include path { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5 $as_echo_n "checking for Python include path... " >&6; } python_path=`echo $PYTHON | sed "s,/bin.*$,,"` for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do python_path=`find $i -type f -name Python.h -print | sed "1q"` if test -n "$python_path" ; then break fi done python_path=`echo $python_path | sed "s,/Python.h$,,"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $python_path" >&5 $as_echo "$python_path" >&6; } if test -z "$python_path" ; then as_fn_error "cannot find Python include path" "$LINENO" 5 fi PYTHON_CFLAGS=-I$python_path # Check for Python library path { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5 $as_echo_n "checking for Python library path... " >&6; } python_path=`echo $PYTHON | sed "s,/bin.*$,,"` for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"` if test -n "$python_path" ; then break fi done python_path=`echo $python_path | sed "s,/libpython.*$,,"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $python_path" >&5 $as_echo "$python_path" >&6; } if test -z "$python_path" ; then as_fn_error "cannot find Python library path" "$LINENO" 5 fi python_libs="-L$python_path -lpython$PYTHON_VERSION" # What a pain case $host_os in darwin*) python_libs="${python_libs} -lSystem" ;; *) python_libs="${python_libs} -lutil" ;; esac PYTHON_LIBS=$python_libs # python_site=`echo $python_path | sed "s/config/site-packages/"` PYTHON_SITE_PKG=$python_site # # libraries which must be linked in when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5 $as_echo_n "checking python extra libraries... " >&6; } PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print conf('LOCALMODLIBS')+' '+conf('LIBS')" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5 $as_echo "$PYTHON_EXTRA_LIBS" >&6; }` # Try for pygobject first (removes gtk dependency) pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYGTK" >&5 $as_echo_n "checking for PYGTK... " >&6; } if test -n "$PKG_CONFIG"; then if test -n "$PYGTK_CFLAGS"; then pkg_cv_PYGTK_CFLAGS="$PYGTK_CFLAGS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pygobject-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "pygobject-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PYGTK_CFLAGS=`$PKG_CONFIG --cflags "pygobject-2.0" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$PYGTK_LIBS"; then pkg_cv_PYGTK_LIBS="$PYGTK_LIBS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pygobject-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "pygobject-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PYGTK_LIBS=`$PKG_CONFIG --libs "pygobject-2.0" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then PYGTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "pygobject-2.0"` else PYGTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "pygobject-2.0"` fi # Put the nasty error message in config.log where it belongs echo "$PYGTK_PKG_ERRORS" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PYGTK_SUPPORT=0 elif test $pkg_failed = untried; then PYGTK_SUPPORT=0 else PYGTK_CFLAGS=$pkg_cv_PYGTK_CFLAGS PYGTK_LIBS=$pkg_cv_PYGTK_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } PYGTK_SUPPORT=1 fi # If no pygobject check for full pygtk if test ! "$PYGTK_SUPPORT" = "1" ; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYGTK" >&5 $as_echo_n "checking for PYGTK... " >&6; } if test -n "$PKG_CONFIG"; then if test -n "$PYGTK_CFLAGS"; then pkg_cv_PYGTK_CFLAGS="$PYGTK_CFLAGS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pygtk-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "pygtk-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PYGTK_CFLAGS=`$PKG_CONFIG --cflags "pygtk-2.0" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$PYGTK_LIBS"; then pkg_cv_PYGTK_LIBS="$PYGTK_LIBS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pygtk-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "pygtk-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PYGTK_LIBS=`$PKG_CONFIG --libs "pygtk-2.0" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then PYGTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "pygtk-2.0"` else PYGTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "pygtk-2.0"` fi # Put the nasty error message in config.log where it belongs echo "$PYGTK_PKG_ERRORS" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PYGTK_SUPPORT=0 elif test $pkg_failed = untried; then PYGTK_SUPPORT=0 else PYGTK_CFLAGS=$pkg_cv_PYGTK_CFLAGS PYGTK_LIBS=$pkg_cv_PYGTK_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } PYGTK_SUPPORT=1 fi PYGTK_CODEGEN_DIR=`pkg-config pygtk-2.0 --variable=codegendir` else PYGTK_CODEGEN_DIR=`pkg-config pygobject-2.0 --variable=codegendir` fi # Check whether --enable-python was given. if test "${enable_python+set}" = set; then : enableval=$enable_python; enable_python=$enableval else enable_python="yes" fi if test "x${enable_python}" = "xyes" -a "$PYGTK_SUPPORT" = "1" ; then $as_echo "#define PYTHON_SUPPORT 1" >>confdefs.h if test "x$PYGTK_CODEGEN_DIR" = "x" ; then PYGTK_CODEGEN_DIR=/usr/share/pygtk/2.0/codegen fi else enable_python="no" fi if test "x$enable_python" = "xyes"; then PYTHON_SUPPORT_TRUE= PYTHON_SUPPORT_FALSE='#' else PYTHON_SUPPORT_TRUE='#' PYTHON_SUPPORT_FALSE= fi # Check for gtk-doc. # Check whether --with-html-dir was given. if test "${with_html_dir+set}" = set; then : withval=$with_html_dir; else with_html_dir='${datadir}/gtk-doc/html' fi HTML_DIR="$with_html_dir" # Check whether --enable-gtk-doc was given. if test "${enable_gtk_doc+set}" = set; then : enableval=$enable_gtk_doc; else enable_gtk_doc=no fi if test x$enable_gtk_doc = xyes; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk-doc >= 1.9\""; } >&5 ($PKG_CONFIG --exists --print-errors "gtk-doc >= 1.9") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : else as_fn_error "You need to have gtk-doc >= 1.9 installed to build gtk-doc" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build gtk-doc documentation" >&5 $as_echo_n "checking whether to build gtk-doc documentation... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_gtk_doc" >&5 $as_echo "$enable_gtk_doc" >&6; } for ac_prog in gtkdoc-check do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_GTKDOC_CHECK+set}" = set; then : $as_echo_n "(cached) " >&6 else case $GTKDOC_CHECK in [\\/]* | ?:[\\/]*) ac_cv_path_GTKDOC_CHECK="$GTKDOC_CHECK" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_GTKDOC_CHECK="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi GTKDOC_CHECK=$ac_cv_path_GTKDOC_CHECK if test -n "$GTKDOC_CHECK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_CHECK" >&5 $as_echo "$GTKDOC_CHECK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$GTKDOC_CHECK" && break done if test x$enable_gtk_doc = xyes; then ENABLE_GTK_DOC_TRUE= ENABLE_GTK_DOC_FALSE='#' else ENABLE_GTK_DOC_TRUE='#' ENABLE_GTK_DOC_FALSE= fi if test -n "$LIBTOOL"; then GTK_DOC_USE_LIBTOOL_TRUE= GTK_DOC_USE_LIBTOOL_FALSE='#' else GTK_DOC_USE_LIBTOOL_TRUE='#' GTK_DOC_USE_LIBTOOL_FALSE= fi ac_config_files="$ac_config_files Makefile docs/Makefile docs/reference/Makefile examples/Makefile libinstpatch/libinstpatch.h libinstpatch/Makefile libinstpatch/version.h libinstpatch-1.0.pc m4/Makefile po/Makefile.in python/Makefile tests/Makefile utils/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi ac_config_commands="$ac_config_commands po/stamp-it" if test -z "${OS_WIN32_TRUE}" && test -z "${OS_WIN32_FALSE}"; then as_fn_error "conditional \"OS_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PLATFORM_WIN32_TRUE}" && test -z "${PLATFORM_WIN32_FALSE}"; then as_fn_error "conditional \"PLATFORM_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PYTHON_SUPPORT_TRUE}" && test -z "${PYTHON_SUPPORT_FALSE}"; then as_fn_error "conditional \"PYTHON_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_GTK_DOC_TRUE}" && test -z "${ENABLE_GTK_DOC_FALSE}"; then as_fn_error "conditional \"ENABLE_GTK_DOC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GTK_DOC_USE_LIBTOOL_TRUE}" && test -z "${GTK_DOC_USE_LIBTOOL_FALSE}"; then as_fn_error "conditional \"GTK_DOC_USE_LIBTOOL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error ERROR [LINENO LOG_FD] # --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with status $?, using 1 if that was 0. as_fn_error () { as_status=$?; test $as_status -eq 0 && as_status=1 if test "$3"; then as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.64. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.64, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' AS='`$ECHO "X$AS" | $Xsed -e "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "X$DLLTOOL" | $Xsed -e "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # Quote evaled strings. for var in SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ deplibs_check_method \ file_magic_cmd \ AR \ AR_FLAGS \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ SHELL \ ECHO \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ fix_srcfile_path \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Fix-up fallback echo if it was mangled by the above quoting rules. case \$lt_ECHO in *'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` ;; esac ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; "docs/reference/Makefile") CONFIG_FILES="$CONFIG_FILES docs/reference/Makefile" ;; "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "libinstpatch/libinstpatch.h") CONFIG_FILES="$CONFIG_FILES libinstpatch/libinstpatch.h" ;; "libinstpatch/Makefile") CONFIG_FILES="$CONFIG_FILES libinstpatch/Makefile" ;; "libinstpatch/version.h") CONFIG_FILES="$CONFIG_FILES libinstpatch/version.h" ;; "libinstpatch-1.0.pc") CONFIG_FILES="$CONFIG_FILES libinstpatch-1.0.pc" ;; "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "utils/Makefile") CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;; "po/stamp-it") CONFIG_COMMANDS="$CONFIG_COMMANDS po/stamp-it" ;; *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || as_fn_error "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "default-1":C) for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assigment from automake. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Assembler program. AS=$AS # DLL creation program. DLLTOOL=$DLLTOOL # Object dumper program. OBJDUMP=$OBJDUMP # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == "file_magic". file_magic_cmd=$lt_file_magic_cmd # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name of the directory that contains temporary libtool files. objdir=$objdir # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that does not interpret backslashes. ECHO=$lt_ECHO # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) case $xsi_shell in yes) cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac } # func_basename file func_basename () { func_basename_result="${1##*/}" } # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}" } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). func_stripname () { # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"} } # func_opt_split func_opt_split () { func_opt_split_opt=${1%%=*} func_opt_split_arg=${1#*=} } # func_lo2o object func_lo2o () { case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac } # func_xform libobj-or-source func_xform () { func_xform_result=${1%.*}.lo } # func_arith arithmetic-term... func_arith () { func_arith_result=$(( $* )) } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=${#1} } _LT_EOF ;; *) # Bourne compatible functions. cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_basename file func_basename () { func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; esac } # sed scripts: my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^-[^=]*=//' # func_opt_split func_opt_split () { func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` } # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` } # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$@"` } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } _LT_EOF esac case $lt_shell_append in yes) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$1+=\$2" } _LT_EOF ;; *) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$1=\$$1\$2" } _LT_EOF ;; esac sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "po/stamp-it":C) if ! grep "^# INTLTOOL_MAKEFILE$" "po/Makefile.in" > /dev/null ; then as_fn_error "po/Makefile.in.in was not created by intltoolize." "$LINENO" 5 fi rm -f "po/stamp-it" "po/stamp-it.tmp" "po/POTFILES" "po/Makefile.tmp" >"po/stamp-it.tmp" sed '/^#/d s/^[[].*] *// /^[ ]*$/d '"s|^| $ac_top_srcdir/|" \ "$srcdir/po/POTFILES.in" | sed '$!s/$/ \\/' >"po/POTFILES" sed '/^POTFILES =/,/[^\\]$/ { /^POTFILES =/!d r po/POTFILES } ' "po/Makefile.in" >"po/Makefile" rm -f "po/Makefile.tmp" mv "po/stamp-it.tmp" "po/stamp-it" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit $? fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi _SUMMARY_ENABLED= _SUMMARY_DISABLED= if test "x${enable_python}" = "xyes"; then _SUMMARY_ENABLED="$_SUMMARY_ENABLED Python support\n" else _SUMMARY_DISABLED="$_SUMMARY_DISABLED Python support\n" : fi if test "x${enable_gtk_doc}" == "xyes"; then _SUMMARY_ENABLED="$_SUMMARY_ENABLED Generate gtk-doc API docs\n" else _SUMMARY_DISABLED="$_SUMMARY_DISABLED Generate gtk-doc API docs\n" : fi if test "${enable_debug}" == "yes"; then _SUMMARY_ENABLED="$_SUMMARY_ENABLED Debugging\n" else _SUMMARY_DISABLED="$_SUMMARY_DISABLED Debugging\n" : fi echo echo "**************************************************************" echo "Enabled features:" echo -e -n "$_SUMMARY_ENABLED" echo echo "Disabled features:" echo -e -n "$_SUMMARY_DISABLED" echo echo "**************************************************************" echo libinstpatch-1.0.0/utils/0000777000175000017500000000000011461404254012342 500000000000000libinstpatch-1.0.0/utils/riff_dump.c0000644000175000017500000001663711461332142014406 00000000000000/* * riff_dump.c - Command line utility to dump info about RIFF files * * riff_dump utility (licensed separately from libInstPatch) * Copyright (C) 1999-2010 Joshua "Element" Green * * Public Domain, use as you please. */ #include #include #include #include #include #define _GNU_SOURCE #include void usage (void); gboolean recurse_riff_chunks (IpatchRiff *riff, char *indent, GError **err); void display_chunk (IpatchRiff *riff, char *indent); gboolean dump_chunk (IpatchRiff *riff, GError **err); /* chunk index - so commands can be run on specific chunks */ int chunk_index = 0; int dump_index = -1; /* set to chunk index if chunk dump requested */ char *dump_type = NULL; /* set to 4 char string if dumping a chunk type */ gboolean raw_dump = FALSE; /* set to TRUE for raw byte dumps */ gboolean display = TRUE; /* set to FALSE to not display chunks */ gboolean stop = FALSE; /* set to TRUE to stop recursion */ extern char *optarg; extern int optind, opterr, optopt; int main (int argc, char *argv[]) { IpatchRiff *riff; IpatchRiffChunk *chunk; IpatchFile *file; IpatchFileHandle *fhandle; char indent_buf[256] = ""; GError *err = NULL; char *file_name = NULL; int option_index = 0; int c; static struct option long_options[] = { {"dump", 1, 0, 'd'}, {"dump-type", 1, 0, 't'}, {"raw", 0, 0, 'r'}, {NULL, 0, NULL, 0} }; while (TRUE) { c = getopt_long (argc, argv, "rd:t:", long_options, &option_index); if (c == -1) break; switch (c) { case 'd': /* dump chunk? */ dump_index = atoi (optarg); /* get chunk index */ display = FALSE; /* we enable display when we find chunk */ break; case 't': dump_type = g_strndup (optarg, 4); display = FALSE; break; case 'r': raw_dump = TRUE; break; case ':': /* missing option */ fprintf (stderr, "Missing parameter for option '-%c, %s'\n", (char)(long_options[option_index].val), long_options[option_index].name); usage(); exit (1); break; case '?': /* unknown switch */ usage(); exit(1); break; default: fprintf (stderr, "Unknown getopt return val '%d'\n", c); exit (1); break; } } if (optind >= argc) { usage (); exit (1); } file_name = argv[optind]; g_type_init (); ipatch_init (); file = ipatch_file_new (); if (!(fhandle = ipatch_file_open (file, file_name, "r", &err))) { fprintf (stderr, "Failed to open file '%s': %s\n", file_name, err ? err->message : ""); exit (1); } riff = ipatch_riff_new (fhandle); if (!(chunk = ipatch_riff_start_read (riff, &err))) { fprintf (stderr, "Failed to start RIFF parse of file '%s': %s\n", file_name, err ? err->message : ""); exit (1); } /* if a dump of chunk 0 requested or type matches, display everything */ if (dump_index == 0 || (dump_type && strncmp (dump_type, chunk->idstr, 4) == 0)) display = TRUE; if (display) display_chunk (riff, indent_buf); chunk_index++; strcat (indent_buf, " "); if (!recurse_riff_chunks (riff, indent_buf, &err)) { fprintf (stderr, "%s\n", ipatch_riff_message_detail (riff, -1, "Error while parsing RIFF file '%s': %s", file_name, err ? err->message : "")); exit (1); } exit (0); } void usage (void) { fprintf (stderr, "Usage: riff_dump [OPTION]... FILE\n"); fprintf (stderr, " -d, --dump=CHUNK_INDEX " "Dump a chunk by index\n"); fprintf (stderr, " -t, --dump-type='CHNK' " "Dump a chunk by RIFF FOURCC ID\n"); fprintf (stderr, " -r, --raw " "Do raw dump rather than formatted hex dump\n\n"); fprintf (stderr, "CHUNK_INDEX - The chunk index (number in brackets [])\n"); } gboolean recurse_riff_chunks (IpatchRiff *riff, char *indent, GError **err) { IpatchRiffChunk *chunk; gboolean retval; while (!stop && (chunk = ipatch_riff_read_chunk (riff, err))) { if (dump_index == chunk_index) /* dump by chunk index match? */ { if (chunk->type != IPATCH_RIFF_CHUNK_SUB) /* list chunk? */ { display_chunk (riff, indent); strcat (indent, " "); display = TRUE; retval = recurse_riff_chunks (riff, indent, err); stop = TRUE; return (retval); } else { retval = dump_chunk (riff, err); /* hex dump of sub chunk */ stop = TRUE; return (retval); } } /* dump by type match? */ else if (dump_type && strncmp (dump_type, chunk->idstr, 4) == 0) { if (chunk->type != IPATCH_RIFF_CHUNK_SUB) /* list chunk? */ { display = TRUE; strcat (indent, " "); recurse_riff_chunks (riff, indent, err); indent[strlen (indent) - 2] = '\0'; display = FALSE; } else dump_chunk (riff, err); /* hex dump of sub chunk */ } else /* no dump match, just do stuff */ { if (display) display_chunk (riff, indent); chunk_index++; /* advance chunk index */ if (chunk->type != IPATCH_RIFF_CHUNK_SUB) /* list chunk? */ { strcat (indent, " "); if (!recurse_riff_chunks (riff, indent, err)) return (FALSE); indent[strlen (indent) - 2] = '\0'; } } if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); } return (ipatch_riff_get_error (riff, NULL)); } void display_chunk (IpatchRiff *riff, char *indent) { IpatchRiffChunk *chunk; int filepos; chunk = ipatch_riff_get_chunk (riff, -1); filepos = ipatch_riff_get_position (riff); if (chunk->type == IPATCH_RIFF_CHUNK_SUB) printf ("%s(%.4s)[%4d] (ofs = 0x%x, size = %d)\n", indent, chunk->idstr, chunk_index, filepos - (chunk->position + IPATCH_RIFF_HEADER_SIZE), chunk->size); else /* list chunk */ printf ("%s<%.4s>[%4d] (ofs = 0x%x, size = %d)\n", indent, chunk->idstr, chunk_index, filepos - (chunk->position + IPATCH_RIFF_HEADER_SIZE), chunk->size); } #define BUFFER_SIZE (16 * 1024) /* hex dump of a sub chunk */ gboolean dump_chunk (IpatchRiff *riff, GError **err) { IpatchRiffChunk *chunk; guint8 buf[BUFFER_SIZE]; int filepos, read_size, bytes_left, i; chunk = ipatch_riff_get_chunk (riff, -1); filepos = ipatch_riff_get_position (riff); if (!raw_dump) { printf ("Dump chunk: (%.4s)[%4d] (ofs = 0x%x, size = %d)", chunk->idstr, chunk_index, filepos - (chunk->position + IPATCH_RIFF_HEADER_SIZE), chunk->size); i = filepos & ~0xF; /* round down to nearest 16 byte offset */ while (i < filepos) /* advance to start point in 16 byte block */ { if (!(i & 0xF)) printf ("\n%08u ", i); /* print file position */ else if (!(i & 0x3)) printf (" | "); /* print divider */ printf (" "); /* skip 1 byte character */ i++; } } read_size = BUFFER_SIZE; bytes_left = chunk->size; while (bytes_left) /* loop until chunk exhausted */ { if (bytes_left < BUFFER_SIZE) read_size = bytes_left; if (!ipatch_file_read (riff->handle, &buf, read_size, err)) return (FALSE); for (i = 0; i < read_size; i++, filepos++) { if (!raw_dump) { if (!(filepos & 0xF)) printf ("\n%08u ", filepos); /* print file position */ else if (!(filepos & 0x3)) printf (" | "); /* print divider */ } printf ("%02X ", buf[i]); } bytes_left -= read_size; } printf ("\n"); return (TRUE); } libinstpatch-1.0.0/utils/Makefile.in0000644000175000017500000004317411461360571014337 00000000000000# Makefile.in generated by automake 1.11 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@ bin_PROGRAMS = riff_dump$(EXEEXT) subdir = utils DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/python.m4 \ $(top_srcdir)/acinclude.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)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_riff_dump_OBJECTS = riff_dump.$(OBJEXT) riff_dump_OBJECTS = $(am_riff_dump_OBJECTS) riff_dump_DEPENDENCIES = \ $(top_srcdir)/libinstpatch/libinstpatch-1.0.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) 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 = $(riff_dump_SOURCES) DIST_SOURCES = $(riff_dump_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ IPATCH_BINARY_AGE = @IPATCH_BINARY_AGE@ IPATCH_INTERFACE_AGE = @IPATCH_INTERFACE_AGE@ IPATCH_VERSION = @IPATCH_VERSION@ IPATCH_VERSION_MAJOR = @IPATCH_VERSION_MAJOR@ IPATCH_VERSION_MICRO = @IPATCH_VERSION_MICRO@ IPATCH_VERSION_MINOR = @IPATCH_VERSION_MINOR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ 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@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ PYGTK_CODEGEN_DIR = @PYGTK_CODEGEN_DIR@ PYGTK_LIBS = @PYGTK_LIBS@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ SNDFILE_LIBS = @SNDFILE_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ 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@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ 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@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ riff_dump_SOURCES = riff_dump.c riff_dump_LDADD = @GOBJECT_LIBS@ \ $(top_srcdir)/libinstpatch/libinstpatch-1.0.la -lm INCLUDES = -I$(top_srcdir) @GOBJECT_CFLAGS@ MAINTAINERCLEANFILES = Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(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 utils/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu utils/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list riff_dump$(EXEEXT): $(riff_dump_OBJECTS) $(riff_dump_DEPENDENCIES) @rm -f riff_dump$(EXEEXT) $(LINK) $(riff_dump_OBJECTS) $(riff_dump_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/riff_dump.Po@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 distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; 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." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool 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-binPROGRAMS 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-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS 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-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-binPROGRAMS # 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: libinstpatch-1.0.0/utils/Makefile.am0000644000175000017500000000043511456655763014335 00000000000000## Process this file with automake to produce Makefile.in bin_PROGRAMS = riff_dump riff_dump_SOURCES = riff_dump.c riff_dump_LDADD = @GOBJECT_LIBS@ \ $(top_srcdir)/libinstpatch/libinstpatch-1.0.la -lm INCLUDES = -I$(top_srcdir) @GOBJECT_CFLAGS@ MAINTAINERCLEANFILES = Makefile.in libinstpatch-1.0.0/python/0000777000175000017500000000000011461404254012523 500000000000000libinstpatch-1.0.0/python/Makefile.in0000644000175000017500000005162711461360570014521 00000000000000# Makefile.in generated by automake 1.11 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 = python DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/python.m4 \ $(top_srcdir)/acinclude.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)/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)$(pyexecdir)" "$(DESTDIR)$(defsdir)" LTLIBRARIES = $(pyexec_LTLIBRARIES) ipatchmodule_la_DEPENDENCIES = ../libinstpatch/libinstpatch-1.0.la am_ipatchmodule_la_OBJECTS = ipatchmodule.lo nodist_ipatchmodule_la_OBJECTS = ipatch.lo ipatchmodule_la_OBJECTS = $(am_ipatchmodule_la_OBJECTS) \ $(nodist_ipatchmodule_la_OBJECTS) ipatchmodule_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(ipatchmodule_la_LDFLAGS) $(LDFLAGS) -o $@ @PYTHON_SUPPORT_TRUE@am_ipatchmodule_la_rpath = -rpath $(pyexecdir) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) 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 = $(ipatchmodule_la_SOURCES) $(nodist_ipatchmodule_la_SOURCES) DIST_SOURCES = $(ipatchmodule_la_SOURCES) DATA = $(defs_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ IPATCH_BINARY_AGE = @IPATCH_BINARY_AGE@ IPATCH_INTERFACE_AGE = @IPATCH_INTERFACE_AGE@ IPATCH_VERSION = @IPATCH_VERSION@ IPATCH_VERSION_MAJOR = @IPATCH_VERSION_MAJOR@ IPATCH_VERSION_MICRO = @IPATCH_VERSION_MICRO@ IPATCH_VERSION_MINOR = @IPATCH_VERSION_MINOR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ 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@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ PYGTK_CODEGEN_DIR = @PYGTK_CODEGEN_DIR@ PYGTK_LIBS = @PYGTK_LIBS@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ SNDFILE_LIBS = @SNDFILE_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ 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@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ 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@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # Path to PyGtk defs utilities H2DEF = $(PYGTK_CODEGEN_DIR)/h2def.py AUTOMAKE_OPTIONS = 1.5 INCLUDES = -I$(top_srcdir) $(PYTHON_CFLAGS) $(PYGTK_CFLAGS) $(GOBJECT_CFLAGS) @PYTHON_SUPPORT_TRUE@ipatchmodule_cond = ipatchmodule.la @PYTHON_SUPPORT_TRUE@DEFPATH = `pkg-config --variable=defsdir pygtk-2.0` @PYTHON_SUPPORT_TRUE@defsdir = $(DEFPATH) @PYTHON_SUPPORT_TRUE@defs_DATA = ipatch.defs ipatch-types.defs EXTRA_DIST = ipatch.override ipatch.defs ipatch-types.defs ipatchmodule.c pyexec_LTLIBRARIES = $(ipatchmodule_cond) ipatchmodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex \ initipatch ipatchmodule_la_LIBADD = ../libinstpatch/libinstpatch-1.0.la @PYGTK_LIBS@ \ @GOBJECT_LIBS@ ipatchmodule_la_SOURCES = ipatchmodule.c nodist_ipatchmodule_la_SOURCES = ipatch.c CLEANFILES = ipatch.c all: all-am .SUFFIXES: .SUFFIXES: .c .defs .lo .o .obj $(srcdir)/Makefile.in: $(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 python/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu python/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pyexecLTLIBRARIES: $(pyexec_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pyexecdir)" || $(MKDIR_P) "$(DESTDIR)$(pyexecdir)" @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || 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)$(pyexecdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pyexecdir)"; \ } uninstall-pyexecLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pyexecdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pyexecdir)/$$f"; \ done clean-pyexecLTLIBRARIES: -test -z "$(pyexec_LTLIBRARIES)" || rm -f $(pyexec_LTLIBRARIES) @list='$(pyexec_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 ipatchmodule.la: $(ipatchmodule_la_OBJECTS) $(ipatchmodule_la_DEPENDENCIES) $(ipatchmodule_la_LINK) $(am_ipatchmodule_la_rpath) $(ipatchmodule_la_OBJECTS) $(ipatchmodule_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipatch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipatchmodule.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 install-defsDATA: $(defs_DATA) @$(NORMAL_INSTALL) test -z "$(defsdir)" || $(MKDIR_P) "$(DESTDIR)$(defsdir)" @list='$(defs_DATA)'; test -n "$(defsdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(defsdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(defsdir)" || exit $$?; \ done uninstall-defsDATA: @$(NORMAL_UNINSTALL) @list='$(defs_DATA)'; test -n "$(defsdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(defsdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(defsdir)" && rm -f $$files 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 distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: for dir in "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(defsdir)"; 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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-pyexecLTLIBRARIES \ 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-defsDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pyexecLTLIBRARIES 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-defsDATA uninstall-pyexecLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pyexecLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-defsDATA install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-pyexecLTLIBRARIES \ 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-defsDATA uninstall-pyexecLTLIBRARIES ipatch.c: ipatch.defs ipatch-types.defs ipatch.override .defs.c: (cd $(srcdir)\ && pygtk-codegen-2.0 \ --register $(DEFPATH)/gdk-types.defs \ --register $(DEFPATH)/gtk-types.defs \ --register ipatch-types.defs \ --override $*.override \ --prefix py$* $*.defs) > gen-$*.c \ && cp gen-$*.c $*.c \ && rm -f gen-$*.c # Auto generation of defs file for merging into ipatch.defs # To be run manually to aid the developer in adding new bindings ipatch-auto.defs: (cd $(srcdir)\ && $(PYTHON) ${H2DEF} `cat ../libinstpatch/libinstpatch.h | grep "^#include [<]libinstpatch" | sed 's/#include //;s/^/\.\.\/libinstpatch\//'`) \ | sed 's/DL_S2/DLS2/g;s/IpatchSf2/IpatchSF2/g;s/IpatchDls2/IpatchDLS2/g;s/Izone/IZone/g;s/Pzone/PZone/g;s/IpatchDlsFile/IpatchDLSFile/g;s/IpatchDlsReader/IpatchDLSReader/g;s/IpatchDlsWriter/IpatchDLSWriter/g' \ > ipatch-auto.defs .PHONY: ipatch-auto.defs # 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: libinstpatch-1.0.0/python/ipatchmodule.c0000644000175000017500000000360111456655754015302 00000000000000#ifdef HAVE_CONFIG_H #include "config.h" #endif #define NO_IMPORT_PYGOBJECT #include #include void pyipatch_register_classes (PyObject *d); void pyipatch_add_constants (PyObject *module, const gchar *strip_prefix); static void pyipatch_register_boxed_types (PyObject *moddict); extern PyMethodDef pyipatch_functions[]; DL_EXPORT(void) initipatch(void) { PyObject *m, *d; init_pygobject (); ipatch_init (); /* initialize libInstPatch */ m = Py_InitModule ("ipatch", pyipatch_functions); d = PyModule_GetDict (m); pyipatch_register_classes (d); pyipatch_add_constants(m, "IPATCH_"); pyipatch_register_boxed_types (d); if (PyErr_Occurred ()) Py_FatalError ("can't initialise module ipatch"); } gboolean pyipatch_range_from_pyobject (PyObject *object, IpatchRange *range) { g_return_val_if_fail (range != NULL, FALSE); if (pyg_boxed_check (object, IPATCH_TYPE_RANGE)) { *range = *pyg_boxed_get (object, IpatchRange); return TRUE; } if (PyArg_ParseTuple (object, "ii", &range->low, &range->high)) return TRUE; PyErr_Clear (); PyErr_SetString (PyExc_TypeError, "could not convert to IpatchRange"); return FALSE; } static PyObject * PyIpatchRange_from_value (const GValue *value) { IpatchRange *range = (IpatchRange *)g_value_get_boxed (value); return pyg_boxed_new(IPATCH_TYPE_RANGE, range, TRUE, TRUE); } static int PyIpatchRange_to_value (GValue *value, PyObject *object) { IpatchRange range; if (!pyipatch_range_from_pyobject (object, &range)) return -1; g_value_set_boxed (value, &range); return 0; } static void pyipatch_register_boxed_types (PyObject *moddict) { pyg_register_boxed_custom (IPATCH_TYPE_RANGE, PyIpatchRange_from_value, PyIpatchRange_to_value); } libinstpatch-1.0.0/python/ipatch-types.defs0000644000175000017500000000036611456655754015742 00000000000000;; -*- scheme -*- ;; ;; Note, everything should be sorted in here. ;; Boxed types ... (define-boxed Range (in-module "Ipatch") (c-name "IpatchRange") (gtype-id "IPATCH_TYPE_RANGE") (fields '("gint" "low") '("gint" "high") ) ) libinstpatch-1.0.0/python/Makefile.am0000644000175000017500000000322511456655754014516 00000000000000# Path to PyGtk defs utilities H2DEF=$(PYGTK_CODEGEN_DIR)/h2def.py AUTOMAKE_OPTIONS=1.5 INCLUDES = -I$(top_srcdir) $(PYTHON_CFLAGS) $(PYGTK_CFLAGS) $(GOBJECT_CFLAGS) if PYTHON_SUPPORT ipatchmodule_cond = ipatchmodule.la DEFPATH=`pkg-config --variable=defsdir pygtk-2.0` defsdir = $(DEFPATH) defs_DATA = ipatch.defs ipatch-types.defs endif EXTRA_DIST = ipatch.override ipatch.defs ipatch-types.defs ipatchmodule.c pyexec_LTLIBRARIES = $(ipatchmodule_cond) ipatchmodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex \ initipatch ipatchmodule_la_LIBADD = ../libinstpatch/libinstpatch-1.0.la @PYGTK_LIBS@ \ @GOBJECT_LIBS@ ipatchmodule_la_SOURCES = ipatchmodule.c nodist_ipatchmodule_la_SOURCES = ipatch.c ipatch.c: ipatch.defs ipatch-types.defs ipatch.override CLEANFILES = ipatch.c .defs.c: (cd $(srcdir)\ && pygtk-codegen-2.0 \ --register $(DEFPATH)/gdk-types.defs \ --register $(DEFPATH)/gtk-types.defs \ --register ipatch-types.defs \ --override $*.override \ --prefix py$* $*.defs) > gen-$*.c \ && cp gen-$*.c $*.c \ && rm -f gen-$*.c # Auto generation of defs file for merging into ipatch.defs # To be run manually to aid the developer in adding new bindings ipatch-auto.defs: (cd $(srcdir)\ && $(PYTHON) ${H2DEF} `cat ../libinstpatch/libinstpatch.h | grep "^#include [<]libinstpatch" | sed 's/#include //;s/^/\.\.\/libinstpatch\//'`) \ | sed 's/DL_S2/DLS2/g;s/IpatchSf2/IpatchSF2/g;s/IpatchDls2/IpatchDLS2/g;s/Izone/IZone/g;s/Pzone/PZone/g;s/IpatchDlsFile/IpatchDLSFile/g;s/IpatchDlsReader/IpatchDLSReader/g;s/IpatchDlsWriter/IpatchDLSWriter/g' \ > ipatch-auto.defs .PHONY: ipatch-auto.defs libinstpatch-1.0.0/python/ipatch.override0000644000175000017500000002270711456655754015501 00000000000000/* -*- Mode: C -*- * * ipatch.override - Function override for libInstPatch python binding * * libInstPatch * Copyright (C) 1999-2002 Josh Green * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ %% headers #include #include "pygobject.h" #include %% modulename InstPatch %% import gobject.GObject as PyGObject_Type %% ignore-glob *_get_type ipatch_list_* ipatch_*_first ipatch_*_next %% ignore _ipatch_code_error _ipatch_code_errorv IpatchList ipatch_container_init_iter ipatch_container_insert_iter ipatch_container_remove_iter ipatch_container_set_add_hook ipatch_container_set_remove_hook ipatch_dls2_info_install_class_properties ipatch_dls2_info_set ipatch_dls2_info_set_property ipatch_dls2_sample_info_install_class_properties ipatch_dls2_sample_info_set_property ipatch_error_quark ipatch_file_default_read_method ipatch_file_default_seek_method ipatch_file_default_write_method ipatch_file_get_iofuncs ipatch_file_open_with_io_channel ipatch_file_ref_io_channel ipatch_file_set_iofuncs ipatch_file_set_iofuncs_static ipatch_gerror_message ipatch_gig_parse_effects ipatch_gig_region_last ipatch_gig_region_previous ipatch_item_get_atomic ipatch_item_get_hooks ipatch_item_set_atomic ipatch_item_set_hooks ipatch_item_set_prop_notify_hook ipatch_iter_alloc ipatch_riff_parser_error_quark ipatch_sample_install_property ipatch_sample_install_property_readonly ipatch_sample_new_property_param_spec ipatch_sample_new_transform_func_array ipatch_sample_store_RAM_get_location ipatch_sample_store_RAM_set_location ipatch_sf2_free_info_array ipatch_sf2_gen_amount_to_value ipatch_sf2_get_info ipatch_sf2_parse_bag ipatch_sf2_parse_gen ipatch_sf2_parse_ihdr ipatch_sf2_parse_mod ipatch_sf2_parse_phdr ipatch_sf2_parse_shdr ipatch_sf2_set_info ipatch_sf2_zone_class_install_gen_properties ipatch_sf2_zone_genid_get_pspec %% override ipatch_container_get_children kwargs static PyObject * _wrap_ipatch_container_get_children (PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "type", NULL }; PyObject *py_type = NULL; GType type; IpatchList *list; PyObject *py_list; GList *p; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O:IpatchContainer.get_children", kwlist, &py_type)) return NULL; if ((type = pyg_type_from_object (py_type)) == 0) return NULL; /* ++ ref new list */ list = ipatch_container_get_children (IPATCH_CONTAINER (self->obj), type); if ((py_list = PyList_New (0)) == NULL) { g_object_unref (list); /* -- unref list */ return (NULL); } for (p = list->items; p != NULL; p = g_list_next (p)) { PyObject *obj = pygobject_new (G_OBJECT (p->data)); if (obj == NULL) { g_object_unref (list); /* -- unref list */ Py_DECREF (py_list); return (NULL); } PyList_Append (py_list, obj); Py_DECREF (obj); } g_object_unref (list); /* -- unref list */ return (py_list); } %% override ipatch_container_get_child_types noargs static PyObject * _wrap_ipatch_container_get_child_types (PyGObject *self) { const GType *types; PyObject *py_list; if ((py_list = PyList_New (0)) == NULL) return (NULL); types = ipatch_container_get_child_types (IPATCH_CONTAINER (self->obj)); for (; *types != 0; types++) { PyObject *py_type = pyg_type_wrapper_new (*types); if (py_type == NULL) { Py_DECREF (py_list); return (NULL); } PyList_Append (py_list, py_type); Py_DECREF (py_type); } return (py_list); } %% override ipatch_container_type_get_child_types kwargs static PyObject * _wrap_ipatch_container_type_get_child_types (PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "type", NULL }; const GType *types; PyObject *py_type = NULL; PyObject *py_list; GType container_type; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O:container_type_children", kwlist, &py_type)) return NULL; if ((container_type = pyg_type_from_object (py_type)) == 0) return NULL; if ((py_list = PyList_New (0)) == NULL) return (NULL); types = ipatch_container_type_get_child_types (container_type); for (; *types != 0; types++) { PyObject *py_type = pyg_type_wrapper_new (*types); if (py_type == NULL) { Py_DECREF (py_list); return (NULL); } PyList_Append (py_list, py_type); Py_DECREF (py_type); } return (py_list); } %% override-slot IpatchList.tp_iter typedef struct { PyObject_HEAD GList *curpos; } PyIpatchListIter; static void pyipatch_list_iter_dealloc(PyIpatchListIter *self) { PyObject_Del((PyObject*) self); } static PyObject* pyipatch_list_iter_next(PyIpatchListIter *iter) { PyObject *pyobj; if (!iter->curpos) { PyErr_SetNone(PyExc_StopIteration); return NULL; } pyobj = pygobject_new ((GObject *)(iter->curpos->data)); iter->curpos = g_list_next (iter->curpos); return pyobj; } PyTypeObject PyIpatchListIter_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ "ipatch.ListIter", /* tp_name */ sizeof(PyIpatchListIter), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)pyipatch_list_iter_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "IpatchList iterator", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ (iternextfunc)pyipatch_list_iter_next, /* tp_iternext */ }; static PyObject* _wrap_ipatch_list_tp_iter(PyGObject *self) { PyIpatchListIter *iter; iter = PyObject_NEW(PyIpatchListIter, &PyIpatchListIter_Type); iter->curpos = IPATCH_LIST (self->obj)->items; return (PyObject *) iter; } %% override-slot IpatchRange.tp_as_sequence static int _wrap_ipatch_range_length(PyGBoxed *self) { return 2; } static PyObject * _wrap_ipatch_range_getitem(PyGBoxed *self, int pos) { IpatchRange *range; if (pos < 0) pos += 2; if (pos < 0 || pos >= 2) { PyErr_SetString(PyExc_IndexError, "index out of range"); return NULL; } range = pyg_boxed_get(self, IpatchRange); switch (pos) { case 0: return PyInt_FromLong(range->low); case 1: return PyInt_FromLong(range->high); default: g_assert_not_reached(); return NULL; } } static int _wrap_ipatch_range_setitem(PyGBoxed *self, int pos, PyObject *value) { IpatchRange *range; gint val; if (pos < 0) pos += 2; if (pos < 0 || pos >= 2) { PyErr_SetString(PyExc_IndexError, "index out of range"); return -1; } range = pyg_boxed_get(self, IpatchRange); val = PyInt_AsLong(value); if (PyErr_Occurred()) return -1; switch(pos) { case 0: range->low = val; break; case 1: range->high = val; break; default: g_assert_not_reached(); return -1; } return 0; } static PySequenceMethods _wrap_ipatch_range_tp_as_sequence = { (inquiry)_wrap_ipatch_range_length, (binaryfunc)0, (intargfunc)0, (intargfunc)_wrap_ipatch_range_getitem, (intintargfunc)0, (intobjargproc)_wrap_ipatch_range_setitem, (intintobjargproc)0 }; %% override-attr IpatchRange.low static int _wrap_ipatch_range__set_low(PyGBoxed *self, PyObject *value, void *closure) { gint val; val = PyInt_AsLong(value); if (PyErr_Occurred()) return -1; pyg_boxed_get(self, IpatchRange)->low = val; return 0; } %% override-attr IpatchRange.high static int _wrap_ipatch_range__set_high(PyGBoxed *self, PyObject *value, void *closure) { gint val; val = PyInt_AsLong(value); if (PyErr_Occurred()) return -1; pyg_boxed_get(self, IpatchRange)->high = val; return 0; } %% override ipatch_cram_decoder_next_file noargs static PyObject * _wrap_ipatch_cram_decoder_next_file(PyGObject *self) { IpatchCramDecoderFileInfo *info; GError *err = NULL; info = ipatch_cram_decoder_next_file(IPATCH_CRAM_DECODER(self->obj), &err); if (pyg_error_check(&err)) return NULL; if (!info) Py_RETURN_NONE; /* FIXME - 32 bit support only, 64 bit numbers truncated? */ return (Py_BuildValue ("{s:s,s:i,s:i,s:i,s:i}", "filename", info->filename, "size", (int)(info->size), "compress_size", (int)(info->compress_size), "date", info->date, "flags", info->flags)); } libinstpatch-1.0.0/python/ipatch.defs0000644000175000017500000052213411457527544014576 00000000000000;; -*- scheme -*- (include "ipatch-types.defs") ; object definitions ... (define-object Converter (in-module "Ipatch") (parent "GObject") (c-name "IpatchConverter") (gtype-id "IPATCH_TYPE_CONVERTER") ) (define-object Item (in-module "Ipatch") (parent "GObject") (c-name "IpatchItem") (gtype-id "IPATCH_TYPE_ITEM") ) (define-object GigSubRegion (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchGigSubRegion") (gtype-id "IPATCH_TYPE_GIG_SUB_REGION") ) (define-object GigDimension (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchGigDimension") (gtype-id "IPATCH_TYPE_GIG_DIMENSION") ) (define-object File (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchFile") (gtype-id "IPATCH_TYPE_FILE") ) (define-object DLSFile (in-module "Ipatch") (parent "IpatchFile") (c-name "IpatchDLSFile") (gtype-id "IPATCH_TYPE_DLS_FILE") ) (define-object GigFile (in-module "Ipatch") (parent "IpatchDLSFile") (c-name "IpatchGigFile") (gtype-id "IPATCH_TYPE_GIG_FILE") ) (define-object DLS2Sample (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchDLS2Sample") (gtype-id "IPATCH_TYPE_DLS2_SAMPLE") ) (define-object GigSample (in-module "Ipatch") (parent "IpatchDLS2Sample") (c-name "IpatchGigSample") (gtype-id "IPATCH_TYPE_GIG_SAMPLE") ) (define-object DLS2Region (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchDLS2Region") (gtype-id "IPATCH_TYPE_DLS2_REGION") ) (define-object Container (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchContainer") (gtype-id "IPATCH_TYPE_CONTAINER") ) (define-object GigRegion (in-module "Ipatch") (parent "IpatchContainer") (c-name "IpatchGigRegion") (gtype-id "IPATCH_TYPE_GIG_REGION") ) (define-object DLS2Inst (in-module "Ipatch") (parent "IpatchContainer") (c-name "IpatchDLS2Inst") (gtype-id "IPATCH_TYPE_DLS2_INST") ) (define-object GigInst (in-module "Ipatch") (parent "IpatchDLS2Inst") (c-name "IpatchGigInst") (gtype-id "IPATCH_TYPE_GIG_INST") ) (define-object Base (in-module "Ipatch") (parent "IpatchContainer") (c-name "IpatchBase") (gtype-id "IPATCH_TYPE_BASE") ) (define-object DLS2 (in-module "Ipatch") (parent "IpatchBase") (c-name "IpatchDLS2") (gtype-id "IPATCH_TYPE_DLS2") ) (define-object Gig (in-module "Ipatch") (parent "IpatchDLS2") (c-name "IpatchGig") (gtype-id "IPATCH_TYPE_GIG") ) (define-object List (in-module "Ipatch") (parent "GObject") (c-name "IpatchList") (gtype-id "IPATCH_TYPE_LIST") ) (define-object Paste (in-module "Ipatch") (parent "GObject") (c-name "IpatchPaste") (gtype-id "IPATCH_TYPE_PASTE") ) (define-object Riff (in-module "Ipatch") (parent "GObject") (c-name "IpatchRiff") (gtype-id "IPATCH_TYPE_RIFF") ) (define-object DLSWriter (in-module "Ipatch") (parent "IpatchRiff") (c-name "IpatchDLSWriter") (gtype-id "IPATCH_TYPE_DLS_WRITER") ) (define-object DLSReader (in-module "Ipatch") (parent "IpatchRiff") (c-name "IpatchDLSReader") (gtype-id "IPATCH_TYPE_DLS_READER") ) (define-object SF2 (in-module "Ipatch") (parent "IpatchBase") (c-name "IpatchSF2") (gtype-id "IPATCH_TYPE_SF2") ) (define-object SF2File (in-module "Ipatch") (parent "IpatchFile") (c-name "IpatchSF2File") (gtype-id "IPATCH_TYPE_SF2_FILE") ) (define-interface SF2GenItem (in-module "Ipatch") (c-name "IpatchSF2GenItem") (gtype-id "IPATCH_TYPE_SF2_GEN_ITEM") ) (define-object SF2Inst (in-module "Ipatch") (parent "IpatchContainer") (c-name "IpatchSF2Inst") (gtype-id "IPATCH_TYPE_SF2_INST") ) (define-interface SF2ModItem (in-module "Ipatch") (c-name "IpatchSF2ModItem") (gtype-id "IPATCH_TYPE_SF2_MOD_ITEM") ) (define-object SF2Preset (in-module "Ipatch") (parent "IpatchContainer") (c-name "IpatchSF2Preset") (gtype-id "IPATCH_TYPE_SF2_PRESET") ) (define-object SF2Reader (in-module "Ipatch") (parent "IpatchRiff") (c-name "IpatchSF2Reader") (gtype-id "IPATCH_TYPE_SF2_READER") ) (define-object SF2Sample (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchSF2Sample") (gtype-id "IPATCH_TYPE_SF2_SAMPLE") ) (define-object SF2VoiceCache (in-module "Ipatch") (parent "GObject") (c-name "IpatchSF2VoiceCache") (gtype-id "IPATCH_TYPE_SF2_VOICE_CACHE") ) (define-object SF2Writer (in-module "Ipatch") (parent "IpatchRiff") (c-name "IpatchSF2Writer") (gtype-id "IPATCH_TYPE_SF2_WRITER") ) (define-object SF2Zone (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchSF2Zone") (gtype-id "IPATCH_TYPE_SF2_ZONE") ) (define-object SF2PZone (in-module "Ipatch") (parent "IpatchSF2Zone") (c-name "IpatchSF2PZone") (gtype-id "IPATCH_TYPE_SF2_PZONE") ) (define-object SF2IZone (in-module "Ipatch") (parent "IpatchSF2Zone") (c-name "IpatchSF2IZone") (gtype-id "IPATCH_TYPE_SF2_IZONE") ) (define-interface Sample (in-module "Ipatch") (c-name "IpatchSample") (gtype-id "IPATCH_TYPE_SAMPLE") ) (define-object SampleStore (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchSampleStore") (gtype-id "IPATCH_TYPE_SAMPLE_STORE") ) (define-object SampleStoreCache (in-module "Ipatch") (parent "IpatchSampleStore") (c-name "IpatchSampleStoreCache") (gtype-id "IPATCH_TYPE_SAMPLE_STORE_CACHE") ) (define-object SampleStoreFile (in-module "Ipatch") (parent "IpatchSampleStore") (c-name "IpatchSampleStoreFile") (gtype-id "IPATCH_TYPE_SAMPLE_STORE_FILE") ) (define-object SampleStoreRam (in-module "Ipatch") (parent "IpatchSampleStore") (c-name "IpatchSampleStoreRam") (gtype-id "IPATCH_TYPE_SAMPLE_STORE_RAM") ) (define-object SampleStoreRom (in-module "Ipatch") (parent "IpatchSampleStore") (c-name "IpatchSampleStoreRom") (gtype-id "IPATCH_TYPE_SAMPLE_STORE_ROM") ) (define-object SampleStoreSndFile (in-module "Ipatch") (parent "IpatchSampleStore") (c-name "IpatchSampleStoreSndFile") (gtype-id "IPATCH_TYPE_SAMPLE_STORE_SND_FILE") ) (define-object SampleStoreSwap (in-module "Ipatch") (parent "IpatchSampleStoreFile") (c-name "IpatchSampleStoreSwap") (gtype-id "IPATCH_TYPE_SAMPLE_STORE_SWAP") ) (define-object SampleStoreVirtual (in-module "Ipatch") (parent "IpatchSampleStore") (c-name "IpatchSampleStoreVirtual") (gtype-id "IPATCH_TYPE_SAMPLE_STORE_VIRTUAL") ) (define-object SndFile (in-module "Ipatch") (parent "IpatchFile") (c-name "IpatchSndFile") (gtype-id "IPATCH_TYPE_SND_FILE") ) (define-object VBank (in-module "Ipatch") (parent "IpatchBase") (c-name "IpatchVBank") (gtype-id "IPATCH_TYPE_VBANK") ) (define-object VBankInst (in-module "Ipatch") (parent "IpatchContainer") (c-name "IpatchVBankInst") (gtype-id "IPATCH_TYPE_VBANK_INST") ) (define-object VBankRegion (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchVBankRegion") (gtype-id "IPATCH_TYPE_VBANK_REGION") ) (define-object VirtualContainer (in-module "Ipatch") (parent "IpatchItem") (c-name "IpatchVirtualContainer") (gtype-id "IPATCH_TYPE_VIRTUAL_CONTAINER") ) ;; Enumerations and flags ... (define-flags BaseFlags (in-module "Ipatch") (c-name "IpatchBaseFlags") (gtype-id "IPATCH_TYPE_BASE_FLAGS") (values '("changed" "IPATCH_BASE_CHANGED") '("saved" "IPATCH_BASE_SAVED") ) ) (define-enum ConverterLogType (in-module "Ipatch") (c-name "IpatchConverterLogType") (gtype-id "IPATCH_TYPE_CONVERTER_LOG_TYPE") (values '("rating" "IPATCH_CONVERTER_LOG_RATING") '("info" "IPATCH_CONVERTER_LOG_INFO") '("warn" "IPATCH_CONVERTER_LOG_WARN") '("critical" "IPATCH_CONVERTER_LOG_CRITICAL") '("fatal" "IPATCH_CONVERTER_LOG_FATAL") ) ) (define-enum ConverterCount (in-module "Ipatch") (c-name "IpatchConverterCount") (gtype-id "IPATCH_TYPE_CONVERTER_COUNT") (values '("one-or-more" "IPATCH_CONVERTER_COUNT_ONE_OR_MORE") '("zero-or-more" "IPATCH_CONVERTER_COUNT_ZERO_OR_MORE") ) ) (define-flags ConverterFlags (in-module "Ipatch") (c-name "IpatchConverterFlags") (gtype-id "IPATCH_TYPE_CONVERTER_FLAGS") (values '("derived" "IPATCH_CONVERTER_FLAG_SRC_DERIVED") ) ) (define-enum ConverterPriority (in-module "Ipatch") (c-name "IpatchConverterPriority") (gtype-id "IPATCH_TYPE_CONVERTER_PRIORITY") (values '("lowest" "IPATCH_CONVERTER_PRIORITY_LOWEST") '("low" "IPATCH_CONVERTER_PRIORITY_LOW") '("default" "IPATCH_CONVERTER_PRIORITY_DEFAULT") '("high" "IPATCH_CONVERTER_PRIORITY_HIGH") '("highest" "IPATCH_CONVERTER_PRIORITY_HIGHEST") ) ) (define-enum DLSReaderError (in-module "Ipatch") (c-name "IpatchDLSReaderError") (gtype-id "IPATCH_TYPE_DLS_READER_ERROR") (values '("gig" "IPATCH_DLS_READER_ERROR_GIG") ) ) (define-flags FileFlags (in-module "Ipatch") (c-name "IpatchFileFlags") (gtype-id "IPATCH_TYPE_FILE_FLAGS") (values '("swap" "IPATCH_FILE_FLAG_SWAP") '("big-endian" "IPATCH_FILE_FLAG_BIG_ENDIAN") '("free-iofuncs" "IPATCH_FILE_FLAG_FREE_IOFUNCS") ) ) (define-enum FileIdentifyOrder (in-module "Ipatch") (c-name "IpatchFileIdentifyOrder") (gtype-id "IPATCH_TYPE_FILE_IDENTIFY_ORDER") (values '("last" "IPATCH_FILE_IDENTIFY_ORDER_LAST") '("default" "IPATCH_FILE_IDENTIFY_ORDER_DEFAULT") '("first" "IPATCH_FILE_IDENTIFY_ORDER_FIRST") ) ) (define-enum GigFilterType (in-module "Ipatch") (c-name "IpatchGigFilterType") (gtype-id "IPATCH_TYPE_GIG_FILTER_TYPE") (values '("lowpass" "IPATCH_GIG_FILTER_LOWPASS") '("bandpass" "IPATCH_GIG_FILTER_BANDPASS") '("highpass" "IPATCH_GIG_FILTER_HIGHPASS") '("bandreject" "IPATCH_GIG_FILTER_BANDREJECT") ) ) (define-enum GigControlType (in-module "Ipatch") (c-name "IpatchGigControlType") (gtype-id "IPATCH_TYPE_GIG_CONTROL_TYPE") (values '("mod-wheel" "IPATCH_GIG_CTRL_MOD_WHEEL") '("breath" "IPATCH_GIG_CTRL_BREATH") '("foot" "IPATCH_GIG_CTRL_FOOT") '("portamento-time" "IPATCH_GIG_CTRL_PORTAMENTO_TIME") '("effect-1" "IPATCH_GIG_CTRL_EFFECT_1") '("effect-2" "IPATCH_GIG_CTRL_EFFECT_2") '("gen-purpose-1" "IPATCH_GIG_CTRL_GEN_PURPOSE_1") '("gen-purpose-2" "IPATCH_GIG_CTRL_GEN_PURPOSE_2") '("gen-purpose-3" "IPATCH_GIG_CTRL_GEN_PURPOSE_3") '("gen-purpose-4" "IPATCH_GIG_CTRL_GEN_PURPOSE_4") '("sustain-pedal" "IPATCH_GIG_CTRL_SUSTAIN_PEDAL") '("portamento" "IPATCH_GIG_CTRL_PORTAMENTO") '("sostenuto" "IPATCH_GIG_CTRL_SOSTENUTO") '("soft-pedal" "IPATCH_GIG_CTRL_SOFT_PEDAL") '("gen-purpose-5" "IPATCH_GIG_CTRL_GEN_PURPOSE_5") '("gen-purpose-6" "IPATCH_GIG_CTRL_GEN_PURPOSE_6") '("gen-purpose-7" "IPATCH_GIG_CTRL_GEN_PURPOSE_7") '("gen-purpose-8" "IPATCH_GIG_CTRL_GEN_PURPOSE_8") '("effect-depth-1" "IPATCH_GIG_CTRL_EFFECT_DEPTH_1") '("effect-depth-2" "IPATCH_GIG_CTRL_EFFECT_DEPTH_2") '("effect-depth-3" "IPATCH_GIG_CTRL_EFFECT_DEPTH_3") '("effect-depth-4" "IPATCH_GIG_CTRL_EFFECT_DEPTH_4") '("effect-depth-5" "IPATCH_GIG_CTRL_EFFECT_DEPTH_5") ) ) (define-enum GigDimensionType (in-module "Ipatch") (c-name "IpatchGigDimensionType") (gtype-id "IPATCH_TYPE_GIG_DIMENSION_TYPE") (values '("none" "IPATCH_GIG_DIMENSION_NONE") '("mod-wheel" "IPATCH_GIG_DIMENSION_MOD_WHEEL") '("breath" "IPATCH_GIG_DIMENSION_BREATH") '("foot" "IPATCH_GIG_DIMENSION_FOOT") '("portamento-time" "IPATCH_GIG_DIMENSION_PORTAMENTO_TIME") '("effect-1" "IPATCH_GIG_DIMENSION_EFFECT_1") '("effect-2" "IPATCH_GIG_DIMENSION_EFFECT_2") '("gen-purpose-1" "IPATCH_GIG_DIMENSION_GEN_PURPOSE_1") '("gen-purpose-2" "IPATCH_GIG_DIMENSION_GEN_PURPOSE_2") '("gen-purpose-3" "IPATCH_GIG_DIMENSION_GEN_PURPOSE_3") '("gen-purpose-4" "IPATCH_GIG_DIMENSION_GEN_PURPOSE_4") '("sustain-pedal" "IPATCH_GIG_DIMENSION_SUSTAIN_PEDAL") '("portamento" "IPATCH_GIG_DIMENSION_PORTAMENTO") '("sostenuto" "IPATCH_GIG_DIMENSION_SOSTENUTO") '("soft-pedal" "IPATCH_GIG_DIMENSION_SOFT_PEDAL") '("gen-purpose-5" "IPATCH_GIG_DIMENSION_GEN_PURPOSE_5") '("gen-purpose-6" "IPATCH_GIG_DIMENSION_GEN_PURPOSE_6") '("gen-purpose-7" "IPATCH_GIG_DIMENSION_GEN_PURPOSE_7") '("gen-purpose-8" "IPATCH_GIG_DIMENSION_GEN_PURPOSE_8") '("effect-depth-1" "IPATCH_GIG_DIMENSION_EFFECT_DEPTH_1") '("effect-depth-2" "IPATCH_GIG_DIMENSION_EFFECT_DEPTH_2") '("effect-depth-3" "IPATCH_GIG_DIMENSION_EFFECT_DEPTH_3") '("effect-depth-4" "IPATCH_GIG_DIMENSION_EFFECT_DEPTH_4") '("effect-depth-5" "IPATCH_GIG_DIMENSION_EFFECT_DEPTH_5") '("channel" "IPATCH_GIG_DIMENSION_CHANNEL") '("layer" "IPATCH_GIG_DIMENSION_LAYER") '("velocity" "IPATCH_GIG_DIMENSION_VELOCITY") '("after-touch" "IPATCH_GIG_DIMENSION_AFTER_TOUCH") '("release-trig" "IPATCH_GIG_DIMENSION_RELEASE_TRIG") '("keyboard" "IPATCH_GIG_DIMENSION_KEYBOARD") '("round-robin" "IPATCH_GIG_DIMENSION_ROUND_ROBIN") '("random" "IPATCH_GIG_DIMENSION_RANDOM") ) ) (define-flags GigRegionFlags (in-module "Ipatch") (c-name "IpatchGigRegionFlags") (gtype-id "IPATCH_TYPE_GIG_REGION_FLAGS") (values '("self-non-exclusive" "IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE") '("phase-master" "IPATCH_GIG_REGION_PHASE_MASTER") '("multi-channel" "IPATCH_GIG_REGION_MULTI_CHANNEL") ) ) (define-flags GigSubRegionFlags (in-module "Ipatch") (c-name "IpatchGigSubRegionFlags") (gtype-id "IPATCH_TYPE_GIG_SUB_REGION_FLAGS") (values '("override" "IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE") ) ) (define-flags ItemFlags (in-module "Ipatch") (c-name "IpatchItemFlags") (gtype-id "IPATCH_TYPE_ITEM_FLAGS") (values '("hooks-active" "IPATCH_ITEM_HOOKS_ACTIVE") '("free-mutex" "IPATCH_ITEM_FREE_MUTEX") ) ) (define-enum PasteChoice (in-module "Ipatch") (c-name "IpatchPasteChoice") (gtype-id "IPATCH_TYPE_PASTE_CHOICE") (values '("ignore" "IPATCH_PASTE_CHOICE_IGNORE") '("replace" "IPATCH_PASTE_CHOICE_REPLACE") '("keep" "IPATCH_PASTE_CHOICE_KEEP") '("cancel" "IPATCH_PASTE_CHOICE_CANCEL") ) ) (define-enum PastePriority (in-module "Ipatch") (c-name "IpatchPastePriority") (gtype-id "IPATCH_TYPE_PASTE_PRIORITY") (values '("lowest" "IPATCH_PASTE_PRIORITY_LOWEST") '("low" "IPATCH_PASTE_PRIORITY_LOW") '("default" "IPATCH_PASTE_PRIORITY_DEFAULT") '("high" "IPATCH_PASTE_PRIORITY_HIGH") '("highest" "IPATCH_PASTE_PRIORITY_HIGHEST") ) ) (define-enum RiffStatus (in-module "Ipatch") (c-name "IpatchRiffStatus") (gtype-id "IPATCH_TYPE_RIFF_STATUS") (values '("fail" "IPATCH_RIFF_STATUS_FAIL") '("begin" "IPATCH_RIFF_STATUS_BEGIN") '("finished" "IPATCH_RIFF_STATUS_FINISHED") '("normal" "IPATCH_RIFF_STATUS_NORMAL") '("chunk-end" "IPATCH_RIFF_STATUS_CHUNK_END") ) ) (define-enum RiffMode (in-module "Ipatch") (c-name "IpatchRiffMode") (gtype-id "IPATCH_TYPE_RIFF_MODE") (values '("read" "IPATCH_RIFF_READ") '("write" "IPATCH_RIFF_WRITE") ) ) (define-enum RiffChunkType (in-module "Ipatch") (c-name "IpatchRiffChunkType") (gtype-id "IPATCH_TYPE_RIFF_CHUNK_TYPE") (values '("riff" "IPATCH_RIFF_CHUNK_RIFF") '("list" "IPATCH_RIFF_CHUNK_LIST") '("sub" "IPATCH_RIFF_CHUNK_SUB") ) ) (define-enum RiffError (in-module "Ipatch") (c-name "IpatchRiffError") (gtype-id "IPATCH_TYPE_RIFF_ERROR") (values '("not-riff" "IPATCH_RIFF_ERROR_NOT_RIFF") '("unexpected-id" "IPATCH_RIFF_ERROR_UNEXPECTED_ID") '("unexpected-chunk-end" "IPATCH_RIFF_ERROR_UNEXPECTED_CHUNK_END") '("invalid-id" "IPATCH_RIFF_ERROR_INVALID_ID") '("odd-size" "IPATCH_RIFF_ERROR_ODD_SIZE") '("size-exceeded" "IPATCH_RIFF_ERROR_SIZE_EXCEEDED") '("size-mismatch" "IPATCH_RIFF_ERROR_SIZE_MISMATCH") '("invalid-data" "IPATCH_RIFF_ERROR_INVALID_DATA") ) ) (define-enum SampleLoopType (in-module "Ipatch") (c-name "IpatchSampleLoopType") (gtype-id "IPATCH_TYPE_SAMPLE_LOOP_TYPE") (values '("none" "IPATCH_SAMPLE_LOOP_NONE") '("standard" "IPATCH_SAMPLE_LOOP_STANDARD") '("release" "IPATCH_SAMPLE_LOOP_RELEASE") '("pingpong" "IPATCH_SAMPLE_LOOP_PINGPONG") ) ) (define-flags SampleStoreRamFlags (in-module "Ipatch") (c-name "IpatchSampleStoreRamFlags") (gtype-id "IPATCH_TYPE_SAMPLE_STORE_RAM_FLAGS") (values '("allocated" "IPATCH_SAMPLE_STORE_RAM_ALLOCATED") ) ) (define-enum SndFileEndian (in-module "Ipatch") (c-name "IpatchSndFileEndian") (gtype-id "IPATCH_TYPE_SND_FILE_ENDIAN") (values '("file" "IPATCH_SND_FILE_ENDIAN_FILE") '("little" "IPATCH_SND_FILE_ENDIAN_LITTLE") '("big" "IPATCH_SND_FILE_ENDIAN_BIG") '("cpu" "IPATCH_SND_FILE_ENDIAN_CPU") ) ) (define-enum SplitsType (in-module "Ipatch") (c-name "IpatchSplitsType") (gtype-id "IPATCH_TYPE_SPLITS_TYPE") (values '("none" "IPATCH_SPLITS_NONE") '("normal" "IPATCH_SPLITS_NORMAL") '("no-overlap" "IPATCH_SPLITS_NO_OVERLAP") ) ) (define-flags UnitFlags (in-module "Ipatch") (c-name "IpatchUnitFlags") (gtype-id "IPATCH_TYPE_UNIT_FLAGS") (values '("logarithmic" "IPATCH_UNIT_LOGARITHMIC") '("user" "IPATCH_UNIT_USER") ) ) (define-enum UnitType (in-module "Ipatch") (c-name "IpatchUnitType") (gtype-id "IPATCH_TYPE_UNIT_TYPE") (values '("none" "IPATCH_UNIT_TYPE_NONE") '("int" "IPATCH_UNIT_TYPE_INT") '("uint" "IPATCH_UNIT_TYPE_UINT") '("range" "IPATCH_UNIT_TYPE_RANGE") '("decibels" "IPATCH_UNIT_TYPE_DECIBELS") '("percent" "IPATCH_UNIT_TYPE_PERCENT") '("semitones" "IPATCH_UNIT_TYPE_SEMITONES") '("cents" "IPATCH_UNIT_TYPE_CENTS") '("time-cents" "IPATCH_UNIT_TYPE_TIME_CENTS") '("sample-rate" "IPATCH_UNIT_TYPE_SAMPLE_RATE") '("samples" "IPATCH_UNIT_TYPE_SAMPLES") '("hertz" "IPATCH_UNIT_TYPE_HERTZ") '("seconds" "IPATCH_UNIT_TYPE_SECONDS") '("multiplier" "IPATCH_UNIT_TYPE_MULTIPLIER") '("dls-gain" "IPATCH_UNIT_TYPE_DLS_GAIN") '("dls-abs-time" "IPATCH_UNIT_TYPE_DLS_ABS_TIME") '("dls-rel-time" "IPATCH_UNIT_TYPE_DLS_REL_TIME") '("dls-abs-pitch" "IPATCH_UNIT_TYPE_DLS_ABS_PITCH") '("dls-rel-pitch" "IPATCH_UNIT_TYPE_DLS_REL_PITCH") '("dls-percent" "IPATCH_UNIT_TYPE_DLS_PERCENT") '("sf2-abs-pitch" "IPATCH_UNIT_TYPE_SF2_ABS_PITCH") '("sf2-ofs-pitch" "IPATCH_UNIT_TYPE_SF2_OFS_PITCH") '("sf2-abs-time" "IPATCH_UNIT_TYPE_SF2_ABS_TIME") '("sf2-ofs-time" "IPATCH_UNIT_TYPE_SF2_OFS_TIME") '("centibels" "IPATCH_UNIT_TYPE_CENTIBELS") '("32k-samples" "IPATCH_UNIT_TYPE_32K_SAMPLES") '("tenth-percent" "IPATCH_UNIT_TYPE_TENTH_PERCENT") ) ) (define-enum UnitClassType (in-module "Ipatch") (c-name "IpatchUnitClassType") (gtype-id "IPATCH_TYPE_UNIT_CLASS_TYPE") (values '("none" "IPATCH_UNIT_CLASS_NONE") '("user" "IPATCH_UNIT_CLASS_USER") '("dls" "IPATCH_UNIT_CLASS_DLS") '("count" "IPATCH_UNIT_CLASS_COUNT") ) ) (define-enum VBankRegionNoteRangeMode (in-module "Ipatch") (c-name "IpatchVBankRegionNoteRangeMode") (gtype-id "IPATCH_TYPE_VBANK_REGION_NOTE_RANGE_MODE") (values '("intersect" "IPATCH_VBANK_REGION_NOTE_RANGE_MODE_INTERSECT") '("override" "IPATCH_VBANK_REGION_NOTE_RANGE_MODE_OVERRIDE") ) ) (define-enum VBankRegionRootNoteMode (in-module "Ipatch") (c-name "IpatchVBankRegionRootNoteMode") (gtype-id "IPATCH_TYPE_VBANK_REGION_ROOT_NOTE_MODE") (values '("offset" "IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OFFSET") '("override" "IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OVERRIDE") ) ) (define-enum Error (in-module "Ipatch") (c-name "IpatchError") (gtype-id "IPATCH_TYPE_ERROR") (values '("fail" "IPATCH_ERROR_FAIL") '("io" "IPATCH_ERROR_IO") '("program" "IPATCH_ERROR_PROGRAM") '("invalid" "IPATCH_ERROR_INVALID") '("corrupt" "IPATCH_ERROR_CORRUPT") '("nomem" "IPATCH_ERROR_NOMEM") '("unsupported" "IPATCH_ERROR_UNSUPPORTED") '("unexpected-eof" "IPATCH_ERROR_UNEXPECTED_EOF") '("unhandled-conversion" "IPATCH_ERROR_UNHANDLED_CONVERSION") ) ) (define-enum SampleWidth (in-module "Ipatch") (c-name "IpatchSampleWidth") (gtype-id "IPATCH_TYPE_SAMPLE_WIDTH") (values '("invalid" "IPATCH_SAMPLE_INVALID") '("8bit" "IPATCH_SAMPLE_8BIT") '("16bit" "IPATCH_SAMPLE_16BIT") '("24bit" "IPATCH_SAMPLE_24BIT") '("32bit" "IPATCH_SAMPLE_32BIT") '("float" "IPATCH_SAMPLE_FLOAT") '("double" "IPATCH_SAMPLE_DOUBLE") '("real24bit" "IPATCH_SAMPLE_REAL24BIT") ) ) (define-flags SampleChannel (in-module "Ipatch") (c-name "IpatchSampleChannel") (gtype-id "IPATCH_TYPE_SAMPLE_CHANNEL") (values '("mono" "IPATCH_SAMPLE_MONO") '("stereo" "IPATCH_SAMPLE_STEREO") ) ) (define-enum SampleChannelType (in-module "Ipatch") (c-name "IpatchSampleChannelType") (gtype-id "IPATCH_TYPE_SAMPLE_CHANNEL_TYPE") (values '("left" "IPATCH_SAMPLE_LEFT") '("right" "IPATCH_SAMPLE_RIGHT") ) ) (define-flags SampleSign (in-module "Ipatch") (c-name "IpatchSampleSign") (gtype-id "IPATCH_TYPE_SAMPLE_SIGN") (values '("signed" "IPATCH_SAMPLE_SIGNED") '("unsigned" "IPATCH_SAMPLE_UNSIGNED") ) ) (define-flags SampleEndian (in-module "Ipatch") (c-name "IpatchSampleEndian") (gtype-id "IPATCH_TYPE_SAMPLE_ENDIAN") (values '("lendian" "IPATCH_SAMPLE_LENDIAN") '("bendian" "IPATCH_SAMPLE_BENDIAN") ) ) ;; From builtin_enums.h (define-function ipatch_base_flags_get_type (c-name "ipatch_base_flags_get_type") (return-type "GType") ) (define-function ipatch_converter_log_type_get_type (c-name "ipatch_converter_log_type_get_type") (return-type "GType") ) (define-function ipatch_converter_count_get_type (c-name "ipatch_converter_count_get_type") (return-type "GType") ) (define-function ipatch_converter_flags_get_type (c-name "ipatch_converter_flags_get_type") (return-type "GType") ) (define-function ipatch_converter_priority_get_type (c-name "ipatch_converter_priority_get_type") (return-type "GType") ) (define-function ipatch_dls2_conn_src_type_get_type (c-name "ipatch_dls2_conn_src_type_get_type") (return-type "GType") ) (define-function ipatch_dls2_conn_dest_type_get_type (c-name "ipatch_dls2_conn_dest_type_get_type") (return-type "GType") ) (define-function ipatch_dls2_conn_transform_type_get_type (c-name "ipatch_dls2_conn_transform_type_get_type") (return-type "GType") ) (define-function ipatch_dls2_conn_polarity_type_get_type (c-name "ipatch_dls2_conn_polarity_type_get_type") (return-type "GType") ) (define-function ipatch_dls2_conn_transform_masks_get_type (c-name "ipatch_dls2_conn_transform_masks_get_type") (return-type "GType") ) (define-function ipatch_dls2_conn_transform_shifts_get_type (c-name "ipatch_dls2_conn_transform_shifts_get_type") (return-type "GType") ) (define-function ipatch_dls2_flags_get_type (c-name "ipatch_dls2_flags_get_type") (return-type "GType") ) (define-function ipatch_dls2_info_type_get_type (c-name "ipatch_dls2_info_type_get_type") (return-type "GType") ) (define-function ipatch_dls2_inst_flags_get_type (c-name "ipatch_dls2_inst_flags_get_type") (return-type "GType") ) (define-function ipatch_dls2_param_get_type (c-name "ipatch_dls2_param_get_type") (return-type "GType") ) (define-function ipatch_dls2_region_channel_type_get_type (c-name "ipatch_dls2_region_channel_type_get_type") (return-type "GType") ) (define-function ipatch_dls2_region_flags_get_type (c-name "ipatch_dls2_region_flags_get_type") (return-type "GType") ) (define-function ipatch_dls2_sample_flags_get_type (c-name "ipatch_dls2_sample_flags_get_type") (return-type "GType") ) (define-function ipatch_dls_reader_error_get_type (c-name "ipatch_dls_reader_error_get_type") (return-type "GType") ) (define-function ipatch_file_flags_get_type (c-name "ipatch_file_flags_get_type") (return-type "GType") ) (define-function ipatch_file_identify_order_get_type (c-name "ipatch_file_identify_order_get_type") (return-type "GType") ) (define-function ipatch_gig_dimension_type_get_type (c-name "ipatch_gig_dimension_type_get_type") (return-type "GType") ) (define-function ipatch_gig_filter_type_get_type (c-name "ipatch_gig_filter_type_get_type") (return-type "GType") ) (define-function ipatch_gig_control_type_get_type (c-name "ipatch_gig_control_type_get_type") (return-type "GType") ) (define-function ipatch_gig_region_flags_get_type (c-name "ipatch_gig_region_flags_get_type") (return-type "GType") ) (define-function ipatch_gig_sub_region_flags_get_type (c-name "ipatch_gig_sub_region_flags_get_type") (return-type "GType") ) (define-function ipatch_item_flags_get_type (c-name "ipatch_item_flags_get_type") (return-type "GType") ) (define-function ipatch_paste_choice_get_type (c-name "ipatch_paste_choice_get_type") (return-type "GType") ) (define-function ipatch_paste_priority_get_type (c-name "ipatch_paste_priority_get_type") (return-type "GType") ) (define-function ipatch_riff_status_get_type (c-name "ipatch_riff_status_get_type") (return-type "GType") ) (define-function ipatch_riff_mode_get_type (c-name "ipatch_riff_mode_get_type") (return-type "GType") ) (define-function ipatch_riff_chunk_type_get_type (c-name "ipatch_riff_chunk_type_get_type") (return-type "GType") ) (define-function ipatch_riff_error_get_type (c-name "ipatch_riff_error_get_type") (return-type "GType") ) (define-function ipatch_sample_loop_type_get_type (c-name "ipatch_sample_loop_type_get_type") (return-type "GType") ) (define-function ipatch_sample_store_ram_flags_get_type (c-name "ipatch_sample_store_ram_flags_get_type") (return-type "GType") ) (define-function ipatch_sf2_flags_get_type (c-name "ipatch_sf2_flags_get_type") (return-type "GType") ) (define-function ipatch_sf2_info_type_get_type (c-name "ipatch_sf2_info_type_get_type") (return-type "GType") ) (define-function ipatch_sf2_file_sample_type_get_type (c-name "ipatch_sf2_file_sample_type_get_type") (return-type "GType") ) (define-function ipatch_sf2_gen_props_type_get_type (c-name "ipatch_sf2_gen_props_type_get_type") (return-type "GType") ) (define-function ipatch_sf2_gen_type_get_type (c-name "ipatch_sf2_gen_type_get_type") (return-type "GType") ) (define-function ipatch_sf2_gen_sample_modes_get_type (c-name "ipatch_sf2_gen_sample_modes_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_field_masks_get_type (c-name "ipatch_sf2_mod_field_masks_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_field_shifts_get_type (c-name "ipatch_sf2_mod_field_shifts_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_control_get_type (c-name "ipatch_sf2_mod_control_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_control_palette_get_type (c-name "ipatch_sf2_mod_control_palette_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_direction_get_type (c-name "ipatch_sf2_mod_direction_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_polarity_get_type (c-name "ipatch_sf2_mod_polarity_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_type_get_type (c-name "ipatch_sf2_mod_type_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_transform_get_type (c-name "ipatch_sf2_mod_transform_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_flags_get_type (c-name "ipatch_sf2_mod_flags_get_type") (return-type "GType") ) (define-function ipatch_sf2_sample_channel_get_type (c-name "ipatch_sf2_sample_channel_get_type") (return-type "GType") ) (define-function ipatch_sf2_voice_sel_type_get_type (c-name "ipatch_sf2_voice_sel_type_get_type") (return-type "GType") ) (define-function ipatch_snd_file_endian_get_type (c-name "ipatch_snd_file_endian_get_type") (return-type "GType") ) (define-function ipatch_splits_type_get_type (c-name "ipatch_splits_type_get_type") (return-type "GType") ) (define-function ipatch_unit_flags_get_type (c-name "ipatch_unit_flags_get_type") (return-type "GType") ) (define-function ipatch_unit_type_get_type (c-name "ipatch_unit_type_get_type") (return-type "GType") ) (define-function ipatch_unit_class_type_get_type (c-name "ipatch_unit_class_type_get_type") (return-type "GType") ) (define-function ipatch_vbank_region_note_range_mode_get_type (c-name "ipatch_vbank_region_note_range_mode_get_type") (return-type "GType") ) (define-function ipatch_vbank_region_root_note_mode_get_type (c-name "ipatch_vbank_region_root_note_mode_get_type") (return-type "GType") ) (define-function ipatch_error_get_type (c-name "ipatch_error_get_type") (return-type "GType") ) (define-function ipatch_sample_width_get_type (c-name "ipatch_sample_width_get_type") (return-type "GType") ) (define-function ipatch_sample_channel_get_type (c-name "ipatch_sample_channel_get_type") (return-type "GType") ) (define-function ipatch_sample_channel_type_get_type (c-name "ipatch_sample_channel_type_get_type") (return-type "GType") ) (define-function ipatch_sample_sign_get_type (c-name "ipatch_sample_sign_get_type") (return-type "GType") ) (define-function ipatch_sample_endian_get_type (c-name "ipatch_sample_endian_get_type") (return-type "GType") ) ;; From IpatchBase.h (define-function ipatch_base_get_type (c-name "ipatch_base_get_type") (return-type "GType") ) (define-method set_file (of-object "IpatchBase") (c-name "ipatch_base_set_file") (return-type "none") (parameters '("IpatchFile*" "file") ) ) (define-method get_file (of-object "IpatchBase") (c-name "ipatch_base_get_file") (return-type "IpatchFile*") ) (define-method set_file_name (of-object "IpatchBase") (c-name "ipatch_base_set_file_name") (return-type "none") (parameters '("const-char*" "file_name") ) ) (define-method get_file_name (of-object "IpatchBase") (c-name "ipatch_base_get_file_name") (return-type "char*") ) (define-method find_unused_midi_locale (of-object "IpatchBase") (c-name "ipatch_base_find_unused_midi_locale") (return-type "none") (parameters '("int*" "bank") '("int*" "program") '("const-IpatchItem*" "exclude") '("gboolean" "percussion") ) ) (define-method find_item_by_midi_locale (of-object "IpatchBase") (c-name "ipatch_base_find_item_by_midi_locale") (return-type "IpatchItem*") (parameters '("int" "bank") '("int" "program") ) ) ;; From IpatchContainer.h (define-function ipatch_container_get_type (c-name "ipatch_container_get_type") (return-type "GType") ) (define-method get_children (of-object "IpatchContainer") (c-name "ipatch_container_get_children") (return-type "IpatchList*") (parameters '("GType" "type") ) ) (define-method get_child_types (of-object "IpatchContainer") (c-name "ipatch_container_get_child_types") (return-type "const-GType*") ) (define-method get_virtual_types (of-object "IpatchContainer") (c-name "ipatch_container_get_virtual_types") (return-type "const-GType*") ) (define-function ipatch_container_type_get_child_types (c-name "ipatch_container_type_get_child_types") (return-type "const-GType*") (parameters '("GType" "container_type") ) ) (define-method insert (of-object "IpatchContainer") (c-name "ipatch_container_insert") (return-type "none") (parameters '("IpatchItem*" "item") '("int" "pos") ) ) (define-method append (of-object "IpatchContainer") (c-name "ipatch_container_append") (return-type "none") (parameters '("IpatchItem*" "item") ) ) (define-method remove (of-object "IpatchContainer") (c-name "ipatch_container_remove") (return-type "none") (parameters '("IpatchItem*" "item") ) ) (define-method remove_all (of-object "IpatchContainer") (c-name "ipatch_container_remove_all") (return-type "none") ) (define-method count (of-object "IpatchContainer") (c-name "ipatch_container_count") (return-type "guint") (parameters '("GType" "type") ) ) (define-method make_unique (of-object "IpatchContainer") (c-name "ipatch_container_make_unique") (return-type "none") (parameters '("IpatchItem*" "item") ) ) (define-method add_unique (of-object "IpatchContainer") (c-name "ipatch_container_add_unique") (return-type "none") (parameters '("IpatchItem*" "item") ) ) (define-method init_iter (of-object "IpatchContainer") (c-name "ipatch_container_init_iter") (return-type "gboolean") (parameters '("IpatchIter*" "iter") '("GType" "type") ) ) (define-method insert_iter (of-object "IpatchContainer") (c-name "ipatch_container_insert_iter") (return-type "none") (parameters '("IpatchItem*" "item") '("IpatchIter*" "iter") ) ) (define-method remove_iter (of-object "IpatchContainer") (c-name "ipatch_container_remove_iter") (return-type "none") (parameters '("IpatchIter*" "iter") ) ) (define-method add_notify (of-object "IpatchContainer") (c-name "ipatch_container_add_notify") (return-type "none") (parameters '("IpatchItem*" "child") ) ) (define-method remove_notify (of-object "IpatchContainer") (c-name "ipatch_container_remove_notify") (return-type "none") (parameters '("IpatchItem*" "child") ) ) (define-method add_connect (of-object "IpatchContainer") (c-name "ipatch_container_add_connect") (return-type "guint") (parameters '("IpatchContainerCallback" "callback") '("IpatchContainerDisconnect" "disconnect") '("gpointer" "user_data") ) ) (define-method remove_connect (of-object "IpatchContainer") (c-name "ipatch_container_remove_connect") (return-type "guint") (parameters '("IpatchItem*" "child") '("IpatchContainerCallback" "callback") '("IpatchContainerDisconnect" "disconnect") '("gpointer" "user_data") ) ) (define-function ipatch_container_add_disconnect (c-name "ipatch_container_add_disconnect") (return-type "none") (parameters '("guint" "handler_id") ) ) (define-method add_disconnect_matched (of-object "IpatchContainer") (c-name "ipatch_container_add_disconnect_matched") (return-type "none") (parameters '("IpatchContainerCallback" "callback") '("gpointer" "user_data") ) ) (define-function ipatch_container_remove_disconnect (c-name "ipatch_container_remove_disconnect") (return-type "none") (parameters '("guint" "handler_id") ) ) (define-method remove_disconnect_matched (of-object "IpatchContainer") (c-name "ipatch_container_remove_disconnect_matched") (return-type "none") (parameters '("IpatchItem*" "child") '("IpatchContainerCallback" "callback") '("gpointer" "user_data") ) ) ;; From IpatchConverter.h (define-function ipatch_convert_objects (c-name "ipatch_convert_objects") (return-type "gboolean") (parameters '("GObject*" "input") '("GObject*" "output") '("GError**" "err") ) ) (define-function ipatch_convert_object_to_type (c-name "ipatch_convert_object_to_type") (return-type "GObject*") (parameters '("GObject*" "object") '("GType" "type") '("GError**" "err") ) ) (define-function ipatch_convert_object_to_type_multi (c-name "ipatch_convert_object_to_type_multi") (return-type "IpatchList*") (parameters '("GObject*" "object") '("GType" "type") '("GError**" "err") ) ) (define-function ipatch_create_converter (c-name "ipatch_create_converter") (return-type "IpatchConverter*") (parameters '("GType" "src_type") '("GType" "dest_type") ) ) (define-function ipatch_register_converter_map (c-name "ipatch_register_converter_map") (return-type "none") (parameters '("GType" "conv_type") '("guint" "flags") '("GType" "src_type") '("GType" "src_match") '("gint8" "src_count") '("GType" "dest_type") '("GType" "dest_match") '("gint8" "dest_count") ) ) (define-function ipatch_find_converter (c-name "ipatch_find_converter") (return-type "GType") (parameters '("GType" "src_type") '("GType" "dest_type") ) ) (define-function ipatch_lookup_converter_info (c-name "ipatch_lookup_converter_info") (return-type "IpatchConverterInfo*") (parameters '("GType" "conv_type") '("GType" "src_type") '("GType" "dest_type") ) ) (define-function ipatch_converter_get_type (c-name "ipatch_converter_get_type") (return-type "GType") ) (define-method add_input (of-object "IpatchConverter") (c-name "ipatch_converter_add_input") (return-type "none") (parameters '("GObject*" "object") ) ) (define-method add_output (of-object "IpatchConverter") (c-name "ipatch_converter_add_output") (return-type "none") (parameters '("GObject*" "object") ) ) (define-method add_inputs (of-object "IpatchConverter") (c-name "ipatch_converter_add_inputs") (return-type "none") (parameters '("GList*" "objects") ) ) (define-method add_outputs (of-object "IpatchConverter") (c-name "ipatch_converter_add_outputs") (return-type "none") (parameters '("GList*" "objects") ) ) (define-method get_input (of-object "IpatchConverter") (c-name "ipatch_converter_get_input") (return-type "GObject*") ) (define-method get_output (of-object "IpatchConverter") (c-name "ipatch_converter_get_output") (return-type "GObject*") ) (define-method get_inputs (of-object "IpatchConverter") (c-name "ipatch_converter_get_inputs") (return-type "IpatchList*") ) (define-method get_outputs (of-object "IpatchConverter") (c-name "ipatch_converter_get_outputs") (return-type "IpatchList*") ) (define-method verify (of-object "IpatchConverter") (c-name "ipatch_converter_verify") (return-type "gboolean") (parameters '("char**" "failmsg") ) ) (define-method init (of-object "IpatchConverter") (c-name "ipatch_converter_init") (return-type "none") ) (define-method convert (of-object "IpatchConverter") (c-name "ipatch_converter_convert") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-method reset (of-object "IpatchConverter") (c-name "ipatch_converter_reset") (return-type "none") ) (define-method get_notes (of-object "IpatchConverter") (c-name "ipatch_converter_get_notes") (return-type "char*") ) (define-method log (of-object "IpatchConverter") (c-name "ipatch_converter_log") (return-type "none") (parameters '("GObject*" "item") '("int" "type") '("char*" "msg") ) ) (define-method log_printf (of-object "IpatchConverter") (c-name "ipatch_converter_log_printf") (return-type "none") (parameters '("GObject*" "item") '("int" "type") '("const-char*" "fmt") ) (varargs #t) ) (define-method log_next (of-object "IpatchConverter") (c-name "ipatch_converter_log_next") (return-type "gboolean") (parameters '("gpointer*" "pos") '("GObject**" "item") '("int*" "type") '("char**" "msg") ) ) (define-method set_link_funcs (of-object "IpatchConverter") (c-name "ipatch_converter_set_link_funcs") (return-type "none") (parameters '("IpatchConverterLinkLookupFunc*" "link_lookup") '("IpatchConverterLinkNotifyFunc*" "link_notify") ) ) ;; From IpatchConvert_DLS2.h (define-function ipatch_converter_dls2_to_file_get_type (c-name "ipatch_converter_dls2_to_file_get_type") (return-type "GType") ) (define-function ipatch_converter_file_to_dls2_get_type (c-name "ipatch_converter_file_to_dls2_get_type") (return-type "GType") ) (define-function ipatch_converter_file_to_dls2_sample_get_type (c-name "ipatch_converter_file_to_dls2_sample_get_type") (return-type "GType") ) ;; From IpatchConvert_Gig.h (define-function ipatch_converter_gig_to_file_get_type (c-name "ipatch_converter_gig_to_file_get_type") (return-type "GType") ) (define-function ipatch_converter_file_to_gig_get_type (c-name "ipatch_converter_file_to_gig_get_type") (return-type "GType") ) (define-function ipatch_converter_file_to_gig_sample_get_type (c-name "ipatch_converter_file_to_gig_sample_get_type") (return-type "GType") ) ;; From IpatchConvert_SF2.h (define-function ipatch_converter_sf2_to_file_get_type (c-name "ipatch_converter_sf2_to_file_get_type") (return-type "GType") ) (define-function ipatch_converter_file_to_sf2_get_type (c-name "ipatch_converter_file_to_sf2_get_type") (return-type "GType") ) (define-function ipatch_converter_file_to_sf2_sample_get_type (c-name "ipatch_converter_file_to_sf2_sample_get_type") (return-type "GType") ) (define-function ipatch_converter_sf2_to_dls2_get_type (c-name "ipatch_converter_sf2_to_dls2_get_type") (return-type "GType") ) (define-function ipatch_converter_dls2_to_sf2_get_type (c-name "ipatch_converter_dls2_to_sf2_get_type") (return-type "GType") ) (define-function ipatch_converter_sf2_preset_to_dls2_inst_get_type (c-name "ipatch_converter_sf2_preset_to_dls2_inst_get_type") (return-type "GType") ) (define-function ipatch_converter_dls2_inst_to_sf2_preset_get_type (c-name "ipatch_converter_dls2_inst_to_sf2_preset_get_type") (return-type "GType") ) (define-function ipatch_converter_sf2_inst_to_dls2_inst_get_type (c-name "ipatch_converter_sf2_inst_to_dls2_inst_get_type") (return-type "GType") ) (define-function ipatch_converter_dls2_inst_to_sf2_inst_get_type (c-name "ipatch_converter_dls2_inst_to_sf2_inst_get_type") (return-type "GType") ) (define-function ipatch_converter_sf2_pzone_to_dls2_region_get_type (c-name "ipatch_converter_sf2_pzone_to_dls2_region_get_type") (return-type "GType") ) (define-function ipatch_converter_dls2_region_to_sf2_pzone_get_type (c-name "ipatch_converter_dls2_region_to_sf2_pzone_get_type") (return-type "GType") ) (define-function ipatch_converter_sf2_izone_to_dls2_region_get_type (c-name "ipatch_converter_sf2_izone_to_dls2_region_get_type") (return-type "GType") ) (define-function ipatch_converter_dls2_region_to_sf2_izone_get_type (c-name "ipatch_converter_dls2_region_to_sf2_izone_get_type") (return-type "GType") ) (define-function ipatch_converter_sf2_sample_to_dls2_sample_get_type (c-name "ipatch_converter_sf2_sample_to_dls2_sample_get_type") (return-type "GType") ) (define-function ipatch_converter_dls2_sample_to_sf2_sample_get_type (c-name "ipatch_converter_dls2_sample_to_sf2_sample_get_type") (return-type "GType") ) ;; From IpatchDLS2Conn.h (define-function ipatch_dls2_conn_get_type (c-name "ipatch_dls2_conn_get_type") (return-type "GType") ) (define-function ipatch_dls2_conn_new (c-name "ipatch_dls2_conn_new") (is-constructor-of "IpatchDLS2Conn") (return-type "IpatchDLS2Conn*") ) (define-method free (of-object "IpatchDLS2Conn") (c-name "ipatch_dls2_conn_free") (return-type "none") ) (define-method duplicate (of-object "IpatchDLS2Conn") (c-name "ipatch_dls2_conn_duplicate") (return-type "IpatchDLS2Conn*") ) (define-function ipatch_dls2_conn_list_set (c-name "ipatch_dls2_conn_list_set") (return-type "none") (parameters '("GSList**" "list") '("const-IpatchDLS2Conn*" "conn") ) ) (define-function ipatch_dls2_conn_list_unset (c-name "ipatch_dls2_conn_list_unset") (return-type "none") (parameters '("GSList**" "list") '("const-IpatchDLS2Conn*" "conn") ) ) (define-function ipatch_dls2_conn_list_duplicate (c-name "ipatch_dls2_conn_list_duplicate") (return-type "GSList*") (parameters '("const-GSList*" "list") ) ) (define-function ipatch_dls2_conn_list_duplicate_fast (c-name "ipatch_dls2_conn_list_duplicate_fast") (return-type "GSList*") (parameters '("const-GSList*" "list") ) ) (define-function ipatch_dls2_conn_list_free (c-name "ipatch_dls2_conn_list_free") (return-type "none") (parameters '("GSList*" "list") '("gboolean" "free_conns") ) ) ;; From IpatchDLS2.h (define-function ipatch_dls2_get_type (c-name "ipatch_dls2_get_type") (return-type "GType") ) (define-function ipatch_dls2_new (c-name "ipatch_dls2_new") (is-constructor-of "IpatchDLS2") (return-type "IpatchDLS2*") ) (define-method set_file (of-object "IpatchDLS2") (c-name "ipatch_dls2_set_file") (return-type "none") (parameters '("IpatchDLSFile*" "file") ) ) (define-method get_file (of-object "IpatchDLS2") (c-name "ipatch_dls2_get_file") (return-type "IpatchDLSFile*") ) (define-method get_info (of-object "IpatchDLS2") (c-name "ipatch_dls2_get_info") (return-type "char*") (parameters '("guint32" "fourcc") ) ) (define-method set_info (of-object "IpatchDLS2") (c-name "ipatch_dls2_set_info") (return-type "none") (parameters '("guint32" "fourcc") '("const-char*" "val") ) ) (define-method make_unique_name (of-object "IpatchDLS2") (c-name "ipatch_dls2_make_unique_name") (return-type "char*") (parameters '("GType" "child_type") '("const-char*" "name") '("const-IpatchItem*" "exclude") ) ) (define-method find_inst (of-object "IpatchDLS2") (c-name "ipatch_dls2_find_inst") (return-type "IpatchDLS2Inst*") (parameters '("const-char*" "name") '("int" "bank") '("int" "program") '("const-IpatchDLS2Inst*" "exclude") ) ) (define-method find_sample (of-object "IpatchDLS2") (c-name "ipatch_dls2_find_sample") (return-type "IpatchDLS2Sample*") (parameters '("const-char*" "name") '("const-IpatchDLS2Sample*" "exclude") ) ) (define-function ipatch_dls2_get_region_references (c-name "ipatch_dls2_get_region_references") (return-type "IpatchList*") (parameters '("IpatchDLS2Sample*" "sample") ) ) ;; From IpatchDLS2Info.h (define-method get (of-object "IpatchDLS2Info") (c-name "ipatch_dls2_info_get") (return-type "char*") (parameters '("guint32" "fourcc") ) ) (define-method peek (of-object "IpatchDLS2Info") (c-name "ipatch_dls2_info_peek") (return-type "const-char*") (parameters '("guint32" "fourcc") ) ) (define-function ipatch_dls2_info_set (c-name "ipatch_dls2_info_set") (return-type "none") (parameters '("IpatchDLS2Info**" "info") '("guint32" "fourcc") '("const-char*" "value") ) ) (define-method free (of-object "IpatchDLS2Info") (c-name "ipatch_dls2_info_free") (return-type "none") ) (define-method duplicate (of-object "IpatchDLS2Info") (c-name "ipatch_dls2_info_duplicate") (return-type "IpatchDLS2Info*") ) (define-function ipatch_dls2_info_is_defined (c-name "ipatch_dls2_info_is_defined") (return-type "gboolean") (parameters '("guint32" "fourcc") ) ) (define-function ipatch_dls2_info_install_class_properties (c-name "ipatch_dls2_info_install_class_properties") (return-type "none") (parameters '("GObjectClass*" "obj_class") ) ) (define-function ipatch_dls2_info_set_property (c-name "ipatch_dls2_info_set_property") (return-type "gboolean") (parameters '("IpatchDLS2Info**" "info_list") '("guint" "property_id") '("const-GValue*" "value") ) ) (define-method get_property (of-object "IpatchDLS2Info") (c-name "ipatch_dls2_info_get_property") (return-type "gboolean") (parameters '("guint" "property_id") '("GValue*" "value") ) ) (define-function ipatch_dls2_info_notify (c-name "ipatch_dls2_info_notify") (return-type "none") (parameters '("IpatchItem*" "item") '("guint32" "fourcc") '("const-GValue*" "new_value") '("const-GValue*" "old_value") ) ) (define-function ipatch_dls2_info_bag_new (c-name "ipatch_dls2_info_bag_new") (is-constructor-of "IpatchDLS2InfoBag") (return-type "IpatchDLS2InfoBag*") ) (define-method free (of-object "IpatchDLS2InfoBag") (c-name "ipatch_dls2_info_bag_free") (return-type "none") ) ;; From IpatchDLS2Inst.h (define-function ipatch_dls2_inst_get_type (c-name "ipatch_dls2_inst_get_type") (return-type "GType") ) (define-function ipatch_dls2_inst_new (c-name "ipatch_dls2_inst_new") (is-constructor-of "IpatchDLS2Inst") (return-type "IpatchDLS2Inst*") ) (define-function ipatch_dls2_inst_first (c-name "ipatch_dls2_inst_first") (return-type "IpatchDLS2Inst*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_dls2_inst_next (c-name "ipatch_dls2_inst_next") (return-type "IpatchDLS2Inst*") (parameters '("IpatchIter*" "iter") ) ) (define-method get_info (of-object "IpatchDLS2Inst") (c-name "ipatch_dls2_inst_get_info") (return-type "char*") (parameters '("guint32" "fourcc") ) ) (define-method set_info (of-object "IpatchDLS2Inst") (c-name "ipatch_dls2_inst_set_info") (return-type "none") (parameters '("guint32" "fourcc") '("const-char*" "val") ) ) (define-method set_midi_locale (of-object "IpatchDLS2Inst") (c-name "ipatch_dls2_inst_set_midi_locale") (return-type "none") (parameters '("int" "bank") '("int" "program") ) ) (define-method get_midi_locale (of-object "IpatchDLS2Inst") (c-name "ipatch_dls2_inst_get_midi_locale") (return-type "none") (parameters '("int*" "bank") '("int*" "program") ) ) (define-method compare (of-object "IpatchDLS2Inst") (c-name "ipatch_dls2_inst_compare") (return-type "int") (parameters '("const-IpatchDLS2Inst*" "p2") ) ) (define-method get_conns (of-object "IpatchDLS2Inst") (c-name "ipatch_dls2_inst_get_conns") (return-type "GSList*") ) (define-method set_conn (of-object "IpatchDLS2Inst") (c-name "ipatch_dls2_inst_set_conn") (return-type "none") (parameters '("const-IpatchDLS2Conn*" "conn") ) ) (define-method unset_conn (of-object "IpatchDLS2Inst") (c-name "ipatch_dls2_inst_unset_conn") (return-type "none") (parameters '("const-IpatchDLS2Conn*" "conn") ) ) (define-method unset_all_conns (of-object "IpatchDLS2Inst") (c-name "ipatch_dls2_inst_unset_all_conns") (return-type "none") ) (define-method conn_count (of-object "IpatchDLS2Inst") (c-name "ipatch_dls2_inst_conn_count") (return-type "guint") ) ;; From IpatchDLS2Region.h (define-function ipatch_dls2_region_get_type (c-name "ipatch_dls2_region_get_type") (return-type "GType") ) (define-function ipatch_dls2_region_new (c-name "ipatch_dls2_region_new") (is-constructor-of "IpatchDLS2Region") (return-type "IpatchDLS2Region*") ) (define-function ipatch_dls2_region_first (c-name "ipatch_dls2_region_first") (return-type "IpatchDLS2Region*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_dls2_region_next (c-name "ipatch_dls2_region_next") (return-type "IpatchDLS2Region*") (parameters '("IpatchIter*" "iter") ) ) (define-method get_info (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_get_info") (return-type "char*") (parameters '("guint32" "fourcc") ) ) (define-method set_info (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_set_info") (return-type "none") (parameters '("guint32" "fourcc") '("const-char*" "val") ) ) (define-method set_sample (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_set_sample") (return-type "none") (parameters '("IpatchDLS2Sample*" "sample") ) ) (define-method get_sample (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_get_sample") (return-type "IpatchDLS2Sample*") ) (define-method peek_sample (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_peek_sample") (return-type "IpatchDLS2Sample*") ) (define-method set_note_range (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_set_note_range") (return-type "none") (parameters '("int" "low") '("int" "high") ) ) (define-method set_velocity_range (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_set_velocity_range") (return-type "none") (parameters '("int" "low") '("int" "high") ) ) (define-method in_range (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_in_range") (return-type "gboolean") (parameters '("int" "note") '("int" "velocity") ) ) (define-method set_param (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_set_param") (return-type "none") (parameters '("IpatchDLS2Param" "param") '("gint32" "val") ) ) (define-method set_param_array (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_set_param_array") (return-type "none") (parameters '("IpatchDLS2ParamArray*" "array") ) ) (define-method get_conns (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_get_conns") (return-type "GSList*") ) (define-method set_conn (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_set_conn") (return-type "none") (parameters '("const-IpatchDLS2Conn*" "conn") ) ) (define-method unset_conn (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_unset_conn") (return-type "none") (parameters '("const-IpatchDLS2Conn*" "conn") ) ) (define-method unset_all_conns (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_unset_all_conns") (return-type "none") ) (define-method conn_count (of-object "IpatchDLS2Region") (c-name "ipatch_dls2_region_conn_count") (return-type "guint") ) (define-function ipatch_dls2_region_channel_map_stereo (c-name "ipatch_dls2_region_channel_map_stereo") (return-type "int") (parameters '("IpatchDLS2RegionChannelType" "chan") ) ) ;; From IpatchDLS2Sample.h (define-function ipatch_dls2_sample_get_type (c-name "ipatch_dls2_sample_get_type") (return-type "GType") ) (define-function ipatch_dls2_sample_new (c-name "ipatch_dls2_sample_new") (is-constructor-of "IpatchDLS2Sample") (return-type "IpatchDLS2Sample*") ) (define-function ipatch_dls2_sample_first (c-name "ipatch_dls2_sample_first") (return-type "IpatchDLS2Sample*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_dls2_sample_next (c-name "ipatch_dls2_sample_next") (return-type "IpatchDLS2Sample*") (parameters '("IpatchIter*" "iter") ) ) (define-method set_data (of-object "IpatchDLS2Sample") (c-name "ipatch_dls2_sample_set_data") (return-type "none") (parameters '("IpatchSampleData*" "sampledata") ) ) (define-method get_data (of-object "IpatchDLS2Sample") (c-name "ipatch_dls2_sample_get_data") (return-type "IpatchSampleData*") ) (define-method peek_data (of-object "IpatchDLS2Sample") (c-name "ipatch_dls2_sample_peek_data") (return-type "IpatchSampleData*") ) (define-method set_blank (of-object "IpatchDLS2Sample") (c-name "ipatch_dls2_sample_set_blank") (return-type "none") ) (define-function ipatch_dls2_sample_info_new (c-name "ipatch_dls2_sample_info_new") (is-constructor-of "IpatchDLS2SampleInfo") (return-type "IpatchDLS2SampleInfo*") ) (define-method free (of-object "IpatchDLS2SampleInfo") (c-name "ipatch_dls2_sample_info_free") (return-type "none") ) (define-method duplicate (of-object "IpatchDLS2SampleInfo") (c-name "ipatch_dls2_sample_info_duplicate") (return-type "IpatchDLS2SampleInfo*") ) (define-method init (of-object "IpatchDLS2SampleInfo") (c-name "ipatch_dls2_sample_info_init") (return-type "none") ) (define-function ipatch_dls2_sample_info_install_class_properties (c-name "ipatch_dls2_sample_info_install_class_properties") (return-type "none") (parameters '("GObjectClass*" "obj_class") ) ) (define-function ipatch_dls2_sample_info_is_property_id_valid (c-name "ipatch_dls2_sample_info_is_property_id_valid") (return-type "gboolean") (parameters '("guint" "property_id") ) ) (define-function ipatch_dls2_sample_info_set_property (c-name "ipatch_dls2_sample_info_set_property") (return-type "gboolean") (parameters '("IpatchDLS2SampleInfo**" "sample_info") '("guint" "property_id") '("const-GValue*" "value") ) ) (define-method get_property (of-object "IpatchDLS2SampleInfo") (c-name "ipatch_dls2_sample_info_get_property") (return-type "gboolean") (parameters '("guint" "property_id") '("GValue*" "value") ) ) (define-function ipatch_dls2_sample_info_notify_changes (c-name "ipatch_dls2_sample_info_notify_changes") (return-type "none") (parameters '("IpatchItem*" "item") '("IpatchDLS2SampleInfo*" "newinfo") '("IpatchDLS2SampleInfo*" "oldinfo") ) ) ;; From IpatchDLSFile.h (define-function ipatch_dls_file_get_type (c-name "ipatch_dls_file_get_type") (return-type "GType") ) (define-function ipatch_dls_file_new (c-name "ipatch_dls_file_new") (is-constructor-of "IpatchDLSFile") (return-type "IpatchDLSFile*") ) ;; From IpatchDLSReader.h (define-function ipatch_dls_reader_get_type (c-name "ipatch_dls_reader_get_type") (return-type "GType") ) (define-function ipatch_dls_reader_new (c-name "ipatch_dls_reader_new") (is-constructor-of "IpatchDLSReader") (return-type "IpatchDLSReader*") (parameters '("IpatchFileHandle*" "handle") ) ) (define-method load (of-object "IpatchDLSReader") (c-name "ipatch_dls_reader_load") (return-type "IpatchDLS2*") (parameters '("GError**" "err") ) ) (define-method start (of-object "IpatchDLSReader") (c-name "ipatch_dls_reader_start") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-method set_pool_table (of-object "IpatchDLSReader") (c-name "ipatch_dls_reader_set_pool_table") (return-type "none") (parameters '("const-guint32[]" "pool_table") '("guint" "size") ) ) (define-method fixup (of-object "IpatchDLSReader") (c-name "ipatch_dls_reader_fixup") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-method load_level_0 (of-object "IpatchDLSReader") (c-name "ipatch_dls_reader_load_level_0") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-method load_inst_list (of-object "IpatchDLSReader") (c-name "ipatch_dls_reader_load_inst_list") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-method load_region_list (of-object "IpatchDLSReader") (c-name "ipatch_dls_reader_load_region_list") (return-type "gboolean") (parameters '("IpatchDLS2Inst*" "inst") '("GError**" "err") ) ) (define-function ipatch_gig_reader_load_region_list (c-name "ipatch_gig_reader_load_region_list") (return-type "gboolean") (parameters '("IpatchDLSReader*" "reader") '("IpatchGigInst*" "giginst") '("GError**" "err") ) ) (define-method load_art_list (of-object "IpatchDLSReader") (c-name "ipatch_dls_reader_load_art_list") (return-type "gboolean") (parameters '("GSList**" "conn_list") '("GError**" "err") ) ) (define-method load_wave_pool (of-object "IpatchDLSReader") (c-name "ipatch_dls_reader_load_wave_pool") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-function ipatch_gig_reader_load_sub_regions (c-name "ipatch_gig_reader_load_sub_regions") (return-type "gboolean") (parameters '("IpatchDLSReader*" "reader") '("IpatchGigRegion*" "region") '("GError**" "err") ) ) (define-function ipatch_gig_reader_load_inst_lart (c-name "ipatch_gig_reader_load_inst_lart") (return-type "gboolean") (parameters '("IpatchDLSReader*" "reader") '("IpatchGigInst*" "inst") '("GError**" "err") ) ) (define-function ipatch_dls_load_info (c-name "ipatch_dls_load_info") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("IpatchDLS2Info**" "info") '("GError**" "err") ) ) (define-function ipatch_dls_load_region_header (c-name "ipatch_dls_load_region_header") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("IpatchDLS2Region*" "region") '("GError**" "err") ) ) (define-function ipatch_gig_load_region_header (c-name "ipatch_gig_load_region_header") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("IpatchGigRegion*" "region") '("GError**" "err") ) ) (define-function ipatch_dls_load_wave_link (c-name "ipatch_dls_load_wave_link") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("IpatchDLS2Region*" "region") '("GError**" "err") ) ) (define-function ipatch_dls_load_sample_info (c-name "ipatch_dls_load_sample_info") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("IpatchDLS2SampleInfo*" "info") '("GError**" "err") ) ) (define-function ipatch_dls_load_connection (c-name "ipatch_dls_load_connection") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("GSList**" "conn_list") '("GError**" "err") ) ) (define-function ipatch_dls_load_sample_format (c-name "ipatch_dls_load_sample_format") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("IpatchDLS2Sample*" "sample") '("int*" "bitwidth") '("int*" "channels") '("GError**" "err") ) ) (define-function ipatch_dls_load_pool_table (c-name "ipatch_dls_load_pool_table") (return-type "guint32*") (parameters '("IpatchRiff*" "riff") '("guint*" "size") '("GError**" "err") ) ) (define-function ipatch_dls_load_dlid (c-name "ipatch_dls_load_dlid") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("guint8*" "dlid") '("GError**" "err") ) ) (define-function ipatch_gig_load_sample_info (c-name "ipatch_gig_load_sample_info") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("IpatchDLS2SampleInfo*" "info") '("GError**" "err") ) ) (define-function ipatch_gig_load_dimension_info (c-name "ipatch_gig_load_dimension_info") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("IpatchGigRegion*" "region") '("GError**" "err") ) ) (define-function ipatch_gig_load_dimension_names (c-name "ipatch_gig_load_dimension_names") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("IpatchGigRegion*" "region") '("GError**" "err") ) ) (define-function ipatch_gig_load_group_names (c-name "ipatch_gig_load_group_names") (return-type "gboolean") (parameters '("IpatchRiff*" "riff") '("GSList**" "name_list") '("GError**" "err") ) ) ;; From IpatchDLSWriter.h (define-function ipatch_dls_writer_get_type (c-name "ipatch_dls_writer_get_type") (return-type "GType") ) (define-function ipatch_dls_writer_new (c-name "ipatch_dls_writer_new") (is-constructor-of "IpatchDLSWriter") (return-type "IpatchDLSWriter*") (parameters '("IpatchFileHandle*" "handle") '("IpatchDLS2*" "dls") ) ) (define-method set_patch (of-object "IpatchDLSWriter") (c-name "ipatch_dls_writer_set_patch") (return-type "none") (parameters '("IpatchDLS2*" "dls") ) ) (define-method set_file_handle (of-object "IpatchDLSWriter") (c-name "ipatch_dls_writer_set_file_handle") (return-type "none") (parameters '("IpatchFileHandle*" "handle") ) ) (define-method save (of-object "IpatchDLSWriter") (c-name "ipatch_dls_writer_save") (return-type "gboolean") (parameters '("GError**" "err") ) ) ;; From IpatchFile.h (define-function ipatch_file_get_type (c-name "ipatch_file_get_type") (return-type "GType") ) (define-function ipatch_file_new (c-name "ipatch_file_new") (is-constructor-of "IpatchFile") (return-type "IpatchFile*") ) (define-method set_name (of-object "IpatchFile") (c-name "ipatch_file_set_name") (return-type "none") (parameters '("const-char*" "file_name") ) ) (define-method get_name (of-object "IpatchFile") (c-name "ipatch_file_get_name") (return-type "char*") ) (define-method open (of-object "IpatchFile") (c-name "ipatch_file_open") (return-type "IpatchFileHandle*") (parameters '("const-char*" "file_name") '("const-char*" "mode") '("GError**" "err") ) ) (define-method assign_fd (of-object "IpatchFile") (c-name "ipatch_file_assign_fd") (return-type "none") (parameters '("int" "fd") '("gboolean" "close_on_finalize") ) ) (define-method assign_io_channel (of-object "IpatchFile") (c-name "ipatch_file_assign_io_channel") (return-type "none") (parameters '("GIOChannel*" "iochan") ) ) (define-function ipatch_file_get_io_channel (c-name "ipatch_file_get_io_channel") (return-type "GIOChannel*") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_get_fd (c-name "ipatch_file_get_fd") (return-type "int") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_close (c-name "ipatch_file_close") (return-type "none") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_get_position (c-name "ipatch_file_get_position") (return-type "guint") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_update_position (c-name "ipatch_file_update_position") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("guint" "offset") ) ) (define-function ipatch_file_read (c-name "ipatch_file_read") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("gpointer" "buf") '("guint" "size") '("GError**" "err") ) ) (define-function ipatch_file_read_eof (c-name "ipatch_file_read_eof") (return-type "GIOStatus") (parameters '("IpatchFileHandle*" "handle") '("gpointer" "buf") '("guint" "size") '("guint*" "bytes_read") '("GError**" "err") ) ) (define-function ipatch_file_write (c-name "ipatch_file_write") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("gconstpointer" "buf") '("guint" "size") '("GError**" "err") ) ) (define-function ipatch_file_seek (c-name "ipatch_file_seek") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("int" "offset") '("GSeekType" "type") '("GError**" "err") ) ) (define-function ipatch_file_seek_eof (c-name "ipatch_file_seek_eof") (return-type "GIOStatus") (parameters '("IpatchFileHandle*" "handle") '("int" "offset") '("GSeekType" "type") '("GError**" "err") ) ) (define-method get_size (of-object "IpatchFile") (c-name "ipatch_file_get_size") (return-type "int") (parameters '("GError**" "err") ) ) (define-method identify (of-object "IpatchFile") (c-name "ipatch_file_identify") (return-type "GType") (parameters '("GError**" "err") ) ) (define-method identify_by_ext (of-object "IpatchFile") (c-name "ipatch_file_identify_by_ext") (return-type "GType") ) (define-function ipatch_file_identify_open (c-name "ipatch_file_identify_open") (return-type "IpatchFileHandle*") (parameters '("const-char*" "file_name") '("GError**" "err") ) ) (define-method set_little_endian (of-object "IpatchFile") (c-name "ipatch_file_set_little_endian") (return-type "none") ) (define-method set_big_endian (of-object "IpatchFile") (c-name "ipatch_file_set_big_endian") (return-type "none") ) (define-function ipatch_file_read_u8 (c-name "ipatch_file_read_u8") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("guint8*" "val") '("GError**" "err") ) ) (define-function ipatch_file_read_u16 (c-name "ipatch_file_read_u16") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("guint16*" "val") '("GError**" "err") ) ) (define-function ipatch_file_read_u32 (c-name "ipatch_file_read_u32") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("guint32*" "val") '("GError**" "err") ) ) (define-function ipatch_file_read_u64 (c-name "ipatch_file_read_u64") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("guint64*" "val") '("GError**" "err") ) ) (define-function ipatch_file_read_s8 (c-name "ipatch_file_read_s8") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("gint8*" "val") '("GError**" "err") ) ) (define-function ipatch_file_read_s16 (c-name "ipatch_file_read_s16") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("gint16*" "val") '("GError**" "err") ) ) (define-function ipatch_file_read_s32 (c-name "ipatch_file_read_s32") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("gint32*" "val") '("GError**" "err") ) ) (define-function ipatch_file_read_s64 (c-name "ipatch_file_read_s64") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("gint64*" "val") '("GError**" "err") ) ) (define-function ipatch_file_write_u8 (c-name "ipatch_file_write_u8") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("guint8" "val") '("GError**" "err") ) ) (define-function ipatch_file_write_u16 (c-name "ipatch_file_write_u16") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("guint16" "val") '("GError**" "err") ) ) (define-function ipatch_file_write_u32 (c-name "ipatch_file_write_u32") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("guint32" "val") '("GError**" "err") ) ) (define-function ipatch_file_write_u64 (c-name "ipatch_file_write_u64") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("guint64" "val") '("GError**" "err") ) ) (define-function ipatch_file_write_s8 (c-name "ipatch_file_write_s8") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("gint8" "val") '("GError**" "err") ) ) (define-function ipatch_file_write_s16 (c-name "ipatch_file_write_s16") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("gint16" "val") '("GError**" "err") ) ) (define-function ipatch_file_write_s32 (c-name "ipatch_file_write_s32") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("gint32" "val") '("GError**" "err") ) ) (define-function ipatch_file_write_s64 (c-name "ipatch_file_write_s64") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("gint64" "val") '("GError**" "err") ) ) (define-function ipatch_file_buf_load (c-name "ipatch_file_buf_load") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("guint" "size") '("GError**" "err") ) ) (define-function ipatch_file_buf_read (c-name "ipatch_file_buf_read") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("gpointer" "buf") '("guint" "size") ) ) (define-function ipatch_file_buf_write (c-name "ipatch_file_buf_write") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("gconstpointer" "buf") '("guint" "size") ) ) (define-function ipatch_file_buf_memset (c-name "ipatch_file_buf_memset") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("char" "c") '("guint" "size") ) ) (define-function ipatch_file_buf_commit (c-name "ipatch_file_buf_commit") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("GError**" "err") ) ) (define-function ipatch_file_buf_seek (c-name "ipatch_file_buf_seek") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("int" "offset") '("GSeekType" "type") ) ) (define-function ipatch_file_buf_read_u8 (c-name "ipatch_file_buf_read_u8") (return-type "guint8") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_buf_read_u16 (c-name "ipatch_file_buf_read_u16") (return-type "guint16") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_buf_read_u32 (c-name "ipatch_file_buf_read_u32") (return-type "guint32") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_buf_read_u64 (c-name "ipatch_file_buf_read_u64") (return-type "guint64") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_buf_read_s8 (c-name "ipatch_file_buf_read_s8") (return-type "gint8") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_buf_read_s16 (c-name "ipatch_file_buf_read_s16") (return-type "gint16") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_buf_read_s32 (c-name "ipatch_file_buf_read_s32") (return-type "gint32") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_buf_read_s64 (c-name "ipatch_file_buf_read_s64") (return-type "gint64") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_buf_write_u8 (c-name "ipatch_file_buf_write_u8") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("guint8" "val") ) ) (define-function ipatch_file_buf_write_u16 (c-name "ipatch_file_buf_write_u16") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("guint16" "val") ) ) (define-function ipatch_file_buf_write_u32 (c-name "ipatch_file_buf_write_u32") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("guint32" "val") ) ) (define-function ipatch_file_buf_write_u64 (c-name "ipatch_file_buf_write_u64") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("guint64" "val") ) ) (define-function ipatch_file_buf_write_s8 (c-name "ipatch_file_buf_write_s8") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("gint8" "val") ) ) (define-function ipatch_file_buf_write_s16 (c-name "ipatch_file_buf_write_s16") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("gint16" "val") ) ) (define-function ipatch_file_buf_write_s32 (c-name "ipatch_file_buf_write_s32") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("gint32" "val") ) ) (define-function ipatch_file_buf_write_s64 (c-name "ipatch_file_buf_write_s64") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("gint64" "val") ) ) (define-method set_iofuncs_static (of-object "IpatchFile") (c-name "ipatch_file_set_iofuncs_static") (return-type "none") (parameters '("IpatchFileIOFuncs*" "funcs") ) ) (define-method set_iofuncs (of-object "IpatchFile") (c-name "ipatch_file_set_iofuncs") (return-type "none") (parameters '("const-IpatchFileIOFuncs*" "funcs") ) ) (define-method get_iofuncs (of-object "IpatchFile") (c-name "ipatch_file_get_iofuncs") (return-type "none") (parameters '("IpatchFileIOFuncs*" "out_funcs") ) ) (define-method set_iofuncs_null (of-object "IpatchFile") (c-name "ipatch_file_set_iofuncs_null") (return-type "none") ) (define-function ipatch_file_default_open_method (c-name "ipatch_file_default_open_method") (return-type "gboolean") (parameters '("IpatchFileHandle*" "handle") '("const-char*" "mode") '("GError**" "err") ) ) (define-function ipatch_file_default_close_method (c-name "ipatch_file_default_close_method") (return-type "none") (parameters '("IpatchFileHandle*" "handle") ) ) (define-function ipatch_file_default_read_method (c-name "ipatch_file_default_read_method") (return-type "GIOStatus") (parameters '("IpatchFileHandle*" "handle") '("gpointer" "buf") '("guint" "size") '("guint*" "bytes_read") '("GError**" "err") ) ) (define-function ipatch_file_default_write_method (c-name "ipatch_file_default_write_method") (return-type "GIOStatus") (parameters '("IpatchFileHandle*" "handle") '("gconstpointer" "buf") '("guint" "size") '("GError**" "err") ) ) (define-function ipatch_file_default_seek_method (c-name "ipatch_file_default_seek_method") (return-type "GIOStatus") (parameters '("IpatchFileHandle*" "handle") '("int" "offset") '("GSeekType" "type") '("GError**" "err") ) ) (define-function ipatch_file_default_getfd_method (c-name "ipatch_file_default_getfd_method") (return-type "int") (parameters '("IpatchFileHandle*" "handle") ) ) (define-method default_get_size_method (of-object "IpatchFile") (c-name "ipatch_file_default_get_size_method") (return-type "int") (parameters '("GError**" "err") ) ) ;; From IpatchGigEffects.h (define-function ipatch_gig_parse_effects (c-name "ipatch_gig_parse_effects") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("IpatchGigEffects*" "effects") ) ) (define-function ipatch_gig_store_effects (c-name "ipatch_gig_store_effects") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("IpatchGigEffects*" "effects") ) ) (define-method init (of-object "IpatchGigEffects") (c-name "ipatch_gig_effects_init") (return-type "none") ) (define-method to_gen_array (of-object "IpatchGigEffects") (c-name "ipatch_gig_effects_to_gen_array") (return-type "none") (parameters '("IpatchSF2GenArray*" "array") ) ) (define-function ipatch_gig_to_sf2_timecents (c-name "ipatch_gig_to_sf2_timecents") (return-type "guint16") (parameters '("gint32" "gig_tc") ) ) (define-function ipatch_gig_volsust_to_sf2_centibels (c-name "ipatch_gig_volsust_to_sf2_centibels") (return-type "guint16") (parameters '("guint" "gig_tperc") ) ) ;; From IpatchGigFile.h (define-function ipatch_gig_file_get_type (c-name "ipatch_gig_file_get_type") (return-type "GType") ) (define-function ipatch_gig_file_new (c-name "ipatch_gig_file_new") (is-constructor-of "IpatchGigFile") (return-type "IpatchGigFile*") ) ;; From IpatchGig.h (define-function ipatch_gig_get_type (c-name "ipatch_gig_get_type") (return-type "GType") ) (define-function ipatch_gig_new (c-name "ipatch_gig_new") (is-constructor-of "IpatchGig") (return-type "IpatchGig*") ) ;; From IpatchGigDimension.h (define-function ipatch_gig_dimension_get_type (c-name "ipatch_gig_dimension_get_type") (return-type "GType") ) (define-function ipatch_gig_dimension_new (c-name "ipatch_gig_dimension_new") (is-constructor-of "IpatchGigDimension") (return-type "IpatchGigDimension*") ) (define-function ipatch_gig_dimension_first (c-name "ipatch_gig_dimension_first") (return-type "IpatchGigDimension*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_gig_dimension_next (c-name "ipatch_gig_dimension_next") (return-type "IpatchGigDimension*") (parameters '("IpatchIter*" "iter") ) ) ;; From IpatchGigInst.h (define-function ipatch_gig_inst_get_type (c-name "ipatch_gig_inst_get_type") (return-type "GType") ) (define-function ipatch_gig_inst_new (c-name "ipatch_gig_inst_new") (is-constructor-of "IpatchGigInst") (return-type "IpatchGigInst*") ) (define-function ipatch_gig_inst_first (c-name "ipatch_gig_inst_first") (return-type "IpatchGigInst*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_gig_inst_next (c-name "ipatch_gig_inst_next") (return-type "IpatchGigInst*") (parameters '("IpatchIter*" "iter") ) ) ;; From IpatchGigRegion.h (define-function ipatch_gig_region_get_type (c-name "ipatch_gig_region_get_type") (return-type "GType") ) (define-function ipatch_gig_region_new (c-name "ipatch_gig_region_new") (is-constructor-of "IpatchGigRegion") (return-type "IpatchGigRegion*") ) (define-function ipatch_gig_region_first (c-name "ipatch_gig_region_first") (return-type "IpatchGigRegion*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_gig_region_next (c-name "ipatch_gig_region_next") (return-type "IpatchGigRegion*") (parameters '("IpatchIter*" "iter") ) ) (define-method set_note_range (of-object "IpatchGigRegion") (c-name "ipatch_gig_region_set_note_range") (return-type "none") (parameters '("int" "low") '("int" "high") ) ) (define-method set_velocity_range (of-object "IpatchGigRegion") (c-name "ipatch_gig_region_set_velocity_range") (return-type "none") (parameters '("int" "low") '("int" "high") ) ) (define-method new_dimension (of-object "IpatchGigRegion") (c-name "ipatch_gig_region_new_dimension") (return-type "none") (parameters '("IpatchGigDimensionType" "type") '("int" "split_count") ) ) (define-method remove_dimension (of-object "IpatchGigRegion") (c-name "ipatch_gig_region_remove_dimension") (return-type "none") (parameters '("int" "dim_index") '("int" "split_index") ) ) ;; From IpatchGigSample.h (define-function ipatch_gig_sample_get_type (c-name "ipatch_gig_sample_get_type") (return-type "GType") ) (define-function ipatch_gig_sample_new (c-name "ipatch_gig_sample_new") (is-constructor-of "IpatchGigSample") (return-type "IpatchGigSample*") ) (define-function ipatch_gig_sample_first (c-name "ipatch_gig_sample_first") (return-type "IpatchGigSample*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_gig_sample_next (c-name "ipatch_gig_sample_next") (return-type "IpatchGigSample*") (parameters '("IpatchIter*" "iter") ) ) ;; From IpatchGigSubRegion.h (define-function ipatch_gig_sub_region_get_type (c-name "ipatch_gig_sub_region_get_type") (return-type "GType") ) (define-function ipatch_gig_sub_region_new (c-name "ipatch_gig_sub_region_new") (is-constructor-of "IpatchGigSubRegion") (return-type "IpatchGigSubRegion*") ) (define-function ipatch_gig_sub_region_first (c-name "ipatch_gig_sub_region_first") (return-type "IpatchGigSubRegion*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_gig_sub_region_next (c-name "ipatch_gig_sub_region_next") (return-type "IpatchGigSubRegion*") (parameters '("IpatchIter*" "iter") ) ) (define-method get_sample (of-object "IpatchGigSubRegion") (c-name "ipatch_gig_sub_region_get_sample") (return-type "IpatchGigSample*") ) (define-method set_sample (of-object "IpatchGigSubRegion") (c-name "ipatch_gig_sub_region_set_sample") (return-type "none") (parameters '("IpatchGigSample*" "sample") ) ) ;; From IpatchItem.h (define-function ipatch_item_get_type (c-name "ipatch_item_get_type") (return-type "GType") ) (define-method unparent (of-object "IpatchItem") (c-name "ipatch_item_unparent") (return-type "none") ) (define-method get_parent (of-object "IpatchItem") (c-name "ipatch_item_get_parent") (return-type "IpatchItem*") ) (define-method peek_parent (of-object "IpatchItem") (c-name "ipatch_item_peek_parent") (return-type "IpatchItem*") ) (define-method get_base (of-object "IpatchItem") (c-name "ipatch_item_get_base") (return-type "IpatchItem*") ) (define-method peek_base (of-object "IpatchItem") (c-name "ipatch_item_peek_base") (return-type "IpatchItem*") ) (define-method get_ancestor_by_type (of-object "IpatchItem") (c-name "ipatch_item_get_ancestor_by_type") (return-type "IpatchItem*") (parameters '("GType" "ancestor_type") ) ) (define-method peek_ancestor_by_type (of-object "IpatchItem") (c-name "ipatch_item_peek_ancestor_by_type") (return-type "IpatchItem*") (parameters '("GType" "ancestor_type") ) ) (define-method remove (of-object "IpatchItem") (c-name "ipatch_item_remove") (return-type "none") ) (define-method changed (of-object "IpatchItem") (c-name "ipatch_item_changed") (return-type "none") ) (define-method get_property_fast (of-object "IpatchItem") (c-name "ipatch_item_get_property_fast") (return-type "none") (parameters '("GParamSpec*" "pspec") '("GValue*" "value") ) ) (define-method copy (of-object "IpatchItem") (c-name "ipatch_item_copy") (return-type "none") (parameters '("IpatchItem*" "src") ) ) (define-method copy_link_func (of-object "IpatchItem") (c-name "ipatch_item_copy_link_func") (return-type "none") (parameters '("IpatchItem*" "src") '("IpatchItemCopyLinkFunc" "link_func") '("gpointer" "user_data") ) ) (define-method copy_replace (of-object "IpatchItem") (c-name "ipatch_item_copy_replace") (return-type "none") (parameters '("IpatchItem*" "src") '("GHashTable*" "repl_hash") ) ) (define-method duplicate (of-object "IpatchItem") (c-name "ipatch_item_duplicate") (return-type "IpatchItem*") ) (define-method duplicate_link_func (of-object "IpatchItem") (c-name "ipatch_item_duplicate_link_func") (return-type "IpatchItem*") (parameters '("IpatchItemCopyLinkFunc" "link_func") '("gpointer" "user_data") ) ) (define-method duplicate_replace (of-object "IpatchItem") (c-name "ipatch_item_duplicate_replace") (return-type "IpatchItem*") (parameters '("GHashTable*" "repl_hash") ) ) (define-method duplicate_deep (of-object "IpatchItem") (c-name "ipatch_item_duplicate_deep") (return-type "IpatchList*") ) (define-method copy_link_func_deep (of-object "IpatchItem") (c-name "ipatch_item_copy_link_func_deep") (return-type "IpatchItem*") (parameters '("IpatchItem*" "link") '("gpointer" "user_data") ) ) (define-method copy_link_func_hash (of-object "IpatchItem") (c-name "ipatch_item_copy_link_func_hash") (return-type "IpatchItem*") (parameters '("IpatchItem*" "link") '("gpointer" "user_data") ) ) (define-function ipatch_item_type_can_conflict (c-name "ipatch_item_type_can_conflict") (return-type "gboolean") (parameters '("GType" "item_type") ) ) (define-function ipatch_item_type_get_unique_specs (c-name "ipatch_item_type_get_unique_specs") (return-type "GParamSpec**") (parameters '("GType" "item_type") '("guint32*" "groups") ) ) (define-method get_unique_props (of-object "IpatchItem") (c-name "ipatch_item_get_unique_props") (return-type "GValueArray*") ) (define-method test_conflict (of-object "IpatchItem") (c-name "ipatch_item_test_conflict") (return-type "guint") (parameters '("IpatchItem*" "item2") ) ) (define-function ipatch_item_set_atomic (c-name "ipatch_item_set_atomic") (return-type "none") (parameters '("gpointer" "item") '("const-char*" "first_property_name") ) (varargs #t) ) (define-function ipatch_item_get_atomic (c-name "ipatch_item_get_atomic") (return-type "none") (parameters '("gpointer" "item") '("const-char*" "first_property_name") ) (varargs #t) ) (define-function ipatch_item_first (c-name "ipatch_item_first") (return-type "IpatchItem*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_item_next (c-name "ipatch_item_next") (return-type "IpatchItem*") (parameters '("IpatchIter*" "iter") ) ) (define-method prop_notify (of-object "IpatchItem") (c-name "ipatch_item_prop_notify") (return-type "none") (parameters '("GParamSpec*" "pspec") '("const-GValue*" "new_value") '("const-GValue*" "old_value") ) ) (define-method prop_notify_by_name (of-object "IpatchItem") (c-name "ipatch_item_prop_notify_by_name") (return-type "none") (parameters '("const-char*" "prop_name") '("const-GValue*" "new_value") '("const-GValue*" "old_value") ) ) (define-method prop_connect (of-object "IpatchItem") (c-name "ipatch_item_prop_connect") (return-type "guint") (parameters '("GParamSpec*" "pspec") '("IpatchItemPropCallback" "callback") '("IpatchItemPropDisconnect" "disconnect") '("gpointer" "user_data") ) ) (define-method prop_connect_by_name (of-object "IpatchItem") (c-name "ipatch_item_prop_connect_by_name") (return-type "guint") (parameters '("const-char*" "prop_name") '("IpatchItemPropCallback" "callback") '("IpatchItemPropDisconnect" "disconnect") '("gpointer" "user_data") ) ) (define-function ipatch_item_prop_disconnect (c-name "ipatch_item_prop_disconnect") (return-type "none") (parameters '("guint" "handler_id") ) ) (define-method prop_disconnect_matched (of-object "IpatchItem") (c-name "ipatch_item_prop_disconnect_matched") (return-type "none") (parameters '("GParamSpec*" "pspec") '("IpatchItemPropCallback" "callback") '("gpointer" "user_data") ) ) (define-method prop_disconnect_by_name (of-object "IpatchItem") (c-name "ipatch_item_prop_disconnect_by_name") (return-type "none") (parameters '("const-char*" "prop_name") '("IpatchItemPropCallback" "callback") '("gpointer" "user_data") ) ) ;; From IpatchIter.h (define-function ipatch_iter_get_type (c-name "ipatch_iter_get_type") (return-type "GType") ) (define-function ipatch_iter_alloc (c-name "ipatch_iter_alloc") (return-type "IpatchIter*") ) (define-method free (of-object "IpatchIter") (c-name "ipatch_iter_free") (return-type "none") ) (define-method duplicate (of-object "IpatchIter") (c-name "ipatch_iter_duplicate") (return-type "IpatchIter*") ) (define-method GSList_init (of-object "IpatchIter") (c-name "ipatch_iter_GSList_init") (return-type "none") (parameters '("GSList**" "list") ) ) (define-method GSList_get (of-object "IpatchIter") (c-name "ipatch_iter_GSList_get") (return-type "gpointer") ) (define-method GSList_next (of-object "IpatchIter") (c-name "ipatch_iter_GSList_next") (return-type "gpointer") ) (define-method GSList_first (of-object "IpatchIter") (c-name "ipatch_iter_GSList_first") (return-type "gpointer") ) (define-method GSList_last (of-object "IpatchIter") (c-name "ipatch_iter_GSList_last") (return-type "gpointer") ) (define-method GSList_index (of-object "IpatchIter") (c-name "ipatch_iter_GSList_index") (return-type "gpointer") (parameters '("int" "index") ) ) (define-method GSList_insert (of-object "IpatchIter") (c-name "ipatch_iter_GSList_insert") (return-type "none") (parameters '("gpointer" "item") ) ) (define-method GSList_remove (of-object "IpatchIter") (c-name "ipatch_iter_GSList_remove") (return-type "none") ) (define-method GSList_count (of-object "IpatchIter") (c-name "ipatch_iter_GSList_count") (return-type "int") ) (define-method GList_init (of-object "IpatchIter") (c-name "ipatch_iter_GList_init") (return-type "none") (parameters '("GList**" "list") ) ) (define-method GList_get (of-object "IpatchIter") (c-name "ipatch_iter_GList_get") (return-type "gpointer") ) (define-method GList_next (of-object "IpatchIter") (c-name "ipatch_iter_GList_next") (return-type "gpointer") ) (define-method GList_first (of-object "IpatchIter") (c-name "ipatch_iter_GList_first") (return-type "gpointer") ) (define-method GList_last (of-object "IpatchIter") (c-name "ipatch_iter_GList_last") (return-type "gpointer") ) (define-method GList_index (of-object "IpatchIter") (c-name "ipatch_iter_GList_index") (return-type "gpointer") (parameters '("int" "index") ) ) (define-method GList_insert (of-object "IpatchIter") (c-name "ipatch_iter_GList_insert") (return-type "none") (parameters '("gpointer" "item") ) ) (define-method GList_remove (of-object "IpatchIter") (c-name "ipatch_iter_GList_remove") (return-type "none") ) (define-method GList_count (of-object "IpatchIter") (c-name "ipatch_iter_GList_count") (return-type "int") ) (define-method array_init (of-object "IpatchIter") (c-name "ipatch_iter_array_init") (return-type "none") (parameters '("gpointer*" "array") '("guint" "size") ) ) (define-method array_get (of-object "IpatchIter") (c-name "ipatch_iter_array_get") (return-type "gpointer") ) (define-method array_next (of-object "IpatchIter") (c-name "ipatch_iter_array_next") (return-type "gpointer") ) (define-method array_first (of-object "IpatchIter") (c-name "ipatch_iter_array_first") (return-type "gpointer") ) (define-method array_last (of-object "IpatchIter") (c-name "ipatch_iter_array_last") (return-type "gpointer") ) (define-method array_index (of-object "IpatchIter") (c-name "ipatch_iter_array_index") (return-type "gpointer") (parameters '("int" "index") ) ) (define-method array_insert (of-object "IpatchIter") (c-name "ipatch_iter_array_insert") (return-type "none") (parameters '("gpointer" "item") ) ) (define-method array_remove (of-object "IpatchIter") (c-name "ipatch_iter_array_remove") (return-type "none") ) (define-method array_count (of-object "IpatchIter") (c-name "ipatch_iter_array_count") (return-type "int") ) ;; From IpatchList.h (define-function ipatch_list_get_type (c-name "ipatch_list_get_type") (return-type "GType") ) (define-function ipatch_list_new (c-name "ipatch_list_new") (is-constructor-of "IpatchList") (return-type "IpatchList*") ) (define-method duplicate (of-object "IpatchList") (c-name "ipatch_list_duplicate") (return-type "IpatchList*") ) (define-method init_iter (of-object "IpatchList") (c-name "ipatch_list_init_iter") (return-type "none") (parameters '("IpatchIter*" "iter") ) ) ;; From IpatchParamProp.h (define-function ipatch_param_install_property (c-name "ipatch_param_install_property") (return-type "none") (parameters '("GParamSpec*" "prop_spec") ) ) (define-function ipatch_param_find_property (c-name "ipatch_param_find_property") (return-type "GParamSpec*") (parameters '("const-char*" "name") ) ) (define-function ipatch_param_list_properties (c-name "ipatch_param_list_properties") (return-type "GParamSpec**") (parameters '("guint*" "n_properties") ) ) (define-function ipatch_param_set (c-name "ipatch_param_set") (return-type "GParamSpec*") (parameters '("GParamSpec*" "spec") '("const-char*" "first_property_name") ) (varargs #t) ) (define-function ipatch_param_set_valist (c-name "ipatch_param_set_valist") (return-type "none") (parameters '("GParamSpec*" "spec") '("const-char*" "first_property_name") '("va_list" "args") ) ) (define-function ipatch_param_set_property (c-name "ipatch_param_set_property") (return-type "none") (parameters '("GParamSpec*" "spec") '("const-char*" "property_name") '("const-GValue*" "value") ) ) (define-function ipatch_param_get (c-name "ipatch_param_get") (return-type "none") (parameters '("GParamSpec*" "spec") '("const-char*" "first_property_name") ) (varargs #t) ) (define-function ipatch_param_get_valist (c-name "ipatch_param_get_valist") (return-type "none") (parameters '("GParamSpec*" "spec") '("const-char*" "first_property_name") '("va_list" "args") ) ) (define-function ipatch_param_get_property (c-name "ipatch_param_get_property") (return-type "gboolean") (parameters '("GParamSpec*" "spec") '("const-char*" "property_name") '("GValue*" "value") ) ) ;; From IpatchPaste.h (define-function ipatch_register_paste_handler (c-name "ipatch_register_paste_handler") (return-type "none") (parameters '("IpatchPasteTestFunc" "test_func") '("IpatchPasteExecFunc" "exec_func") '("int" "flags") ) ) (define-function ipatch_is_paste_possible (c-name "ipatch_is_paste_possible") (return-type "gboolean") (parameters '("IpatchItem*" "dest") '("IpatchItem*" "src") ) ) (define-function ipatch_simple_paste (c-name "ipatch_simple_paste") (return-type "gboolean") (parameters '("IpatchItem*" "dest") '("IpatchItem*" "src") '("GError**" "err") ) ) (define-function ipatch_paste_get_type (c-name "ipatch_paste_get_type") (return-type "GType") ) (define-function ipatch_paste_new (c-name "ipatch_paste_new") (is-constructor-of "IpatchPaste") (return-type "IpatchPaste*") ) (define-method objects (of-object "IpatchPaste") (c-name "ipatch_paste_objects") (return-type "gboolean") (parameters '("IpatchItem*" "dest") '("IpatchItem*" "src") '("GError**" "err") ) ) (define-method resolve (of-object "IpatchPaste") (c-name "ipatch_paste_resolve") (return-type "gboolean") (parameters '("IpatchPasteResolveFunc" "resolve_func") '("gpointer" "user_data") ) ) (define-method finish (of-object "IpatchPaste") (c-name "ipatch_paste_finish") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-method get_add_list (of-object "IpatchPaste") (c-name "ipatch_paste_get_add_list") (return-type "IpatchList*") ) (define-method object_add (of-object "IpatchPaste") (c-name "ipatch_paste_object_add") (return-type "none") (parameters '("IpatchItem*" "additem") '("IpatchContainer*" "parent") '("IpatchItem*" "orig") ) ) (define-method object_add_duplicate (of-object "IpatchPaste") (c-name "ipatch_paste_object_add_duplicate") (return-type "IpatchItem*") (parameters '("IpatchItem*" "item") '("IpatchContainer*" "parent") ) ) (define-method object_add_duplicate_deep (of-object "IpatchPaste") (c-name "ipatch_paste_object_add_duplicate_deep") (return-type "IpatchItem*") (parameters '("IpatchItem*" "item") '("IpatchContainer*" "parent") ) ) (define-method object_add_convert (of-object "IpatchPaste") (c-name "ipatch_paste_object_add_convert") (return-type "gboolean") (parameters '("GType" "conv_type") '("IpatchItem*" "item") '("IpatchContainer*" "parent") '("IpatchList**" "item_list") '("GError**" "err") ) ) (define-method object_link (of-object "IpatchPaste") (c-name "ipatch_paste_object_link") (return-type "none") (parameters '("IpatchItem*" "from") '("IpatchItem*" "to") ) ) (define-function ipatch_paste_default_test_func (c-name "ipatch_paste_default_test_func") (return-type "gboolean") (parameters '("IpatchItem*" "dest") '("IpatchItem*" "src") ) ) (define-method default_exec_func (of-object "IpatchPaste") (c-name "ipatch_paste_default_exec_func") (return-type "gboolean") (parameters '("IpatchItem*" "dest") '("IpatchItem*" "src") '("GError**" "err") ) ) ;; From IpatchRange.h (define-function ipatch_range_get_type (c-name "ipatch_range_get_type") (return-type "GType") ) (define-function ipatch_range_new (c-name "ipatch_range_new") (is-constructor-of "IpatchRange") (return-type "IpatchRange*") (parameters '("int" "low") '("int" "high") ) ) (define-method copy (of-object "IpatchRange") (c-name "ipatch_range_copy") (return-type "IpatchRange*") (caller-owns-return #t) ) (define-method free (of-object "IpatchRange") (c-name "ipatch_range_free") (return-type "none") ) (define-function ipatch_value_set_range (c-name "ipatch_value_set_range") (return-type "none") (parameters '("GValue*" "value") '("const-IpatchRange*" "range") ) ) (define-function ipatch_value_set_static_range (c-name "ipatch_value_set_static_range") (return-type "none") (parameters '("GValue*" "value") '("IpatchRange*" "range") ) ) (define-function ipatch_value_get_range (c-name "ipatch_value_get_range") (return-type "IpatchRange*") (parameters '("const-GValue*" "value") ) ) (define-function ipatch_param_spec_range_get_type (c-name "ipatch_param_spec_range_get_type") (return-type "GType") ) (define-function ipatch_param_spec_range (c-name "ipatch_param_spec_range") (return-type "GParamSpec*") (parameters '("const-char*" "name") '("const-char*" "nick") '("const-char*" "blurb") '("int" "min") '("int" "max") '("int" "default_low") '("int" "default_high") '("GParamFlags" "flags") ) ) ;; From IpatchRiff.h (define-function ipatch_riff_get_type (c-name "ipatch_riff_get_type") (return-type "GType") ) (define-function ipatch_riff_error_quark (c-name "ipatch_riff_error_quark") (return-type "GQuark") ) (define-function ipatch_riff_new (c-name "ipatch_riff_new") (is-constructor-of "IpatchRiff") (return-type "IpatchRiff*") (parameters '("IpatchFileHandle*" "handle") ) ) (define-method set_file_handle (of-object "IpatchRiff") (c-name "ipatch_riff_set_file_handle") (return-type "none") (parameters '("IpatchFileHandle*" "handle") ) ) (define-method get_file_handle (of-object "IpatchRiff") (c-name "ipatch_riff_get_file_handle") (return-type "IpatchFileHandle*") ) (define-method get_chunk_level (of-object "IpatchRiff") (c-name "ipatch_riff_get_chunk_level") (return-type "int") ) (define-method get_chunk_array (of-object "IpatchRiff") (c-name "ipatch_riff_get_chunk_array") (return-type "IpatchRiffChunk*") (parameters '("int*" "count") ) ) (define-method get_chunk (of-object "IpatchRiff") (c-name "ipatch_riff_get_chunk") (return-type "IpatchRiffChunk*") (parameters '("int" "level") ) ) (define-method get_total_size (of-object "IpatchRiff") (c-name "ipatch_riff_get_total_size") (return-type "guint32") ) (define-method get_position (of-object "IpatchRiff") (c-name "ipatch_riff_get_position") (return-type "guint32") ) (define-method push_state (of-object "IpatchRiff") (c-name "ipatch_riff_push_state") (return-type "none") ) (define-method pop_state (of-object "IpatchRiff") (c-name "ipatch_riff_pop_state") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-method start_read (of-object "IpatchRiff") (c-name "ipatch_riff_start_read") (return-type "IpatchRiffChunk*") (parameters '("GError**" "err") ) ) (define-method start_read_chunk (of-object "IpatchRiff") (c-name "ipatch_riff_start_read_chunk") (return-type "IpatchRiffChunk*") (parameters '("GError**" "err") ) ) (define-method read_chunk_verify (of-object "IpatchRiff") (c-name "ipatch_riff_read_chunk_verify") (return-type "IpatchRiffChunk*") (parameters '("IpatchRiffChunkType" "type") '("guint32" "id") '("GError**" "err") ) ) (define-method read_chunk (of-object "IpatchRiff") (c-name "ipatch_riff_read_chunk") (return-type "IpatchRiffChunk*") (parameters '("GError**" "err") ) ) (define-method write_chunk (of-object "IpatchRiff") (c-name "ipatch_riff_write_chunk") (return-type "gboolean") (parameters '("IpatchRiffChunkType" "type") '("guint32" "id") '("GError**" "err") ) ) (define-method close_chunk (of-object "IpatchRiff") (c-name "ipatch_riff_close_chunk") (return-type "gboolean") (parameters '("int" "level") '("GError**" "err") ) ) (define-method skip_chunks (of-object "IpatchRiff") (c-name "ipatch_riff_skip_chunks") (return-type "gboolean") (parameters '("guint" "count") '("GError**" "err") ) ) (define-method get_error (of-object "IpatchRiff") (c-name "ipatch_riff_get_error") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-method message_detail (of-object "IpatchRiff") (c-name "ipatch_riff_message_detail") (return-type "char*") (parameters '("int" "level") '("const-char*" "format") ) (varargs #t) ) ;; From IpatchSample.h (define-function ipatch_sample_get_type (c-name "ipatch_sample_get_type") (return-type "GType") ) (define-method get_loop_types (of-object "IpatchSample") (c-name "ipatch_sample_get_loop_types") (return-type "int*") ) (define-function ipatch_sample_type_get_loop_types (c-name "ipatch_sample_type_get_loop_types") (return-type "int*") (parameters '("GType" "type") ) ) (define-method set_format (of-object "IpatchSample") (c-name "ipatch_sample_set_format") (return-type "none") (parameters '("int" "format") ) ) (define-method get_format (of-object "IpatchSample") (c-name "ipatch_sample_get_format") (return-type "int") ) (define-method set_size (of-object "IpatchSample") (c-name "ipatch_sample_set_size") (return-type "none") (parameters '("guint" "size") ) ) (define-method get_size (of-object "IpatchSample") (c-name "ipatch_sample_get_size") (return-type "guint") (parameters '("guint*" "bytes") ) ) (define-method get_frame_size (of-object "IpatchSample") (c-name "ipatch_sample_get_frame_size") (return-type "int") ) (define-method get_sample_data (of-object "IpatchSample") (c-name "ipatch_sample_get_sample_data") (return-type "IpatchSampleData*") ) (define-method set_sample_data (of-object "IpatchSample") (c-name "ipatch_sample_set_sample_data") (return-type "gboolean") (parameters '("IpatchSampleData*" "sampledata") ) ) (define-method read (of-object "IpatchSample") (c-name "ipatch_sample_read") (return-type "gboolean") (parameters '("guint" "offset") '("guint" "frames") '("gpointer" "buf") '("GError**" "err") ) ) (define-method write (of-object "IpatchSample") (c-name "ipatch_sample_write") (return-type "gboolean") (parameters '("guint" "offset") '("guint" "frames") '("gconstpointer" "buf") '("GError**" "err") ) ) (define-method read_transform (of-object "IpatchSample") (c-name "ipatch_sample_read_transform") (return-type "gboolean") (parameters '("guint" "offset") '("guint" "frames") '("gpointer" "buf") '("int" "format") '("guint32" "channel_map") '("GError**" "err") ) ) (define-method write_transform (of-object "IpatchSample") (c-name "ipatch_sample_write_transform") (return-type "gboolean") (parameters '("guint" "offset") '("guint" "frames") '("gconstpointer" "buf") '("int" "format") '("guint32" "channel_map") '("GError**" "err") ) ) (define-method copy (of-object "IpatchSample") (c-name "ipatch_sample_copy") (return-type "gboolean") (parameters '("IpatchSample*" "src_sample") '("guint32" "channel_map") '("GError**" "err") ) ) (define-method save_to_file (of-object "IpatchSample") (c-name "ipatch_sample_save_to_file") (return-type "gboolean") (parameters '("const-char*" "filename") '("int" "file_format") '("int" "sub_format") '("GError**" "err") ) ) (define-method handle_open (of-object "IpatchSample") (c-name "ipatch_sample_handle_open") (return-type "gboolean") (parameters '("IpatchSampleHandle*" "handle") '("char" "mode") '("int" "format") '("guint32" "channel_map") '("GError**" "err") ) ) (define-method close (of-object "IpatchSampleHandle") (c-name "ipatch_sample_handle_close") (return-type "none") ) (define-method get_transform (of-object "IpatchSampleHandle") (c-name "ipatch_sample_handle_get_transform") (return-type "IpatchSampleTransform*") ) (define-method set_transform (of-object "IpatchSampleHandle") (c-name "ipatch_sample_handle_set_transform") (return-type "none") (parameters '("IpatchSampleTransform*" "transform") ) ) (define-method get_format (of-object "IpatchSampleHandle") (c-name "ipatch_sample_handle_get_format") (return-type "int") ) (define-method get_frame_size (of-object "IpatchSampleHandle") (c-name "ipatch_sample_handle_get_frame_size") (return-type "int") ) (define-method get_max_frames (of-object "IpatchSampleHandle") (c-name "ipatch_sample_handle_get_max_frames") (return-type "guint") ) (define-method read (of-object "IpatchSampleHandle") (c-name "ipatch_sample_handle_read") (return-type "gpointer") (parameters '("guint" "offset") '("guint" "frames") '("gpointer" "buf") '("GError**" "err") ) ) (define-method write (of-object "IpatchSampleHandle") (c-name "ipatch_sample_handle_write") (return-type "gboolean") (parameters '("guint" "offset") '("guint" "frames") '("gconstpointer" "buf") '("GError**" "err") ) ) (define-method cascade_open (of-object "IpatchSampleHandle") (c-name "ipatch_sample_handle_cascade_open") (return-type "gboolean") (parameters '("IpatchSample*" "sample") '("GError**" "err") ) ) (define-function ipatch_sample_install_property (c-name "ipatch_sample_install_property") (return-type "GParamSpec*") (parameters '("GObjectClass*" "oclass") '("guint" "property_id") '("const-char*" "property_name") ) ) (define-function ipatch_sample_install_property_readonly (c-name "ipatch_sample_install_property_readonly") (return-type "GParamSpec*") (parameters '("GObjectClass*" "oclass") '("guint" "property_id") '("const-char*" "property_name") ) ) (define-function ipatch_sample_new_property_param_spec (c-name "ipatch_sample_new_property_param_spec") (return-type "GParamSpec*") (parameters '("const-char*" "property_name") '("GParamFlags" "flags") ) ) ;; From IpatchSampleStore.h (define-function ipatch_sample_store_get_type (c-name "ipatch_sample_store_get_type") (return-type "GType") ) (define-function ipatch_sample_store_first (c-name "ipatch_sample_store_first") (return-type "IpatchSampleStore*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_sample_store_next (c-name "ipatch_sample_store_next") (return-type "IpatchSampleStore*") (parameters '("IpatchIter*" "iter") ) ) ;; From IpatchSampleStoreCache.h (define-function ipatch_sample_store_cache_get_type (c-name "ipatch_sample_store_cache_get_type") (return-type "GType") ) (define-function ipatch_sample_store_cache_new (c-name "ipatch_sample_store_cache_new") (is-constructor-of "IpatchSampleStoreCache") (return-type "IpatchSample*") (parameters '("gpointer" "location") ) ) (define-method open (of-object "IpatchSampleStoreCache") (c-name "ipatch_sample_store_cache_open") (return-type "none") ) (define-method close (of-object "IpatchSampleStoreCache") (c-name "ipatch_sample_store_cache_close") (return-type "none") ) ;; From IpatchSampleStoreFile.h (define-function ipatch_sample_store_file_get_type (c-name "ipatch_sample_store_file_get_type") (return-type "GType") ) (define-function ipatch_sample_store_file_new (c-name "ipatch_sample_store_file_new") (is-constructor-of "IpatchSampleStoreFile") (return-type "IpatchSample*") (parameters '("IpatchFile*" "file") '("guint" "location") ) ) ;; From IpatchSampleStoreRam.h (define-function ipatch_sample_store_ram_get_type (c-name "ipatch_sample_store_ram_get_type") (return-type "GType") ) (define-function ipatch_sample_store_ram_new (c-name "ipatch_sample_store_ram_new") (is-constructor-of "IpatchSampleStoreRam") (return-type "IpatchSample*") (parameters '("gpointer" "location") '("gboolean" "free_data") ) ) (define-function ipatch_sample_store_ram_get_blank (c-name "ipatch_sample_store_ram_get_blank") (return-type "IpatchSample*") ) ;; From IpatchSampleStoreRom.h (define-function ipatch_sample_store_rom_get_type (c-name "ipatch_sample_store_rom_get_type") (return-type "GType") ) (define-function ipatch_sample_store_rom_new (c-name "ipatch_sample_store_rom_new") (is-constructor-of "IpatchSampleStoreRom") (return-type "IpatchSample*") (parameters '("guint" "location") ) ) ;; From IpatchSampleStoreSndFile.h (define-function ipatch_sample_store_snd_file_get_type (c-name "ipatch_sample_store_snd_file_get_type") (return-type "GType") ) (define-function ipatch_sample_store_snd_file_new (c-name "ipatch_sample_store_snd_file_new") (is-constructor-of "IpatchSampleStoreSndFile") (return-type "IpatchSample*") (parameters '("const-char*" "filename") ) ) (define-method init_read (of-object "IpatchSampleStoreSndFile") (c-name "ipatch_sample_store_snd_file_init_read") (return-type "gboolean") ) (define-method init_write (of-object "IpatchSampleStoreSndFile") (c-name "ipatch_sample_store_snd_file_init_write") (return-type "gboolean") (parameters '("int" "file_format") '("int" "sub_format") '("int" "endian") '("int" "channels") '("int" "samplerate") ) ) ;; From IpatchSampleStoreSwap.h (define-function ipatch_sample_store_swap_get_type (c-name "ipatch_sample_store_swap_get_type") (return-type "GType") ) (define-function ipatch_sample_store_swap_new (c-name "ipatch_sample_store_swap_new") (is-constructor-of "IpatchSampleStoreSwap") (return-type "IpatchSample*") ) (define-function ipatch_sample_store_swap_get_unused_size (c-name "ipatch_sample_store_swap_get_unused_size") (return-type "int") ) ;; From IpatchSampleStoreVirtual.h (define-function ipatch_sample_store_virtual_get_type (c-name "ipatch_sample_store_virtual_get_type") (return-type "GType") ) (define-function ipatch_sample_store_virtual_new (c-name "ipatch_sample_store_virtual_new") (is-constructor-of "IpatchSampleStoreVirtual") (return-type "IpatchSample*") ) (define-method get_list (of-object "IpatchSampleStoreVirtual") (c-name "ipatch_sample_store_virtual_get_list") (return-type "IpatchSampleList*") (parameters '("guint" "chan") ) ) (define-method set_list (of-object "IpatchSampleStoreVirtual") (c-name "ipatch_sample_store_virtual_set_list") (return-type "none") (parameters '("guint" "chan") '("IpatchSampleList*" "list") ) ) ;; From IpatchSampleTransform.h (define-function ipatch_sample_transform_new (c-name "ipatch_sample_transform_new") (is-constructor-of "IpatchSampleTransform") (return-type "IpatchSampleTransform*") (parameters '("int" "src_format") '("int" "dest_format") '("guint32" "channel_map") ) ) (define-method free (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_free") (return-type "none") ) (define-method init (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_init") (return-type "none") ) (define-function ipatch_sample_transform_pool_acquire (c-name "ipatch_sample_transform_pool_acquire") (return-type "IpatchSampleTransform*") (parameters '("int" "src_format") '("int" "dest_format") '("guint32" "channel_map") ) ) (define-method pool_release (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_pool_release") (return-type "none") ) (define-method set_formats (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_set_formats") (return-type "none") (parameters '("int" "src_format") '("int" "dest_format") '("guint32" "channel_map") ) ) (define-method alloc (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_alloc") (return-type "none") (parameters '("guint" "frames") ) ) (define-method alloc_size (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_alloc_size") (return-type "int") (parameters '("guint" "size") ) ) (define-method free_buffers (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_free_buffers") (return-type "none") ) (define-method set_buffers_size (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_set_buffers_size") (return-type "guint") (parameters '("gpointer" "buf") '("guint" "size") ) ) (define-method get_buffers (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_get_buffers") (return-type "none") (parameters '("gpointer*" "buf1") '("gpointer*" "buf2") ) ) (define-method get_frame_sizes (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_get_frame_sizes") (return-type "none") (parameters '("guint*" "buf1_size") '("guint*" "buf2_size") ) ) (define-method get_max_frames (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_get_max_frames") (return-type "guint") ) (define-method convert (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_convert") (return-type "gpointer") (parameters '("gconstpointer" "src") '("gpointer" "dest") '("guint" "frames") ) ) (define-method convert_single (of-object "IpatchSampleTransform") (c-name "ipatch_sample_transform_convert_single") (return-type "gpointer") (parameters '("guint" "frames") ) ) ;; From IpatchSF2File.h (define-function ipatch_sf2_file_get_type (c-name "ipatch_sf2_file_get_type") (return-type "GType") ) (define-function ipatch_sf2_file_new (c-name "ipatch_sf2_file_new") (is-constructor-of "IpatchSF2File") (return-type "IpatchSF2File*") ) (define-method set_sample_pos (of-object "IpatchSF2File") (c-name "ipatch_sf2_file_set_sample_pos") (return-type "none") (parameters '("guint" "sample_pos") ) ) (define-method get_sample_pos (of-object "IpatchSF2File") (c-name "ipatch_sf2_file_get_sample_pos") (return-type "guint") ) (define-method set_sample_size (of-object "IpatchSF2File") (c-name "ipatch_sf2_file_set_sample_size") (return-type "none") (parameters '("guint" "sample_size") ) ) (define-method get_sample_size (of-object "IpatchSF2File") (c-name "ipatch_sf2_file_get_sample_size") (return-type "guint") ) (define-method set_sample24_pos (of-object "IpatchSF2File") (c-name "ipatch_sf2_file_set_sample24_pos") (return-type "none") (parameters '("guint" "sample24_pos") ) ) (define-method get_sample24_pos (of-object "IpatchSF2File") (c-name "ipatch_sf2_file_get_sample24_pos") (return-type "guint") ) ;; From IpatchSF2Gen.h (define-function ipatch_sf2_gen_is_valid (c-name "ipatch_sf2_gen_is_valid") (return-type "gboolean") (parameters '("guint" "genid") '("IpatchSF2GenPropsType" "propstype") ) ) (define-function ipatch_sf2_gen_array_get_type (c-name "ipatch_sf2_gen_array_get_type") (return-type "GType") ) (define-function ipatch_sf2_gen_array_new (c-name "ipatch_sf2_gen_array_new") (is-constructor-of "IpatchSF2GenArray") (return-type "IpatchSF2GenArray*") (parameters '("gboolean" "clear") ) ) (define-method free (of-object "IpatchSF2GenArray") (c-name "ipatch_sf2_gen_array_free") (return-type "none") ) (define-method duplicate (of-object "IpatchSF2GenArray") (c-name "ipatch_sf2_gen_array_duplicate") (return-type "IpatchSF2GenArray*") ) (define-method init (of-object "IpatchSF2GenArray") (c-name "ipatch_sf2_gen_array_init") (return-type "none") (parameters '("gboolean" "offset") '("gboolean" "set") ) ) (define-method offset (of-object "IpatchSF2GenArray") (c-name "ipatch_sf2_gen_array_offset") (return-type "gboolean") (parameters '("const-IpatchSF2GenArray*" "ofs_array") ) ) (define-method intersect_test (of-object "IpatchSF2GenArray") (c-name "ipatch_sf2_gen_array_intersect_test") (return-type "gboolean") (parameters '("const-IpatchSF2GenArray*" "array2") ) ) (define-method count_set (of-object "IpatchSF2GenArray") (c-name "ipatch_sf2_gen_array_count_set") (return-type "guint") ) (define-function ipatch_sf2_gen_amount_to_value (c-name "ipatch_sf2_gen_amount_to_value") (return-type "none") (parameters '("guint" "genid") '("const-IpatchSF2GenAmount*" "amt") '("GValue*" "value") ) ) (define-function ipatch_sf2_gen_default_value (c-name "ipatch_sf2_gen_default_value") (return-type "none") (parameters '("guint" "genid") '("gboolean" "ispreset") '("IpatchSF2GenAmount*" "out_amt") ) ) (define-function ipatch_sf2_gen_offset (c-name "ipatch_sf2_gen_offset") (return-type "gboolean") (parameters '("guint" "genid") '("IpatchSF2GenAmount*" "dst") '("const-IpatchSF2GenAmount*" "ofs") ) ) (define-function ipatch_sf2_gen_clamp (c-name "ipatch_sf2_gen_clamp") (return-type "none") (parameters '("guint" "genid") '("int*" "sfval") '("gboolean" "ispreset") ) ) (define-function ipatch_sf2_gen_range_intersect (c-name "ipatch_sf2_gen_range_intersect") (return-type "gboolean") (parameters '("IpatchSF2GenAmount*" "dst") '("const-IpatchSF2GenAmount*" "src") ) ) (define-function ipatch_sf2_gen_range_intersect_test (c-name "ipatch_sf2_gen_range_intersect_test") (return-type "gboolean") (parameters '("const-IpatchSF2GenAmount*" "amt1") '("const-IpatchSF2GenAmount*" "amt2") ) ) (define-function ipatch_sf2_gen_get_prop_name (c-name "ipatch_sf2_gen_get_prop_name") (return-type "const-char*") (parameters '("guint" "genid") ) ) ;; From IpatchSF2GenItem.h (define-function ipatch_sf2_gen_item_get_type (c-name "ipatch_sf2_gen_item_get_type") (return-type "GType") ) (define-method get_amount (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_get_amount") (return-type "gboolean") (parameters '("guint" "genid") '("IpatchSF2GenAmount*" "out_amt") ) ) (define-method set_amount (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_set_amount") (return-type "none") (parameters '("guint" "genid") '("IpatchSF2GenAmount*" "amt") ) ) (define-method set_gen_flag (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_set_gen_flag") (return-type "none") (parameters '("guint" "genid") '("gboolean" "setflag") ) ) (define-method count_set (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_count_set") (return-type "guint") ) (define-method copy_all (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_copy_all") (return-type "none") (parameters '("IpatchSF2GenArray*" "array") ) ) (define-method copy_set (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_copy_set") (return-type "none") (parameters '("IpatchSF2GenArray*" "array") ) ) (define-method set_note_range (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_set_note_range") (return-type "none") (parameters '("int" "low") '("int" "high") ) ) (define-method set_velocity_range (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_set_velocity_range") (return-type "none") (parameters '("int" "low") '("int" "high") ) ) (define-method in_range (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_in_range") (return-type "gboolean") (parameters '("int" "note") '("int" "velocity") ) ) (define-method intersect_test (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_intersect_test") (return-type "gboolean") (parameters '("const-IpatchSF2GenArray*" "genarray") ) ) (define-function ipatch_sf2_gen_item_class_get_pspec (c-name "ipatch_sf2_gen_item_class_get_pspec") (return-type "GParamSpec*") (parameters '("GObjectClass*" "klass") '("guint" "genid") ) ) (define-function ipatch_sf2_gen_item_class_get_pspec_set (c-name "ipatch_sf2_gen_item_class_get_pspec_set") (return-type "GParamSpec*") (parameters '("GObjectClass*" "klass") '("guint" "genid") ) ) (define-function ipatch_sf2_gen_item_iface_install_properties (c-name "ipatch_sf2_gen_item_iface_install_properties") (return-type "none") (parameters '("GObjectClass*" "klass") '("IpatchSF2GenPropsType" "propstype") '("GParamSpec***" "specs") '("GParamSpec***" "setspecs") ) ) (define-method iface_set_property (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_iface_set_property") (return-type "gboolean") (parameters '("guint" "property_id") '("const-GValue*" "value") ) ) (define-method iface_get_property (of-object "IpatchSF2GenItem") (c-name "ipatch_sf2_gen_item_iface_get_property") (return-type "gboolean") (parameters '("guint" "property_id") '("GValue*" "value") ) ) ;; From IpatchSF2.h (define-function ipatch_sf2_get_type (c-name "ipatch_sf2_get_type") (return-type "GType") ) (define-function ipatch_sf2_new (c-name "ipatch_sf2_new") (is-constructor-of "IpatchSF2") (return-type "IpatchSF2*") ) (define-method set_file (of-object "IpatchSF2") (c-name "ipatch_sf2_set_file") (return-type "none") (parameters '("IpatchSF2File*" "file") ) ) (define-method get_file (of-object "IpatchSF2") (c-name "ipatch_sf2_get_file") (return-type "IpatchSF2File*") ) (define-method get_info (of-object "IpatchSF2") (c-name "ipatch_sf2_get_info") (return-type "char*") (parameters '("IpatchSF2InfoType" "id") ) ) (define-method set_info (of-object "IpatchSF2") (c-name "ipatch_sf2_set_info") (return-type "none") (parameters '("IpatchSF2InfoType" "id") '("const-char*" "val") ) ) (define-method get_info_array (of-object "IpatchSF2") (c-name "ipatch_sf2_get_info_array") (return-type "IpatchSF2Info*") ) (define-function ipatch_sf2_free_info_array (c-name "ipatch_sf2_free_info_array") (return-type "none") (parameters '("IpatchSF2Info*" "array") ) ) (define-function ipatch_sf2_info_id_is_valid (c-name "ipatch_sf2_info_id_is_valid") (return-type "gboolean") (parameters '("guint32" "id") ) ) (define-function ipatch_sf2_get_info_max_size (c-name "ipatch_sf2_get_info_max_size") (return-type "int") (parameters '("IpatchSF2InfoType" "infotype") ) ) (define-method find_preset (of-object "IpatchSF2") (c-name "ipatch_sf2_find_preset") (return-type "IpatchSF2Preset*") (parameters '("const-char*" "name") '("int" "bank") '("int" "program") '("const-IpatchSF2Preset*" "exclude") ) ) (define-method find_inst (of-object "IpatchSF2") (c-name "ipatch_sf2_find_inst") (return-type "IpatchSF2Inst*") (parameters '("const-char*" "name") '("const-IpatchSF2Inst*" "exclude") ) ) (define-method find_sample (of-object "IpatchSF2") (c-name "ipatch_sf2_find_sample") (return-type "IpatchSF2Sample*") (parameters '("const-char*" "name") '("const-IpatchSF2Sample*" "exclude") ) ) (define-function ipatch_sf2_get_zone_references (c-name "ipatch_sf2_get_zone_references") (return-type "IpatchList*") (parameters '("IpatchItem*" "item") ) ) (define-method make_unique_name (of-object "IpatchSF2") (c-name "ipatch_sf2_make_unique_name") (return-type "char*") (parameters '("GType" "child_type") '("const-char*" "name") '("const-IpatchItem*" "exclude") ) ) ;; From IpatchSF2Inst.h (define-function ipatch_sf2_inst_get_type (c-name "ipatch_sf2_inst_get_type") (return-type "GType") ) (define-function ipatch_sf2_inst_new (c-name "ipatch_sf2_inst_new") (is-constructor-of "IpatchSF2Inst") (return-type "IpatchSF2Inst*") ) (define-function ipatch_sf2_inst_first (c-name "ipatch_sf2_inst_first") (return-type "IpatchSF2Inst*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_sf2_inst_next (c-name "ipatch_sf2_inst_next") (return-type "IpatchSF2Inst*") (parameters '("IpatchIter*" "iter") ) ) (define-method new_zone (of-object "IpatchSF2Inst") (c-name "ipatch_sf2_inst_new_zone") (return-type "none") (parameters '("IpatchSF2Sample*" "sample") ) ) (define-method set_name (of-object "IpatchSF2Inst") (c-name "ipatch_sf2_inst_set_name") (return-type "none") (parameters '("const-char*" "name") ) ) (define-method get_name (of-object "IpatchSF2Inst") (c-name "ipatch_sf2_inst_get_name") (return-type "char*") ) ;; From IpatchSF2IZone.h (define-function ipatch_sf2_izone_get_type (c-name "ipatch_sf2_izone_get_type") (return-type "GType") ) (define-function ipatch_sf2_izone_new (c-name "ipatch_sf2_izone_new") (is-constructor-of "IpatchSF2IZone") (return-type "IpatchSF2IZone*") ) (define-function ipatch_sf2_izone_first (c-name "ipatch_sf2_izone_first") (return-type "IpatchSF2IZone*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_sf2_izone_next (c-name "ipatch_sf2_izone_next") (return-type "IpatchSF2IZone*") (parameters '("IpatchIter*" "iter") ) ) (define-method set_sample (of-object "IpatchSF2IZone") (c-name "ipatch_sf2_izone_set_sample") (return-type "none") (parameters '("IpatchSF2Sample*" "sample") ) ) (define-method get_sample (of-object "IpatchSF2IZone") (c-name "ipatch_sf2_izone_get_sample") (return-type "IpatchSF2Sample*") ) ;; From IpatchSF2Mod.h (define-function ipatch_sf2_mod_get_type (c-name "ipatch_sf2_mod_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_list_get_type (c-name "ipatch_sf2_mod_list_get_type") (return-type "GType") ) (define-function ipatch_sf2_mod_new (c-name "ipatch_sf2_mod_new") (is-constructor-of "IpatchSF2Mod") (return-type "IpatchSF2Mod*") ) (define-method free (of-object "IpatchSF2Mod") (c-name "ipatch_sf2_mod_free") (return-type "none") ) (define-method duplicate (of-object "IpatchSF2Mod") (c-name "ipatch_sf2_mod_duplicate") (return-type "IpatchSF2Mod*") ) (define-function ipatch_sf2_mod_list_duplicate (c-name "ipatch_sf2_mod_list_duplicate") (return-type "GSList*") (parameters '("const-GSList*" "list") ) ) (define-function ipatch_sf2_mod_list_override (c-name "ipatch_sf2_mod_list_override") (return-type "GSList*") (parameters '("const-GSList*" "alist") '("const-GSList*" "blist") '("gboolean" "copy") ) ) (define-function ipatch_sf2_mod_list_boxed_free (c-name "ipatch_sf2_mod_list_boxed_free") (return-type "none") (parameters '("GSList*" "list") ) ) (define-function ipatch_sf2_mod_list_insert (c-name "ipatch_sf2_mod_list_insert") (return-type "GSList*") (parameters '("GSList*" "mods") '("const-IpatchSF2Mod*" "modvals") '("int" "pos") ) ) (define-function ipatch_sf2_mod_list_remove (c-name "ipatch_sf2_mod_list_remove") (return-type "GSList*") (parameters '("GSList*" "mods") '("const-IpatchSF2Mod*" "modvals") '("gboolean*" "changed") ) ) (define-function ipatch_sf2_mod_list_change (c-name "ipatch_sf2_mod_list_change") (return-type "gboolean") (parameters '("GSList*" "mods") '("const-IpatchSF2Mod*" "oldvals") '("const-IpatchSF2Mod*" "newvals") ) ) (define-function ipatch_sf2_mod_list_offset (c-name "ipatch_sf2_mod_list_offset") (return-type "GSList*") (parameters '("const-GSList*" "alist") '("const-GSList*" "blist") ) ) (define-function ipatch_sf2_mod_list_free (c-name "ipatch_sf2_mod_list_free") (return-type "none") (parameters '("GSList*" "list") '("gboolean" "free_mods") ) ) (define-function ipatch_sf2_mod_list_get_default (c-name "ipatch_sf2_mod_list_get_default") (return-type "const-GSList*") ) ;; From IpatchSF2ModItem.h (define-function ipatch_sf2_mod_item_get_type (c-name "ipatch_sf2_mod_item_get_type") (return-type "GType") ) (define-method get_mods (of-object "IpatchSF2ModItem") (c-name "ipatch_sf2_mod_item_get_mods") (return-type "GSList*") ) (define-method set_mods (of-object "IpatchSF2ModItem") (c-name "ipatch_sf2_mod_item_set_mods") (return-type "none") (parameters '("GSList*" "mod_list") '("int" "flags") ) ) (define-method insert (of-object "IpatchSF2ModItem") (c-name "ipatch_sf2_mod_item_insert") (return-type "none") (parameters '("const-IpatchSF2Mod*" "mod") '("int" "pos") ) ) (define-method remove (of-object "IpatchSF2ModItem") (c-name "ipatch_sf2_mod_item_remove") (return-type "none") (parameters '("const-IpatchSF2Mod*" "mod") ) ) (define-method change (of-object "IpatchSF2ModItem") (c-name "ipatch_sf2_mod_item_change") (return-type "none") (parameters '("const-IpatchSF2Mod*" "oldmod") '("const-IpatchSF2Mod*" "newmod") ) ) (define-method count (of-object "IpatchSF2ModItem") (c-name "ipatch_sf2_mod_item_count") (return-type "guint") ) ;; From IpatchSF2Preset.h (define-function ipatch_sf2_preset_get_type (c-name "ipatch_sf2_preset_get_type") (return-type "GType") ) (define-function ipatch_sf2_preset_new (c-name "ipatch_sf2_preset_new") (is-constructor-of "IpatchSF2Preset") (return-type "IpatchSF2Preset*") ) (define-function ipatch_sf2_preset_first (c-name "ipatch_sf2_preset_first") (return-type "IpatchSF2Preset*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_sf2_preset_next (c-name "ipatch_sf2_preset_next") (return-type "IpatchSF2Preset*") (parameters '("IpatchIter*" "iter") ) ) (define-method new_zone (of-object "IpatchSF2Preset") (c-name "ipatch_sf2_preset_new_zone") (return-type "none") (parameters '("IpatchSF2Inst*" "inst") ) ) (define-method set_name (of-object "IpatchSF2Preset") (c-name "ipatch_sf2_preset_set_name") (return-type "none") (parameters '("const-char*" "name") ) ) (define-method get_name (of-object "IpatchSF2Preset") (c-name "ipatch_sf2_preset_get_name") (return-type "char*") ) (define-method set_midi_locale (of-object "IpatchSF2Preset") (c-name "ipatch_sf2_preset_set_midi_locale") (return-type "none") (parameters '("int" "bank") '("int" "program") ) ) (define-method get_midi_locale (of-object "IpatchSF2Preset") (c-name "ipatch_sf2_preset_get_midi_locale") (return-type "none") (parameters '("int*" "bank") '("int*" "program") ) ) (define-method compare (of-object "IpatchSF2Preset") (c-name "ipatch_sf2_preset_compare") (return-type "int") (parameters '("const-IpatchSF2Preset*" "p2") ) ) ;; From IpatchSF2PZone.h (define-function ipatch_sf2_pzone_get_type (c-name "ipatch_sf2_pzone_get_type") (return-type "GType") ) (define-function ipatch_sf2_pzone_new (c-name "ipatch_sf2_pzone_new") (is-constructor-of "IpatchSF2PZone") (return-type "IpatchSF2PZone*") ) (define-function ipatch_sf2_pzone_first (c-name "ipatch_sf2_pzone_first") (return-type "IpatchSF2PZone*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_sf2_pzone_next (c-name "ipatch_sf2_pzone_next") (return-type "IpatchSF2PZone*") (parameters '("IpatchIter*" "iter") ) ) (define-method set_inst (of-object "IpatchSF2PZone") (c-name "ipatch_sf2_pzone_set_inst") (return-type "none") (parameters '("IpatchSF2Inst*" "inst") ) ) (define-method get_inst (of-object "IpatchSF2PZone") (c-name "ipatch_sf2_pzone_get_inst") (return-type "IpatchSF2Inst*") ) ;; From IpatchSF2Reader.h (define-function ipatch_sf2_reader_get_type (c-name "ipatch_sf2_reader_get_type") (return-type "GType") ) (define-function ipatch_sf2_reader_new (c-name "ipatch_sf2_reader_new") (is-constructor-of "IpatchSF2Reader") (return-type "IpatchSF2Reader*") (parameters '("IpatchFileHandle*" "handle") ) ) (define-method set_file_handle (of-object "IpatchSF2Reader") (c-name "ipatch_sf2_reader_set_file_handle") (return-type "none") (parameters '("IpatchFileHandle*" "handle") ) ) (define-method load (of-object "IpatchSF2Reader") (c-name "ipatch_sf2_reader_load") (return-type "IpatchSF2*") (parameters '("GError**" "err") ) ) (define-function ipatch_sf2_load_phdr (c-name "ipatch_sf2_load_phdr") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("IpatchSF2Phdr*" "phdr") ) ) (define-function ipatch_sf2_load_ihdr (c-name "ipatch_sf2_load_ihdr") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("IpatchSF2Ihdr*" "ihdr") ) ) (define-function ipatch_sf2_load_shdr (c-name "ipatch_sf2_load_shdr") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("IpatchSF2Shdr*" "shdr") ) ) (define-function ipatch_sf2_load_bag (c-name "ipatch_sf2_load_bag") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("IpatchSF2Bag*" "bag") ) ) (define-function ipatch_sf2_load_mod (c-name "ipatch_sf2_load_mod") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("IpatchSF2Mod*" "mod") ) ) (define-function ipatch_sf2_load_gen (c-name "ipatch_sf2_load_gen") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("int*" "genid") '("IpatchSF2GenAmount*" "amount") ) ) ;; From IpatchSF2Sample.h (define-function ipatch_sf2_sample_get_type (c-name "ipatch_sf2_sample_get_type") (return-type "GType") ) (define-function ipatch_sf2_sample_new (c-name "ipatch_sf2_sample_new") (is-constructor-of "IpatchSF2Sample") (return-type "IpatchSF2Sample*") ) (define-function ipatch_sf2_sample_first (c-name "ipatch_sf2_sample_first") (return-type "IpatchSF2Sample*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_sf2_sample_next (c-name "ipatch_sf2_sample_next") (return-type "IpatchSF2Sample*") (parameters '("IpatchIter*" "iter") ) ) (define-method set_name (of-object "IpatchSF2Sample") (c-name "ipatch_sf2_sample_set_name") (return-type "none") (parameters '("const-char*" "name") ) ) (define-method get_name (of-object "IpatchSF2Sample") (c-name "ipatch_sf2_sample_get_name") (return-type "char*") ) (define-method set_data (of-object "IpatchSF2Sample") (c-name "ipatch_sf2_sample_set_data") (return-type "none") (parameters '("IpatchSampleData*" "sampledata") ) ) (define-method get_data (of-object "IpatchSF2Sample") (c-name "ipatch_sf2_sample_get_data") (return-type "IpatchSampleData*") ) (define-method peek_data (of-object "IpatchSF2Sample") (c-name "ipatch_sf2_sample_peek_data") (return-type "IpatchSampleData*") ) (define-method set_linked (of-object "IpatchSF2Sample") (c-name "ipatch_sf2_sample_set_linked") (return-type "none") (parameters '("IpatchSF2Sample*" "linked") ) ) (define-method get_linked (of-object "IpatchSF2Sample") (c-name "ipatch_sf2_sample_get_linked") (return-type "IpatchSF2Sample*") ) (define-method peek_linked (of-object "IpatchSF2Sample") (c-name "ipatch_sf2_sample_peek_linked") (return-type "IpatchSF2Sample*") ) (define-method set_blank (of-object "IpatchSF2Sample") (c-name "ipatch_sf2_sample_set_blank") (return-type "none") ) ;; From IpatchSF2VoiceCache.h (define-function ipatch_sf2_voice_cache_get_type (c-name "ipatch_sf2_voice_cache_get_type") (return-type "GType") ) (define-function ipatch_sf2_voice_cache_new (c-name "ipatch_sf2_voice_cache_new") (is-constructor-of "IpatchSF2VoiceCache") (return-type "IpatchSF2VoiceCache*") (parameters '("IpatchSF2VoiceSelInfo*" "info") '("int" "sel_count") ) ) (define-method set_default_mods (of-object "IpatchSF2VoiceCache") (c-name "ipatch_sf2_voice_cache_set_default_mods") (return-type "none") (parameters '("GSList*" "mods") ) ) (define-method add_voice (of-object "IpatchSF2VoiceCache") (c-name "ipatch_sf2_voice_cache_add_voice") (return-type "IpatchSF2Voice*") ) (define-method set_voice_range (of-object "IpatchSF2VoiceCache") (c-name "ipatch_sf2_voice_cache_set_voice_range") (return-type "none") (parameters '("IpatchSF2Voice*" "voice") '("guint" "sel_index") '("int" "low") '("int" "high") ) ) (define-method set_sample_data (of-object "IpatchSF2Voice") (c-name "ipatch_sf2_voice_set_sample_data") (return-type "none") (parameters '("IpatchSampleData*" "sample_data") ) ) (define-method cache_sample_data (of-object "IpatchSF2Voice") (c-name "ipatch_sf2_voice_cache_sample_data") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-method copy (of-object "IpatchSF2Voice") (c-name "ipatch_sf2_voice_copy") (return-type "none") (parameters '("IpatchSF2Voice*" "src") ) ) (define-method optimize (of-object "IpatchSF2VoiceCache") (c-name "ipatch_sf2_voice_cache_optimize") (return-type "none") ) (define-method select (of-object "IpatchSF2VoiceCache") (c-name "ipatch_sf2_voice_cache_select") (return-type "int") (parameters '("int*" "select_values") '("guint16*" "index_array") '("guint16" "max_indexes") ) ) (define-method update (of-object "IpatchSF2VoiceCache") (c-name "ipatch_sf2_voice_cache_update") (return-type "int") (parameters '("int*" "select_values") '("GObject*" "cache_item") '("GObject*" "item") '("GParamSpec*" "pspec") '("const-GValue*" "value") '("IpatchSF2VoiceUpdate*" "updates") '("guint" "max_updates") ) ) ;; From IpatchSF2Writer.h (define-function ipatch_sf2_writer_get_type (c-name "ipatch_sf2_writer_get_type") (return-type "GType") ) (define-function ipatch_sf2_writer_new (c-name "ipatch_sf2_writer_new") (is-constructor-of "IpatchSF2Writer") (return-type "IpatchSF2Writer*") (parameters '("IpatchFileHandle*" "handle") '("IpatchSF2*" "sfont") ) ) (define-method set_patch (of-object "IpatchSF2Writer") (c-name "ipatch_sf2_writer_set_patch") (return-type "none") (parameters '("IpatchSF2*" "sfont") ) ) (define-method set_file_handle (of-object "IpatchSF2Writer") (c-name "ipatch_sf2_writer_set_file_handle") (return-type "none") (parameters '("IpatchFileHandle*" "handle") ) ) (define-method save (of-object "IpatchSF2Writer") (c-name "ipatch_sf2_writer_save") (return-type "gboolean") (parameters '("GError**" "err") ) ) (define-function ipatch_sf2_write_phdr (c-name "ipatch_sf2_write_phdr") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("const-IpatchSF2Phdr*" "phdr") ) ) (define-function ipatch_sf2_write_ihdr (c-name "ipatch_sf2_write_ihdr") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("const-IpatchSF2Ihdr*" "ihdr") ) ) (define-function ipatch_sf2_write_shdr (c-name "ipatch_sf2_write_shdr") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("const-IpatchSF2Shdr*" "shdr") ) ) (define-function ipatch_sf2_write_bag (c-name "ipatch_sf2_write_bag") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("const-IpatchSF2Bag*" "bag") ) ) (define-function ipatch_sf2_write_mod (c-name "ipatch_sf2_write_mod") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("const-IpatchSF2Mod*" "mod") ) ) (define-function ipatch_sf2_write_gen (c-name "ipatch_sf2_write_gen") (return-type "none") (parameters '("IpatchFileHandle*" "handle") '("int" "genid") '("const-IpatchSF2GenAmount*" "amount") ) ) ;; From IpatchSF2Zone.h (define-function ipatch_sf2_zone_get_type (c-name "ipatch_sf2_zone_get_type") (return-type "GType") ) (define-function ipatch_sf2_zone_first (c-name "ipatch_sf2_zone_first") (return-type "IpatchSF2Zone*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_sf2_zone_next (c-name "ipatch_sf2_zone_next") (return-type "IpatchSF2Zone*") (parameters '("IpatchIter*" "iter") ) ) (define-method set_link_item (of-object "IpatchSF2Zone") (c-name "ipatch_sf2_zone_set_link_item") (return-type "none") (parameters '("IpatchItem*" "item") ) ) (define-method set_link_item_no_notify (of-object "IpatchSF2Zone") (c-name "ipatch_sf2_zone_set_link_item_no_notify") (return-type "gboolean") (parameters '("IpatchItem*" "item") '("IpatchItem**" "olditem") ) ) (define-method get_link_item (of-object "IpatchSF2Zone") (c-name "ipatch_sf2_zone_get_link_item") (return-type "IpatchItem*") ) (define-method peek_link_item (of-object "IpatchSF2Zone") (c-name "ipatch_sf2_zone_peek_link_item") (return-type "IpatchItem*") ) ;; From IpatchSndFile.h (define-function ipatch_snd_file_get_type (c-name "ipatch_snd_file_get_type") (return-type "GType") ) (define-function ipatch_snd_file_new (c-name "ipatch_snd_file_new") (is-constructor-of "IpatchSndFile") (return-type "IpatchSndFile*") ) (define-function ipatch_snd_file_format_get_type (c-name "ipatch_snd_file_format_get_type") (return-type "GType") ) (define-function ipatch_snd_file_sub_format_get_type (c-name "ipatch_snd_file_sub_format_get_type") (return-type "GType") ) (define-function ipatch_snd_file_format_get_sub_formats (c-name "ipatch_snd_file_format_get_sub_formats") (return-type "int*") (parameters '("int" "format") '("guint*" "size") ) ) (define-function ipatch_snd_file_sample_format_to_sub_format (c-name "ipatch_snd_file_sample_format_to_sub_format") (return-type "int") (parameters '("int" "sample_format") '("int" "file_format") ) ) ;; From IpatchTypeProp.h (define-function ipatch_type_install_property (c-name "ipatch_type_install_property") (return-type "none") (parameters '("GParamSpec*" "prop_spec") ) ) (define-function ipatch_type_find_property (c-name "ipatch_type_find_property") (return-type "GParamSpec*") (parameters '("const-char*" "name") ) ) (define-function ipatch_type_list_properties (c-name "ipatch_type_list_properties") (return-type "GParamSpec**") (parameters '("guint*" "n_properties") ) ) (define-function ipatch_type_find_types_with_property (c-name "ipatch_type_find_types_with_property") (return-type "GType*") (parameters '("const-char*" "name") '("guint*" "n_types") ) ) (define-function ipatch_type_set (c-name "ipatch_type_set") (return-type "none") (parameters '("GType" "type") '("const-char*" "first_property_name") ) (varargs #t) ) (define-function ipatch_type_set_valist (c-name "ipatch_type_set_valist") (return-type "none") (parameters '("GType" "type") '("const-char*" "first_property_name") '("va_list" "args") ) ) (define-function ipatch_type_set_property (c-name "ipatch_type_set_property") (return-type "none") (parameters '("GType" "type") '("const-char*" "property_name") '("const-GValue*" "value") ) ) (define-function ipatch_type_get (c-name "ipatch_type_get") (return-type "none") (parameters '("GType" "type") '("const-char*" "first_property_name") ) (varargs #t) ) (define-function ipatch_type_get_valist (c-name "ipatch_type_get_valist") (return-type "none") (parameters '("GType" "type") '("const-char*" "first_property_name") '("va_list" "args") ) ) (define-function ipatch_type_get_property (c-name "ipatch_type_get_property") (return-type "none") (parameters '("GType" "type") '("const-char*" "property_name") '("GValue*" "value") ) ) (define-function ipatch_type_object_get (c-name "ipatch_type_object_get") (return-type "none") (parameters '("GObject*" "object") '("const-char*" "first_property_name") ) (varargs #t) ) (define-function ipatch_type_object_get_valist (c-name "ipatch_type_object_get_valist") (return-type "none") (parameters '("GObject*" "object") '("const-char*" "first_property_name") '("va_list" "args") ) ) (define-function ipatch_type_object_get_property (c-name "ipatch_type_object_get_property") (return-type "none") (parameters '("GObject*" "object") '("const-char*" "property_name") '("GValue*" "value") ) ) (define-function ipatch_type_set_dynamic_func (c-name "ipatch_type_set_dynamic_func") (return-type "none") (parameters '("GType" "type") '("const-char*" "property_name") '("IpatchTypePropGetFunc" "func") ) ) (define-function ipatch_type_get_dynamic_func (c-name "ipatch_type_get_dynamic_func") (return-type "IpatchTypePropGetFunc") (parameters '("GType" "type") '("const-char*" "property_name") ) ) ;; From IpatchUnit.h (define-function ipatch_unit_info_new (c-name "ipatch_unit_info_new") (is-constructor-of "IpatchUnitInfo") (return-type "IpatchUnitInfo*") ) (define-method free (of-object "IpatchUnitInfo") (c-name "ipatch_unit_info_free") (return-type "none") ) (define-function ipatch_unit_register (c-name "ipatch_unit_register") (return-type "guint16") (parameters '("const-IpatchUnitInfo*" "info") ) ) (define-function ipatch_unit_lookup (c-name "ipatch_unit_lookup") (return-type "IpatchUnitInfo*") (parameters '("guint16" "id") ) ) (define-function ipatch_unit_lookup_by_name (c-name "ipatch_unit_lookup_by_name") (return-type "IpatchUnitInfo*") (parameters '("const-char*" "name") ) ) (define-function ipatch_unit_class_register_map (c-name "ipatch_unit_class_register_map") (return-type "none") (parameters '("guint16" "class_type") '("guint16" "src_units") '("guint16" "dest_units") ) ) (define-function ipatch_unit_class_lookup_map (c-name "ipatch_unit_class_lookup_map") (return-type "IpatchUnitInfo*") (parameters '("guint16" "class_type") '("guint16" "src_units") ) ) (define-function ipatch_unit_conversion_register (c-name "ipatch_unit_conversion_register") (return-type "none") (parameters '("guint16" "src_units") '("guint16" "dest_units") '("IpatchValueTransform" "func") ) ) (define-function ipatch_unit_conversion_lookup (c-name "ipatch_unit_conversion_lookup") (return-type "IpatchValueTransform") (parameters '("guint16" "src_units") '("guint16" "dest_units") '("gboolean*" "set") ) ) (define-function ipatch_unit_convert (c-name "ipatch_unit_convert") (return-type "gboolean") (parameters '("guint16" "src_units") '("guint16" "dest_units") '("const-GValue*" "src_val") '("GValue*" "dest_val") ) ) (define-function ipatch_unit_user_class_convert (c-name "ipatch_unit_user_class_convert") (return-type "double") (parameters '("guint16" "src_units") '("const-GValue*" "src_val") ) ) ;; From IpatchUnit_generic.h (define-function ipatch_unit_hertz_to_cents (c-name "ipatch_unit_hertz_to_cents") (return-type "double") (parameters '("double" "hz") ) ) (define-function ipatch_unit_cents_to_hertz (c-name "ipatch_unit_cents_to_hertz") (return-type "double") (parameters '("double" "cents") ) ) ;; From IpatchUnit_DLS.h (define-function ipatch_unit_dls_class_convert (c-name "ipatch_unit_dls_class_convert") (return-type "int") (parameters '("guint16" "src_units") '("const-GValue*" "src_val") ) ) (define-function ipatch_unit_dls_percent_to_percent (c-name "ipatch_unit_dls_percent_to_percent") (return-type "double") (parameters '("int" "dls_percent") ) ) (define-function ipatch_unit_percent_to_dls_percent (c-name "ipatch_unit_percent_to_dls_percent") (return-type "int") (parameters '("double" "percent") ) ) (define-function ipatch_unit_dls_gain_to_decibels (c-name "ipatch_unit_dls_gain_to_decibels") (return-type "double") (parameters '("int" "dls_gain") ) ) (define-function ipatch_unit_decibels_to_dls_gain (c-name "ipatch_unit_decibels_to_dls_gain") (return-type "int") (parameters '("double" "db") ) ) (define-function ipatch_unit_dls_abs_time_to_seconds (c-name "ipatch_unit_dls_abs_time_to_seconds") (return-type "double") (parameters '("int" "dls_abs_time") ) ) (define-function ipatch_unit_seconds_to_dls_abs_time (c-name "ipatch_unit_seconds_to_dls_abs_time") (return-type "int") (parameters '("double" "seconds") ) ) (define-function ipatch_unit_dls_rel_time_to_time_cents (c-name "ipatch_unit_dls_rel_time_to_time_cents") (return-type "double") (parameters '("int" "dls_rel_time") ) ) (define-function ipatch_unit_time_cents_to_dls_rel_time (c-name "ipatch_unit_time_cents_to_dls_rel_time") (return-type "int") (parameters '("double" "time_cents") ) ) (define-function ipatch_unit_dls_abs_pitch_to_hertz (c-name "ipatch_unit_dls_abs_pitch_to_hertz") (return-type "double") (parameters '("int" "dls_abs_pitch") ) ) (define-function ipatch_unit_hertz_to_dls_abs_pitch (c-name "ipatch_unit_hertz_to_dls_abs_pitch") (return-type "int") (parameters '("double" "hertz") ) ) (define-function ipatch_unit_dls_rel_pitch_to_cents (c-name "ipatch_unit_dls_rel_pitch_to_cents") (return-type "double") (parameters '("int" "dls_rel_pitch") ) ) (define-function ipatch_unit_cents_to_dls_rel_pitch (c-name "ipatch_unit_cents_to_dls_rel_pitch") (return-type "int") (parameters '("double" "cents") ) ) ;; From IpatchUnit_SF2.h (define-function ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch (c-name "ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch") (return-type "int") (parameters '("int" "sf2_abs_pitch") ) ) (define-function ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch (c-name "ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch") (return-type "int") (parameters '("int" "dls_abs_pitch") ) ) (define-function ipatch_unit_sf2_abs_pitch_to_hertz (c-name "ipatch_unit_sf2_abs_pitch_to_hertz") (return-type "double") (parameters '("int" "sf2_abs_pitch") ) ) (define-function ipatch_unit_hertz_to_sf2_abs_pitch (c-name "ipatch_unit_hertz_to_sf2_abs_pitch") (return-type "int") (parameters '("double" "hz") ) ) (define-function ipatch_unit_sf2_ofs_pitch_to_multiplier (c-name "ipatch_unit_sf2_ofs_pitch_to_multiplier") (return-type "double") (parameters '("int" "sf2_ofs_pitch") ) ) (define-function ipatch_unit_multiplier_to_sf2_ofs_pitch (c-name "ipatch_unit_multiplier_to_sf2_ofs_pitch") (return-type "int") (parameters '("double" "multiplier") ) ) (define-function ipatch_unit_sf2_abs_time_to_dls_abs_time (c-name "ipatch_unit_sf2_abs_time_to_dls_abs_time") (return-type "int") (parameters '("int" "sf2_abs_time") ) ) (define-function ipatch_unit_dls_abs_time_to_sf2_abs_time (c-name "ipatch_unit_dls_abs_time_to_sf2_abs_time") (return-type "int") (parameters '("int" "dls_abs_time") ) ) (define-function ipatch_unit_sf2_abs_time_to_seconds (c-name "ipatch_unit_sf2_abs_time_to_seconds") (return-type "double") (parameters '("int" "sf2_abs_time") ) ) (define-function ipatch_unit_seconds_to_sf2_abs_time (c-name "ipatch_unit_seconds_to_sf2_abs_time") (return-type "int") (parameters '("double" "sec") ) ) (define-function ipatch_unit_sf2_ofs_time_to_multiplier (c-name "ipatch_unit_sf2_ofs_time_to_multiplier") (return-type "double") (parameters '("int" "sf2_ofs_time") ) ) (define-function ipatch_unit_multiplier_to_sf2_ofs_time (c-name "ipatch_unit_multiplier_to_sf2_ofs_time") (return-type "int") (parameters '("double" "multiplier") ) ) (define-function ipatch_unit_centibels_to_dls_gain (c-name "ipatch_unit_centibels_to_dls_gain") (return-type "int") (parameters '("int" "centibel") ) ) (define-function ipatch_unit_dls_gain_to_centibels (c-name "ipatch_unit_dls_gain_to_centibels") (return-type "int") (parameters '("int" "dls_gain") ) ) (define-function ipatch_unit_centibels_to_decibels (c-name "ipatch_unit_centibels_to_decibels") (return-type "double") (parameters '("int" "cb") ) ) (define-function ipatch_unit_decibels_to_centibels (c-name "ipatch_unit_decibels_to_centibels") (return-type "int") (parameters '("double" "db") ) ) (define-function ipatch_unit_tenth_percent_to_percent (c-name "ipatch_unit_tenth_percent_to_percent") (return-type "double") (parameters '("int" "tenth_percent") ) ) (define-function ipatch_unit_percent_to_tenth_percent (c-name "ipatch_unit_percent_to_tenth_percent") (return-type "int") (parameters '("double" "percent") ) ) ;; From IpatchVBank.h (define-function ipatch_vbank_get_type (c-name "ipatch_vbank_get_type") (return-type "GType") ) (define-function ipatch_vbank_new (c-name "ipatch_vbank_new") (is-constructor-of "IpatchVbank") (return-type "IpatchVBank*") ) (define-method find_inst (of-object "IpatchVBank") (c-name "ipatch_vbank_find_inst") (return-type "IpatchVBankInst*") (parameters '("const-char*" "name") '("int" "bank") '("int" "program") '("const-IpatchVBankInst*" "exclude") ) ) (define-method make_unique_name (of-object "IpatchVBank") (c-name "ipatch_vbank_make_unique_name") (return-type "char*") (parameters '("const-char*" "name") '("const-IpatchVBankInst*" "exclude") ) ) ;; From IpatchVBankInst.h (define-function ipatch_vbank_inst_get_type (c-name "ipatch_vbank_inst_get_type") (return-type "GType") ) (define-function ipatch_vbank_inst_new (c-name "ipatch_vbank_inst_new") (is-constructor-of "IpatchVbankInst") (return-type "IpatchVBankInst*") ) (define-function ipatch_vbank_inst_first (c-name "ipatch_vbank_inst_first") (return-type "IpatchVBankInst*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_vbank_inst_next (c-name "ipatch_vbank_inst_next") (return-type "IpatchVBankInst*") (parameters '("IpatchIter*" "iter") ) ) (define-method new_region (of-object "IpatchVBankInst") (c-name "ipatch_vbank_inst_new_region") (return-type "none") (parameters '("IpatchItem*" "item") ) ) (define-method set_midi_locale (of-object "IpatchVBankInst") (c-name "ipatch_vbank_inst_set_midi_locale") (return-type "none") (parameters '("int" "bank") '("int" "program") ) ) (define-method get_midi_locale (of-object "IpatchVBankInst") (c-name "ipatch_vbank_inst_get_midi_locale") (return-type "none") (parameters '("int*" "bank") '("int*" "program") ) ) (define-method compare (of-object "IpatchVBankInst") (c-name "ipatch_vbank_inst_compare") (return-type "int") (parameters '("const-IpatchVBankInst*" "p2") ) ) ;; From IpatchVBankRegion.h (define-function ipatch_vbank_region_get_type (c-name "ipatch_vbank_region_get_type") (return-type "GType") ) (define-function ipatch_vbank_region_new (c-name "ipatch_vbank_region_new") (is-constructor-of "IpatchVbankRegion") (return-type "IpatchVBankRegion*") ) (define-function ipatch_vbank_region_first (c-name "ipatch_vbank_region_first") (return-type "IpatchVBankRegion*") (parameters '("IpatchIter*" "iter") ) ) (define-function ipatch_vbank_region_next (c-name "ipatch_vbank_region_next") (return-type "IpatchVBankRegion*") (parameters '("IpatchIter*" "iter") ) ) (define-method set_id_props (of-object "IpatchVBankRegion") (c-name "ipatch_vbank_region_set_id_props") (return-type "none") (parameters '("char**" "id_props") ) ) (define-method get_id_props (of-object "IpatchVBankRegion") (c-name "ipatch_vbank_region_get_id_props") (return-type "char**") (parameters '("guint*" "n_elements") ) ) ;; From IpatchVirtualContainer.h (define-function ipatch_virtual_container_get_type (c-name "ipatch_virtual_container_get_type") (return-type "GType") ) ;; From IpatchVirtualContainer_types.h (define-function ipatch_virtual_dls2_melodic_get_type (c-name "ipatch_virtual_dls2_melodic_get_type") (return-type "GType") ) (define-function ipatch_virtual_dls2_percussion_get_type (c-name "ipatch_virtual_dls2_percussion_get_type") (return-type "GType") ) (define-function ipatch_virtual_dls2_samples_get_type (c-name "ipatch_virtual_dls2_samples_get_type") (return-type "GType") ) (define-function ipatch_virtual_gig_melodic_get_type (c-name "ipatch_virtual_gig_melodic_get_type") (return-type "GType") ) (define-function ipatch_virtual_gig_percussion_get_type (c-name "ipatch_virtual_gig_percussion_get_type") (return-type "GType") ) (define-function ipatch_virtual_gig_samples_get_type (c-name "ipatch_virtual_gig_samples_get_type") (return-type "GType") ) (define-function ipatch_virtual_sf2_inst_get_type (c-name "ipatch_virtual_sf2_inst_get_type") (return-type "GType") ) (define-function ipatch_virtual_sf2_melodic_get_type (c-name "ipatch_virtual_sf2_melodic_get_type") (return-type "GType") ) (define-function ipatch_virtual_sf2_percussion_get_type (c-name "ipatch_virtual_sf2_percussion_get_type") (return-type "GType") ) (define-function ipatch_virtual_sf2_samples_get_type (c-name "ipatch_virtual_sf2_samples_get_type") (return-type "GType") ) (define-function ipatch_virtual_sf2_rom_get_type (c-name "ipatch_virtual_sf2_rom_get_type") (return-type "GType") ) ;; From IpatchXml.h (define-function ipatch_xml_new_node (c-name "ipatch_xml_new_node") (return-type "GNode*") (parameters '("GNode*" "parent") '("const-char*" "name") '("const-char*" "value") '("const-char*" "attr_name") ) (varargs #t) ) (define-function ipatch_xml_new_node_strv (c-name "ipatch_xml_new_node_strv") (return-type "GNode*") (parameters '("GNode*" "parent") '("const-char*" "name") '("const-char*" "value") '("const-char**" "attr_names") '("const-char**" "attr_values") ) ) (define-function ipatch_xml_get_data (c-name "ipatch_xml_get_data") (return-type "gpointer") (parameters '("GNode*" "node") '("const-char*" "key") ) ) (define-function ipatch_xml_set_data (c-name "ipatch_xml_set_data") (return-type "none") (parameters '("GNode*" "node") '("const-char*" "key") '("gpointer" "data") ) ) (define-function ipatch_xml_set_data_full (c-name "ipatch_xml_set_data_full") (return-type "none") (parameters '("GNode*" "node") '("const-char*" "key") '("gpointer" "data") '("GDestroyNotify" "destroy_func") ) ) (define-function ipatch_xml_steal_data (c-name "ipatch_xml_steal_data") (return-type "gpointer") (parameters '("GNode*" "node") '("const-char*" "key") ) ) (define-function ipatch_xml_get_qdata (c-name "ipatch_xml_get_qdata") (return-type "gpointer") (parameters '("GNode*" "node") '("GQuark" "quark") ) ) (define-function ipatch_xml_set_qdata (c-name "ipatch_xml_set_qdata") (return-type "none") (parameters '("GNode*" "node") '("GQuark" "quark") '("gpointer" "data") ) ) (define-function ipatch_xml_set_qdata_full (c-name "ipatch_xml_set_qdata_full") (return-type "none") (parameters '("GNode*" "node") '("GQuark" "quark") '("gpointer" "data") '("GDestroyNotify" "destroy_func") ) ) (define-function ipatch_xml_steal_qdata (c-name "ipatch_xml_steal_qdata") (return-type "gpointer") (parameters '("GNode*" "node") '("GQuark" "quark") ) ) (define-function ipatch_xml_destroy (c-name "ipatch_xml_destroy") (return-type "none") (parameters '("GNode*" "node") ) ) (define-function ipatch_xml_copy (c-name "ipatch_xml_copy") (return-type "GNode*") (parameters '("GNode*" "node") ) ) (define-function ipatch_xml_set_name (c-name "ipatch_xml_set_name") (return-type "none") (parameters '("GNode*" "node") '("const-char*" "name") ) ) (define-function ipatch_xml_set_value (c-name "ipatch_xml_set_value") (return-type "none") (parameters '("GNode*" "node") '("const-char*" "value") ) ) (define-function ipatch_xml_set_value_printf (c-name "ipatch_xml_set_value_printf") (return-type "none") (parameters '("GNode*" "node") '("const-char*" "format") ) (varargs #t) ) (define-function ipatch_xml_take_name (c-name "ipatch_xml_take_name") (return-type "none") (parameters '("GNode*" "node") '("char*" "name") ) ) (define-function ipatch_xml_take_value (c-name "ipatch_xml_take_value") (return-type "none") (parameters '("GNode*" "node") '("char*" "value") ) ) (define-function ipatch_xml_get_name (c-name "ipatch_xml_get_name") (return-type "const-char*") (parameters '("GNode*" "node") ) ) (define-function ipatch_xml_test_name (c-name "ipatch_xml_test_name") (return-type "gboolean") (parameters '("GNode*" "node") '("const-char*" "cmpname") ) ) (define-function ipatch_xml_get_value (c-name "ipatch_xml_get_value") (return-type "const-char*") (parameters '("GNode*" "node") ) ) (define-function ipatch_xml_dup_value (c-name "ipatch_xml_dup_value") (return-type "char*") (parameters '("GNode*" "node") ) ) (define-function ipatch_xml_test_value (c-name "ipatch_xml_test_value") (return-type "gboolean") (parameters '("GNode*" "node") '("const-char*" "cmpvalue") ) ) (define-function ipatch_xml_set_attribute (c-name "ipatch_xml_set_attribute") (return-type "none") (parameters '("GNode*" "node") '("const-char*" "attr_name") '("const-char*" "attr_value") ) ) (define-function ipatch_xml_set_attributes (c-name "ipatch_xml_set_attributes") (return-type "none") (parameters '("GNode*" "node") '("const-char*" "attr_name") '("const-char*" "attr_value") '("const-char*" "attr2_name") ) (varargs #t) ) (define-function ipatch_xml_get_attribute (c-name "ipatch_xml_get_attribute") (return-type "const-char*") (parameters '("GNode*" "node") '("const-char*" "name") ) ) (define-function ipatch_xml_test_attribute (c-name "ipatch_xml_test_attribute") (return-type "gboolean") (parameters '("GNode*" "node") '("const-char*" "attr_name") '("const-char*" "cmpval") ) ) (define-function ipatch_xml_find_child (c-name "ipatch_xml_find_child") (return-type "GNode*") (parameters '("GNode*" "node") '("const-char*" "name") ) ) (define-function ipatch_xml_find_by_path (c-name "ipatch_xml_find_by_path") (return-type "GNode*") (parameters '("GNode*" "node") '("const-char*" "path") ) ) (define-function ipatch_xml_to_str (c-name "ipatch_xml_to_str") (return-type "char*") (parameters '("GNode*" "node") '("guint" "indent") ) ) (define-function ipatch_xml_save_to_file (c-name "ipatch_xml_save_to_file") (return-type "gboolean") (parameters '("GNode*" "node") '("guint" "indent") '("const-char*" "filename") '("GError**" "err") ) ) (define-function ipatch_xml_from_str (c-name "ipatch_xml_from_str") (return-type "GNode*") (parameters '("const-char*" "str") '("GError**" "err") ) ) (define-function ipatch_xml_load_from_file (c-name "ipatch_xml_load_from_file") (return-type "GNode*") (parameters '("const-char*" "filename") '("GError**" "err") ) ) (define-function ipatch_xml_node_new (c-name "ipatch_xml_node_new") (is-constructor-of "IpatchXmlNode") (return-type "IpatchXmlNode*") ) (define-method free (of-object "IpatchXmlNode") (c-name "ipatch_xml_node_free") (return-type "none") ) (define-method duplicate (of-object "IpatchXmlNode") (c-name "ipatch_xml_node_duplicate") (return-type "IpatchXmlNode*") ) (define-function ipatch_xml_attr_new (c-name "ipatch_xml_attr_new") (is-constructor-of "IpatchXmlAttr") (return-type "IpatchXmlAttr*") ) (define-method free (of-object "IpatchXmlAttr") (c-name "ipatch_xml_attr_free") (return-type "none") ) (define-method duplicate (of-object "IpatchXmlAttr") (c-name "ipatch_xml_attr_duplicate") (return-type "IpatchXmlAttr*") ) ;; From IpatchXmlObject.h (define-function ipatch_xml_register_handler (c-name "ipatch_xml_register_handler") (return-type "none") (parameters '("GType" "type") '("const-char*" "prop_name") '("IpatchXmlEncodeFunc" "encode_func") '("IpatchXmlDecodeFunc" "decode_func") ) ) (define-function ipatch_xml_lookup_handler (c-name "ipatch_xml_lookup_handler") (return-type "gboolean") (parameters '("GType" "type") '("GParamSpec*" "pspec") '("IpatchXmlEncodeFunc*" "encode_func") '("IpatchXmlDecodeFunc*" "decode_func") ) ) (define-function ipatch_xml_lookup_handler_by_prop_name (c-name "ipatch_xml_lookup_handler_by_prop_name") (return-type "gboolean") (parameters '("GType" "type") '("const-char*" "prop_name") '("IpatchXmlEncodeFunc*" "encode_func") '("IpatchXmlDecodeFunc*" "decode_func") ) ) (define-function ipatch_xml_encode_object (c-name "ipatch_xml_encode_object") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("gboolean" "create_element") '("GError**" "err") ) ) (define-function ipatch_xml_encode_property (c-name "ipatch_xml_encode_property") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("GParamSpec*" "pspec") '("gboolean" "create_element") '("GError**" "err") ) ) (define-function ipatch_xml_encode_property_by_name (c-name "ipatch_xml_encode_property_by_name") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("const-char*" "propname") '("gboolean" "create_element") '("GError**" "err") ) ) (define-function ipatch_xml_encode_value (c-name "ipatch_xml_encode_value") (return-type "gboolean") (parameters '("GNode*" "node") '("GValue*" "value") '("GError**" "err") ) ) (define-function ipatch_xml_decode_object (c-name "ipatch_xml_decode_object") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("GError**" "err") ) ) (define-function ipatch_xml_decode_property (c-name "ipatch_xml_decode_property") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("GParamSpec*" "pspec") '("GError**" "err") ) ) (define-function ipatch_xml_decode_property_by_name (c-name "ipatch_xml_decode_property_by_name") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("const-char*" "propname") '("GError**" "err") ) ) (define-function ipatch_xml_decode_value (c-name "ipatch_xml_decode_value") (return-type "gboolean") (parameters '("GNode*" "node") '("GValue*" "value") '("GError**" "err") ) ) (define-function ipatch_xml_default_encode_object_func (c-name "ipatch_xml_default_encode_object_func") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("GParamSpec*" "pspec") '("GValue*" "value") '("GError**" "err") ) ) (define-function ipatch_xml_default_encode_property_func (c-name "ipatch_xml_default_encode_property_func") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("GParamSpec*" "pspec") '("GValue*" "value") '("GError**" "err") ) ) (define-function ipatch_xml_default_encode_value_func (c-name "ipatch_xml_default_encode_value_func") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("GParamSpec*" "pspec") '("GValue*" "value") '("GError**" "err") ) ) (define-function ipatch_xml_default_decode_object_func (c-name "ipatch_xml_default_decode_object_func") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("GParamSpec*" "pspec") '("GValue*" "value") '("GError**" "err") ) ) (define-function ipatch_xml_default_decode_property_func (c-name "ipatch_xml_default_decode_property_func") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("GParamSpec*" "pspec") '("GValue*" "value") '("GError**" "err") ) ) (define-function ipatch_xml_default_decode_value_func (c-name "ipatch_xml_default_decode_value_func") (return-type "gboolean") (parameters '("GNode*" "node") '("GObject*" "object") '("GParamSpec*" "pspec") '("GValue*" "value") '("GError**" "err") ) ) ;; From misc.h (define-function ipatch_init (c-name "ipatch_init") (return-type "none") ) (define-function ipatch_set_application_name (c-name "ipatch_set_application_name") (return-type "none") (parameters '("const-char*" "name") ) ) (define-function ipatch_error_quark (c-name "ipatch_error_quark") (return-type "GQuark") ) (define-function ipatch_gerror_message (c-name "ipatch_gerror_message") (return-type "const-char*") (parameters '("GError*" "err") ) ) (define-function ipatch_strconcat_num (c-name "ipatch_strconcat_num") (return-type "none") (parameters '("const-char*" "src") '("int" "num") '("char*" "dest") '("int" "size") ) ) (define-function ipatch_dump_object (c-name "ipatch_dump_object") (return-type "none") (parameters '("GObject*" "object") '("gboolean" "recursive") '("FILE*" "file") ) ) ;; From sample.h (define-function ipatch_sample_format_bit_width (c-name "ipatch_sample_format_bit_width") (return-type "int") (parameters '("int" "format") ) ) (define-function ipatch_sample_format_verify (c-name "ipatch_sample_format_verify") (return-type "gboolean") (parameters '("int" "format") ) ) (define-function ipatch_sample_format_transform_verify (c-name "ipatch_sample_format_transform_verify") (return-type "gboolean") (parameters '("int" "src_format") '("int" "dest_format") '("guint32" "channel_map") ) ) (define-function ipatch_sample_get_transform_funcs (c-name "ipatch_sample_get_transform_funcs") (return-type "guint") (parameters '("int" "src_format") '("int" "dest_format") '("guint32" "channel_map") '("guint*" "buf1_max_frame") '("guint*" "buf2_max_frame") '("IpatchSampleTransformFunc*" "funcs") ) ) ;; From version.h (define-function ipatch_version (c-name "ipatch_version") (return-type "none") (parameters '("guint*" "major") '("guint*" "minor") '("guint*" "micro") ) ) libinstpatch-1.0.0/libinstpatch/0000777000175000017500000000000011461404253013665 500000000000000libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreSwap.c0000644000175000017500000001221111461332142020161 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSampleStoreSwap.h" #include "ipatch_priv.h" #include "i18n.h" /* Indicates if swap file sample location has been set yet */ #define LOCATION_SET (1 << IPATCH_SAMPLE_STORE_FILE_UNUSED_FLAG_SHIFT) static void ipatch_sample_store_swap_sample_iface_init (IpatchSampleIface *iface); static gboolean ipatch_sample_store_swap_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_sample_store_swap_finalize (GObject *gobject); G_LOCK_DEFINE_STATIC (swap); static int swap_fd = -1; static char *swap_file_name = NULL; static guint swap_position = 0; /* Current position in swap file, for new sample data */ static volatile gint swap_unused_size = 0; /* Amount of wasted space (unused samples) */ G_DEFINE_TYPE_WITH_CODE (IpatchSampleStoreSwap, ipatch_sample_store_swap, IPATCH_TYPE_SAMPLE_STORE_FILE, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sample_store_swap_sample_iface_init)) static void ipatch_sample_store_swap_sample_iface_init (IpatchSampleIface *iface) { iface->open = ipatch_sample_store_swap_sample_iface_open; } static void ipatch_sample_store_swap_class_init (IpatchSampleStoreSwapClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); obj_class->finalize = ipatch_sample_store_swap_finalize; } static gboolean ipatch_sample_store_swap_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchSampleStoreSwap *store = IPATCH_SAMPLE_STORE_SWAP (handle->sample); GError *local_err = NULL; guint sample_size; int location = -1; guint flags; ipatch_sample_get_size (IPATCH_SAMPLE (store), &sample_size); flags = ipatch_item_get_flags (IPATCH_ITEM (store)); G_LOCK (swap); if (swap_fd == -1) /* Swap file not yet created? */ { swap_fd = g_file_open_tmp ("libInstPatch_XXXXXX", &swap_file_name, &local_err); if (swap_fd == -1) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("Failed to create sample store swap file: %s"), ipatch_gerror_message (local_err)); g_clear_error (&local_err); G_UNLOCK (swap); return (FALSE); } } if (!(flags & LOCATION_SET)) { location = swap_position; swap_position += sample_size; } G_UNLOCK (swap); /* Set location if it has not yet been set. * No lock required, since data should be written before use in MT environment. */ if (location != -1) { g_object_set (store, "location", location, NULL); ipatch_item_set_flags (IPATCH_ITEM (store), LOCATION_SET); } handle->data1 = fopen (swap_file_name, handle->read_mode ? "rb" : "wb"); if (!handle->data1) { if (handle->read_mode) g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("Error opening file '%s' for reading: %s"), swap_file_name, g_strerror (errno)); else g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("Error opening file '%s' for writing: %s"), swap_file_name, g_strerror (errno)); return (FALSE); } return (TRUE); } static void ipatch_sample_store_swap_init (IpatchSampleStoreSwap *store) { } /* finalization for a swap sample store, keeps track of unused data size */ static void ipatch_sample_store_swap_finalize (GObject *gobject) { guint size; ipatch_sample_get_size (IPATCH_SAMPLE (gobject), &size); g_atomic_int_add (&swap_unused_size, size); if (G_OBJECT_CLASS (ipatch_sample_store_swap_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sample_store_swap_parent_class)->finalize (gobject); } /** * ipatch_sample_store_swap_new: * * Creates a new disk swap sample store. * * Returns: New disk swap sample store, cast as an #IpatchSample for convenience. */ IpatchSample * ipatch_sample_store_swap_new (void) { return (IPATCH_SAMPLE (g_object_new (IPATCH_TYPE_SAMPLE_STORE_SWAP, NULL))); } /** * ipatch_sample_store_swap_get_unused_size: * * Get amount of unused space in the swap file. * * Returns: Amount of unused data in bytes */ int ipatch_sample_store_swap_get_unused_size (void) { return (g_atomic_int_get (&swap_unused_size)); } libinstpatch-1.0.0/libinstpatch/IpatchVirtualContainer.c0000644000175000017500000000265311461332142020372 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchVirtualContainer.h" #include "IpatchTypeProp.h" GType ipatch_virtual_container_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchVirtualContainerClass), NULL, NULL, (GClassInitFunc) NULL, NULL, NULL, sizeof (IpatchVirtualContainer), 0, (GInstanceInitFunc) NULL, }; item_type = g_type_register_static (IPATCH_TYPE_ITEM, "IpatchVirtualContainer", &item_info, G_TYPE_FLAG_ABSTRACT); } return (item_type); } libinstpatch-1.0.0/libinstpatch/sample.h0000644000175000017500000002371411461357124015246 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: sample * @short_description: Audio sample format conversion functions and defines. * @see_also: * @stability: Stable * * This module provides functions for converting audio formats as well as a system * for defining audio formats with a single integer composed of multiple fields * for sample width, channel count, sign and endian byte order. */ #ifndef __SAMPLE_H__ #define __SAMPLE_H__ #include /** * IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS: * * Maximum number of transform functions returned by * ipatch_sample_get_transform_funcs(). Is larger than current actual maximum * to allow for future backwards compatible expansion (8 is the real current * maximum). */ #define IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS 16 #include /** * IPATCH_SAMPLE_FORMAT_MASK: * * Mask for all fields of sample format integers (width, sign, endian, channel). */ #define IPATCH_SAMPLE_FORMAT_MASK 0x1FF /** * IPATCH_SAMPLE_FORMAT_BITCOUNT: * * Number of bits used for sample format integers. */ #define IPATCH_SAMPLE_FORMAT_BITCOUNT 9 #define IPATCH_SAMPLE_WIDTH_MASK 0x00F /* total of 16 formats (8 reserved) */ #define IPATCH_SAMPLE_CHANNEL_MASK 0x070 /* channel count (8 channels max) */ #define IPATCH_SAMPLE_SIGN_MASK 0x080 /* sign or unsigned (for PCM formats) */ #define IPATCH_SAMPLE_ENDIAN_MASK 0x100 /* endian byte order */ #define IPATCH_SAMPLE_WIDTH_SHIFT 0 #define IPATCH_SAMPLE_CHANNEL_SHIFT 4 #define IPATCH_SAMPLE_SIGN_SHIFT 7 #define IPATCH_SAMPLE_ENDIAN_SHIFT 8 /** * IpatchSampleWidth: * @IPATCH_SAMPLE_INVALID: Invalid format (so 0 can be used to indicate a NULL state) * @IPATCH_SAMPLE_8BIT: 8 bit integer PCM * @IPATCH_SAMPLE_16BIT: 16 bit integer PCM * @IPATCH_SAMPLE_24BIT: 24 bit integer PCM (32 bit ints) * @IPATCH_SAMPLE_32BIT: 32 bit integer PCM * @IPATCH_SAMPLE_FLOAT: 32 bit IEEE float (-1.0 - 1.0) * @IPATCH_SAMPLE_DOUBLE: 64 bit IEEE double (-1.0 - 1.0) * @IPATCH_SAMPLE_REAL24BIT: Real 3 byte 24 bit data (not padded to 32 bits) * * Sample data widths/formats. */ typedef enum { IPATCH_SAMPLE_INVALID = 0, IPATCH_SAMPLE_8BIT = 1, IPATCH_SAMPLE_16BIT = 2, IPATCH_SAMPLE_24BIT = 3, IPATCH_SAMPLE_32BIT = 4, IPATCH_SAMPLE_FLOAT = 5, IPATCH_SAMPLE_DOUBLE = 6, IPATCH_SAMPLE_REAL24BIT = 7 } IpatchSampleWidth; /** * IpatchSampleChannel: * @IPATCH_SAMPLE_MONO: Mono audio * @IPATCH_SAMPLE_STEREO: Stereo audio * * Descriptive enums for common audio channel configurations. These values * are actually channel count - 1 (0 = mono, 1 = stereo, etc) and can be compared * with the macro IPATCH_SAMPLE_FORMAT_GET_CHANNELS(). */ typedef enum { IPATCH_SAMPLE_MONO = 0 << IPATCH_SAMPLE_CHANNEL_SHIFT, IPATCH_SAMPLE_STEREO = 1 << IPATCH_SAMPLE_CHANNEL_SHIFT } IpatchSampleChannel; /** * IpatchSampleChannelType: * @IPATCH_SAMPLE_LEFT: Left channel comes first * @IPATCH_SAMPLE_RIGHT: Right channel comes second * * Channel designation. Currently there are only 2 designated channels, * though the remaining 6 supported channels may be defined to be surround * sound channels in the future. */ typedef enum { IPATCH_SAMPLE_LEFT = 0, IPATCH_SAMPLE_RIGHT = 1 } IpatchSampleChannelType; /** * IPATCH_SAMPLE_MAX_CHANNELS: * * Maximum number of audio channels handled by libInstPatch. */ #define IPATCH_SAMPLE_MAX_CHANNELS 8 /** * IpatchSampleSign: * @IPATCH_SAMPLE_SIGNED: Signed PCM audio data. * @IPATCH_SAMPLE_UNSIGNED: Unsigned PCM audio data. * * Defines the sign of PCM integer audio data. */ typedef enum { IPATCH_SAMPLE_SIGNED = 0 << IPATCH_SAMPLE_SIGN_SHIFT, IPATCH_SAMPLE_UNSIGNED = 1 << IPATCH_SAMPLE_SIGN_SHIFT } IpatchSampleSign; /** * IpatchSampleEndian: * @IPATCH_SAMPLE_LENDIAN: Little endian byte order * @IPATCH_SAMPLE_BENDIAN: Big endian byte order * * Defines the byte order of multi-byte audio data. */ typedef enum { IPATCH_SAMPLE_LENDIAN = 0 << IPATCH_SAMPLE_ENDIAN_SHIFT, IPATCH_SAMPLE_BENDIAN = 1 << IPATCH_SAMPLE_ENDIAN_SHIFT } IpatchSampleEndian; /** * IPATCH_SAMPLE_ENDIAN_HOST: * * Host byte order value (#IPATCH_SAMPLE_LENDIAN or #IPATCH_SAMPLE_BENDIAN). */ #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define IPATCH_SAMPLE_ENDIAN_HOST IPATCH_SAMPLE_LENDIAN #else #define IPATCH_SAMPLE_ENDIAN_HOST IPATCH_SAMPLE_BENDIAN #endif /** * IPATCH_SAMPLE_FORMAT_GET_WIDTH: * @format: Sample format integer * * Get #IpatchSampleWidth enum from a sample format integer. * * Returns: Format field of sample format integer. */ #define IPATCH_SAMPLE_FORMAT_GET_WIDTH(format) \ ((format) & IPATCH_SAMPLE_WIDTH_MASK) /** * IPATCH_SAMPLE_FORMAT_IS_FLOATING: * @format: Sample format integer * * Check if a sample format integer defines floating point audio. * * Returns: %TRUE if sample format is #IPATCH_SAMPLE_FLOAT or #IPATCH_SAMPLE_DOUBLE. */ #define IPATCH_SAMPLE_FORMAT_IS_FLOATING(format) \ (((format) & IPATCH_SAMPLE_WIDTH_MASK) == IPATCH_SAMPLE_FLOAT \ || ((format) & IPATCH_SAMPLE_WIDTH_MASK) == IPATCH_SAMPLE_DOUBLE) /** * IPATCH_SAMPLE_FORMAT_GET_CHANNELS: * @format: Sample format integer * * Get the channel field from a sample format integer. * * Returns: Channel field value (see #IpatchSampleChannel) */ #define IPATCH_SAMPLE_FORMAT_GET_CHANNELS(format) \ ((format) & IPATCH_SAMPLE_CHANNEL_MASK) /** * IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT: * @format: Sample format integer * * Get the channel count from a sample format integer. * * Returns: Channel count (starting at 1 for mono). */ #define IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT(format) \ ((((format) & IPATCH_SAMPLE_CHANNEL_MASK) >> IPATCH_SAMPLE_CHANNEL_SHIFT) + 1) /** * IPATCH_SAMPLE_FORMAT_IS_SIGNED: * @format: Sample format integer * * Check if a sample format integer defines signed audio. * * Returns: %TRUE if sample format is signed. */ #define IPATCH_SAMPLE_FORMAT_IS_SIGNED(format) \ (((format) & IPATCH_SAMPLE_UNSIGNED) == 0) /** * IPATCH_SAMPLE_FORMAT_IS_UNSIGNED: * @format: Sample format integer * * Check if a sample format integer defines unsigned audio. * * Returns: %TRUE if sample format is unsigned. */ #define IPATCH_SAMPLE_FORMAT_IS_UNSIGNED(format) \ (((format) & IPATCH_SAMPLE_UNSIGNED) != 0) /** * IPATCH_SAMPLE_FORMAT_IS_LENDIAN: * @format: Sample format integer * * Check if a sample format integer defines little endian audio. * * Returns: %TRUE if sample format is little endian. */ #define IPATCH_SAMPLE_FORMAT_IS_LENDIAN(format) \ (((format) & IPATCH_SAMPLE_BENDIAN) == 0) /** * IPATCH_SAMPLE_FORMAT_IS_BENDIAN: * @format: Sample format integer * * Check if a sample format integer defines big endian audio. * * Returns: %TRUE if sample format is big endian. */ #define IPATCH_SAMPLE_FORMAT_IS_BENDIAN(format) \ (((format) & IPATCH_SAMPLE_BENDIAN) != 0) /** * ipatch_sample_format_size: * @format: Sample format integer * * Get frame byte size for a given sample format (sample byte size * channels). * * Returns: Size in bytes of a single sample frame. */ #define ipatch_sample_format_size(format) \ (ipatch_sample_width_sizes[(format) & IPATCH_SAMPLE_WIDTH_MASK] \ * IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format)) /** * ipatch_sample_format_width: * @format: Sample format * * Gets the number of bytes used for storing a single sample for @format. * Doesn't take into account channels. This is the number of bytes used * to store the samples, not the effective bit width. For example: * #IPATCH_SAMPLE_24BIT uses 4 bytes for each sample. * * Returns: Byte width of a single sample (not including channels). */ #define ipatch_sample_format_width(format) \ (ipatch_sample_width_sizes[(format) & IPATCH_SAMPLE_WIDTH_MASK]) /** * IPATCH_SAMPLE_MAP_CHANNEL: * @dest: Destination channel in mapping bit field (0-7) * @src: Source channel (0-7) * * Macro to calculate a channel mapping value for a given destination and * source. A channel mapping is composed of up to 24 bits * (3 bits * 8 channels = 24). Channel mappings are used for sample * conversions to route channels from a source format to a destination format. * Multiple channel map values should be OR'd together. */ #define IPATCH_SAMPLE_MAP_CHANNEL(dest, src) ((src) << (3 * (dest))) /** * IPATCH_SAMPLE_MAP_GET_CHANNEL: * @map: Channel map value (#guint32 - only 24 bits are used) * @dest: Destination channel in @map bit field (0-7) * * Macro to get a source channel value given a destination channel. * * Returns: Source channel for @dest (0-7) */ #define IPATCH_SAMPLE_MAP_GET_CHANNEL(map, dest) (((map) >> ((dest) * 3)) & 0x07) /** * IPATCH_SAMPLE_UNITY_CHANNEL_MAP: * * Unity channel mapping which routes each input channel to the same output * channel. */ #define IPATCH_SAMPLE_UNITY_CHANNEL_MAP 0xFAC688 extern guint ipatch_sample_width_sizes[16]; int ipatch_sample_format_bit_width (int format); gboolean ipatch_sample_format_verify (int format); gboolean ipatch_sample_format_transform_verify (int src_format, int dest_format, guint32 channel_map); guint ipatch_sample_get_transform_funcs (int src_format, int dest_format, guint32 channel_map, guint *buf1_max_frame, guint *buf2_max_frame, IpatchSampleTransformFunc *funcs); #endif libinstpatch-1.0.0/libinstpatch/builtin_enums.h0000644000175000017500000002226611456656123016650 00000000000000 /* Generated data (by glib-mkenums) */ #ifndef __IPATCH_BUILTIN_ENUMS_H__ #define __IPATCH_BUILTIN_ENUMS_H__ #include G_BEGIN_DECLS /* enumerations from "IpatchBase.h" */ GType ipatch_base_flags_get_type (void); #define IPATCH_TYPE_BASE_FLAGS (ipatch_base_flags_get_type()) /* enumerations from "IpatchConverter.h" */ GType ipatch_converter_log_type_get_type (void); #define IPATCH_TYPE_CONVERTER_LOG_TYPE (ipatch_converter_log_type_get_type()) GType ipatch_converter_count_get_type (void); #define IPATCH_TYPE_CONVERTER_COUNT (ipatch_converter_count_get_type()) GType ipatch_converter_flags_get_type (void); #define IPATCH_TYPE_CONVERTER_FLAGS (ipatch_converter_flags_get_type()) GType ipatch_converter_priority_get_type (void); #define IPATCH_TYPE_CONVERTER_PRIORITY (ipatch_converter_priority_get_type()) /* enumerations from "IpatchDLS2Conn.h" */ GType ipatch_dls2_conn_src_type_get_type (void); #define IPATCH_TYPE_DLS2_CONN_SRC_TYPE (ipatch_dls2_conn_src_type_get_type()) GType ipatch_dls2_conn_dest_type_get_type (void); #define IPATCH_TYPE_DLS2_CONN_DEST_TYPE (ipatch_dls2_conn_dest_type_get_type()) GType ipatch_dls2_conn_transform_type_get_type (void); #define IPATCH_TYPE_DLS2_CONN_TRANSFORM_TYPE (ipatch_dls2_conn_transform_type_get_type()) GType ipatch_dls2_conn_polarity_type_get_type (void); #define IPATCH_TYPE_DLS2_CONN_POLARITY_TYPE (ipatch_dls2_conn_polarity_type_get_type()) GType ipatch_dls2_conn_transform_masks_get_type (void); #define IPATCH_TYPE_DLS2_CONN_TRANSFORM_MASKS (ipatch_dls2_conn_transform_masks_get_type()) GType ipatch_dls2_conn_transform_shifts_get_type (void); #define IPATCH_TYPE_DLS2_CONN_TRANSFORM_SHIFTS (ipatch_dls2_conn_transform_shifts_get_type()) /* enumerations from "IpatchDLS2.h" */ GType ipatch_dls2_flags_get_type (void); #define IPATCH_TYPE_DLS2_FLAGS (ipatch_dls2_flags_get_type()) /* enumerations from "IpatchDLS2Info.h" */ GType ipatch_dls2_info_type_get_type (void); #define IPATCH_TYPE_DLS2_INFO_TYPE (ipatch_dls2_info_type_get_type()) /* enumerations from "IpatchDLS2Inst.h" */ GType ipatch_dls2_inst_flags_get_type (void); #define IPATCH_TYPE_DLS2_INST_FLAGS (ipatch_dls2_inst_flags_get_type()) /* enumerations from "IpatchDLS2Region.h" */ GType ipatch_dls2_param_get_type (void); #define IPATCH_TYPE_DLS2_PARAM (ipatch_dls2_param_get_type()) GType ipatch_dls2_region_channel_type_get_type (void); #define IPATCH_TYPE_DLS2_REGION_CHANNEL_TYPE (ipatch_dls2_region_channel_type_get_type()) GType ipatch_dls2_region_flags_get_type (void); #define IPATCH_TYPE_DLS2_REGION_FLAGS (ipatch_dls2_region_flags_get_type()) /* enumerations from "IpatchDLS2Sample.h" */ GType ipatch_dls2_sample_flags_get_type (void); #define IPATCH_TYPE_DLS2_SAMPLE_FLAGS (ipatch_dls2_sample_flags_get_type()) /* enumerations from "IpatchDLSReader.h" */ GType ipatch_dls_reader_error_get_type (void); #define IPATCH_TYPE_DLS_READER_ERROR (ipatch_dls_reader_error_get_type()) /* enumerations from "IpatchFile.h" */ GType ipatch_file_flags_get_type (void); #define IPATCH_TYPE_FILE_FLAGS (ipatch_file_flags_get_type()) GType ipatch_file_identify_order_get_type (void); #define IPATCH_TYPE_FILE_IDENTIFY_ORDER (ipatch_file_identify_order_get_type()) /* enumerations from "IpatchGigDimension.h" */ GType ipatch_gig_dimension_type_get_type (void); #define IPATCH_TYPE_GIG_DIMENSION_TYPE (ipatch_gig_dimension_type_get_type()) /* enumerations from "IpatchGigEffects.h" */ GType ipatch_gig_filter_type_get_type (void); #define IPATCH_TYPE_GIG_FILTER_TYPE (ipatch_gig_filter_type_get_type()) GType ipatch_gig_control_type_get_type (void); #define IPATCH_TYPE_GIG_CONTROL_TYPE (ipatch_gig_control_type_get_type()) /* enumerations from "IpatchGigRegion.h" */ GType ipatch_gig_region_flags_get_type (void); #define IPATCH_TYPE_GIG_REGION_FLAGS (ipatch_gig_region_flags_get_type()) /* enumerations from "IpatchGigSubRegion.h" */ GType ipatch_gig_sub_region_flags_get_type (void); #define IPATCH_TYPE_GIG_SUB_REGION_FLAGS (ipatch_gig_sub_region_flags_get_type()) /* enumerations from "IpatchItem.h" */ GType ipatch_item_flags_get_type (void); #define IPATCH_TYPE_ITEM_FLAGS (ipatch_item_flags_get_type()) /* enumerations from "IpatchPaste.h" */ GType ipatch_paste_choice_get_type (void); #define IPATCH_TYPE_PASTE_CHOICE (ipatch_paste_choice_get_type()) GType ipatch_paste_priority_get_type (void); #define IPATCH_TYPE_PASTE_PRIORITY (ipatch_paste_priority_get_type()) /* enumerations from "IpatchRiff.h" */ GType ipatch_riff_status_get_type (void); #define IPATCH_TYPE_RIFF_STATUS (ipatch_riff_status_get_type()) GType ipatch_riff_mode_get_type (void); #define IPATCH_TYPE_RIFF_MODE (ipatch_riff_mode_get_type()) GType ipatch_riff_chunk_type_get_type (void); #define IPATCH_TYPE_RIFF_CHUNK_TYPE (ipatch_riff_chunk_type_get_type()) GType ipatch_riff_error_get_type (void); #define IPATCH_TYPE_RIFF_ERROR (ipatch_riff_error_get_type()) /* enumerations from "IpatchSample.h" */ GType ipatch_sample_loop_type_get_type (void); #define IPATCH_TYPE_SAMPLE_LOOP_TYPE (ipatch_sample_loop_type_get_type()) /* enumerations from "IpatchSampleStoreRam.h" */ GType ipatch_sample_store_ram_flags_get_type (void); #define IPATCH_TYPE_SAMPLE_STORE_RAM_FLAGS (ipatch_sample_store_ram_flags_get_type()) /* enumerations from "IpatchSF2.h" */ GType ipatch_sf2_flags_get_type (void); #define IPATCH_TYPE_SF2_FLAGS (ipatch_sf2_flags_get_type()) GType ipatch_sf2_info_type_get_type (void); #define IPATCH_TYPE_SF2_INFO_TYPE (ipatch_sf2_info_type_get_type()) /* enumerations from "IpatchSF2File.h" */ GType ipatch_sf2_file_sample_type_get_type (void); #define IPATCH_TYPE_SF2_FILE_SAMPLE_TYPE (ipatch_sf2_file_sample_type_get_type()) /* enumerations from "IpatchSF2Gen.h" */ GType ipatch_sf2_gen_props_type_get_type (void); #define IPATCH_TYPE_SF2_GEN_PROPS_TYPE (ipatch_sf2_gen_props_type_get_type()) GType ipatch_sf2_gen_type_get_type (void); #define IPATCH_TYPE_SF2_GEN_TYPE (ipatch_sf2_gen_type_get_type()) GType ipatch_sf2_gen_sample_modes_get_type (void); #define IPATCH_TYPE_SF2_GEN_SAMPLE_MODES (ipatch_sf2_gen_sample_modes_get_type()) /* enumerations from "IpatchSF2Mod.h" */ GType ipatch_sf2_mod_field_masks_get_type (void); #define IPATCH_TYPE_SF2_MOD_FIELD_MASKS (ipatch_sf2_mod_field_masks_get_type()) GType ipatch_sf2_mod_field_shifts_get_type (void); #define IPATCH_TYPE_SF2_MOD_FIELD_SHIFTS (ipatch_sf2_mod_field_shifts_get_type()) GType ipatch_sf2_mod_control_get_type (void); #define IPATCH_TYPE_SF2_MOD_CONTROL (ipatch_sf2_mod_control_get_type()) GType ipatch_sf2_mod_control_palette_get_type (void); #define IPATCH_TYPE_SF2_MOD_CONTROL_PALETTE (ipatch_sf2_mod_control_palette_get_type()) GType ipatch_sf2_mod_direction_get_type (void); #define IPATCH_TYPE_SF2_MOD_DIRECTION (ipatch_sf2_mod_direction_get_type()) GType ipatch_sf2_mod_polarity_get_type (void); #define IPATCH_TYPE_SF2_MOD_POLARITY (ipatch_sf2_mod_polarity_get_type()) GType ipatch_sf2_mod_type_get_type (void); #define IPATCH_TYPE_SF2_MOD_TYPE (ipatch_sf2_mod_type_get_type()) GType ipatch_sf2_mod_transform_get_type (void); #define IPATCH_TYPE_SF2_MOD_TRANSFORM (ipatch_sf2_mod_transform_get_type()) GType ipatch_sf2_mod_flags_get_type (void); #define IPATCH_TYPE_SF2_MOD_FLAGS (ipatch_sf2_mod_flags_get_type()) /* enumerations from "IpatchSF2Sample.h" */ GType ipatch_sf2_sample_channel_get_type (void); #define IPATCH_TYPE_SF2_SAMPLE_CHANNEL (ipatch_sf2_sample_channel_get_type()) /* enumerations from "IpatchSF2VoiceCache.h" */ GType ipatch_sf2_voice_sel_type_get_type (void); #define IPATCH_TYPE_SF2_VOICE_SEL_TYPE (ipatch_sf2_voice_sel_type_get_type()) /* enumerations from "IpatchSndFile.h" */ GType ipatch_snd_file_endian_get_type (void); #define IPATCH_TYPE_SND_FILE_ENDIAN (ipatch_snd_file_endian_get_type()) /* enumerations from "IpatchTypeProp.h" */ GType ipatch_splits_type_get_type (void); #define IPATCH_TYPE_SPLITS_TYPE (ipatch_splits_type_get_type()) /* enumerations from "IpatchUnit.h" */ GType ipatch_unit_flags_get_type (void); #define IPATCH_TYPE_UNIT_FLAGS (ipatch_unit_flags_get_type()) GType ipatch_unit_type_get_type (void); #define IPATCH_TYPE_UNIT_TYPE (ipatch_unit_type_get_type()) GType ipatch_unit_class_type_get_type (void); #define IPATCH_TYPE_UNIT_CLASS_TYPE (ipatch_unit_class_type_get_type()) /* enumerations from "IpatchVBankRegion.h" */ GType ipatch_vbank_region_note_range_mode_get_type (void); #define IPATCH_TYPE_VBANK_REGION_NOTE_RANGE_MODE (ipatch_vbank_region_note_range_mode_get_type()) GType ipatch_vbank_region_root_note_mode_get_type (void); #define IPATCH_TYPE_VBANK_REGION_ROOT_NOTE_MODE (ipatch_vbank_region_root_note_mode_get_type()) /* enumerations from "misc.h" */ GType ipatch_error_get_type (void); #define IPATCH_TYPE_ERROR (ipatch_error_get_type()) /* enumerations from "sample.h" */ GType ipatch_sample_width_get_type (void); #define IPATCH_TYPE_SAMPLE_WIDTH (ipatch_sample_width_get_type()) GType ipatch_sample_channel_get_type (void); #define IPATCH_TYPE_SAMPLE_CHANNEL (ipatch_sample_channel_get_type()) GType ipatch_sample_channel_type_get_type (void); #define IPATCH_TYPE_SAMPLE_CHANNEL_TYPE (ipatch_sample_channel_type_get_type()) GType ipatch_sample_sign_get_type (void); #define IPATCH_TYPE_SAMPLE_SIGN (ipatch_sample_sign_get_type()) GType ipatch_sample_endian_get_type (void); #define IPATCH_TYPE_SAMPLE_ENDIAN (ipatch_sample_endian_get_type()) G_END_DECLS #endif /* __IPATCH_BUILTIN_ENUMS_H__ */ /* Generated data ends here */ libinstpatch-1.0.0/libinstpatch/IpatchSF2GenItem.c0000644000175000017500000007501611461332142016747 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include /* for conversion functions */ #include #include #include "IpatchSF2GenItem.h" #include "IpatchSF2Gen.h" #include "IpatchParamProp.h" #include "IpatchRange.h" #include "IpatchUnit.h" #include "ipatch_priv.h" #include "builtin_enums.h" #include "util.h" static gboolean ipatch_sf2_gen_item_set_gen_flag_no_notify (IpatchSF2GenItem *item, guint genid, gboolean setflag); /* non realtime synthesis parameters */ static const guint8 non_realtime[] = { IPATCH_SF2_GEN_SAMPLE_START, IPATCH_SF2_GEN_SAMPLE_END, IPATCH_SF2_GEN_SAMPLE_COARSE_START, IPATCH_SF2_GEN_SAMPLE_COARSE_END, IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_HOLD, IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_DECAY, IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_HOLD, IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_DECAY, IPATCH_SF2_GEN_INSTRUMENT_ID, IPATCH_SF2_GEN_NOTE_RANGE, IPATCH_SF2_GEN_VELOCITY_RANGE, IPATCH_SF2_GEN_FIXED_NOTE, IPATCH_SF2_GEN_FIXED_VELOCITY, IPATCH_SF2_GEN_SAMPLE_ID, IPATCH_SF2_GEN_SAMPLE_MODES, IPATCH_SF2_GEN_EXCLUSIVE_CLASS, IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE }; GType ipatch_sf2_gen_item_get_type (void) { static GType itype = 0; if (!itype) { static const GTypeInfo info = { sizeof (IpatchSF2GenItemIface), NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL }; itype = g_type_register_static (G_TYPE_INTERFACE, "IpatchSF2GenItemIface", &info, 0); /* IpatchSF2GenItemIface types must be IpatchItem objects (for locking) */ g_type_interface_add_prerequisite (itype, IPATCH_TYPE_ITEM); } return (itype); } /** * ipatch_sf2_gen_item_get_amount: * @item: Item with generators to get value from * @genid: Generator ID (#IpatchSF2GenType) of value to get * @out_amt: Output: Pointer to store generator amount to * * Get a generator amount from an item with generator properties. * * Returns: %TRUE if generator value is set, %FALSE if not set, in which case * the value stored to output_amt is the default value for the given generator * ID. */ gboolean ipatch_sf2_gen_item_get_amount (IpatchSF2GenItem *item, guint genid, IpatchSF2GenAmount *out_amt) { IpatchSF2GenItemIface *iface; IpatchSF2GenArray *genarray; gboolean set; g_return_val_if_fail (IPATCH_IS_SF2_GEN_ITEM (item), FALSE); g_return_val_if_fail (genid < IPATCH_SF2_GEN_COUNT, FALSE); g_return_val_if_fail (out_amt != NULL, FALSE); /* get pointer to genarray from IpatchSF2GenItemIface->genarray_ofs */ iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); g_return_val_if_fail (iface->genarray_ofs != 0, FALSE); genarray = (IpatchSF2GenArray *)G_STRUCT_MEMBER_P (item, iface->genarray_ofs); IPATCH_ITEM_RLOCK (item); *out_amt = genarray->values[genid]; set = IPATCH_SF2_GEN_ARRAY_TEST_FLAG (genarray, genid); IPATCH_ITEM_RUNLOCK (item); return (set); } /** * ipatch_sf2_gen_item_set_amount: * @item: Item with generators to set value in * @genid: Generator ID (#IpatchSF2GenType) of generator to set * @amt: Value to set generator to * * Set a generator amount for an item with generators. * * #IpatchItem property notify is done for the property and possibly the "-set" * property if it was unset before. */ void ipatch_sf2_gen_item_set_amount (IpatchSF2GenItem *item, guint genid, IpatchSF2GenAmount *amt) { IpatchSF2GenItemIface *iface; IpatchSF2GenArray *genarray; IpatchSF2GenType propstype; GParamSpec *pspec; IpatchSF2GenAmount oldamt; GValue oldval = { 0 }, newval = { 0 }; gboolean valchanged = FALSE, oldset; g_return_if_fail (IPATCH_IS_ITEM (item)); g_return_if_fail (amt != NULL); iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); propstype = iface->propstype; /* propstype for this class */ g_return_if_fail (ipatch_sf2_gen_is_valid (genid, propstype)); /* get pointer to genarray from IpatchSF2GenItemIface->genarray_ofs */ g_return_if_fail (iface->genarray_ofs != 0); genarray = (IpatchSF2GenArray *)G_STRUCT_MEMBER_P (item, iface->genarray_ofs); IPATCH_ITEM_WLOCK (item); /* has different value? */ if (genarray->values[genid].sword != amt->sword) { oldamt = genarray->values[genid]; /* store old val for notify */ genarray->values[genid] = *amt; valchanged = TRUE; } oldset = IPATCH_SF2_GEN_ARRAY_TEST_FLAG (genarray, genid); IPATCH_SF2_GEN_ARRAY_SET_FLAG (genarray, genid); /* value is set */ IPATCH_ITEM_WUNLOCK (item); if (valchanged) /* do the property change notify if it actually changed */ { pspec = iface->specs[genid]; ipatch_sf2_gen_amount_to_value (genid, amt, &newval); ipatch_sf2_gen_amount_to_value (genid, &oldamt, &oldval); ipatch_item_prop_notify (item, pspec, &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } if (oldset != TRUE) /* "set" state of property changed? */ { pspec = iface->setspecs[genid]; ipatch_item_prop_notify (item, pspec, ipatch_util_value_bool_true, ipatch_util_value_bool_false); } } /** * ipatch_sf2_gen_item_set_gen_flag: * @item: Item with generator properties to set value of a gen "set" flag of * @genid: Generator ID (#IpatchSF2GenType) of generator to set "set" flag value of * @setflag: If %TRUE then generatore amount is assigned, FALSE will cause the * amount to be unset (and revert to its default value) * * Sets the value of a generator "set" flag in an item with generators. * * #IpatchItem property notify is done for the property and possibly the "-set" * property if it was set before. */ void ipatch_sf2_gen_item_set_gen_flag (IpatchSF2GenItem *item, guint genid, gboolean setflag) { IpatchSF2GenItemIface *iface; GParamSpec *pspec; if (!ipatch_sf2_gen_item_set_gen_flag_no_notify (item, genid, setflag)) return; iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); g_return_if_fail (iface != NULL); /* do "-set" property notify */ pspec = iface->setspecs[genid]; ipatch_item_prop_notify (item, pspec, IPATCH_UTIL_VALUE_BOOL (setflag), IPATCH_UTIL_VALUE_BOOL (!setflag)); } /* Like ipatch_sf2_gen_item_set_gen_flag() but doesn't do "-set" property notify. * A regular property notify may occur though, * if the effective amount has changed. Caller can check if "-set" parameter * changed from return value (TRUE if changed from old value). */ static gboolean ipatch_sf2_gen_item_set_gen_flag_no_notify (IpatchSF2GenItem *item, guint genid, gboolean setflag) { IpatchSF2GenItemIface *iface; IpatchSF2GenArray *genarray; IpatchSF2GenType propstype; GParamSpec *pspec; IpatchSF2GenAmount oldamt, defamt; GValue newval = { 0 }, oldval = { 0 }; gboolean valchanged = FALSE, oldset; g_return_val_if_fail (IPATCH_IS_SF2_GEN_ITEM (item), FALSE); iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); propstype = iface->propstype; /* propstype for this class */ g_return_val_if_fail (ipatch_sf2_gen_is_valid (genid, propstype), FALSE); /* get pointer to genarray from IpatchSF2GenItemIface->genarray_ofs */ g_return_val_if_fail (iface->genarray_ofs != 0, FALSE); genarray = (IpatchSF2GenArray *)G_STRUCT_MEMBER_P (item, iface->genarray_ofs); /* grab default val from gen info table if absolute instrument gen or a range offset preset gen, otherwise offset gens are 0 by default */ if (!setflag) { if ((propstype & 0x1) == IPATCH_SF2_GEN_PROPS_INST || ipatch_sf2_gen_info[genid].unit == IPATCH_UNIT_TYPE_RANGE) defamt = ipatch_sf2_gen_info[genid].def; else defamt.sword = 0; } IPATCH_ITEM_WLOCK (item); /* unsetting flag and amount has different value than default? */ if (!setflag && genarray->values[genid].sword != defamt.sword) { oldamt = genarray->values[genid]; genarray->values[genid] = defamt; valchanged = TRUE; } oldset = IPATCH_SF2_GEN_ARRAY_TEST_FLAG (genarray, genid); /* set/unset flag as requested */ if (setflag) IPATCH_SF2_GEN_ARRAY_SET_FLAG (genarray, genid); else IPATCH_SF2_GEN_ARRAY_CLEAR_FLAG (genarray, genid); IPATCH_ITEM_WUNLOCK (item); /* do the property change notify if it actually changed */ if (valchanged) { pspec = iface->specs[genid]; ipatch_sf2_gen_amount_to_value (genid, &defamt, &newval); ipatch_sf2_gen_amount_to_value (genid, &oldamt, &oldval); ipatch_item_prop_notify (item, pspec, &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } return (setflag != oldset); } /** * ipatch_sf2_gen_item_count_set: * @item: Item with generators * * Get count of "set" generators in an item with generators. * * Returns: Count of "set" generators. */ guint ipatch_sf2_gen_item_count_set (IpatchSF2GenItem *item) { IpatchSF2GenItemIface *iface; IpatchSF2GenArray *genarray; guint count = 0; guint64 v; g_return_val_if_fail (IPATCH_IS_SF2_GEN_ITEM (item), 0); /* get pointer to genarray from IpatchSF2GenItemIface->genarray_ofs */ iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); g_return_val_if_fail (iface->genarray_ofs != 0, 0); genarray = (IpatchSF2GenArray *)G_STRUCT_MEMBER_P (item, iface->genarray_ofs); IPATCH_ITEM_RLOCK (item); for (v = genarray->flags; v; v >>= 1) if (v & 0x1) count++; IPATCH_ITEM_RUNLOCK (item); return (count); } /** * ipatch_sf2_gen_item_copy_all: * @item: Item with generators * @array: Destination generator array to store to * * Copies an item's generators to a caller supplied generator array. */ void ipatch_sf2_gen_item_copy_all (IpatchSF2GenItem *item, IpatchSF2GenArray *array) { IpatchSF2GenItemIface *iface; IpatchSF2GenArray *genarray; g_return_if_fail (IPATCH_IS_SF2_GEN_ITEM (item)); g_return_if_fail (array != NULL); /* get pointer to genarray from IpatchSF2GenItemIface->genarray_ofs */ iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); g_return_if_fail (iface->genarray_ofs != 0); genarray = (IpatchSF2GenArray *)G_STRUCT_MEMBER_P (item, iface->genarray_ofs); IPATCH_ITEM_RLOCK (item); memcpy (array, genarray, sizeof (IpatchSF2GenArray)); IPATCH_ITEM_RUNLOCK (item); } /** * ipatch_sf2_gen_item_copy_set: * @item: Item with generators * @array: Destination generator array to store to * * Copies a item's "set" generators to a caller supplied generator array. * This function differs from ipatch_sf2_gen_item_copy_all() in that it * only copies generators that are set. It can be used to override values * in one array with set values in another. Note that this doesn't change * any generators in @item, despite "set" being in the name. */ void ipatch_sf2_gen_item_copy_set (IpatchSF2GenItem *item, IpatchSF2GenArray *array) { IpatchSF2GenItemIface *iface; IpatchSF2GenArray *genarray; IpatchSF2GenAmount *vals; guint64 v; int i; g_return_if_fail (IPATCH_IS_SF2_GEN_ITEM (item)); g_return_if_fail (array != NULL); /* get pointer to genarray from IpatchSF2GenItemIface->genarray_ofs */ iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); g_return_if_fail (iface->genarray_ofs != 0); genarray = (IpatchSF2GenArray *)G_STRUCT_MEMBER_P (item, iface->genarray_ofs); IPATCH_ITEM_RLOCK (item); vals = genarray->values; v = genarray->flags; array->flags |= v; /* set destination array bits from source */ for (i = 0; v != 0; i++, v >>= 1) if (v & 0x1) array->values[i] = vals[i]; /* only copy set values */ IPATCH_ITEM_RUNLOCK (item); } /** * ipatch_sf2_gen_item_set_note_range: * @item: Item with generators * @low: Low value of range (MIDI note # between 0 and 127) * @high: High value of range (MIDI note # between 0 and 127) * * Set the MIDI note range that an item with generators is active on. * Only a convenience function really. */ void ipatch_sf2_gen_item_set_note_range (IpatchSF2GenItem *item, int low, int high) { IpatchSF2GenAmount amt; g_return_if_fail (IPATCH_IS_SF2_GEN_ITEM (item)); g_return_if_fail (low >= 0 && low <= 127); g_return_if_fail (high >= 0 && high <= 127); if (low > high) /* swap if backwards */ { int temp = low; low = high; high = temp; } amt.range.low = low; amt.range.high = high; ipatch_sf2_gen_item_set_amount (item, IPATCH_SF2_GEN_NOTE_RANGE, &amt); } /** * ipatch_sf2_gen_item_set_velocity_range: * @item: Item with generators * @low: Low value of range (MIDI velocity # between 0 and 127) * @high: High value of range (MIDI velocity # between 0 and 127) * * Set the MIDI velocity range that an item with generators is active on. * Only a convenience function really. */ void ipatch_sf2_gen_item_set_velocity_range (IpatchSF2GenItem *item, int low, int high) { IpatchSF2GenAmount amt; g_return_if_fail (IPATCH_IS_SF2_GEN_ITEM (item)); g_return_if_fail (low >= 0 && low <= 127); g_return_if_fail (high >= 0 && high <= 127); if (low > high) /* swap if backwards */ { int temp = low; low = high; high = temp; } amt.range.low = low; amt.range.high = high; ipatch_sf2_gen_item_set_amount (item, IPATCH_SF2_GEN_VELOCITY_RANGE, &amt); } /** * ipatch_sf2_gen_item_in_range: * @item: Item with generators * @note: MIDI note number or -1 for wildcard * @velocity: MIDI velocity or -1 for wildcard * * Check if a note and velocity falls in the ranges of an item with generators * * Returns: %TRUE if @item is in @note and @velocity range, %FALSE otherwise */ gboolean ipatch_sf2_gen_item_in_range (IpatchSF2GenItem *item, int note, int velocity) { IpatchSF2GenAmount *noteamt, *velamt; IpatchSF2GenItemIface *iface; IpatchSF2GenArray *genarray; gboolean in_range; g_return_val_if_fail (IPATCH_IS_SF2_GEN_ITEM (item), FALSE); /* get pointer to genarray from IpatchSF2GenItemIface->genarray_ofs */ iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); g_return_val_if_fail (iface->genarray_ofs != 0, 0); genarray = (IpatchSF2GenArray *)G_STRUCT_MEMBER_P (item, iface->genarray_ofs); IPATCH_ITEM_RLOCK (item); noteamt = &genarray->values[IPATCH_SF2_GEN_NOTE_RANGE]; velamt = &genarray->values[IPATCH_SF2_GEN_VELOCITY_RANGE]; in_range = ((note == -1) || (note >= noteamt->range.low && note <= noteamt->range.high)) && ((velocity == -1) || (velocity >= velamt->range.low && velocity <= velamt->range.high)); IPATCH_ITEM_RUNLOCK (item); return (in_range); } /** * ipatch_sf2_gen_item_intersect_test: * @item: Item with generators * @genarray: Generator array to test note and velocity ranges against * * Check if a given item's note and velocity ranges intersect with those in a * generator array. * * Returns: %TRUE if both note and velocity ranges intersect, %FALSE if one or * both do not. */ gboolean ipatch_sf2_gen_item_intersect_test (IpatchSF2GenItem *item, const IpatchSF2GenArray *genarray) { IpatchSF2GenAmount noteamt, velamt; IpatchSF2GenItemIface *iface; IpatchSF2GenArray *itemgenarray; g_return_val_if_fail (IPATCH_IS_SF2_GEN_ITEM (item), FALSE); /* get pointer to genarray from IpatchSF2GenItemIface->genarray_ofs */ iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); g_return_val_if_fail (iface->genarray_ofs != 0, 0); itemgenarray = (IpatchSF2GenArray *)G_STRUCT_MEMBER_P (item, iface->genarray_ofs); IPATCH_ITEM_RLOCK (item); noteamt = itemgenarray->values[IPATCH_SF2_GEN_NOTE_RANGE]; velamt = itemgenarray->values[IPATCH_SF2_GEN_VELOCITY_RANGE]; IPATCH_ITEM_RUNLOCK (item); return ipatch_sf2_gen_range_intersect_test (¬eamt, &genarray->values[IPATCH_SF2_GEN_NOTE_RANGE]) && ipatch_sf2_gen_range_intersect_test (&velamt, &genarray->values[IPATCH_SF2_GEN_VELOCITY_RANGE]); } /** * ipatch_sf2_gen_item_class_get_pspec: * @genid: Generator ID * @klass: Class with an #IpatchSF2GenItem interface * * Get the parameter specification for a given generator ID and object class. * * Returns: The parameter specification for the generator or %NULL if * the given @genid for @klass is not valid. */ GParamSpec * ipatch_sf2_gen_item_class_get_pspec (GObjectClass *klass, guint genid) { IpatchSF2GenItemIface *gen_item_iface; g_return_val_if_fail (genid < IPATCH_SF2_GEN_COUNT, NULL); g_return_val_if_fail (klass != NULL, NULL); gen_item_iface = g_type_interface_peek (klass, IPATCH_TYPE_SF2_GEN_ITEM); g_return_val_if_fail (gen_item_iface != NULL, NULL); return (gen_item_iface->specs[genid]); } /** * ipatch_sf2_gen_item_class_get_pspec_set: * @genid: Generator ID * @klass: Class with an #IpatchSF2GenItem interface * * Get a "-set" property parameter specification for a given generator ID and * object class. * * Returns: The "-set" property parameter specification for the generator or * %NULL if the given @genid or @klass are not valid. */ GParamSpec * ipatch_sf2_gen_item_class_get_pspec_set (GObjectClass *klass, guint genid) { IpatchSF2GenItemIface *gen_item_iface; g_return_val_if_fail (genid < IPATCH_SF2_GEN_COUNT, NULL); g_return_val_if_fail (klass != NULL, NULL); gen_item_iface = g_type_interface_peek (klass, IPATCH_TYPE_SF2_GEN_ITEM); g_return_val_if_fail (gen_item_iface != NULL, NULL); return (gen_item_iface->setspecs[genid]); } /** * ipatch_sf2_gen_item_iface_install_properties: * @klass: Object class to install properties on * @propstype: Type of properties to install (instrument/preset) * @specs: Location to store a pointer to an allocated array of parameter * specs which should get copied to the interface's specs field and then freed * @setspecs: Location to store a pointer to an allocated array of parameter * specs which should get copied to the interface's setspecs field and then freed * * Installs generator item properties on the provided @klass. * Used internally in IpatchSF2GenItemIface init functions. */ /* This function is complicated by the fact that GObject properties are supposed * to be installed in the class init function, but the gen item interface has * not yet been initialized, so values need to be passed to the interface init * function. */ void ipatch_sf2_gen_item_iface_install_properties (GObjectClass *klass, IpatchSF2GenPropsType propstype, GParamSpec ***specs, GParamSpec ***setspecs) { GEnumClass *enum_class; GEnumValue *enum_value; GParamSpec *pspec; char *set_name; const IpatchSF2GenInfo *gen_info; int nonrt_index = 0; /* non realtime generator array index */ gboolean ispreset; int i, diff, unit; ispreset = propstype & 1; /* get generator type GObject enum */ enum_class = g_type_class_ref (IPATCH_TYPE_SF2_GEN_TYPE); g_return_if_fail (enum_class != NULL); *specs = g_new (GParamSpec *, IPATCH_SF2_GEN_COUNT); *setspecs = g_new (GParamSpec *, IPATCH_SF2_GEN_COUNT); /* install generator properties */ for (i = 0; i < IPATCH_SF2_GEN_COUNT; i++) { /* gen is valid for zone type? */ if (!ipatch_sf2_gen_is_valid (i, propstype)) continue; gen_info = &ipatch_sf2_gen_info[i]; enum_value = g_enum_get_value (enum_class, i); if (gen_info->unit == IPATCH_UNIT_TYPE_RANGE) pspec = ipatch_param_spec_range (enum_value->value_nick, _(gen_info->label), _(gen_info->descr ? gen_info->descr : gen_info->label), 0, 127, 0, 127, G_PARAM_READWRITE); /* allow 30 bit number which stores fine and coarse (32k) values */ else if (gen_info->unit == IPATCH_UNIT_TYPE_SAMPLES) pspec = g_param_spec_int (enum_value->value_nick, _(gen_info->label), _(gen_info->descr ? gen_info->descr : gen_info->label), ispreset ? -0x03FFFFFFF : 0, 0x03FFFFFFF, 0, G_PARAM_READWRITE); else if (!ispreset) /* integer absolute property */ pspec = g_param_spec_int (enum_value->value_nick, _(gen_info->label), _(gen_info->descr ? gen_info->descr : gen_info->label), gen_info->min.sword, gen_info->max.sword, gen_info->def.sword, G_PARAM_READWRITE); else /* integer offset property */ { diff = (int)gen_info->max.sword - gen_info->min.sword; pspec = g_param_spec_int (enum_value->value_nick, _(gen_info->label), _(gen_info->descr ? gen_info->descr : gen_info->label), -diff, diff, 0, G_PARAM_READWRITE); } /* all generators affect synthesis */ pspec->flags |= IPATCH_PARAM_SYNTH; /* if generator is not in non_realtime generator array.. */ if (nonrt_index >= G_N_ELEMENTS (non_realtime) || non_realtime[nonrt_index] != i) pspec->flags |= IPATCH_PARAM_SYNTH_REALTIME; /* set realtime flag */ else if (non_realtime[nonrt_index] == i) nonrt_index++; /* current gen is non realtime, adv to next index */ /* install the property */ g_object_class_install_property (klass, i + IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID, pspec); unit = gen_info->unit; /* set parameter unit type extended property */ if (ispreset) { if (unit == IPATCH_UNIT_TYPE_SF2_ABS_PITCH) unit = IPATCH_UNIT_TYPE_SF2_OFS_PITCH; else if (unit == IPATCH_UNIT_TYPE_SF2_ABS_TIME) unit = IPATCH_UNIT_TYPE_SF2_OFS_PITCH; } ipatch_param_set (pspec, "unit-type", unit, NULL); (*specs)[i] = g_param_spec_ref (pspec); /* add to parameter spec array */ /* create prop-set property and add to setspecs array */ set_name = g_strconcat (enum_value->value_nick, "-set", NULL); pspec = g_param_spec_boolean (set_name, NULL, NULL, FALSE, G_PARAM_READWRITE); g_free (set_name); (*setspecs)[i] = g_param_spec_ref (pspec); /* add to set spec array */ /* install "-set" property */ g_object_class_install_property (klass, i + IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID, pspec); } /* for loop */ } /** * ipatch_sf2_gen_item_iface_set_property: * @item: IpatchItem instance with generator properties * @property_id: Property id to set * @value: Value to set property to * * Used internally for classes with generators, to set values thereof. * * Returns: %TRUE if @property_id handled, %FALSE otherwise */ gboolean ipatch_sf2_gen_item_iface_set_property (IpatchSF2GenItem *item, guint property_id, const GValue *value) { IpatchSF2GenItemIface *iface; IpatchSF2GenArray *genarray; const IpatchSF2GenInfo *gen_info; IpatchSF2GenAmount amt; IpatchRange *range; int genid, coarse, val; gboolean oldset, oldcoarseset = 0, newcoarseset = 0; IpatchSF2GenAmount oldcoarseamt, newcoarseamt; gboolean coarsevalchanged = FALSE; GParamSpec *pspec; GValue newval = { 0 }, oldval = { 0 }; gboolean setflag; iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); /* a "-set" property? */ if (property_id >= IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID && property_id < IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID + IPATCH_SF2_GEN_COUNT) { genid = property_id - IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID; /* generator valid for zone type? */ if (!ipatch_sf2_gen_is_valid (genid, iface->propstype)) return (FALSE); setflag = g_value_get_boolean (value); ipatch_sf2_gen_item_set_gen_flag_no_notify (item, genid, setflag); return (TRUE); } /* regular generator property? */ if (property_id < IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID || property_id >= IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID + IPATCH_SF2_GEN_COUNT) return (FALSE); genid = property_id - IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID; /* generator valid for zone type? */ if (!ipatch_sf2_gen_is_valid (genid, iface->propstype)) return (FALSE); /* get pointer to genarray from IpatchSF2GenItemIface->genarray_ofs */ g_return_val_if_fail (iface->genarray_ofs != 0, FALSE); genarray = (IpatchSF2GenArray *)G_STRUCT_MEMBER_P (item, iface->genarray_ofs); gen_info = &ipatch_sf2_gen_info [genid]; if (gen_info->unit == IPATCH_UNIT_TYPE_SAMPLES) { /* set 2 generators - fine and coarse (32k) sample values */ if (genid == IPATCH_SF2_GEN_SAMPLE_START) coarse = IPATCH_SF2_GEN_SAMPLE_COARSE_START; else if (genid == IPATCH_SF2_GEN_SAMPLE_END) coarse = IPATCH_SF2_GEN_SAMPLE_COARSE_END; else if (genid == IPATCH_SF2_GEN_SAMPLE_LOOP_START) coarse = IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START; else if (genid == IPATCH_SF2_GEN_SAMPLE_LOOP_END) coarse = IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END; else g_return_val_if_fail (NOT_REACHED, FALSE); val = g_value_get_int (value); newcoarseamt.uword = val >> 15; IPATCH_ITEM_WLOCK (item); /* atomically set both gens */ /* prop notify done by IpatchItem methods, so just set value */ genarray->values[genid].uword = val & 0x7FFF; oldset = IPATCH_SF2_GEN_ARRAY_TEST_FLAG (genarray, genid); IPATCH_SF2_GEN_ARRAY_SET_FLAG (genarray, genid); /* value is set */ /* only set coarse value if it has changed */ if (genarray->values[coarse].uword != newcoarseamt.uword) { oldcoarseamt = genarray->values[coarse]; genarray->values[coarse] = newcoarseamt; coarsevalchanged = TRUE; oldcoarseset = IPATCH_SF2_GEN_ARRAY_TEST_FLAG (genarray, genid); if (val != 0) { IPATCH_SF2_GEN_ARRAY_SET_FLAG (genarray, genid); /* value is set */ newcoarseset = 1; } else { IPATCH_SF2_GEN_ARRAY_CLEAR_FLAG (genarray, genid); /* value is unset */ newcoarseset = 0; } } IPATCH_ITEM_WUNLOCK (item); if (oldset != TRUE) /* "set" state of property changed? */ { pspec = iface->setspecs[genid]; ipatch_item_prop_notify (item, pspec, ipatch_util_value_bool_true, ipatch_util_value_bool_false); } if (coarsevalchanged) /* do the property change notify if it actually changed */ { pspec = iface->specs[coarse]; ipatch_sf2_gen_amount_to_value (genid, &newcoarseamt, &newval); ipatch_sf2_gen_amount_to_value (genid, &oldcoarseamt, &oldval); ipatch_item_prop_notify (item, pspec, &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } if (oldcoarseset != newcoarseset) /* "set" state of property changed? */ { pspec = iface->setspecs[coarse]; ipatch_item_prop_notify (item, pspec, IPATCH_UTIL_VALUE_BOOL (newcoarseset), IPATCH_UTIL_VALUE_BOOL (oldcoarseset)); } } else { if (gen_info->unit == IPATCH_UNIT_TYPE_RANGE) /* range property? */ { range = ipatch_value_get_range (value); amt.range.low = range->low; amt.range.high = range->high; } else { val = g_value_get_int (value); amt.sword = val; } IPATCH_ITEM_WLOCK (item); /* prop notify done by IpatchItem methods, so just set value */ genarray->values[genid] = amt; /* get old value of set flag, and then set it (if no already) */ oldset = IPATCH_SF2_GEN_ARRAY_TEST_FLAG (genarray, genid); IPATCH_SF2_GEN_ARRAY_SET_FLAG (genarray, genid); /* value is set */ IPATCH_ITEM_WUNLOCK (item); if (oldset != TRUE) /* "set" state of property changed? */ { pspec = iface->setspecs[genid]; ipatch_item_prop_notify (item, pspec, ipatch_util_value_bool_true, ipatch_util_value_bool_false); } } return (TRUE); } /** * ipatch_sf2_gen_item_iface_get_property: * @item: IpatchItem instance with generators * @property_id: Property id to set * @value: Value to set property to * * Used internally for classes with generator properties, to get values thereof. * * Returns: %TRUE if @property_id handled, %FALSE otherwise */ gboolean ipatch_sf2_gen_item_iface_get_property (IpatchItem *item, guint property_id, GValue *value) { IpatchSF2GenItemIface *iface; IpatchSF2GenArray *genarray; const IpatchSF2GenInfo *gen_info; IpatchSF2GenAmount amt; IpatchRange range; int genid, coarse, val; gboolean setflag; iface = IPATCH_SF2_GEN_ITEM_GET_IFACE (item); /* get pointer to genarray from IpatchSF2GenItemIface->genarray_ofs */ g_return_val_if_fail (iface->genarray_ofs != 0, FALSE); genarray = (IpatchSF2GenArray *)G_STRUCT_MEMBER_P (item, iface->genarray_ofs); /* a "-set" property? */ if (property_id >= IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID && property_id < IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID + IPATCH_SF2_GEN_COUNT) { genid = property_id - IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID; /* generator valid for zone type? */ if (!ipatch_sf2_gen_is_valid (genid, iface->propstype)) return (FALSE); IPATCH_ITEM_RLOCK (item); setflag = IPATCH_SF2_GEN_ARRAY_TEST_FLAG (genarray, genid); IPATCH_ITEM_RUNLOCK (item); g_value_set_boolean (value, setflag); return (TRUE); } /* regular generator property? */ if (property_id < IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID || property_id >= IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID + IPATCH_SF2_GEN_COUNT) return (FALSE); genid = property_id - IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID; /* generator valid for propstype? */ if (!ipatch_sf2_gen_is_valid (genid, iface->propstype)) return (FALSE); gen_info = &ipatch_sf2_gen_info [genid]; if (gen_info->unit == IPATCH_UNIT_TYPE_RANGE) /* range property? */ { IPATCH_ITEM_WLOCK (item); /* OPTME - lock might not be necessary? */ amt = genarray->values[genid]; IPATCH_ITEM_WUNLOCK (item); range.low = amt.range.low; range.high = amt.range.high; ipatch_value_set_range (value, &range); } else if (gen_info->unit == IPATCH_UNIT_TYPE_SAMPLES) { /* get 2 generators - fine and coarse (32k) sample values */ if (genid == IPATCH_SF2_GEN_SAMPLE_START) coarse = IPATCH_SF2_GEN_SAMPLE_COARSE_START; else if (genid == IPATCH_SF2_GEN_SAMPLE_END) coarse = IPATCH_SF2_GEN_SAMPLE_COARSE_END; else if (genid == IPATCH_SF2_GEN_SAMPLE_LOOP_START) coarse = IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START; else if (genid == IPATCH_SF2_GEN_SAMPLE_LOOP_END) coarse = IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END; else g_return_val_if_fail (NOT_REACHED, FALSE); IPATCH_ITEM_WLOCK (item); /* atomically get both gens */ val = genarray->values[genid].uword; val |= genarray->values[coarse].uword << 15; IPATCH_ITEM_WUNLOCK (item); g_value_set_int (value, val); } /* sword read is atomic */ else g_value_set_int (value, genarray->values[genid].sword); return (TRUE); } libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreSwap.h0000644000175000017500000000471411461332142020177 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleStoreSwap * @short_description: Sample storage object for audio in a temporary swap file * @see_also: * @stability: Stable */ #ifndef __IPATCH_SAMPLE_STORE_SWAP_H__ #define __IPATCH_SAMPLE_STORE_SWAP_H__ #include #include #include typedef struct _IpatchSampleStoreSwap IpatchSampleStoreSwap; typedef struct _IpatchSampleStoreSwapClass IpatchSampleStoreSwapClass; #define IPATCH_TYPE_SAMPLE_STORE_SWAP \ (ipatch_sample_store_swap_get_type ()) #define IPATCH_SAMPLE_STORE_SWAP(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_STORE_SWAP, \ IpatchSampleStoreSwap)) #define IPATCH_SAMPLE_STORE_SWAP_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_STORE_SWAP, \ IpatchSampleStoreSwapClass)) #define IPATCH_IS_SAMPLE_STORE_SWAP(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_STORE_SWAP)) #define IPATCH_IS_SAMPLE_STORE_SWAP_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_STORE_SWAP)) /* Swap file sample store instance (derived from FILE sample store) */ struct _IpatchSampleStoreSwap { IpatchSampleStoreFile parent_instance; }; /* Swap file sample store class (derived from FILE sample store) */ struct _IpatchSampleStoreSwapClass { IpatchSampleStoreFileClass parent_class; }; /* we reserve 1 private flag */ #define IPATCH_SAMPLE_STORE_SWAP_UNUSED_FLAG_SHIFT \ (IPATCH_SAMPLE_STORE_FILE_UNUSED_FLAG_SHIFT + 1) GType ipatch_sample_store_swap_get_type (void); IpatchSample *ipatch_sample_store_swap_new (void); int ipatch_sample_store_swap_get_unused_size (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchConverter_priv.h0000644000175000017500000000525611461332142020117 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /* * IpatchConverter_priv.h - Helper macros for defining converters */ #ifndef __IPATCH_CONVERTER_PRIV_H__ #define __IPATCH_CONVERTER_PRIV_H__ #define CONVERTER_GET_TYPE(type_under, TypeCase) \ GType ipatch_converter_ ## type_under ## _get_type (void) \ { \ static GType obj_type = 0; \ \ if (!obj_type) { \ static const GTypeInfo obj_info = { \ sizeof (IpatchConverter ## TypeCase ## Class), NULL, NULL, \ (GClassInitFunc) _ ## type_under ## _class_init, NULL, NULL, \ sizeof (IpatchConverter ## TypeCase), 0, \ (GInstanceInitFunc) NULL, \ }; \ \ obj_type = g_type_register_static (IPATCH_TYPE_CONVERTER, \ "IpatchConverter" #TypeCase, \ &obj_info, 0); \ } \ \ return (obj_type); \ } #define CONVERTER_CLASS_INIT(type_under) \ static void _ ## type_under ## _class_init (IpatchConverterClass *klass) \ { \ klass->verify = NULL; \ klass->notes = NULL; \ klass->convert = _ ## type_under ## _convert; \ } #define CONVERTER_CLASS_INIT_NOTES(type_under) \ static void _ ## type_under ## _class_init (IpatchConverterClass *klass) \ { \ klass->verify = NULL; \ klass->notes = _ ## type_under ## _notes; \ klass->convert = _ ## type_under ## _convert; \ } #define CONVERTER_SF2_VOICE_CACHE_GET_TYPE(type_under, TypeCase) \ GType ipatch_converter_ ## type_under ## _get_type (void) \ { \ static GType obj_type = 0; \ \ if (!obj_type) { \ static const GTypeInfo obj_info = { \ sizeof (IpatchConverter ## TypeCase ## Class), NULL, NULL, \ (GClassInitFunc) _ ## type_under ## _class_init, NULL, NULL, \ sizeof (IpatchConverter ## TypeCase), 0, \ (GInstanceInitFunc) NULL, \ }; \ \ obj_type = g_type_register_static (IPATCH_TYPE_CONVERTER_SF2_VOICE_CACHE, \ "IpatchConverter" #TypeCase, \ &obj_info, 0); \ } \ \ return (obj_type); \ } #endif libinstpatch-1.0.0/libinstpatch/IpatchDLSWriter.c0000644000175000017500000013257111461332142016723 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchDLSWriter.h" #include "IpatchDLSFile.h" #include "IpatchDLS2Region.h" #include "IpatchDLS2Sample.h" #include "IpatchGig.h" #include "IpatchGigFile.h" #include "IpatchGigRegion.h" #include "IpatchGigInst.h" #include "IpatchGigSample.h" #include "IpatchItem.h" #include "IpatchSampleData.h" #include "IpatchSampleStoreFile.h" #include "IpatchSample.h" #include "ipatch_priv.h" #include "i18n.h" static void ipatch_dls_writer_finalize (GObject *object); static gboolean ipatch_dls_write_level_0 (IpatchDLSWriter *writer, GError **err); static gboolean dls_write_info (IpatchDLSWriter *writer, GSList *info_list, GError **err); static IpatchDLS2InfoBag *find_info_by_id (GSList *info_list, guint32 id); static gboolean gig_write_file_info (IpatchDLSWriter *writer, GSList *info_list, GError **err); static gboolean gig_write_name_info (IpatchDLSWriter *writer, GSList *info_list, GError **err); static gboolean dls_write_inst_list (IpatchDLSWriter *writer, GError **err); static gboolean dls_write_region_list (IpatchDLSWriter *writer, IpatchDLS2Inst *inst, GError **err); static gboolean gig_write_region_list (IpatchDLSWriter *writer, IpatchGigInst *giginst, GError **err); static gboolean dls_write_art_list (IpatchDLSWriter *writer, GSList *conn_list, GError **err); static gboolean dls_write_region_header (IpatchDLSWriter *writer, IpatchDLS2Region *region, GError **err); static gboolean gig_write_region_header (IpatchDLSWriter *writer, IpatchGigRegion *region, GError **err); static gboolean dls_write_wave_link (IpatchDLSWriter *writer, IpatchDLS2Region *region, GError **err); static gboolean gig_write_wave_link (IpatchDLSWriter *writer, IpatchGigRegion *region, GError **err); static gboolean dls_write_sample_info (IpatchDLSWriter *writer, IpatchDLS2SampleInfo *info, GError **err); static gboolean dls_write_sample_format (IpatchDLSWriter *writer, IpatchDLS2Sample *sample, GError **err); static gboolean dls_reserve_pool_table (IpatchDLSWriter *writer, GError **err); static gboolean dls_fixup_pool_table (IpatchDLSWriter *writer, GError **err); static gboolean dls_write_wave_pool (IpatchDLSWriter *writer, GError **err); static gboolean dls_write_dlid (IpatchDLSWriter *writer, guint8 *dlid, GError **err); static gboolean gig_write_sub_regions (IpatchDLSWriter *writer, IpatchGigRegion *region, GError **err); static gboolean gig_write_dimension_names (IpatchDLSWriter *writer, IpatchGigRegion *region, GError **err); static gboolean gig_write_sample_info (IpatchDLSWriter *writer, IpatchDLS2SampleInfo *info, int rate, GError **err); static gboolean gig_write_dimension_info (IpatchDLSWriter *writer, IpatchGigRegion *region, GError **err); static gboolean gig_write_group_names (IpatchDLSWriter *writer, GError **err); G_DEFINE_TYPE (IpatchDLSWriter, ipatch_dls_writer, IPATCH_TYPE_RIFF); static void ipatch_dls_writer_class_init (IpatchDLSWriterClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); obj_class->finalize = ipatch_dls_writer_finalize; } static void ipatch_dls_writer_init (IpatchDLSWriter *writer) { writer->sample_hash = g_hash_table_new (NULL, NULL); } static void ipatch_dls_writer_finalize (GObject *object) { IpatchDLSWriter *writer = IPATCH_DLS_WRITER (object); if (writer->orig_dls) { g_object_unref (writer->orig_dls); writer->orig_dls = NULL; } if (writer->dls) { g_object_unref (writer->dls); writer->dls = NULL; } g_hash_table_destroy (writer->sample_hash); writer->sample_hash = NULL; if (writer->sample_ofstbl) { g_free (writer->sample_ofstbl); writer->sample_ofstbl = NULL; } if (G_OBJECT_CLASS (ipatch_dls_writer_parent_class)->finalize) G_OBJECT_CLASS (ipatch_dls_writer_parent_class)->finalize (object); } /** * ipatch_dls_writer_new: * @handle: DLS file handle to save to or %NULL to set later, taken over by * writer object and will be closed on finalize. * @dls: DLS object to save or %NULL to set later * * Create a new DLS file writer. * * Returns: The new DLS writer */ IpatchDLSWriter * ipatch_dls_writer_new (IpatchFileHandle *handle, IpatchDLS2 *dls) { IpatchDLSWriter *writer; g_return_val_if_fail (!handle || IPATCH_IS_DLS_FILE (handle->file), NULL); g_return_val_if_fail (!dls || IPATCH_IS_DLS2 (dls), NULL); writer = g_object_new (IPATCH_TYPE_DLS_WRITER, NULL); if (handle) ipatch_dls_writer_set_file_handle (writer, handle); if (dls) ipatch_dls_writer_set_patch (writer, dls); return (writer); } /** * ipatch_dls_writer_set_patch: * @writer: DLS writer object * @dls: DLS patch to save * * Set the DLS patch object to save with a DLS writer. */ void ipatch_dls_writer_set_patch (IpatchDLSWriter *writer, IpatchDLS2 *dls) { g_return_if_fail (IPATCH_IS_DLS_WRITER (writer)); g_return_if_fail (IPATCH_IS_DLS2 (dls)); if (writer->orig_dls) g_object_unref (writer->orig_dls); writer->orig_dls = g_object_ref (dls); } /** * ipatch_dls_writer_set_file_handle: * @writer: DLS writer object * @handle: DLS file handle * * Set the DLS file handle of a DLS writer. A convenience function, since * ipatch_riff_set_file_handle() could also be used. */ void ipatch_dls_writer_set_file_handle (IpatchDLSWriter *writer, IpatchFileHandle *handle) { g_return_if_fail (IPATCH_IS_DLS_WRITER (writer)); g_return_if_fail (handle && IPATCH_IS_DLS_FILE (handle->file)); ipatch_riff_set_file_handle (IPATCH_RIFF (writer), handle); } /** * ipatch_dls_writer_save: * @writer: DLS writer object * @err: Location to store error info or %NULL * * Write a DLS or GigaSampler object to a file. * * Returns: %TRUE on success, %FALSE on error */ gboolean ipatch_dls_writer_save (IpatchDLSWriter *writer, GError **err) { IpatchRiff *riff; IpatchItem *item; g_return_val_if_fail (IPATCH_IS_DLS_WRITER (writer), FALSE); g_return_val_if_fail (!err || !*err, FALSE); g_return_val_if_fail (writer->orig_dls != NULL, FALSE); if (writer->dls) g_object_unref (writer->dls); /* shouldn't be set, but.. */ /* are we writing a GigaSampler file? */ if (IPATCH_IS_GIG (writer->orig_dls)) writer->is_gig = TRUE; /* duplicate for save, so we can be multi-thread friendly :) ++ref new duplicate object */ item = ipatch_item_duplicate (IPATCH_ITEM (writer->orig_dls)); g_return_val_if_fail (item != NULL, FALSE); writer->dls = IPATCH_DLS2 (item); riff = IPATCH_RIFF (writer); /* - Toplevel DLS RIFF chunk */ if (!ipatch_riff_write_chunk (riff, IPATCH_RIFF_CHUNK_RIFF, IPATCH_DLS_FOURCC_DLS, err)) return (FALSE); if (!ipatch_dls_write_level_0 (writer, err)) goto err; if (!ipatch_riff_close_chunk (riff, -1, err)) goto err; /* */ g_object_unref (writer->dls); writer->dls = NULL; return (TRUE); err: g_object_unref (writer->dls); writer->dls = NULL; return (FALSE); } static gboolean ipatch_dls_write_level_0 (IpatchDLSWriter *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchIter iter; IpatchDLS2Sample *sample; guint index; /* write info list */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_INFO, err)) return (FALSE); if (!writer->is_gig) /* DLS file? */ { if (!dls_write_info (writer, writer->dls->info, err)) return (FALSE); } else /* gig file */ { if (!gig_write_file_info (writer, writer->dls->info, err)) return (FALSE); } if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* save file version if its set */ if (ipatch_item_get_flags (writer->dls) & IPATCH_DLS2_VERSION_SET) { if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_VERS, err)) return (FALSE); if (!ipatch_file_write_u32 (riff->handle, writer->dls->ms_version, err)) return (FALSE); if (!ipatch_file_write_u32 (riff->handle, writer->dls->ls_version, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); } /* collection header (instrument count) */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_COLH, err)) return (FALSE); ipatch_container_init_iter (IPATCH_CONTAINER (writer->dls), &iter, IPATCH_TYPE_DLS2_INST); if (!ipatch_file_write_u32 (riff->handle, ipatch_iter_count (&iter), err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* write DLSID if its set */ if (writer->dls->dlid) if (!dls_write_dlid (writer, writer->dls->dlid, err)) return (FALSE); /* create hash of samples -> indexes */ ipatch_container_init_iter (IPATCH_CONTAINER (writer->dls), &iter, IPATCH_TYPE_DLS2_SAMPLE); sample = ipatch_dls2_sample_first (&iter); index = 1; /* index + 1 to catch NULL in hash table */ while (sample) { g_hash_table_insert (writer->sample_hash, sample, GUINT_TO_POINTER (index)); sample = ipatch_dls2_sample_next (&iter); index++; } writer->sample_count = index - 1; /* count of samples */ /* allocate sample offset table */ writer->sample_ofstbl = g_malloc0 (writer->sample_count * 4); /* write instrument list */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_LINS, err)) return (FALSE); if (!dls_write_inst_list (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* GigaSampler sample group name list */ if (writer->is_gig) if (!gig_write_group_names (writer, err)) return (FALSE); /* reserve pool table (sample mappings) chunk */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_PTBL, err)) return (FALSE); if (!dls_reserve_pool_table (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* write wave pool list (all samples) */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_WVPL, err)) return (FALSE); if (!dls_write_wave_pool (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* fixup the pool table */ if (!dls_fixup_pool_table (writer, err)) return (FALSE); /* FIXME: IPATCH_GIG_FOURCC_EINF - GigaSampler unknown */ return (TRUE); } static gboolean dls_write_info (IpatchDLSWriter *writer, GSList *info_list, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchDLS2InfoBag *bag; GSList *p; p = info_list; while (p) { bag = (IpatchDLS2InfoBag *)(p->data); if (!ipatch_riff_write_sub_chunk (riff, bag->fourcc, err)) return (FALSE); if (!ipatch_file_write (riff->handle, bag->value, /* write info str */ strlen (bag->value) + 1, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); p = g_slist_next (p); } return (TRUE); } static IpatchDLS2InfoBag * find_info_by_id (GSList *info_list, guint32 id) { IpatchDLS2InfoBag *bag; GSList *p; p = info_list; while (p) { bag = (IpatchDLS2InfoBag *)(p->data); if (bag->fourcc == id) break; p = g_slist_next (p); } if (p) return (bag); else return (NULL); } /* GigaSampler file info write function */ static gboolean gig_write_file_info (IpatchDLSWriter *writer, GSList *info_list, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchDLS2InfoBag *bag; char *buf; int i, size; guint32 order[] = { IPATCH_DLS_FOURCC_IARL, IPATCH_DLS_FOURCC_IART, IPATCH_DLS_FOURCC_ICMS, IPATCH_DLS_FOURCC_ICMT, IPATCH_DLS_FOURCC_ICOP, IPATCH_DLS_FOURCC_ICRD, IPATCH_DLS_FOURCC_IENG, IPATCH_DLS_FOURCC_IGNR, IPATCH_DLS_FOURCC_IKEY, IPATCH_DLS_FOURCC_IMED, IPATCH_DLS_FOURCC_INAM, IPATCH_DLS_FOURCC_IPRD, IPATCH_DLS_FOURCC_ISBJ, IPATCH_DLS_FOURCC_ISFT, IPATCH_DLS_FOURCC_ISRC, IPATCH_DLS_FOURCC_ISRF, IPATCH_DLS_FOURCC_ITCH }; buf = g_malloc (1024); /* max size is comment field */ for (i = 0; i < G_N_ELEMENTS (order); i++) { if (order[i] == IPATCH_DLS_FOURCC_IARL) size = IPATCH_GIG_IARL_INFO_SIZE; else if (order[i] == IPATCH_DLS_FOURCC_ICMT) size = IPATCH_GIG_ICMT_INFO_SIZE; else size = IPATCH_GIG_MOST_INFO_SIZE; /* blank it first, IARL filled with spaces */ memset (buf, (order[i] != IPATCH_DLS_FOURCC_IARL) ? 0 : ' ', size); bag = find_info_by_id (info_list, order[i]); if (bag) strncpy (buf, bag->value, size - 1); if (!ipatch_riff_write_sub_chunk (riff, order[i], err)) goto err; if (!ipatch_file_write (riff->handle, buf, size, err)) goto err; if (!ipatch_riff_close_chunk (riff, -1, err)) goto err; } return (TRUE); err: g_free (buf); return (FALSE); } /* write GigaSampler name info for instruments or samples */ static gboolean gig_write_name_info (IpatchDLSWriter *writer, GSList *info_list, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchDLS2InfoBag *bag; char buf[IPATCH_GIG_ITEM_INAM_SIZE]; memset (buf, 0, sizeof (buf)); bag = find_info_by_id (info_list, IPATCH_DLS_FOURCC_INAM); if (bag) strncpy (buf, bag->value, sizeof (buf) - 1); if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_INAM, err)) return (FALSE); if (!ipatch_file_write (riff->handle, buf, sizeof (buf), err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); return (TRUE); } static gboolean dls_write_inst_list (IpatchDLSWriter *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchDLS2Inst *inst; IpatchIter iter, region_iter; guint32 uint; gboolean retval; ipatch_container_init_iter (IPATCH_CONTAINER (writer->dls), &iter, IPATCH_TYPE_DLS2_INST); inst = ipatch_dls2_inst_first (&iter); while (inst) /* loop over instruments */ { /* - Instrument chunk */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_INS, err)) return (FALSE); /* - Info list */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_INFO, err)) return (FALSE); if (writer->is_gig) { if (!gig_write_name_info (writer, inst->info, err)) return (FALSE); /* - Write ISFT info value - FIXME (write libInstPatch?) */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_ISFT, err)) return (FALSE); if (!ipatch_file_write (riff->handle, IPATCH_GIG_INST_ISFT_VAL, strlen (IPATCH_GIG_INST_ISFT_VAL), err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ } else if (!dls_write_info (writer, inst->info, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* write DLSID if its set */ if (inst->dlid) if (!dls_write_dlid (writer, inst->dlid, err)) return (FALSE); /* - write instrument header chunk */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_INSH, err)) return (FALSE); /* region count */ if (!writer->is_gig) ipatch_container_init_iter ((IpatchContainer *)inst, ®ion_iter, IPATCH_TYPE_DLS2_REGION); else ipatch_container_init_iter ((IpatchContainer *)inst, ®ion_iter, IPATCH_TYPE_GIG_REGION); ipatch_file_buf_write_u32 (riff->handle, ipatch_iter_count (®ion_iter)); uint = inst->bank | ((ipatch_item_get_flags (inst) & IPATCH_DLS2_INST_PERCUSSION) ? IPATCH_DLS_INSH_BANK_PERCUSSION : 0); ipatch_file_buf_write_u32 (riff->handle, uint); ipatch_file_buf_write_u32 (riff->handle, inst->program); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* - region list */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_LRGN, err)) return (FALSE); if (!writer->is_gig) retval = dls_write_region_list (writer, inst, err); else retval = gig_write_region_list (writer, IPATCH_GIG_INST (inst), err); if (!retval) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* - Global DLS2 articulator list */ if (inst->conns) { if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_LAR2, err)) return (FALSE); if (!dls_write_art_list (writer, inst->conns, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); } /* */ /* FIXME - Global DLS1 articulators? */ /* if GigaSampler - write 3ewg in lart list (global region params) */ if (writer->is_gig) { /* */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_LART, err)) return (FALSE); /* <3ewg> - GigaSampler 3ewg chunk */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_GIG_FOURCC_3EWG, err)) return (FALSE); if (!ipatch_file_write (riff->handle, &(IPATCH_GIG_INST (inst)->chunk_3ewg), IPATCH_GIG_3EWG_SIZE, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ } if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ inst = ipatch_dls2_inst_next (&iter); /* next instrument */ } /* while (p) - instrument loop */ return (TRUE); } static gboolean dls_write_region_list (IpatchDLSWriter *writer, IpatchDLS2Inst *inst, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchDLS2Region *region; IpatchIter iter; ipatch_container_init_iter ((IpatchContainer *)inst, &iter, IPATCH_TYPE_DLS2_REGION); region = ipatch_dls2_region_first (&iter); while (region) /* loop over regions */ { /* FIXME: DLS1 chunks? */ /* - DLS2 region */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_RGN2, err)) return (FALSE); /* FIXME: - conditional chunk */ if (region->info) { /* - Region info */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_INFO, err)) return (FALSE); if (!dls_write_info (writer, region->info, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); } /* */ /* - Region header */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_RGNH, err)) return (FALSE); if (!dls_write_region_header (writer, region, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ if (region->sample_info) { /* - Global sample info override */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_WSMP, err)) return (FALSE); if (!dls_write_sample_info (writer, region->sample_info, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); } /* */ /* - Wave link */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_WLNK, err)) return (FALSE); if (!dls_write_wave_link (writer, region, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* FIXME: - DLS1 articulators? */ if (region->conns) { /* - DLS2 articulators */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_LAR2, err)) return (FALSE); if (!dls_write_art_list (writer, region->conns, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); } /* */ if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ region = ipatch_dls2_region_next (&iter); } return (TRUE); } static gboolean gig_write_region_list (IpatchDLSWriter *writer, IpatchGigInst *giginst, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchDLS2Inst *inst = IPATCH_DLS2_INST (giginst); IpatchGigRegion *region; IpatchGigSubRegion *subregion; IpatchIter iter; ipatch_container_init_iter ((IpatchContainer *)inst, &iter, IPATCH_TYPE_GIG_REGION); region = ipatch_gig_region_first (&iter); while (region) /* loop over regions */ { /* - GigaSampler region */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_RGN, err)) return (FALSE); if (region->info) { /* - Region info */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_INFO, err)) return (FALSE); if (!dls_write_info (writer, region->info, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); } /* */ /* - Region header */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_RGNH, err)) return (FALSE); if (!gig_write_region_header (writer, region, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ if (region->sub_region_count > 0) subregion = region->sub_regions[0]; else subregion = NULL; /* - This is somewhat of a dummy WSMP chunk. */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_WSMP, err)) return (FALSE); if (!dls_write_sample_info (writer, subregion ? subregion->sample_info : NULL, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* - Wave link */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_WLNK, err)) return (FALSE); if (!gig_write_wave_link (writer, region, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* <3LNK> - GigaSampler dimension info */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_GIG_FOURCC_3LNK, err)) return (FALSE); if (!gig_write_dimension_info (writer, region, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* <3PRG> - GigaSampler regions */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_GIG_FOURCC_3PRG, err)) return (FALSE); if (!gig_write_sub_regions (writer, region, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* <3DNL> - GigaSampler dimension names */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_GIG_FOURCC_3DNL, err)) return (FALSE); if (!gig_write_dimension_names (writer, region, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* FIXME: <3DDP> - what is it? (we preserve it for now) */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_GIG_FOURCC_3DDP, err)) return (FALSE); if (!ipatch_file_write (riff->handle, ®ion->chunk_3ddp, IPATCH_GIG_3DDP_SIZE, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ region = ipatch_gig_region_next (&iter); } return (TRUE); } static gboolean dls_write_art_list (IpatchDLSWriter *writer, GSList *conn_list, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchDLS2Conn *conn; GSList *p; /* <3EWG> - Gig region global params handled elsewhere */ /* FIXME: - Conditional chunk */ /* FIXME: - DLS1 articulators? */ if (!conn_list) return (TRUE); /* no connections? */ /* */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_ART2, err)) return (FALSE); /* write articulator header size */ ipatch_file_buf_write_u32 (riff->handle, IPATCH_DLS_ART_HEADER_SIZE); /* FIXME: Preserve header expansion? */ /* write connection count */ ipatch_file_buf_write_u32 (riff->handle, g_slist_length (conn_list)); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); p = conn_list; while (p) /* write connection blocks */ { conn = (IpatchDLS2Conn *)(p->data); ipatch_file_buf_write_u16 (riff->handle, conn->src); ipatch_file_buf_write_u16 (riff->handle, conn->ctrlsrc); ipatch_file_buf_write_u16 (riff->handle, conn->dest); ipatch_file_buf_write_u16 (riff->handle, conn->trans); ipatch_file_buf_write_s32 (riff->handle, conn->scale); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); p = g_slist_next (p); } if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ return (TRUE); } static gboolean dls_write_region_header (IpatchDLSWriter *writer, IpatchDLS2Region *region, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); guint16 options = 0; ipatch_file_buf_write_u16 (riff->handle, region->note_range_low); ipatch_file_buf_write_u16 (riff->handle, region->note_range_high); ipatch_file_buf_write_u16 (riff->handle, region->velocity_range_low); ipatch_file_buf_write_u16 (riff->handle, region->velocity_range_high); if (ipatch_item_get_flags (region) & IPATCH_DLS2_REGION_SELF_NON_EXCLUSIVE) options |= IPATCH_DLS_RGNH_OPTION_SELF_NON_EXCLUSIVE; ipatch_file_buf_write_u16 (riff->handle, options); ipatch_file_buf_write_u16 (riff->handle, region->key_group); if (region->layer_group != 0) /* optional layer field? */ ipatch_file_buf_write_u16 (riff->handle, region->layer_group); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } static gboolean gig_write_region_header (IpatchDLSWriter *writer, IpatchGigRegion *region, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); guint16 options = 0; ipatch_file_buf_write_u16 (riff->handle, region->note_range_low); ipatch_file_buf_write_u16 (riff->handle, region->note_range_high); ipatch_file_buf_write_u16 (riff->handle, region->velocity_range_low); ipatch_file_buf_write_u16 (riff->handle, region->velocity_range_high); if (ipatch_item_get_flags (region) & IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE) options |= IPATCH_DLS_RGNH_OPTION_SELF_NON_EXCLUSIVE; ipatch_file_buf_write_u16 (riff->handle, options); ipatch_file_buf_write_u16 (riff->handle, region->key_group); if (region->layer_group != 0) /* optional layer field? */ ipatch_file_buf_write_u16 (riff->handle, region->layer_group); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } static gboolean dls_write_wave_link (IpatchDLSWriter *writer, IpatchDLS2Region *region, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); guint16 options = 0; guint flags; guint sample_index = 0; flags = ipatch_item_get_flags (region); if (flags & IPATCH_DLS2_REGION_PHASE_MASTER) options |= IPATCH_DLS_WLNK_PHASE_MASTER; if (flags & IPATCH_DLS2_REGION_MULTI_CHANNEL) options |= IPATCH_DLS_WLNK_MULTI_CHANNEL; ipatch_file_buf_write_u16 (riff->handle, options); ipatch_file_buf_write_u16 (riff->handle, region->phase_group); ipatch_file_buf_write_u32 (riff->handle, region->channel); /* get index of sample (index + 1 actually) */ sample_index = GPOINTER_TO_UINT (g_hash_table_lookup (writer->sample_hash, region->sample)); g_return_val_if_fail (sample_index != 0, FALSE); /* write sample index (subtract 1 since we store it +1 to catch NULL) */ ipatch_file_buf_write_u32 (riff->handle, sample_index - 1); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } static gboolean gig_write_wave_link (IpatchDLSWriter *writer, IpatchGigRegion *region, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchGigSubRegion *subregion; guint16 options = 0; guint flags; guint sample_index = 0; flags = ipatch_item_get_flags (region); if (flags & IPATCH_GIG_REGION_PHASE_MASTER) options |= IPATCH_DLS_WLNK_PHASE_MASTER; if (flags & IPATCH_GIG_REGION_MULTI_CHANNEL) options |= IPATCH_DLS_WLNK_MULTI_CHANNEL; ipatch_file_buf_write_u16 (riff->handle, options); ipatch_file_buf_write_u16 (riff->handle, region->phase_group); ipatch_file_buf_write_u32 (riff->handle, region->channel); if (region->sub_region_count > 0) { subregion = region->sub_regions[0]; sample_index = GPOINTER_TO_UINT (g_hash_table_lookup (writer->sample_hash, subregion->sample)); } g_return_val_if_fail (sample_index != 0, FALSE); /* write sample index (subtract 1 since we store it +1 to catch NULL) */ ipatch_file_buf_write_u32 (riff->handle, sample_index - 1); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* writes sample info, @info may be NULL in which case defaults are used */ static gboolean dls_write_sample_info (IpatchDLSWriter *writer, IpatchDLS2SampleInfo *info, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchDLS2SampleInfo definfo = IPATCH_DLS2_SAMPLE_INFO_INIT; guint loop_type, saveloop_type; guint32 options = 0; /* use default info if not supplied */ if (!info) info = &definfo; /* write structure size */ ipatch_file_buf_write_u32 (riff->handle, IPATCH_DLS_WSMP_HEADER_SIZE); ipatch_file_buf_write_u16 (riff->handle, info->root_note); ipatch_file_buf_write_u16 (riff->handle, info->fine_tune); ipatch_file_buf_write_u32 (riff->handle, info->gain); if (info->options & IPATCH_DLS2_SAMPLE_NO_TRUNCATION) options |= IPATCH_DLS_WSMP_NO_TRUNCATION; if (info->options & IPATCH_DLS2_SAMPLE_NO_COMPRESSION) options |= IPATCH_DLS_WSMP_NO_COMPRESSION; ipatch_file_buf_write_u32 (riff->handle, options); /* FIXME: Preserve header expansion data? */ loop_type = info->options & IPATCH_DLS2_SAMPLE_LOOP_MASK; ipatch_file_buf_write_u32 (riff->handle, (loop_type != IPATCH_SAMPLE_LOOP_NONE) ? 1 : 0); /* loop count */ if (loop_type != IPATCH_SAMPLE_LOOP_NONE) { /* write loop structure size */ ipatch_file_buf_write_u32 (riff->handle, IPATCH_DLS_WSMP_LOOP_SIZE); if (loop_type == IPATCH_SAMPLE_LOOP_RELEASE) saveloop_type = IPATCH_DLS_WSMP_LOOP_RELEASE; else saveloop_type = IPATCH_DLS_WSMP_LOOP_FORWARD; /* default */ ipatch_file_buf_write_u32 (riff->handle, saveloop_type); ipatch_file_buf_write_u32 (riff->handle, info->loop_start); ipatch_file_buf_write_u32 (riff->handle, info->loop_end - info->loop_start); } if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } static gboolean dls_write_sample_format (IpatchDLSWriter *writer, IpatchDLS2Sample *sample, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); int format; int frame_size; int channels; g_return_val_if_fail (sample->sample_data != NULL, FALSE); /* get format from primary store */ format = ipatch_sample_get_format (IPATCH_SAMPLE (sample->sample_data)); frame_size = ipatch_sample_format_size (format); channels = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format); g_return_val_if_fail (channels == 1 || channels == 2, FALSE); /* for right now we just support PCM FIXME - What about floating point?? */ ipatch_file_buf_write_u16 (riff->handle, IPATCH_RIFF_WAVE_FMT_PCM); ipatch_file_buf_write_u16 (riff->handle, channels); /* write channels */ ipatch_file_buf_write_u32 (riff->handle, sample->rate); /* write dwAvgBytesPerSec and wBlockAlign fields */ ipatch_file_buf_write_u32 (riff->handle, frame_size * sample->rate); ipatch_file_buf_write_u16 (riff->handle, frame_size); /* bit width of audio */ ipatch_file_buf_write_u16 (riff->handle, ipatch_sample_format_width (format) * 8); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* write the pool table header and reserve entries for the total number of samples, the entries are fixed up later after the wave pool has been written */ static gboolean dls_reserve_pool_table (IpatchDLSWriter *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); guint count; /* write pool table header size */ if (!ipatch_file_write_u32 (riff->handle, IPATCH_DLS_PTBL_HEADER_SIZE, err)) return (FALSE); /* FIXME: Preserve header expansion? */ count = writer->sample_count; if (!ipatch_file_write_u32 (riff->handle, count, err)) /* write sample cue count */ return (FALSE); /* get position of pool table cues for later fixup */ writer->ptbl_pos = ipatch_file_get_position (riff->handle); /* reserve the pool cues (one for each sample) */ if (!ipatch_file_seek (riff->handle, writer->sample_count * IPATCH_DLS_POOLCUE_SIZE, G_SEEK_CUR, err)) return (FALSE); return (TRUE); } static gboolean dls_fixup_pool_table (IpatchDLSWriter *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); guint32 retpos; retpos = ipatch_file_get_position (riff->handle); /* seek back to pool cue table */ if (!ipatch_file_seek (riff->handle, writer->ptbl_pos, G_SEEK_SET, err)) return (FALSE); /* do endian swap on cue offsets if needed */ if (IPATCH_RIFF_NEED_SWAP (riff)) { guint32 *cuep, *stop; cuep = writer->sample_ofstbl; stop = cuep + writer->sample_count; for (; cuep < stop; cuep++) *cuep = GUINT32_SWAP_LE_BE (*cuep); } /* write the table */ if (!ipatch_file_write (riff->handle, writer->sample_ofstbl, writer->sample_count * 4, err)) return (FALSE); /* seek back to original position */ if (!ipatch_file_seek (riff->handle, retpos, G_SEEK_SET, err)) return (FALSE); return (TRUE); } static gboolean dls_write_wave_pool (IpatchDLSWriter *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchDLS2Sample *sample; IpatchSampleHandle sample_handle; IpatchIter iter; gpointer buf; guint samsize, read_size, ofs; guint index; guint32 start; int dest_fmt, fmt_size; /* start position of wave pool chunk */ start = ipatch_file_get_position (riff->handle); ipatch_container_init_iter (IPATCH_CONTAINER (writer->dls), &iter, IPATCH_TYPE_DLS2_SAMPLE); sample = ipatch_dls2_sample_first (&iter); for (index = 0; sample; index++, sample = ipatch_dls2_sample_next (&iter)) { /* store offset to WAVE list chunk for later pool table fixup */ writer->sample_ofstbl[index] = ipatch_file_get_position (riff->handle) - start; /* - Wave list chunk */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_WAVE, err)) goto err; /* write DLSID if its set */ if (sample->dlid) if (!dls_write_dlid (writer, sample->dlid, err)) return (FALSE); /* - Sample format chunk */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_FMT, err)) goto err; if (!dls_write_sample_format (writer, sample, err)) goto err; if (!ipatch_riff_close_chunk (riff, -1, err)) goto err; /* */ /* - Sample text info */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_DLS_FOURCC_INFO, err)) goto err; if (!writer->is_gig) { if (!dls_write_info (writer, sample->info, err)) goto err; } else if (!gig_write_name_info (writer, sample->info, err)) goto err; if (!ipatch_riff_close_chunk (riff, -1, err)) goto err; /* */ if (!writer->is_gig && sample->sample_info) { /* - Wave sample info chunk */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_WSMP, err)) goto err; if (!dls_write_sample_info (writer, sample->sample_info, err)) goto err; if (!ipatch_riff_close_chunk (riff, -1, err)) goto err; /* */ } /* - Sample data */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_DATA, err)) goto err; samsize = ipatch_sample_get_size (IPATCH_SAMPLE (sample->sample_data), NULL); dest_fmt = ipatch_sample_get_format (IPATCH_SAMPLE (sample->sample_data)); dest_fmt &= IPATCH_SAMPLE_WIDTH_MASK | IPATCH_SAMPLE_CHANNEL_MASK; dest_fmt |= IPATCH_SAMPLE_LENDIAN; /* write 8 or 16 bit data FIXME - Support other bit widths? */ if (IPATCH_SAMPLE_FORMAT_GET_WIDTH (dest_fmt) == IPATCH_SAMPLE_8BIT) dest_fmt |= IPATCH_SAMPLE_UNSIGNED; else if (IPATCH_SAMPLE_FORMAT_GET_WIDTH (dest_fmt) >= IPATCH_SAMPLE_16BIT) { dest_fmt |= IPATCH_SAMPLE_SIGNED; dest_fmt &= ~IPATCH_SAMPLE_WIDTH_MASK; dest_fmt |= IPATCH_SAMPLE_16BIT; } /* frame size of dest format */ fmt_size = ipatch_sample_format_size (dest_fmt); /* ++ Open sample data handle (set transform manually) */ if (!ipatch_sample_handle_open (IPATCH_SAMPLE (sample->sample_data), &sample_handle, 'r', dest_fmt, IPATCH_SAMPLE_UNITY_CHANNEL_MAP, err)) goto err; read_size = ipatch_sample_handle_get_max_frames (&sample_handle); ofs = 0; while (ofs < samsize) { if (samsize - ofs < read_size) /* check for last partial fragment */ read_size = samsize - ofs; /* read and transform (if necessary) audio data from sample store */ if (!(buf = ipatch_sample_handle_read (&sample_handle, ofs, read_size, NULL, err))) { ipatch_sample_handle_close (&sample_handle); /* -- close sample handle */ goto err; } /* write sample data to DLS file */ if (!ipatch_file_write (riff->handle, buf, read_size * fmt_size, err)) { ipatch_sample_handle_close (&sample_handle); /* -- close sample handle */ goto err; } ofs += read_size; } ipatch_sample_handle_close (&sample_handle); /* -- close sample handle */ if (!ipatch_riff_close_chunk (riff, -1, err)) goto err; /* */ if (writer->is_gig) { /* - GigaSampler sample info chunk */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_GIG_FOURCC_SMPL, err)) goto err; if (!gig_write_sample_info (writer, sample->sample_info, sample->rate, err)) goto err; if (!ipatch_riff_close_chunk (riff, -1, err)) goto err; /* */ /* <3GIX> - GigaSampler sample group number */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_GIG_FOURCC_3GIX, err)) goto err; if (!ipatch_file_write_u32 (riff->handle, IPATCH_GIG_SAMPLE (sample)->group_number, err)) goto err; if (!ipatch_riff_close_chunk (riff, -1, err)) goto err; /* */ } if (!ipatch_riff_close_chunk (riff, -1, err)) goto err; /* */ } return (TRUE); err: return (FALSE); } static gboolean dls_write_dlid (IpatchDLSWriter *writer, guint8 *dlid, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); /* FIXME - Generate a new DLSID if needed */ /* - DLSID chunk */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_DLID, err)) return (FALSE); if (!ipatch_file_write (riff->handle, dlid, 16, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ return (TRUE); } static gboolean gig_write_sub_regions (IpatchDLSWriter *writer, IpatchGigRegion *region, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchGigSubRegion *sub_region; int i; for (i=0; i < region->sub_region_count; i++) { /* <3EWL> - GigaSampler sub region list chunk */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_GIG_FOURCC_3EWL, err)) return (FALSE); sub_region = region->sub_regions[i]; /* - GigaSampler sample info chunk */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_DLS_FOURCC_WSMP, err)) return (FALSE); if (!dls_write_sample_info (writer, sub_region->sample_info, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* <3EWA> - GigaSampler effects chunk */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_GIG_FOURCC_3EWA, err)) return (FALSE); ipatch_gig_store_effects (riff->handle, &sub_region->effects); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ } return (TRUE); } static gboolean gig_write_dimension_names (IpatchDLSWriter *writer, IpatchGigRegion *region, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchGigDimension *dim; int i; for (i = 0; i < region->dimension_count; i++) { dim = region->dimensions[i]; if (dim->name && *dim->name) { if (!ipatch_riff_write_chunk (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_FOURCC('n','a','m','0'+i), err)) return (FALSE); if (!ipatch_file_write (riff->handle, dim->name, strlen (dim->name) + 1, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); } } return (TRUE); } /* for now we just use the standard DLS sample info */ static gboolean gig_write_sample_info (IpatchDLSWriter *writer, IpatchDLS2SampleInfo *info, int rate, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); ipatch_file_buf_write_u32 (riff->handle, 0); /* manufacturer */ ipatch_file_buf_write_u32 (riff->handle, 0); /* product */ /* period of 1 sample in nanoseconds (1 / rate * 1,000,000,000) */ ipatch_file_buf_write_u32 (riff->handle, 1000000000 / rate); ipatch_file_buf_write_u32 (riff->handle, info->root_note); /* SMPL chunk stores finetune as an unsigned 32bit fraction of a semitone, so 0x80000000 is 1/2 of a MIDI note. DLS on the other hand uses a 16 bit signed relative pitch value (methinks this is rel_pitch = cents / 100 * 32768, but not sure!! FIXME!!) */ ipatch_file_buf_write_u32 (riff->handle, 0); ipatch_file_buf_write_u32 (riff->handle, 0); /* SMPTE format */ ipatch_file_buf_write_u32 (riff->handle, 0); /* SMPTE offset */ /* loop count */ ipatch_file_buf_write_u32 (riff->handle, info->options == IPATCH_SAMPLE_LOOP_NONE ? 0 : 1); ipatch_file_buf_write_u32 (riff->handle, 0); /* extra data size */ /* loop fields are always written, even when no loop */ ipatch_file_buf_write_u32 (riff->handle, 0); /* loop ID */ /* FIXME - Is there a release WSMP loop type or other types? */ ipatch_file_buf_write_u32 (riff->handle, 0); /* loop type - Normal */ ipatch_file_buf_write_u32 (riff->handle, info->loop_start); /* loop start */ ipatch_file_buf_write_u32 (riff->handle, info->loop_end); /* loop end */ ipatch_file_buf_write_u32 (riff->handle, 0); /* loop sample fraction */ ipatch_file_buf_write_u32 (riff->handle, 0); /* times to loop (0=inf) */ if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } static gboolean gig_write_dimension_info (IpatchDLSWriter *writer, IpatchGigRegion *region, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchGigDimension *dimension; int count, bit_count; guint sample_index; int i; count = region->sub_region_count; ipatch_file_buf_write_u32 (riff->handle, count); /* count of sub regions */ bit_count = 0; for (i = 0; i < region->dimension_count; i++) { dimension = region->dimensions[i]; /* type of dimension */ ipatch_file_buf_write_u8 (riff->handle, dimension->type); /* split bit count */ ipatch_file_buf_write_u8 (riff->handle, dimension->split_count); /* FIXME - 6 bytes of unknown data */ ipatch_file_buf_zero (riff->handle, 6); } /* zero out remaining unused dimensions */ i = (5 - region->dimension_count) * 8; if (i) ipatch_file_buf_zero (riff->handle, i); /* write sub region sample indexes */ for (i = 0; i < region->sub_region_count; i++) { sample_index = GPOINTER_TO_UINT (g_hash_table_lookup (writer->sample_hash, region->sub_regions[i]->sample)); g_return_val_if_fail (sample_index != 0, FALSE); ipatch_file_buf_write_u32 (riff->handle, sample_index - 1); } /* fill remaining sample cue indexes with 0xFFFFFFFF */ i = (32 - region->sub_region_count) * 4; if (i) ipatch_file_buf_memset (riff->handle, 0xFF, i); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* write GigaSampler 3gri chunk (sample group names) */ static gboolean gig_write_group_names (IpatchDLSWriter *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchGig *gig = IPATCH_GIG (writer->dls); char name[IPATCH_GIG_3GNM_SIZE]; GSList *p; /* <3gri> - GigaSampler 3gri list chunk */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_GIG_FOURCC_3GRI, err)) return (FALSE); /* <3gnl> - GigaSampler 3dnl list chunk */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_GIG_FOURCC_3GNL, err)) return (FALSE); for (p = gig->group_names; p; p = p->next) { /* <3gnm> - GigaSampler sample info chunk */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_GIG_FOURCC_3GNM, err)) return (FALSE); /* write the sample group name */ strncpy (name, (char *)(p->data), IPATCH_GIG_3GNM_SIZE); if (!ipatch_file_write (riff->handle, name, IPATCH_GIG_3GNM_SIZE, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ } if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ return (TRUE); } libinstpatch-1.0.0/libinstpatch/IpatchDLSReader.c0000644000175000017500000017714711461332142016661 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchDLSReader.h" #include "IpatchDLSFile.h" #include "IpatchDLS2Region.h" #include "IpatchDLS2Sample.h" #include "IpatchGig.h" #include "IpatchGigEffects.h" #include "IpatchGigFile.h" #include "IpatchGigInst.h" #include "IpatchGigRegion.h" #include "IpatchGigSample.h" #include "IpatchSampleStoreFile.h" #include "IpatchSample.h" #include "ipatch_priv.h" #include "i18n.h" #define DEBUG_DLS g_warning #define DEBUG_DLS_UNKNOWN_CHUNK(parser, level) /* #define DEBUG_DLS_UNKNOWN_CHUNK(parser, level) \ g_warning (ipatch_riff_message_detail (parser, -1, "Unknown chunk")) */ /* a slightly sane cap on the max size of an INFO string (1MB comment anyone?) */ #define IPATCH_DLS_MAX_INFO_SIZE (1024 * 1024) /* a size to use for buffered reads or variable length structures - allocated on stack */ #define VARCHUNK_BUF_SIZE 1024 #define DLS_ERROR_MSG "DLS Reader error: %s" #define SET_SIZE_ERROR(parser, level, err) \ g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_SIZE_MISMATCH,\ _(DLS_ERROR_MSG), \ ipatch_riff_message_detail(parser, -1, "Unexpected chunk size")) #define SET_DATA_ERROR(parser, level, err) \ g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_INVALID_DATA,\ _(DLS_ERROR_MSG), \ ipatch_riff_message_detail (parser, -1, "Invalid data")) static void ipatch_dls_reader_class_init (IpatchDLSReaderClass *klass); static void ipatch_dls_reader_init (IpatchDLSReader *reader); static void ipatch_dls_reader_finalize (GObject *object); static void ipatch_dls_nullify_fixups (IpatchDLSReader *reader); static gboolean assert_loading_gig (IpatchDLSReader *reader, GError **err); /* global variables */ static gpointer parent_class = NULL; GQuark ipatch_dls_reader_error_quark (void) { static GQuark q = 0; if (q == 0) q = g_quark_from_static_string ("DLSReader-error-quark"); return (q); } GType ipatch_dls_reader_get_type (void) { static GType obj_type = 0; if (!obj_type) { static const GTypeInfo obj_info = { sizeof (IpatchDLSReaderClass), NULL, NULL, (GClassInitFunc)ipatch_dls_reader_class_init, NULL, NULL, sizeof (IpatchDLSReader), 0, (GInstanceInitFunc)ipatch_dls_reader_init, }; obj_type = g_type_register_static (IPATCH_TYPE_RIFF, "IpatchDLSReader", &obj_info, 0); } return (obj_type); } static void ipatch_dls_reader_class_init (IpatchDLSReaderClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_peek_parent (klass); obj_class->finalize = ipatch_dls_reader_finalize; } static void ipatch_dls_reader_init (IpatchDLSReader *reader) { reader->dls = NULL; reader->needs_fixup = TRUE; reader->is_gig = FALSE; reader->wave_hash = g_hash_table_new (NULL, NULL); } static void ipatch_dls_reader_finalize (GObject *object) { IpatchDLSReader *reader = IPATCH_DLS_READER (object); /* fixup before destroying so bad things don't happen */ if (reader->needs_fixup) ipatch_dls_nullify_fixups (reader); /* unref the dls object */ if (reader->dls) { g_object_unref (reader->dls); reader->dls = NULL; } g_hash_table_destroy (reader->wave_hash); reader->wave_hash = NULL; g_free (reader->pool_table); reader->pool_table = NULL; G_OBJECT_CLASS (parent_class)->finalize (object); } /** * ipatch_dls_reader_new: * @handle: DLS file handle to parse or %NULL to set later * * Create a new DLS file reader * * Returns: The new DLS reader */ IpatchDLSReader * ipatch_dls_reader_new (IpatchFileHandle *handle) { IpatchDLSReader *reader; g_return_val_if_fail (!handle || IPATCH_IS_DLS_FILE (handle->file), NULL); reader = g_object_new (IPATCH_TYPE_DLS_READER, NULL); if (handle) ipatch_riff_set_file_handle (IPATCH_RIFF (reader), handle); return (reader); } /** * ipatch_dls_reader_load: * @reader: DLS reader object * @err: Location to store error info or %NULL * * Load a DLS file. * * Returns: New DLS object with refcount of 1. */ IpatchDLS2 * ipatch_dls_reader_load (IpatchDLSReader *reader, GError **err) { IpatchRiff *riff; GError *local_err = NULL; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), NULL); riff = IPATCH_RIFF (reader); g_return_val_if_fail (IPATCH_IS_FILE_HANDLE (riff->handle), NULL); g_return_val_if_fail (!err || !*err, NULL); restart: /* to restart parsing if a DLS file turns out to be GigaSampler */ if (!ipatch_dls_reader_start (reader, err)) return (NULL); if (!ipatch_dls_reader_load_level_0 (reader, &local_err)) { /* what was thought to be a DLS file turned out to be GigaSampler? */ if (local_err && local_err->domain == IPATCH_DLS_READER_ERROR && local_err->code == IPATCH_DLS_READER_ERROR_GIG) { g_clear_error (&local_err); /* seek back to beginning of file */ if (!ipatch_file_seek (riff->handle, 0, G_SEEK_SET, err)) return (FALSE); reader->is_gig = TRUE; g_object_unref (reader->dls); reader->dls = NULL; goto restart; /* restart in GigaSampler mode */ } if (local_err) g_propagate_error (err, local_err); return (NULL); } if (!ipatch_dls_reader_fixup (reader, err)) return (NULL); /* ++ ref for caller, finalize() will remove reader's ref */ return (g_object_ref (reader->dls)); } /** * ipatch_dls_reader_start: * @reader: DLS/Gig reader * @err: Location to store error info or %NULL * * Starts parsing a DLS/Gig file. This function only needs to be * called if using an IpatchDLSReader without ipatch_dls_load() * (custom readers). The file object of the @reader must be set * before calling this function. Loads the first "DLS" RIFF chunk to * verify we are loading a DLS file and sets other internal variables. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_dls_reader_start (IpatchDLSReader *reader, GError **err) { IpatchRiff *riff; IpatchRiffChunk *chunk; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), FALSE); riff = IPATCH_RIFF (reader); g_return_val_if_fail (IPATCH_IS_FILE_HANDLE (riff->handle), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* are we parsing a GigaSampler file? */ if (IPATCH_IS_GIG_FILE (riff->handle->file)) reader->is_gig = TRUE; /* start parsing */ if (!(chunk = ipatch_riff_start_read (riff, err))) return (FALSE); if (chunk->id != IPATCH_DLS_FOURCC_DLS) { g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_UNEXPECTED_ID, _("Not a DLS file (RIFF id = '%4s')"), chunk->idstr); return (FALSE); } /* ++ ref new object */ if (reader->is_gig) reader->dls = IPATCH_DLS2 (ipatch_gig_new ()); else reader->dls = ipatch_dls2_new (); ipatch_dls2_set_file (reader->dls, IPATCH_DLS_FILE (riff->handle->file)); return (TRUE); } /** * ipatch_dls_reader_set_pool_table: * @reader: DLS/Gig reader * @pool_table: An array of unsigned 32 bit integers which are file offsets * to samples in a DLS file, can be %NULL if @size is 0 * @size: Number of entries in @pool_table * * Set the pool table of a DLS/Gig reader. This function is only used when * doing manual DLS loading (not using ipatch_dls_load()). The pool table is * used to fixup region sample references which are indexes into the pool * table. */ void ipatch_dls_reader_set_pool_table (IpatchDLSReader *reader, const guint32 pool_table[], guint size) { g_return_if_fail (IPATCH_IS_DLS_READER (reader)); g_return_if_fail (pool_table != NULL || size == 0); g_free (reader->pool_table); reader->pool_table = NULL; if (pool_table && size > 0) { reader->pool_table = g_malloc (size * sizeof (guint32)); memcpy (reader->pool_table, pool_table, size * sizeof (guint32)); } } /** * ipatch_dls_reader_fixup: * @reader: DLS/Gig reader * @err: Location to store error info or %NULL * * Fixup sample pointers in DLS/GigaSampler regions of the DLS object in * @reader. The sample pointers should be sample pool indexes previously * stored by ipatch_dls_load_wave_link() or ipatch_gig_load_dimension_info(). * The pool table must also have been previously loaded for this to make * any sense. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_dls_reader_fixup (IpatchDLSReader *reader, GError **err) { GHashTable *fixup_hash; IpatchDLS2Sample *sample; IpatchDLS2Inst *inst; IpatchDLS2Region *region; IpatchGigRegion *gig_region; IpatchGigSubRegion *sub_region; IpatchIter inst_iter, region_iter; int i; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), FALSE); g_return_val_if_fail (!err || !*err, FALSE); if (!reader->needs_fixup) return (TRUE); /* already fixed up? */ fixup_hash = g_hash_table_new (NULL, NULL); /* create pool table index -> sample hash */ i = 0; while (i < reader->pool_table_size) { sample = g_hash_table_lookup (reader->wave_hash, GINT_TO_POINTER (reader->pool_table[i])); if (sample) g_hash_table_insert (fixup_hash, GINT_TO_POINTER (i), sample); else g_warning ("Invalid wave pool entry (index=%d)", i); i++; } if (!reader->is_gig) /* regular DLS file? (not GigaSampler) */ { /* fixup DLS region sample indexes */ ipatch_container_init_iter ((IpatchContainer *)(reader->dls), &inst_iter, IPATCH_TYPE_DLS2_INST); inst = ipatch_dls2_inst_first (&inst_iter); while (inst) /* loop over instruments */ { ipatch_container_init_iter ((IpatchContainer *)inst, ®ion_iter, IPATCH_TYPE_DLS2_REGION); region = ipatch_dls2_region_first (®ion_iter); while (region) /* loop over instrument regions */ { /* region->sample is pool index (ipatch_dls_load_wave_link) */ sample = g_hash_table_lookup (fixup_hash, region->sample); if (!sample) /* fixup failed? */ { char *name; g_object_get (inst, "name", &name, NULL); g_warning ("Failed to fixup sample for inst '%s' (index=%d)", name ? name : "", GPOINTER_TO_UINT (region->sample)); g_free (name); region->sample = NULL; ipatch_container_remove (IPATCH_CONTAINER (inst), IPATCH_ITEM (region)); } else { region->sample = NULL; ipatch_dls2_region_set_sample (region, sample); } region = ipatch_dls2_region_next (®ion_iter); } /* while (region) region loop */ inst = ipatch_dls2_inst_next (&inst_iter); } /* while (inst) instrument loop */ } else /* reader->is_gig - fixup GigaSampler sub region sample indexes */ { ipatch_container_init_iter ((IpatchContainer *)(reader->dls), &inst_iter, IPATCH_TYPE_GIG_INST); inst = ipatch_dls2_inst_first (&inst_iter); while (inst) /* loop over instruments */ { ipatch_container_init_iter ((IpatchContainer *)inst, ®ion_iter, IPATCH_TYPE_GIG_REGION); gig_region = ipatch_gig_region_first (®ion_iter); while (gig_region) /* loop over instrument regions */ { for (i = 0; i < gig_region->sub_region_count; i++) { sub_region = gig_region->sub_regions[i]; /* fixup sample index (see ipatch_gig_load_dimension_info) */ sample = g_hash_table_lookup (fixup_hash, sub_region->sample); if (!sample) /* fixup failed? */ { char *name; g_object_get (inst, "name", &name, NULL); g_warning ("Failed to fixup sample for inst" " '%s' (index=%d)", name ? name : "", GPOINTER_TO_UINT (sub_region->sample)); g_free (name); sub_region->sample = NULL; } else { sub_region->sample = NULL; ipatch_gig_sub_region_set_sample (sub_region, IPATCH_GIG_SAMPLE (sample)); } } /* for each sub region */ gig_region = ipatch_gig_region_next (®ion_iter); } /* while (gig_region) region loop */ inst = ipatch_dls2_inst_next (&inst_iter); } /* while (inst) instrument loop */ } /* else - GigaSampler file */ g_hash_table_destroy (fixup_hash); /* destroy fixup hash */ reader->needs_fixup = FALSE; return (TRUE); } /* sample index fixups have to be cleared on error, so problems don't occur when DLS object is finalized */ static void ipatch_dls_nullify_fixups (IpatchDLSReader *reader) { IpatchDLS2Inst *inst; IpatchDLS2Region *region; IpatchIter inst_iter, region_iter; int i; ipatch_container_init_iter ((IpatchContainer *)(reader->dls), &inst_iter, reader->is_gig ? IPATCH_TYPE_GIG_INST : IPATCH_TYPE_DLS2_INST); inst = ipatch_dls2_inst_first (&inst_iter); while (inst) /* loop over instruments */ { ipatch_container_init_iter ((IpatchContainer *)inst, ®ion_iter, reader->is_gig ? IPATCH_TYPE_GIG_REGION : IPATCH_TYPE_DLS2_REGION); region = ipatch_dls2_region_first (®ion_iter); while (region) /* loop over instrument regions */ { region->sample = NULL; if (reader->is_gig) /* NULLify GigaSampler sample indexes */ { IpatchGigRegion *gig_region = IPATCH_GIG_REGION (region); for (i = 0; i < gig_region->sub_region_count; i++) gig_region->sub_regions[i]->sample = NULL; } region = ipatch_dls2_region_next (®ion_iter); } inst = ipatch_dls2_inst_next (&inst_iter); } } /* called before GigaSampler related stuff to ensure that we are already in GigaSampler mode, if not then an error is returned which signals the ipatch_dls_load() routine to restart in GigaSampler mode */ static gboolean assert_loading_gig (IpatchDLSReader *reader, GError **err) { if (reader->is_gig) return (TRUE); g_set_error (err, IPATCH_DLS_READER_ERROR, IPATCH_DLS_READER_ERROR_GIG, "GigaSampler file detected, restart loading in gig mode"); return (FALSE); } /** * ipatch_dls_reader_load_level_0: * @reader: DLS/Gig reader * @err: Location to store error info or %NULL * * Load the top level DLS chunk of a DLS or GigaSampler file (essentially * the entire file except the toplevel chunk itself). * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_dls_reader_load_level_0 (IpatchDLSReader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; GError *local_err = NULL; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), FALSE); g_return_val_if_fail (!err || !*err, FALSE); while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_LIST) { switch (chunk->id) { case IPATCH_DLS_FOURCC_LINS: /* instrument list */ if (!ipatch_dls_reader_load_inst_list (reader, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_WVPL: /* wave pool list (sample data) */ case IPATCH_DLS_FOURCC_DWPL: /* WTF? - Seen in some DLS1 files */ if (!ipatch_dls_reader_load_wave_pool (reader, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_INFO: /* toplevel INFO */ if (!ipatch_dls_load_info (riff, &reader->dls->info, err)) return (FALSE); break; case IPATCH_GIG_FOURCC_3GRI: if (!assert_loading_gig (reader, err)) return (FALSE); if (!ipatch_gig_load_group_names (riff, &(IPATCH_GIG (reader->dls)->group_names), err)) return (FALSE); break; default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } else /* a sub chunk */ { switch (chunk->id) { case IPATCH_DLS_FOURCC_CDL: /* toplevel conditional chunk */ DEBUG_DLS ("Toplevel DLS CDL chunk!\n"); break; case IPATCH_DLS_FOURCC_VERS: /* file version chunk */ if (chunk->size != IPATCH_DLS_VERS_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_buf_load (riff->handle, IPATCH_DLS_VERS_SIZE, err)) return (FALSE); reader->dls->ms_version = ipatch_file_buf_read_u32 (riff->handle); reader->dls->ls_version = ipatch_file_buf_read_u32 (riff->handle); ipatch_item_set_flags (IPATCH_ITEM (reader->dls), IPATCH_DLS2_VERSION_SET); break; case IPATCH_DLS_FOURCC_DLID: /* globally unique identifier */ if (!reader->dls->dlid) reader->dls->dlid = g_malloc (16); if (!ipatch_dls_load_dlid (riff, reader->dls->dlid, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_COLH: /* collection header (inst count) */ /* we don't care since instruments are dynamically loaded */ break; case IPATCH_DLS_FOURCC_PTBL: /* pool table (sample mappings) */ reader->pool_table = ipatch_dls_load_pool_table (riff, &reader->pool_table_size, &local_err); if (local_err) { g_propagate_error (err, local_err); return (FALSE); } break; case IPATCH_GIG_FOURCC_EINF: /* FIXME - unknown */ break; default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } return (ipatch_riff_get_error (riff, NULL)); } /** * ipatch_dls_reader_load_inst_list: * @reader: DLS/Gig reader * @err: Location to store error info or %NULL * * Loads DLS or GigaSampler instrument list from the current position in * the file assigned to @reader. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_dls_reader_load_inst_list (IpatchDLSReader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; IpatchIter iter; guint32 uint; gboolean retval; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* initialize iterator to instrument list */ ipatch_container_init_iter (IPATCH_CONTAINER (reader->dls), &iter, reader->is_gig ? IPATCH_TYPE_GIG_INST : IPATCH_TYPE_DLS2_INST); while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_LIST && /* an INS list? */ chunk->id == IPATCH_DLS_FOURCC_INS) { IpatchDLS2Inst *inst; /* ++ ref new instrument and append it in DLS2/Gig object */ if (reader->is_gig) inst = IPATCH_DLS2_INST (ipatch_gig_inst_new ()); else inst = ipatch_dls2_inst_new (); ipatch_container_insert_iter ((IpatchContainer *)(reader->dls), (IpatchItem *)inst, &iter); g_object_unref (inst); /* -- unref new instrument (parented) */ while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_LIST) { switch (chunk->id) /* list chunk? */ { case IPATCH_DLS_FOURCC_LRGN: /* region list */ if (!reader->is_gig) retval = ipatch_dls_reader_load_region_list (reader, inst, err); else retval = ipatch_gig_reader_load_region_list (reader, IPATCH_GIG_INST (inst), err); if (!retval) return (FALSE); break; case IPATCH_DLS_FOURCC_LART: /* DLS1 articulator list */ if (reader->is_gig) { /* load GigaSampler 3ewg chunk */ if (!ipatch_gig_reader_load_inst_lart (reader, IPATCH_GIG_INST (inst), err)) return (FALSE); break; } /* fall through */ case IPATCH_DLS_FOURCC_LAR2: /* DLS2 articulator list */ if (!ipatch_dls_reader_load_art_list (reader, &inst->conns, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_INFO: /* instrument INFO */ if (!ipatch_dls_load_info (riff, &inst->info, err)) return (FALSE); break; default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } else /* sub chunk */ { switch (chunk->id) { case IPATCH_DLS_FOURCC_INSH: /* instrument header */ if (chunk->size != IPATCH_DLS_INSH_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_buf_load (riff->handle, chunk->size, err)) return (FALSE); /* we ignore the region count */ ipatch_file_buf_skip (riff->handle, 4); uint = ipatch_file_buf_read_u32 (riff->handle); inst->bank = uint & IPATCH_DLS_INSH_BANK_MASK; if (uint & IPATCH_DLS_INSH_BANK_PERCUSSION) ipatch_item_set_flags (inst, IPATCH_DLS2_INST_PERCUSSION); inst->program = ipatch_file_buf_read_u32 (riff->handle); break; case IPATCH_DLS_FOURCC_DLID: /* globally unique ID */ if (!inst->dlid) inst->dlid = g_malloc (16); if (!ipatch_dls_load_dlid (riff, inst->dlid, err)) return (FALSE); break; default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } inst->conns = g_slist_reverse (inst->conns); if (!ipatch_riff_get_error (riff, NULL)) return (FALSE); } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } return (ipatch_riff_get_error (riff, NULL)); } /** * ipatch_dls_reader_load_region_list: * @reader: DLS reader * @inst: DLS instrument to fill with loaded regions * @err: Location to store error info or %NULL * * Loads DLS region list into an @inst object from the current * position in the file assigned to @reader. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_dls_reader_load_region_list (IpatchDLSReader *reader, IpatchDLS2Inst *inst, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchIter iter; IpatchRiffChunk *chunk; IpatchDLS2Region *region; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), FALSE); g_return_val_if_fail (IPATCH_IS_DLS2_INST (inst), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* initialize iterator to DLS2 region list */ ipatch_container_init_iter (IPATCH_CONTAINER (inst), &iter, IPATCH_TYPE_DLS2_REGION); while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_LIST && (chunk->id == IPATCH_DLS_FOURCC_RGN || chunk->id == IPATCH_DLS_FOURCC_RGN2)) { region = ipatch_dls2_region_new (); ipatch_container_insert_iter ((IpatchContainer *)inst, (IpatchItem *)region, &iter); g_object_unref (region); /* -- unref new region (parented) */ while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_LIST) /* list chunk? */ { switch (chunk->id) { case IPATCH_DLS_FOURCC_LART: case IPATCH_DLS_FOURCC_LAR2: if (!ipatch_dls_reader_load_art_list (reader, ®ion->conns, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_INFO: if (!ipatch_dls_load_info (riff, ®ion->info, err)) return (FALSE); break; case IPATCH_GIG_FOURCC_3PRG: /* gig sub region list */ assert_loading_gig (reader, err); return (FALSE); case IPATCH_GIG_FOURCC_3DNL: /* dimension names */ assert_loading_gig (reader, err); return (FALSE); default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } else /* sub chunk */ { switch (chunk->id) { case IPATCH_DLS_FOURCC_RGNH: if (!ipatch_dls_load_region_header (riff, region, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_WLNK: if (!ipatch_dls_load_wave_link (riff, region, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_WSMP: if (!region->sample_info) /* for sanity */ region->sample_info = ipatch_dls2_sample_info_new (); if (!ipatch_dls_load_sample_info (riff, region->sample_info, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_CDL: DEBUG_DLS ("Region CDL chunk!\n"); break; case IPATCH_GIG_FOURCC_3LNK: /* Gig dimension info */ assert_loading_gig (reader, err); return (FALSE); break; case IPATCH_GIG_FOURCC_3DDP: /* FIXME - what is it? */ assert_loading_gig (reader, err); return (FALSE); default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } if (!ipatch_riff_get_error (riff, NULL)) return (FALSE); } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } return (ipatch_riff_get_error (riff, NULL)); } /** * ipatch_gig_reader_load_region_list: * @reader: DLS/Gig reader * @giginst: Gig instrument to fill with loaded regions * @err: Location to store error info or %NULL * * Loads GigaSampler region list into an @inst object from the current * position in the file assigned to @reader. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_gig_reader_load_region_list (IpatchDLSReader *reader, IpatchGigInst *giginst, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchIter iter; IpatchRiffChunk *chunk; IpatchDLS2Inst *inst; IpatchGigRegion *region; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), FALSE); g_return_val_if_fail (IPATCH_IS_GIG_INST (giginst), FALSE); g_return_val_if_fail (!err || !*err, FALSE); inst = IPATCH_DLS2_INST (giginst); /* initialize iterator to Gig region list */ ipatch_container_init_iter (IPATCH_CONTAINER (inst), &iter, IPATCH_TYPE_GIG_REGION); while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_LIST && (chunk->id == IPATCH_DLS_FOURCC_RGN || chunk->id == IPATCH_DLS_FOURCC_RGN2)) { region = ipatch_gig_region_new (); ipatch_container_insert_iter ((IpatchContainer *)inst, (IpatchItem *)region, &iter); g_object_unref (region); /* -- unref new region (parented) */ while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_LIST) /* list chunk? */ { switch (chunk->id) { case IPATCH_DLS_FOURCC_INFO: if (!ipatch_dls_load_info (riff, ®ion->info, err)) return (FALSE); break; case IPATCH_GIG_FOURCC_3PRG: /* gig sub region list */ if (!ipatch_gig_reader_load_sub_regions (reader, region, err)) return (FALSE); break; case IPATCH_GIG_FOURCC_3DNL: /* dimension names */ if (!ipatch_gig_load_dimension_names (riff, region, err)) return (FALSE); break; default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } else /* sub chunk */ { switch (chunk->id) { case IPATCH_DLS_FOURCC_RGNH: if (!ipatch_gig_load_region_header (riff, region, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_WLNK: /* ignore WLNK chunks with GigaSampler files */ break; case IPATCH_DLS_FOURCC_WSMP: /* ignore useless sample info for GigaSampler files */ break; case IPATCH_DLS_FOURCC_CDL: DEBUG_DLS ("Region CDL chunk!\n"); break; case IPATCH_GIG_FOURCC_3LNK: /* dimension info */ if (!ipatch_gig_load_dimension_info (riff, region, err)) return (FALSE); break; case IPATCH_GIG_FOURCC_3DDP: /* FIXME - what is it? */ if (chunk->size == IPATCH_GIG_3DDP_SIZE) if (!ipatch_file_read (riff->handle, &(IPATCH_GIG_REGION (region)->chunk_3ddp), IPATCH_GIG_3DDP_SIZE, err)) return (FALSE); break; default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } if (!ipatch_riff_get_error (riff, NULL)) return (FALSE); } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } return (ipatch_riff_get_error (riff, NULL)); } /** * ipatch_dls_reader_load_art_list: * @reader: DLS/Gig reader * @conn_list: Pointer to a list to populate * @err: Location to store error info or %NULL * * Loads DLS or GigaSampler articulator list from the current position in * the file assigned to @reader. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_dls_reader_load_art_list (IpatchDLSReader *reader, GSList **conn_list, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), FALSE); g_return_val_if_fail (conn_list != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_SUB) { switch (chunk->id) { case IPATCH_DLS_FOURCC_ART1: case IPATCH_DLS_FOURCC_ART2: if (!ipatch_dls_load_connection (riff, conn_list, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_CDL: DEBUG_DLS ("Articulator CDL chunk!\n"); break; default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } return (ipatch_riff_get_error (riff, NULL)); } /** * ipatch_dls_reader_load_wave_pool: * @reader: DLS/Gig reader * @err: Location to store error info or %NULL * * Loads DLS or GigaSampler wave pool ("wvpl" chunk) from the current position * in the file assigned to @reader. Populates the @reader wave pool hash with * sample offsets for later fixup. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_dls_reader_load_wave_pool (IpatchDLSReader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; IpatchDLS2Sample *sample; IpatchSampleData *sampledata; IpatchSample *store; IpatchIter iter; guint data_ofs, wave_ofs, data_size; int bitwidth; int channels; int format; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* initialize iterator to sample list */ ipatch_container_init_iter (IPATCH_CONTAINER (reader->dls), &iter, IPATCH_TYPE_DLS2_SAMPLE); while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_LIST && chunk->id == IPATCH_DLS_FOURCC_WAVE) { /* offset to wave LIST header in wave pool chunk */ wave_ofs = chunk[-1].position - (IPATCH_RIFF_LIST_HEADER_SIZE + IPATCH_RIFF_FOURCC_SIZE); if (!reader->is_gig) sample = ipatch_dls2_sample_new (); /* ++ ref and add new sample */ else /* ++ ref new gig sample */ sample = IPATCH_DLS2_SAMPLE (ipatch_gig_sample_new ()); ipatch_container_insert_iter ((IpatchContainer *)(reader->dls), (IpatchItem *)sample, &iter); g_object_unref (sample); /* -- unref new sample */ data_size = 0; data_ofs = 0; bitwidth = 0; channels = 0; while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_SUB) /* sub chunk? */ { switch (chunk->id) { case IPATCH_DLS_FOURCC_FMT: if (!ipatch_dls_load_sample_format (riff, sample, &bitwidth, &channels, err)) return (FALSE); break; case IPATCH_DLS_FOURCC_DATA: /* position in file to sample data */ data_ofs = ipatch_riff_get_position (riff); data_size = chunk->size; break; case IPATCH_DLS_FOURCC_WSMP: if (!sample->sample_info) /* for sanity */ sample->sample_info = ipatch_dls2_sample_info_new (); if (!ipatch_dls_load_sample_info (riff, sample->sample_info, err)) return (FALSE); break; case IPATCH_GIG_FOURCC_SMPL: /* GigaSampler sample info */ /* Have seen in non gig files, just ignore it then */ if (!reader->is_gig) break; if (!sample->sample_info) /* for sanity */ sample->sample_info = ipatch_dls2_sample_info_new (); if (!ipatch_gig_load_sample_info (riff, sample->sample_info, err)) return (FALSE); break; case IPATCH_GIG_FOURCC_3GIX: if (!assert_loading_gig (reader, err)) return (FALSE); if (chunk->size == IPATCH_GIG_3GIX_SIZE) { /* Sample group # - FIXME - Is it really 32 bits? */ if (!ipatch_file_read_u32 (riff->handle, &(IPATCH_GIG_SAMPLE (sample)->group_number), err)) return (FALSE); } break; case IPATCH_DLS_FOURCC_DLID: if (!sample->dlid) sample->dlid = g_malloc (16); if (!ipatch_dls_load_dlid (riff, sample->dlid, err)) return (FALSE); break; default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } else if (chunk->id == IPATCH_DLS_FOURCC_INFO) /* info list? */ { if (!ipatch_dls_load_info (riff, &sample->info, err)) return (FALSE); } else DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } /* while() - wave LIST chunk */ if (!ipatch_riff_get_error (riff, NULL)) return (FALSE); /* format and data chunks processed? */ if (bitwidth && channels && data_size && data_ofs) { /* convert data size to samples */ data_size = data_size / (bitwidth / 8) / channels; /* add wave LIST chunk offset to wave hash (fixup later) */ g_hash_table_insert (reader->wave_hash, GUINT_TO_POINTER (wave_ofs), sample); format = (bitwidth == 8 ? IPATCH_SAMPLE_8BIT : IPATCH_SAMPLE_16BIT) | (channels == 2 ? IPATCH_SAMPLE_STEREO : IPATCH_SAMPLE_MONO) | (bitwidth == 8 ? IPATCH_SAMPLE_UNSIGNED : IPATCH_SAMPLE_SIGNED) | IPATCH_SAMPLE_LENDIAN; /* ++ ref new store */ store = ipatch_sample_store_file_new (riff->handle->file, data_ofs); g_object_set (store, "sample-size", data_size, "sample-format", format, "sample-rate", sample->rate, NULL); sampledata = ipatch_sample_data_new (); /* ++ ref sample data */ ipatch_sample_data_add (sampledata, IPATCH_SAMPLE_STORE (store)); ipatch_dls2_sample_set_data (sample, sampledata); g_object_unref (store); /* -- unref store */ g_object_unref (sampledata); /* -- unref sampledata */ } else { /* !!! don't use sample after removed */ g_warning (_("Invalid sample")); ipatch_item_remove ((IpatchItem *)sample); } } /* if wave LIST chunk */ if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } /* while() - wave pool */ return (ipatch_riff_get_error (riff, NULL)); } /** * ipatch_gig_reader_load_sub_regions: * @reader: Gig reader * @region: Gig region to load GigaSampler sub regions into * @err: Location to store error info or %NULL * * Loads GigaSampler sub regions ("3prg" chunk) from the current position * in the file assigned to @reader. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_gig_reader_load_sub_regions (IpatchDLSReader *reader, IpatchGigRegion *region, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; IpatchGigSubRegion *sub_region; int sub_region_index = 0; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), FALSE); g_return_val_if_fail (IPATCH_IS_GIG_REGION (region), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* loop in "3prg" chunk */ while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_LIST && chunk->id == IPATCH_GIG_FOURCC_3EWL) { /* loop in "3ewl" chunk */ if (sub_region_index >= region->sub_region_count) { /* shouldn't happen, but just in case */ g_warning ("GigaSampler sub region count mismatch"); if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); break; } sub_region = region->sub_regions[sub_region_index]; while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_SUB) /* sub chunk? */ { switch (chunk->id) { case IPATCH_DLS_FOURCC_WSMP: /* ipatch_gig_sub_region_set_sample_info_override would probably be cleaner, but sub_region->sample might not be valid (index that is fixed up later) */ if (!sub_region->sample_info) { sub_region->sample_info = ipatch_dls2_sample_info_new (); ipatch_item_set_flags (sub_region, IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE); } if (!ipatch_dls_load_sample_info (riff, sub_region->sample_info, err)) return (FALSE); break; case IPATCH_GIG_FOURCC_3EWA: /* GigaSampler effects */ if (chunk->size != IPATCH_GIG_3EWA_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } /* load effects chunk into buffer */ if (!ipatch_file_buf_load (riff->handle, IPATCH_GIG_3EWA_SIZE, err)) return (FALSE); ipatch_gig_parse_effects (riff->handle, &sub_region->effects); break; default: DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); break; } } else DEBUG_DLS_UNKNOWN_CHUNK (riff, -1); if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } /* while() - "3ewl" LIST chunk */ if (!ipatch_riff_get_error (riff, NULL)) return (FALSE); sub_region_index++; /* advance to next sub region */ } /* if "3ewl" LIST chunk */ if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } /* while() - "3prg" chunk */ return (ipatch_riff_get_error (riff, NULL)); } /** * ipatch_gig_reader_load_inst_lart: * @reader: Gig reader * @err: Location to store error info or %NULL * * Loads a GigaSampler global parameter chunk '3ewg' from an instrument 'lart' * list. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_gig_reader_load_inst_lart (IpatchDLSReader *reader, IpatchGigInst *inst, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; g_return_val_if_fail (IPATCH_IS_DLS_READER (reader), FALSE); g_return_val_if_fail (IPATCH_IS_GIG_INST (inst), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* no chunks? - return */ if (!(chunk = ipatch_riff_read_chunk (riff, err))) return (ipatch_riff_get_error (riff, NULL)); /* not a '3ewg' chunk? - return */ if (chunk->type != IPATCH_RIFF_CHUNK_SUB || chunk->id != IPATCH_GIG_FOURCC_3EWG || chunk->size != IPATCH_GIG_3EWG_SIZE) { if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /* read the 3ewg chunk data */ if (!ipatch_file_read (riff->handle, &inst->chunk_3ewg, IPATCH_GIG_3EWG_SIZE, err)) return (FALSE); if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /** * ipatch_dls_load_info: * @riff: RIFF parser * @info: Pointer to DLS info list * @err: Location to store error info or %NULL * * Loads DLS or GigaSampler info from the current position in the file * assigned to @riff. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_dls_load_info (IpatchRiff *riff, IpatchDLS2Info **info, GError **err) { IpatchRiffChunk *chunk; guint32 size; char *str; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (info != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_SUB && chunk->size > 0) { size = chunk->size; if (size > IPATCH_DLS_MAX_INFO_SIZE) size = IPATCH_DLS_MAX_INFO_SIZE; str = g_malloc (size); if (!ipatch_file_read (riff->handle, str, size, err)) { g_free (str); return (FALSE); } str[size - 1] = '\0'; /* force terminate in case it isn't */ ipatch_dls2_info_set (info, chunk->id, str); g_free (str); } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } return (ipatch_riff_get_error (riff, NULL)); } /** * ipatch_dls_load_region_header: * @riff: RIFF parser * @region: DLS region to store header info in * @err: Location to store error info or %NULL * * Loads DLS instrument region header ("rgnh" chunk) * from the current position in the file assigned to @riff. The "rgnh" chunk * header should have already been loaded. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_dls_load_region_header (IpatchRiff *riff, IpatchDLS2Region *region, GError **err) { IpatchRiffChunk *chunk; guint16 options; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (IPATCH_IS_DLS2_REGION (region), FALSE); g_return_val_if_fail (!err || !*err, FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size != IPATCH_DLS_RGNH_SIZE && chunk->size != IPATCH_DLS_RGNH_LAYER_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_buf_load (riff->handle, chunk->size, err)) return (FALSE); region->note_range_low = ipatch_file_buf_read_u16 (riff->handle); region->note_range_high = ipatch_file_buf_read_u16 (riff->handle); region->velocity_range_low = ipatch_file_buf_read_u16 (riff->handle); region->velocity_range_high = ipatch_file_buf_read_u16 (riff->handle); /* ISOK? Undefined flags are discarded! */ options = ipatch_file_buf_read_u16 (riff->handle); if (options & IPATCH_DLS_RGNH_OPTION_SELF_NON_EXCLUSIVE) ipatch_item_set_flags (region, IPATCH_DLS2_REGION_SELF_NON_EXCLUSIVE); region->key_group = ipatch_file_buf_read_u16 (riff->handle); if (chunk->size == IPATCH_DLS_RGNH_LAYER_SIZE) /* optional layer field? */ region->layer_group = ipatch_file_buf_read_u16 (riff->handle); return (TRUE); } /** * ipatch_gig_load_region_header: * @riff: RIFF parser * @region: Gig region to store header info in * @err: Location to store error info or %NULL * * Loads GigaSampler instrument region header ("rgnh" chunk) * from the current position in the file assigned to @riff. The "rgnh" chunk * header should have already been loaded. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_gig_load_region_header (IpatchRiff *riff, IpatchGigRegion *region, GError **err) { IpatchRiffChunk *chunk; guint16 options; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (IPATCH_IS_GIG_REGION (region), FALSE); g_return_val_if_fail (!err || !*err, FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size != IPATCH_DLS_RGNH_SIZE && chunk->size != IPATCH_DLS_RGNH_LAYER_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_buf_load (riff->handle, chunk->size, err)) return (FALSE); region->note_range_low = ipatch_file_buf_read_u16 (riff->handle); region->note_range_high = ipatch_file_buf_read_u16 (riff->handle); region->velocity_range_low = ipatch_file_buf_read_u16 (riff->handle); region->velocity_range_high = ipatch_file_buf_read_u16 (riff->handle); /* ISOK? Undefined flags are discarded! */ options = ipatch_file_buf_read_u16 (riff->handle); if (options & IPATCH_DLS_RGNH_OPTION_SELF_NON_EXCLUSIVE) ipatch_item_set_flags (region, IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE); region->key_group = ipatch_file_buf_read_u16 (riff->handle); if (chunk->size == IPATCH_DLS_RGNH_LAYER_SIZE) /* optional layer field? */ region->layer_group = ipatch_file_buf_read_u16 (riff->handle); return (TRUE); } /** * ipatch_dls_load_wave_link: * @riff: RIFF parser * @region: DLS region to load info into * @err: Location to store error info or %NULL * * Loads DLS wave link chunk ("wlnk" chunk) from the current position in the * file assigned to @riff. The "wlnk" chunk header should have already been * loaded. * * NOTE: Sample pool index is stored in @region sample pointer. This index * should be fixed up or cleared before the region is freed otherwise bad * things will happen. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_dls_load_wave_link (IpatchRiff *riff, IpatchDLS2Region *region, GError **err) { IpatchRiffChunk *chunk; guint16 options; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (IPATCH_IS_DLS2_REGION (region), FALSE); g_return_val_if_fail (!err || !*err, FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size != IPATCH_DLS_WLNK_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_buf_load (riff->handle, chunk->size, err)) return (FALSE); /* ISOK? Undefined flags are discarded! */ options = ipatch_file_buf_read_u16 (riff->handle); if (options & IPATCH_DLS_WLNK_PHASE_MASTER) ipatch_item_set_flags (region, IPATCH_DLS2_REGION_PHASE_MASTER); if (options & IPATCH_DLS_WLNK_MULTI_CHANNEL) ipatch_item_set_flags (region, IPATCH_DLS2_REGION_MULTI_CHANNEL); region->phase_group = ipatch_file_buf_read_u16 (riff->handle); region->channel = ipatch_file_buf_read_u32 (riff->handle); /* store sample pool index in sample pointer (for later fixup) */ region->sample = GINT_TO_POINTER (ipatch_file_buf_read_u32 (riff->handle)); return (TRUE); } /** * ipatch_dls_load_sample_info: * @riff: RIFF parser * @info: Sample info structure to load info into * @err: Location to store error info or %NULL * * Loads DLS or GigaSampler sample info ("wsmp" chunk) from the * current position in the file assigned to @riff. The "wsmp" chunk header * should already have been loaded. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_dls_load_sample_info (IpatchRiff *riff, IpatchDLS2SampleInfo *info, GError **err) { IpatchRiffChunk *chunk; guint32 options, struct_size, loop_count, loop_type; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (info != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size > VARCHUNK_BUF_SIZE || chunk->size < IPATCH_DLS_WSMP_HEADER_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_buf_load (riff->handle, chunk->size, err)) return (FALSE); struct_size = ipatch_file_buf_read_u32 (riff->handle); if (struct_size < IPATCH_DLS_WSMP_HEADER_SIZE || struct_size & 1) { /* structure size sanity check */ SET_DATA_ERROR (riff, -1, err); return (FALSE); } info->root_note = (guint8)ipatch_file_buf_read_u16 (riff->handle); info->fine_tune = ipatch_file_buf_read_u16 (riff->handle); info->gain = ipatch_file_buf_read_u32 (riff->handle); /* ISOK? Undefined flags are discarded! */ options = ipatch_file_buf_read_u32 (riff->handle); if (options & IPATCH_DLS_WSMP_NO_TRUNCATION) info->options |= IPATCH_DLS2_SAMPLE_NO_TRUNCATION; if (options & IPATCH_DLS_WSMP_NO_COMPRESSION) info->options |= IPATCH_DLS2_SAMPLE_NO_COMPRESSION; /* skip header expansion data (if any) */ ipatch_file_buf_skip (riff->handle, struct_size - IPATCH_DLS_WSMP_HEADER_SIZE); loop_count = ipatch_file_buf_read_u32 (riff->handle); /* we only support 1 loop, but work even if > 1 (spec says undefined) */ if (loop_count > 0 && chunk->size >= struct_size + IPATCH_DLS_WSMP_LOOP_SIZE) { ipatch_file_buf_skip (riff->handle, 4); /* skip loop structure size */ loop_type = ipatch_file_buf_read_u32 (riff->handle); if (loop_type == IPATCH_DLS_WSMP_LOOP_RELEASE) info->options |= IPATCH_SAMPLE_LOOP_RELEASE; else info->options |= IPATCH_SAMPLE_LOOP_STANDARD; /* default */ info->loop_start = ipatch_file_buf_read_u32 (riff->handle); info->loop_end = info->loop_start + ipatch_file_buf_read_u32 (riff->handle); } return (TRUE); } /** * ipatch_dls_load_connection: * @riff: RIFF parser * @conn_list: Pointer to a list to populate with loaded #IpatchDLS2Conn * structures. * @err: Location to store error info or %NULL * * Load a DLS articulator chunk ("art1" or "art2") containing connection * blocks which are loded into @conn_list. The articulation chunk header * should already have been loaded. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_dls_load_connection (IpatchRiff *riff, GSList **conn_list, GError **err) { IpatchDLS2Conn *conn; IpatchRiffChunk *chunk; int header_size, count, i; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (conn_list != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size < IPATCH_DLS_ART_HEADER_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_buf_load (riff->handle, IPATCH_DLS_ART_HEADER_SIZE, err)) return (FALSE); header_size = ipatch_file_buf_read_u32 (riff->handle); if (header_size < IPATCH_DLS_ART_HEADER_SIZE || header_size & 1) { /* make sure art header size is sane */ SET_DATA_ERROR (riff, -1, err); return (FALSE); } /* check for header expansion */ if (header_size > IPATCH_DLS_ART_HEADER_SIZE) { /* skip expansion data */ if (!ipatch_file_seek (riff->handle, header_size - IPATCH_DLS_ART_HEADER_SIZE, G_SEEK_CUR, err)) return (FALSE); /* load connection count (last field before connection blocks) */ if (!ipatch_file_buf_load (riff->handle, 4, err)) return (FALSE); } count = ipatch_file_buf_read_u32 (riff->handle); if (chunk->size != header_size + count * IPATCH_DLS_CONN_SIZE) { /* make sure connection block count is sane */ SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!count) return (TRUE); if (!ipatch_file_buf_load (riff->handle, chunk->size - header_size, err)) return (FALSE); for (i = count; i > 0; i--) /* parse connection blocks */ { conn = ipatch_dls2_conn_new (); *conn_list = g_slist_prepend (*conn_list, conn); conn->src = ipatch_file_buf_read_u16 (riff->handle); conn->ctrlsrc = ipatch_file_buf_read_u16 (riff->handle); conn->dest = ipatch_file_buf_read_u16 (riff->handle); conn->trans = ipatch_file_buf_read_u16 (riff->handle); conn->scale = ipatch_file_buf_read_s32 (riff->handle); } return (TRUE); } /** * ipatch_dls_load_sample_format: * @riff: RIFF parser * @sample: DLS sample to load data into * @bitwidth: Pointer to an integer to fill with the sample's bit width or * %NULL * @channels: Pointer to an integer to fill with the number of channels or * %NULL * @err: Location to store error info or %NULL * * Parses DLS sample format info ("fmt " chunk) from the current * position in the file assigned to the @riff (chunk header should already * be loaded). * * Returns: %TRUE on success, %FALSE on error (in which case @err may be set). */ gboolean ipatch_dls_load_sample_format (IpatchRiff *riff, IpatchDLS2Sample *sample, int *bitwidth, int *channels, GError **err) { IpatchRiffChunk *chunk; guint16 i16; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (IPATCH_IS_DLS2_SAMPLE (sample), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* since it seems there are various length FMT chunks, we only assert that it is at least the size of the default PCM format chunk. sizes seen: (18 bytes..) */ chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size < IPATCH_DLS_WAVE_FMT_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_buf_load (riff->handle, IPATCH_DLS_WAVE_FMT_SIZE, err)) return (FALSE); i16 = ipatch_file_buf_read_u16 (riff->handle); if (i16 != IPATCH_RIFF_WAVE_FMT_PCM) /* assert PCM wave data */ { SET_DATA_ERROR (riff, -1, err); return (FALSE); } i16 = ipatch_file_buf_read_u16 (riff->handle); if (i16 != 1 && i16 != 2) /* assert 1 or 2 channel data */ { SET_DATA_ERROR (riff, -1, err); return (FALSE); } if (channels) *channels = i16; sample->rate = ipatch_file_buf_read_u32 (riff->handle); /* skip useless dwAvgBytesPerSec and wBlockAlign fields */ ipatch_file_buf_skip (riff->handle, 6); /* load bit width */ i16 = ipatch_file_buf_read_u16 (riff->handle); if (i16 != 8 && i16 != 16) /* FIXME - Support higher bit widths */ { SET_DATA_ERROR (riff, -1, err); return (FALSE); } if (bitwidth) *bitwidth = i16; return (TRUE); } /** * ipatch_dls_load_pool_table: * @riff: RIFF parser * @size: Pointer to an unsigned integer to store number of entries in * returned pool table array * @err: Location to store error info or %NULL * * Load a sample pool table ("ptbl" chunk) of a DLS or GigaSampler * file from the current position in the file assigned to @riff (chunk * header should already be loaded). * * Returns: A newly allocated array of 32bit integers for each entry * in the pool table, or %NULL if empty pool table or on error (in * which case @err may be set). Free the table when finished with it. */ guint32 * ipatch_dls_load_pool_table (IpatchRiff *riff, guint *size, GError **err) { IpatchRiffChunk *chunk; guint32 *cuep, *tmpcuep; guint header_size, count; if (size) *size = 0; g_return_val_if_fail (IPATCH_IS_RIFF (riff), NULL); g_return_val_if_fail (size != NULL, NULL); g_return_val_if_fail (!err || !*err, NULL); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size < IPATCH_DLS_PTBL_HEADER_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (NULL); } if (!ipatch_file_buf_load (riff->handle, IPATCH_DLS_PTBL_HEADER_SIZE, err)) return (NULL); header_size = ipatch_file_buf_read_u32 (riff->handle); if (header_size < IPATCH_DLS_PTBL_HEADER_SIZE || header_size & 1) { /* make sure art header size is sane */ SET_DATA_ERROR (riff, -1, err); return (NULL); } /* check for header expansion */ if (header_size > IPATCH_DLS_PTBL_HEADER_SIZE) { /* skip expansion data */ if (!ipatch_file_seek (riff->handle, header_size - IPATCH_DLS_PTBL_HEADER_SIZE, G_SEEK_CUR, err)) return (NULL); /* load cue count (last field before cue offsets) */ if (!ipatch_file_buf_load (riff->handle, 4, err)) return (NULL); } count = ipatch_file_buf_read_u32 (riff->handle); if (chunk->size != header_size + count * IPATCH_DLS_POOLCUE_SIZE) { /* make sure pool cue count is sane */ SET_SIZE_ERROR (riff, -1, err); return (NULL); } if (!count) return (NULL); /* no pool table? */ cuep = g_malloc (chunk->size - header_size); /* load pool cue offsets */ if (!ipatch_file_read (riff->handle, cuep, chunk->size - header_size, err)) { g_free (cuep); return (NULL); } *size = count; /* do endian swap on cue offsets if needed */ if (IPATCH_RIFF_NEED_SWAP (riff)) { tmpcuep = cuep; while (count-- > 0) { *tmpcuep = GUINT32_SWAP_LE_BE (*tmpcuep); tmpcuep++; } } return (cuep); } /** * ipatch_dls_load_dlid: * @riff: Riff parser * @dlid: Location to store 16 byte DLSID * @err: Location to store error info or %NULL * * Load a DLSID from the current position in a riff object. This is a * 16 byte unique ID used for tracking data changes. The "dlid" header * should have already been loaded. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_dls_load_dlid (IpatchRiff *riff, guint8 *dlid, GError **err) { IpatchRiffChunk *chunk; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (dlid != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size != 16) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_read (riff->handle, dlid, 16, err)) return (FALSE); return (TRUE); } /** * ipatch_gig_load_sample_info: * @riff: RIFF parser * @info: DLS sample info to load data into * @err: Location to store error info or %NULL * * Load Gig sample info ("smpl" chunk) from current position in file assigned * to @riff (chunk header should already be loaded). * * Returns: %TRUE on success, %FALSE on error (in which case @err may be set). */ gboolean ipatch_gig_load_sample_info (IpatchRiff *riff, IpatchDLS2SampleInfo *info, GError **err) { IpatchRiffChunk *chunk; guint32 loop_count; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (info != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size != IPATCH_GIG_SMPL_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_buf_load (riff->handle, IPATCH_GIG_SMPL_SIZE, err)) return (FALSE); ipatch_file_buf_read_u32 (riff->handle); /* manufacturer */ ipatch_file_buf_read_u32 (riff->handle); /* product */ ipatch_file_buf_read_u32 (riff->handle); /* sample period in nanoseconds */ info->root_note = (guint8)ipatch_file_buf_read_u32 (riff->handle); /* FIXME - Is this an unsigned 32 bit fraction of a semitone? */ info->fine_tune = (guint16)ipatch_file_buf_read_u32 (riff->handle); ipatch_file_buf_read_u32 (riff->handle); /* SMPTE format */ ipatch_file_buf_read_u32 (riff->handle); /* SMPTE offset */ loop_count = ipatch_file_buf_read_u32 (riff->handle); ipatch_file_buf_read_u32 (riff->handle); /* manufBytes */ ipatch_file_buf_read_u32 (riff->handle); /* loop ID */ if (loop_count > 0) /* we only use 1 loop if it exists */ { ipatch_file_buf_read_u32 (riff->handle); /* loop type - FIXME! */ info->options |= IPATCH_SAMPLE_LOOP_STANDARD; info->loop_start = ipatch_file_buf_read_u32 (riff->handle); info->loop_end = ipatch_file_buf_read_u32 (riff->handle); } return (TRUE); } /** * ipatch_gig_load_dimension_info: * @riff: RIFF parser * @region: Region to load data into * @err: Location to store an error or %NULL * * Load Gigasampler dimension info ("3lnk" chunk), from the current position * in the file assigned to @riff (chunk header should already be loaded). * * NOTE: Sample pool table indexes are stored in the sample pointer of * sub regions. These indexes should be fixed up or cleared before the * @region is freed, otherwise bad things will happen. * * Returns: %TRUE on success, %FALSE on error (in which case @err may be set). */ gboolean ipatch_gig_load_dimension_info (IpatchRiff *riff, IpatchGigRegion *region, GError **err) { IpatchRiffChunk *chunk; int count, temp_count, split_count; guint8 type, c; int i; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (IPATCH_IS_GIG_REGION (region), FALSE); g_return_val_if_fail (!err || !*err, FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size != IPATCH_GIG_3LNK_SIZE) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } if (!ipatch_file_buf_load (riff->handle, IPATCH_GIG_3LNK_SIZE, err)) return (FALSE); count = ipatch_file_buf_read_u32 (riff->handle); /* count of sub regions */ if (count < 1 || count > 32) /* should be between 1 and 32 sub regions */ { SET_DATA_ERROR (riff, -1, err); return (FALSE); } /* calculate number of used split bits */ temp_count = count; split_count = 0; while (!(temp_count & 1)) { temp_count >>= 1; split_count++; } if (temp_count != 1) /* make sure count is a power of 2 */ { SET_DATA_ERROR (riff, -1, err); return (FALSE); } while (split_count > 0) { type = ipatch_file_buf_read_u8 (riff->handle); /* type of dimension */ if (type > IPATCH_GIG_DIMENSION_TYPE_MAX) DEBUG_DLS ("Unknown GigaSampler dimension type '0x%x'", type); c = ipatch_file_buf_read_u8 (riff->handle); /* split bit count */ ipatch_file_buf_skip (riff->handle, 6); /* FIXME - skip ignored stuff */ ipatch_gig_region_new_dimension (region, type, c); split_count -= c; } if (split_count != 0) /* a split bit count is messed up? */ { SET_DATA_ERROR (riff, -1, err); return (FALSE); } /* "seek" to sample cue list */ ipatch_file_buf_seek (riff->handle, 44, G_SEEK_SET); /* store sample indexes to sub region sample pointer fields (fixup later) */ for (i = 0; i < region->sub_region_count; i++) region->sub_regions[i]->sample = GUINT_TO_POINTER (ipatch_file_buf_read_u32 (riff->handle)); return (TRUE); } /** * ipatch_gig_load_dimension_names: * @riff: RIFF parser * @region: Gig region to load names into * @err: Location to store error info or %NULL * * Loads Gigasampler dimension names from the current position in the file * assigned to @riff. The "3dnl" chunk header should already have been * loaded. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_gig_load_dimension_names (IpatchRiff *riff, IpatchGigRegion *region, GError **err) { IpatchRiffChunk *chunk; char name[256]; /* just use a static buffer for name */ int i, size; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (IPATCH_IS_GIG_REGION (region), FALSE); g_return_val_if_fail (!err || !*err, FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size == 0) return (TRUE); /* no dimension names */ while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_SUB && strncmp (chunk->idstr, "nam", 3) == 0 && chunk->size > 0) { /* 4th char of FOURCC is dimension index */ i = chunk->idstr[3] - '0'; if (i >= 0 && i < region->dimension_count) { size = MIN (chunk->size, 255); if (!ipatch_file_read (riff->handle, name, size, err)) return (FALSE); name[size] = '\0'; if (name[0] != '\0') g_object_set (region->dimensions[i], "name", name, NULL); } } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } return (ipatch_riff_get_error (riff, NULL)); } /** * ipatch_gig_load_group_names: * @riff: Riff parser * @name_list: List to add names to * @err: Location to store error info or %NULL * * Load a '3gri' sample group name chunk into a GSList of strings. The * 3gri chunk header should have already been loaded. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_gig_load_group_names (IpatchRiff *riff, GSList **name_list, GError **err) { IpatchRiffChunk *chunk; char buf[65], *name; int size; GSList *p; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (name_list != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* no chunks? - return */ if (!(chunk = ipatch_riff_read_chunk (riff, err))) return (ipatch_riff_get_error (riff, NULL)); /* not a '3gnl' chunk? - return */ if (chunk->type != IPATCH_RIFF_CHUNK_LIST || chunk->id != IPATCH_GIG_FOURCC_3GNL) { if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /* loop over 3gnm chunks */ while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_SUB && chunk->id == IPATCH_GIG_FOURCC_3GNM) { size = MIN (chunk->size, sizeof (buf) - 1); if (!ipatch_file_read (riff->handle, &buf, size, err)) goto err; buf[sizeof(buf) - 1] = '\0'; size = strlen (buf); if (size > 0) { name = g_memdup (buf, size + 1); *name_list = g_slist_append (*name_list, name); } } if (!ipatch_riff_end_chunk (riff, err)) goto err; } /* make sure no errors occured */ if (!ipatch_riff_get_error (riff, NULL)) return (FALSE); if (!ipatch_riff_end_chunk (riff, err)) goto err; return (TRUE); err: /* free any existing names */ p = *name_list; while (p) { g_free (p->data); p = g_slist_delete_link (p, p); } *name_list = NULL; return (FALSE); } libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreSndFile.h0000644000175000017500000000706511461332142020613 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleStoreSndFile * @short_description: Sample store object type which uses libsndfile to access * audio in sound files * @see_also: * @stability: Stable */ #ifndef __IPATCH_SAMPLE_STORE_SND_FILE_H__ #define __IPATCH_SAMPLE_STORE_SND_FILE_H__ #include #include #include #include /* forward type declarations */ typedef struct _IpatchSampleStoreSndFile IpatchSampleStoreSndFile; typedef struct _IpatchSampleStoreSndFileClass IpatchSampleStoreSndFileClass; #define IPATCH_TYPE_SAMPLE_STORE_SND_FILE (ipatch_sample_store_snd_file_get_type ()) #define IPATCH_SAMPLE_STORE_SND_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_STORE_SND_FILE, \ IpatchSampleStoreSndFile)) #define IPATCH_SAMPLE_STORE_SND_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_STORE_SND_FILE, \ IpatchSampleStoreSndFileClass)) #define IPATCH_IS_SAMPLE_STORE_SND_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_STORE_SND_FILE)) #define IPATCH_IS_SAMPLE_STORE_SND_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_STORE_SND_FILE)) /* libsndfile sample instance */ struct _IpatchSampleStoreSndFile { IpatchSampleStore parent_instance; char *filename; /* File name where sample data is */ gboolean identified; /* TRUE if file has been identified (for reading) */ gboolean raw; /* TRUE if audio data is read raw from libsndfile */ int file_format; /* File format enum (enum is dynamic) */ int sub_format; /* File sub format enum (enum is dynamic) */ int endian; /* File endian byte order enum */ guint loop_start; /* loop start */ guint loop_end; /* loop end */ guint8 loop_type; /* loop type */ guint8 root_note; /* root note */ gint8 fine_tune; /* fine tune */ }; /* libsndfile sample class */ struct _IpatchSampleStoreSndFileClass { IpatchSampleStoreClass parent_class; }; /* we reserve 3 flags for expansion */ #define IPATCH_SAMPLE_STORE_SND_FILE_UNUSED_FLAG_SHIFT \ (IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT + 3) GType ipatch_sample_store_snd_file_get_type (void); IpatchSample *ipatch_sample_store_snd_file_new (const char *filename); gboolean ipatch_sample_store_snd_file_init_read (IpatchSampleStoreSndFile *store); gboolean ipatch_sample_store_snd_file_init_write (IpatchSampleStoreSndFile *store, int file_format, int sub_format, int endian, int channels, int samplerate); #endif libinstpatch-1.0.0/libinstpatch/IpatchGigInst.h0000644000175000017500000000510111461332142016441 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchGigInst * @short_description: GigaSampler instrument object * @see_also: * @stability: Stable * * GigaSampler instrument objects are the toplevel instrument objects in a * GigaSampler file. */ #ifndef __IPATCH_GIG_INST_H__ #define __IPATCH_GIG_INST_H__ #include #include /* forward type declarations */ typedef struct _IpatchGigInst IpatchGigInst; typedef struct _IpatchGigInstClass IpatchGigInstClass; typedef struct _IpatchGigInstParams IpatchGigInstParams; #include #define IPATCH_TYPE_GIG_INST (ipatch_gig_inst_get_type ()) #define IPATCH_GIG_INST(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_GIG_INST, \ IpatchGigInst)) #define IPATCH_GIG_INST_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_GIG_INST, \ IpatchGigInstClass)) #define IPATCH_IS_GIG_INST(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_GIG_INST)) #define IPATCH_IS_GIG_INST_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_GIG_INST)) #define IPATCH_GIG_INST_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_GIG_INST, \ IpatchGigInstClass)) /* GigaSampler instrument object */ struct _IpatchGigInst { IpatchDLS2Inst parent_instance; guint32 attenuate; guint16 effect_send; guint16 fine_tune; guint16 pitch_bend_range; guint8 dim_key_start; /* bit 1: piano release */ guint8 dim_key_end; guint8 chunk_3ewg[12]; /* 3ewg chunk - FIXME what is it? */ }; struct _IpatchGigInstClass { IpatchDLS2InstClass parent_class; }; GType ipatch_gig_inst_get_type (void); IpatchGigInst *ipatch_gig_inst_new (void); IpatchGigInst *ipatch_gig_inst_first (IpatchIter *iter); IpatchGigInst *ipatch_gig_inst_next (IpatchIter *iter); #endif libinstpatch-1.0.0/libinstpatch/IpatchPaste.h0000644000175000017500000001427311461332142016163 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchPaste * @short_description: Object paste instance * @see_also: * @stability: Stable * * This object provides a system and instance for doing cut/paste operations * on instrument items. */ #ifndef __IPATCH_PASTE_H__ #define __IPATCH_PASTE_H__ #include #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchPaste IpatchPaste; typedef struct _IpatchPasteClass IpatchPasteClass; #define IPATCH_TYPE_PASTE (ipatch_paste_get_type ()) #define IPATCH_PASTE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_PASTE, IpatchPaste)) #define IPATCH_PASTE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_PASTE, IpatchPasteClass)) #define IPATCH_IS_PASTE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_PASTE)) #define IPATCH_IS_PASTE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_PASTE)) #define IPATCH_PASTE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_PASTE, IpatchPasteClass)) /* paste instance */ struct _IpatchPaste { GObject parent_instance; /* derived from GObject */ /* only available during a paste operation */ IpatchItem *dest; /* current destination */ /*< private >*/ GSList *add_list; /* list of AddItemBag operations */ GSList *add_list_last; /* last item in add_list for append optimization */ GHashTable *add_hash; /* hash of original -> AddItemBag (see IpatchPaste.c) */ GSList *link_list; /* list of LinkItemBag operations (in reverse order) */ }; /* conversion class */ struct _IpatchPasteClass { GObjectClass parent_class; }; /* choice values for when a item conflict occurs */ typedef enum { IPATCH_PASTE_CHOICE_IGNORE, /* item will be pasted (conflict remains) */ IPATCH_PASTE_CHOICE_REPLACE, /* replace item */ IPATCH_PASTE_CHOICE_KEEP, /* keep existing item (reverse replace) */ IPATCH_PASTE_CHOICE_CANCEL /* cancel the current operation */ } IpatchPasteChoice; /** * IpatchPasteTestFunc: * @dest: Destination item of paste operation * @src: Source item of paste operation * * Test if a paste handler can handle the paste operation. * * Returns: %TRUE if paste supported by this handler, %FALSE otherwise */ typedef gboolean (*IpatchPasteTestFunc)(IpatchItem *dest, IpatchItem *src); /** * IpatchPasteExecFunc: * @paste: Paste object * @dest: Destination item of paste operation * @src: Source item of paste operation * @err: Location to store error information * * Perform the construction phase of the paste operation. This includes every * action up to the point of actually adding/linking objects. All object * addition and linking operations are stored in @paste instance to be executed * after resolving conflicts, etc. * * Returns: %TRUE on success, %FALSE on error (in which case @err may be set). */ typedef gboolean (*IpatchPasteExecFunc)(IpatchPaste *paste, IpatchItem *dest, IpatchItem *src, GError **err); /** * IpatchPasteResolveFunc: * @paste: Paste instance * @conflict: Existing conflict item * @item: Conflicting item being pasted * * Function type used to handle paste item conflicts. * * Returns: Return a choice value for how the conflict should be handled. */ typedef IpatchPasteChoice (*IpatchPasteResolveFunc) (IpatchPaste *paste, IpatchItem *conflict, IpatchItem *item); /* priority levels for paste handlers */ typedef enum { /* 0 value is an alias for IPATCH_PASTE_PRIORITY_DEFAULT */ IPATCH_PASTE_PRIORITY_LOWEST = 1, IPATCH_PASTE_PRIORITY_LOW = 25, IPATCH_PASTE_PRIORITY_DEFAULT = 50, IPATCH_PASTE_PRIORITY_HIGH = 75, IPATCH_PASTE_PRIORITY_HIGHEST = 100 } IpatchPastePriority; #define IPATCH_PASTE_FLAGS_PRIORITY_MASK 0x7F void ipatch_register_paste_handler (IpatchPasteTestFunc test_func, IpatchPasteExecFunc exec_func, int flags); gboolean ipatch_is_paste_possible (IpatchItem *dest, IpatchItem *src); gboolean ipatch_simple_paste (IpatchItem *dest, IpatchItem *src, GError **err); GType ipatch_paste_get_type (void); IpatchPaste *ipatch_paste_new (void); gboolean ipatch_paste_objects (IpatchPaste *paste, IpatchItem *dest, IpatchItem *src, GError **err); gboolean ipatch_paste_resolve (IpatchPaste *paste, IpatchPasteResolveFunc resolve_func, gpointer user_data); gboolean ipatch_paste_finish (IpatchPaste *paste, GError **err); IpatchList *ipatch_paste_get_add_list (IpatchPaste *paste); void ipatch_paste_object_add (IpatchPaste *paste, IpatchItem *additem, IpatchContainer *parent, IpatchItem *orig); IpatchItem *ipatch_paste_object_add_duplicate (IpatchPaste *paste, IpatchItem *item, IpatchContainer *parent); IpatchItem *ipatch_paste_object_add_duplicate_deep (IpatchPaste *paste, IpatchItem *item, IpatchContainer *parent); gboolean ipatch_paste_object_add_convert (IpatchPaste *paste, GType conv_type, IpatchItem *item, IpatchContainer *parent, IpatchList **item_list, GError **err); void ipatch_paste_object_link (IpatchPaste *paste, IpatchItem *from, IpatchItem *to); gboolean ipatch_paste_default_test_func (IpatchItem *dest, IpatchItem *src); gboolean ipatch_paste_default_exec_func (IpatchPaste *paste, IpatchItem *dest, IpatchItem *src, GError **err); #endif libinstpatch-1.0.0/libinstpatch/IpatchVBankInst.h0000644000175000017500000000647311461332142016751 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchVBankInst * @short_description: VBank instrument item * @see_also: #IpatchVBank * @stability: Stable * * VBank instruments are children of #IpatchVBank objects and define individual * instruments mapped to MIDI bank/program numbers and which reference items * in other instrument files. */ #ifndef __IPATCH_VBANK_INST_H__ #define __IPATCH_VBANK_INST_H__ #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchVBankInst IpatchVBankInst; typedef struct _IpatchVBankInstClass IpatchVBankInstClass; #define IPATCH_TYPE_VBANK_INST (ipatch_vbank_inst_get_type ()) #define IPATCH_VBANK_INST(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_VBANK_INST, \ IpatchVBankInst)) #define IPATCH_VBANK_INST_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_VBANK_INST, \ IpatchVBankInstClass)) #define IPATCH_IS_VBANK_INST(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VBANK_INST)) #define IPATCH_IS_VBANK_INST_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_VBANK_INST)) #define IPATCH_VBANK_INST_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_VBANK_INST, \ IpatchVBankInstClass)) /* Virtual bank instrument item */ struct _IpatchVBankInst { IpatchContainer parent_instance; char *name; /* name of instrument */ guint16 bank; /* MIDI bank map number */ guint16 program; /* MIDI program number */ GSList *regions; /* list of instrument regions */ }; struct _IpatchVBankInstClass { IpatchContainerClass parent_class; }; /** * IPATCH_VBANK_INST_NAME_SIZE: * * Maximum length of a virtual bank instrument name. */ #define IPATCH_VBANK_INST_NAME_SIZE 64 GType ipatch_vbank_inst_get_type (void); IpatchVBankInst *ipatch_vbank_inst_new (void); #define ipatch_vbank_inst_get_regions(inst) \ ipatch_container_get_children (IPATCH_CONTAINER (inst), \ IPATCH_TYPE_VBANK_REGION) IpatchVBankInst *ipatch_vbank_inst_first (IpatchIter *iter); IpatchVBankInst *ipatch_vbank_inst_next (IpatchIter *iter); void ipatch_vbank_inst_new_region (IpatchVBankInst *inst, IpatchItem *item); void ipatch_vbank_inst_set_midi_locale (IpatchVBankInst *inst, int bank, int program); void ipatch_vbank_inst_get_midi_locale (IpatchVBankInst *inst, int *bank, int *program); int ipatch_vbank_inst_compare (const IpatchVBankInst *p1, const IpatchVBankInst *p2); #endif libinstpatch-1.0.0/libinstpatch/IpatchGig.h0000644000175000017500000000437111461332142015613 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchGig * @short_description: GigaSampler instrument file object * @see_also: * @stability: Stable * * Defines a GigaSampler instrument file object. */ #ifndef __IPATCH_GIG_H__ #define __IPATCH_GIG_H__ #include #include /* NOTE: See IpatchGigFile.h for some info on GigaSampler file format */ typedef struct _IpatchGig IpatchGig; typedef struct _IpatchGigClass IpatchGigClass; #include #include #define IPATCH_TYPE_GIG (ipatch_gig_get_type ()) #define IPATCH_GIG(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_GIG, IpatchGig)) #define IPATCH_GIG_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_GIG, IpatchGigClass)) #define IPATCH_IS_GIG(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_GIG)) #define IPATCH_IS_GIG_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_GIG)) #define IPATCH_GIG_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_GIG, IpatchGigClass)) /* GigaSampler object */ struct _IpatchGig { IpatchDLS2 parent_instance; /* derived from DLS2 object */ GSList *group_names; /* sample group names */ }; struct _IpatchGigClass { IpatchDLS2Class parent_class; }; /* Default GigaSampler sample group name */ #define IPATCH_GIG_DEFAULT_SAMPLE_GROUP_NAME "Default Sample Group" GType ipatch_gig_get_type (void); IpatchGig *ipatch_gig_new (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2VoiceCache_SF2.c0000644000175000017500000003311011461332142020047 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSF2VoiceCache_SF2.h" #include "IpatchConverter.h" #include "IpatchConverterSF2VoiceCache.h" #include "IpatchConverter_priv.h" #include "IpatchSF2Inst.h" #include "IpatchSF2IZone.h" #include "IpatchSF2Preset.h" #include "IpatchSF2PZone.h" #include "IpatchSF2Sample.h" #include "IpatchSF2VoiceCache.h" #include "IpatchSF2Zone.h" #include "IpatchSF2GenItem.h" void _ipatch_sf2_voice_cache_init_SF2 (void) { g_type_class_ref (IPATCH_TYPE_CONVERTER_SF2_PRESET_TO_SF2_VOICE_CACHE); g_type_class_ref (IPATCH_TYPE_CONVERTER_SF2_PZONE_TO_SF2_VOICE_CACHE); g_type_class_ref (IPATCH_TYPE_CONVERTER_SF2_INST_TO_SF2_VOICE_CACHE); g_type_class_ref (IPATCH_TYPE_CONVERTER_SF2_IZONE_TO_SF2_VOICE_CACHE); g_type_class_ref (IPATCH_TYPE_CONVERTER_SF2_SAMPLE_TO_SF2_VOICE_CACHE); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_SF2_PRESET_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_SF2_PRESET, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_SF2_PZONE_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_SF2_PZONE, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_SF2_INST_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_SF2_INST, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_SF2_IZONE_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_SF2_IZONE, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_SF2_SAMPLE_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_SF2_SAMPLE, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); } static gboolean _sf2_preset_to_sf2_voice_cache_convert (IpatchConverter *converter, GError **err) { IpatchSF2Preset *preset; IpatchSF2Inst *inst; IpatchSF2VoiceCache *cache; IpatchSF2Voice *voice; IpatchSF2GenArray *gpz; IpatchSF2GenArray pz; IpatchSF2GenArray *giz; IpatchSF2Zone *pzone, *izone; IpatchSF2Sample *sample; IpatchSF2GenAmount *amt; IpatchItem *solo_item; GObject *obj; GSList *gpmods = NULL, *pmods; /* global and preset modulator lists */ GSList *gimods; /* global and instrument modulator lists */ GSList *imods; /* local instrument modulators */ const GSList *defmods; /* default modulator list */ GSList *p, *p2; obj = IPATCH_CONVERTER_INPUT (converter); cache = IPATCH_SF2_VOICE_CACHE (IPATCH_CONVERTER_OUTPUT (converter)); solo_item = ((IpatchConverterSF2VoiceCache *)converter)->solo_item; /* check if its a preset zone or a preset */ if (IPATCH_IS_SF2_PZONE (obj)) /* ++ ref parent preset */ preset = IPATCH_SF2_PRESET (ipatch_item_get_parent (IPATCH_ITEM (obj))); else preset = IPATCH_SF2_PRESET (obj); /* declare the preset as a dependent item */ ipatch_sf2_voice_cache_declare_item (cache, (GObject *)preset); defmods = cache->default_mods; /* get default mod list */ IPATCH_ITEM_RLOCK (preset); /* ++ LOCK preset */ /* global generators and modulators (can access as long as preset is locked) */ gpz = &preset->genarray; gpmods = preset->mods; for (p = preset->zones; p; p = p->next) /* loop over preset zones */ { pzone = (IpatchSF2Zone *)(p->data); /* If a zone is currently solo, skip other zones */ if (solo_item && (IpatchItem *)pzone != solo_item) continue; ipatch_sf2_voice_cache_declare_item (cache, (GObject *)pzone); /* copy def/global gen values */ memcpy (&pz, gpz, sizeof (IpatchSF2GenArray)); IPATCH_ITEM_RLOCK (pzone); /* ++ LOCK preset zone */ inst = (IpatchSF2Inst *)(pzone->item); if (!inst) /* skip any zones without instrument ref */ { IPATCH_ITEM_RUNLOCK (pzone); continue; } ipatch_sf2_gen_item_copy_set ((IpatchSF2GenItem *)pzone, &pz); /* process pzone */ if (pzone->mods) pmods = ipatch_sf2_mod_list_override (gpmods, pzone->mods, FALSE); else pmods = gpmods; IPATCH_ITEM_RLOCK (inst); /* ++ LOCK inst */ /* process global generators and modulators */ giz = &inst->genarray; if (inst->mods) /* can use modulators while inst is locked (no copy) */ gimods = ipatch_sf2_mod_list_override (defmods, inst->mods, FALSE); /* ++ alloc new mod list */ else gimods = (GSList *)defmods; p2 = inst->zones; for (; p2; p2 = p2->next) /* loop over instrument zones */ { izone = (IpatchSF2Zone *)(p2->data); ipatch_sf2_voice_cache_declare_item (cache, (GObject *)izone); IPATCH_ITEM_RLOCK (izone); /* ++ LOCK izone */ sample = (IpatchSF2Sample *)(izone->item); /* skip zones without sample or which don't note/velocity intersect */ if (!sample || !ipatch_sf2_gen_item_intersect_test ((IpatchSF2GenItem *)izone, &pz)) { IPATCH_ITEM_RUNLOCK (izone); continue; } voice = ipatch_sf2_voice_cache_add_voice (cache); /* copy global inst gen values */ memcpy (&voice->gen_array, giz, sizeof (IpatchSF2GenArray)); /* zone overrides */ ipatch_sf2_gen_item_copy_set ((IpatchSF2GenItem *)izone, &voice->gen_array); if (izone->mods) /* ++ override global/def mods with zone (no copy) */ imods = ipatch_sf2_mod_list_override (gimods, izone->mods, FALSE); else imods = gimods; /* igens += pgens */ ipatch_sf2_gen_array_offset (&voice->gen_array, &pz); /* ++ new modulator list of imods + pmods */ voice->mod_list = ipatch_sf2_mod_list_offset (imods, pmods); /* set MIDI note and velocity ranges */ amt = &voice->gen_array.values[IPATCH_SF2_GEN_NOTE_RANGE]; ipatch_sf2_voice_cache_set_voice_range (cache, voice, 0, amt->range.low, amt->range.high); amt = &voice->gen_array.values[IPATCH_SF2_GEN_VELOCITY_RANGE]; ipatch_sf2_voice_cache_set_voice_range (cache, voice, 1, amt->range.low, amt->range.high); /* copy sample parameters */ ipatch_sf2_voice_cache_declare_item (cache, (GObject *)sample); ipatch_sf2_voice_set_sample_data (voice, sample->sample_data); voice->loop_start = sample->loop_start; voice->loop_end = sample->loop_end; voice->rate = sample->rate; voice->root_note = sample->root_note; voice->fine_tune = sample->fine_tune; IPATCH_ITEM_RUNLOCK (izone); /* -- UNLOCK izone */ /* free imods if not == gimods (only list, since mod data not copied) */ if (imods != gimods) ipatch_sf2_mod_list_free (imods, FALSE); } IPATCH_ITEM_RUNLOCK (inst); /* -- UNLOCK inst */ IPATCH_ITEM_RUNLOCK (pzone); /* -- UNLOCK preset zone */ /* free gimods if not defmods (mod data was not copied) */ if (gimods != defmods) ipatch_sf2_mod_list_free (gimods, FALSE); /* free pmods list if not gpmods (mod data was not copied) */ if (pmods != gpmods) ipatch_sf2_mod_list_free (pmods, FALSE); } IPATCH_ITEM_RUNLOCK (preset); /* -- UNLOCK preset */ /* if convert object was preset zone, unref parent preset */ if ((void *)obj != (void *)preset) g_object_unref (preset); /* -- unref parent preset */ return (TRUE); } /* use preset to voice cache converter function */ #define _sf2_pzone_to_sf2_voice_cache_convert \ _sf2_preset_to_sf2_voice_cache_convert static gboolean _sf2_inst_to_sf2_voice_cache_convert (IpatchConverter *converter, GError **err) { IpatchSF2Inst *inst; IpatchSF2VoiceCache *cache; IpatchSF2Voice *voice; IpatchSF2GenArray *giz; IpatchSF2Zone *izone; IpatchSF2Sample *sample; IpatchSF2GenAmount *amt; GObject *obj; GSList *gimods = NULL; const GSList *defmods; IpatchItem *solo_item; GSList *p; obj = IPATCH_CONVERTER_INPUT (converter); cache = IPATCH_SF2_VOICE_CACHE (IPATCH_CONVERTER_OUTPUT (converter)); solo_item = ((IpatchConverterSF2VoiceCache *)converter)->solo_item; /* check if its a instrument zone or a instrument */ if (IPATCH_IS_SF2_IZONE (obj)) /* ++ ref parent instrument */ inst = IPATCH_SF2_INST (ipatch_item_get_parent (IPATCH_ITEM (obj))); else inst = IPATCH_SF2_INST (obj); /* declare the instrument as a dependent item */ ipatch_sf2_voice_cache_declare_item (cache, (GObject *)inst); defmods = cache->default_mods; IPATCH_ITEM_RLOCK (inst); /* ++ LOCK instrument */ /* global generators and modulators (can access as long as inst is locked) */ giz = &inst->genarray; if (inst->mods) /* don't need to copy mods, under LOCK */ gimods = ipatch_sf2_mod_list_override (defmods, inst->mods, FALSE); else gimods = (GSList *)defmods; p = inst->zones; for (; p; p = p->next) { izone = (IpatchSF2Zone *)(p->data); /* If a zone is currently solo, skip other zones */ if (solo_item && (IpatchItem *)izone != solo_item) continue; ipatch_sf2_voice_cache_declare_item (cache, (GObject *)izone); IPATCH_ITEM_RLOCK (izone); /* ++ LOCK izone */ sample = (IpatchSF2Sample *)(izone->item); if (!sample) /* skip zones without sample ref */ { IPATCH_ITEM_RUNLOCK (izone); /* -- unlock izone */ continue; } voice = ipatch_sf2_voice_cache_add_voice (cache); /* copy global gen values */ memcpy (&voice->gen_array, giz, sizeof (IpatchSF2GenArray)); /* zone overrides global */ ipatch_sf2_gen_item_copy_set ((IpatchSF2GenItem *)izone, &voice->gen_array); if (izone->mods) /* override global/default mods with zone (copy) */ voice->mod_list = ipatch_sf2_mod_list_override (gimods, izone->mods, TRUE); else voice->mod_list = ipatch_sf2_mod_list_duplicate (gimods); /* set MIDI note and velocity ranges */ amt = &voice->gen_array.values[IPATCH_SF2_GEN_NOTE_RANGE]; ipatch_sf2_voice_cache_set_voice_range (cache, voice, 0, amt->range.low, amt->range.high); amt = &voice->gen_array.values[IPATCH_SF2_GEN_VELOCITY_RANGE]; ipatch_sf2_voice_cache_set_voice_range (cache, voice, 1, amt->range.low, amt->range.high); ipatch_sf2_voice_cache_declare_item (cache, (GObject *)sample); ipatch_sf2_voice_set_sample_data (voice, sample->sample_data); voice->loop_start = sample->loop_start; voice->loop_end = sample->loop_end; voice->rate = sample->rate; voice->root_note = sample->root_note; voice->fine_tune = sample->fine_tune; IPATCH_ITEM_RUNLOCK (izone); /* -- UNLOCK izone */ } IPATCH_ITEM_RUNLOCK (inst); /* -- UNLOCK instrument */ /* free gimods (mod data was not copied) */ if (gimods != defmods) ipatch_sf2_mod_list_free (gimods, FALSE); /* if convert object was instrument zone, unref parent instrument */ if ((void *)obj != (void *)inst) g_object_unref (inst); /* -- unref parent instrument */ return (TRUE); } /* use instrument to voice cache converter function */ #define _sf2_izone_to_sf2_voice_cache_convert \ _sf2_inst_to_sf2_voice_cache_convert static gboolean _sf2_sample_to_sf2_voice_cache_convert (IpatchConverter *converter, GError **err) { IpatchSF2Sample *sample; IpatchSF2VoiceCache *cache; IpatchSF2Voice *voice; IpatchSF2GenAmount *amt; sample = IPATCH_SF2_SAMPLE (IPATCH_CONVERTER_INPUT (converter)); cache = IPATCH_SF2_VOICE_CACHE (IPATCH_CONVERTER_OUTPUT (converter)); ipatch_sf2_voice_cache_declare_item (cache, (GObject *)sample); voice = ipatch_sf2_voice_cache_add_voice (cache); voice->mod_list = ipatch_sf2_mod_list_duplicate (cache->default_mods); /* set MIDI note and velocity ranges */ amt = &voice->gen_array.values[IPATCH_SF2_GEN_NOTE_RANGE]; ipatch_sf2_voice_cache_set_voice_range (cache, voice, 0, amt->range.low, amt->range.high); amt = &voice->gen_array.values[IPATCH_SF2_GEN_VELOCITY_RANGE]; ipatch_sf2_voice_cache_set_voice_range (cache, voice, 1, amt->range.low, amt->range.high); /* use the default loop type for the IpatchSF2VoiceCache */ voice->gen_array.values[IPATCH_SF2_GEN_SAMPLE_MODES].sword = cache->default_loop_type; IPATCH_SF2_GEN_ARRAY_SET_FLAG (&voice->gen_array, IPATCH_SF2_GEN_SAMPLE_MODES); ipatch_sf2_voice_set_sample_data (voice, sample->sample_data); voice->loop_start = sample->loop_start; voice->loop_end = sample->loop_end; voice->rate = sample->rate; voice->root_note = sample->root_note; voice->fine_tune = sample->fine_tune; return (TRUE); } CONVERTER_CLASS_INIT(sf2_preset_to_sf2_voice_cache); CONVERTER_CLASS_INIT(sf2_pzone_to_sf2_voice_cache); CONVERTER_CLASS_INIT(sf2_inst_to_sf2_voice_cache); CONVERTER_CLASS_INIT(sf2_izone_to_sf2_voice_cache); CONVERTER_CLASS_INIT(sf2_sample_to_sf2_voice_cache); CONVERTER_SF2_VOICE_CACHE_GET_TYPE(sf2_preset_to_sf2_voice_cache, SF2PresetToSF2VoiceCache); CONVERTER_SF2_VOICE_CACHE_GET_TYPE(sf2_pzone_to_sf2_voice_cache, SF2PZoneToSF2VoiceCache); CONVERTER_SF2_VOICE_CACHE_GET_TYPE(sf2_inst_to_sf2_voice_cache, SF2InstToSF2VoiceCache); CONVERTER_SF2_VOICE_CACHE_GET_TYPE(sf2_izone_to_sf2_voice_cache, SF2IZoneToSF2VoiceCache); CONVERTER_SF2_VOICE_CACHE_GET_TYPE(sf2_sample_to_sf2_voice_cache, SF2SampleToSF2VoiceCache); libinstpatch-1.0.0/libinstpatch/IpatchXml.c0000644000175000017500000006407311461332142015645 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. * */ #include #include "IpatchXml.h" #include "misc.h" static gboolean xml_destroy_traverse_func (GNode *node, gpointer data); static GNode *ipatch_xml_find_by_path_recurse (GNode *node, const char *path); static void ipatch_xml_to_str_recurse (GString *str, GNode *node, guint indent, guint inc); static void xml_start_element (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, GError **error); static void xml_end_element (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error); static void xml_text (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, GError **error); /** * ipatch_xml_new_node: * @parent: Parent node to add new node to as a child, or %NULL to create new root node * @name: Name of the new XML node * @value: Text value to assign to the new node or %NULL * @attr_name: First attribute name to assign or %NULL * @...: If @attr_name was supplied first string value to be assigned should be * the first parameter, additional name/value attribute string pairs may * follow terminated by a %NULL name. * * Create a new XML tree node and append it to the given @parent, if supplied. * Note that the returned GNode can be used with other N-Array glib operations. * * Returns: New XML tree node */ GNode * ipatch_xml_new_node (GNode *parent, const char *name, const char *value, const char *attr_name, ...) { IpatchXmlNode *xmlnode; IpatchXmlAttr *attr; va_list var_args; char *vname, *vvalue; g_return_val_if_fail (name != NULL, NULL); xmlnode = ipatch_xml_node_new (); xmlnode->name = g_strdup (name); xmlnode->value = g_strdup (value); xmlnode->attributes = NULL; if (attr_name) { va_start (var_args, attr_name); attr = ipatch_xml_attr_new (); attr->name = g_strdup (attr_name); attr->value = g_strdup (va_arg (var_args, char *)); xmlnode->attributes = g_list_append (xmlnode->attributes, attr); while ((vname = va_arg (var_args, char *))) { vvalue = va_arg (var_args, char *); if (!vvalue) continue; attr = ipatch_xml_attr_new (); attr->name = g_strdup (vname); attr->value = g_strdup (vvalue); xmlnode->attributes = g_list_append (xmlnode->attributes, attr); } va_end (var_args); } return (parent ? g_node_append_data (parent, xmlnode) : g_node_new (xmlnode)); } /** * ipatch_xml_new_node_strv: * @parent: Parent node to add new node to as a child, or %NULL to create new root node * @name: Name of the new XML node * @value: Text value to assign to the new node or %NULL * @attr_names: %NULL terminated array of attribute names or %NULL * @attr_values: %NULL terminated array of attribute values or %NULL * * Like ipatch_xml_new_node() but takes attribute name/values as separate strv * arrays. * * Returns: New XML tree node */ GNode * ipatch_xml_new_node_strv (GNode *parent, const char *name, const char *value, const char **attr_names, const char **attr_values) { IpatchXmlNode *xmlnode; IpatchXmlAttr *attr; int i; g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (!attr_names == !attr_values, NULL); xmlnode = ipatch_xml_node_new (); xmlnode->name = g_strdup (name); xmlnode->value = g_strdup (value); xmlnode->attributes = NULL; if (attr_names) { for (i = 0; attr_names[i] && attr_values[i]; i++) { if (!attr_values[i]) continue; attr = ipatch_xml_attr_new (); attr->name = g_strdup (attr_names[i]); attr->value = g_strdup (attr_values[i]); xmlnode->attributes = g_list_append (xmlnode->attributes, attr); } } return (parent ? g_node_append_data (parent, xmlnode) : g_node_new (xmlnode)); } #define QDATA(node) &(((IpatchXmlNode *)(node->data))->qdata) /** * ipatch_xml_get_data: * @node: XML node * @key: Name of the key * * Lookup data assigned to an XML node. * * Returns: The data pointer or %NULL if not set */ gpointer ipatch_xml_get_data (GNode *node, const char *key) { g_return_val_if_fail (node != NULL, NULL); return (g_datalist_get_data (QDATA (node), key)); } /** * ipatch_xml_set_data: * @node: XML node * @key: Name of the key * @data: Data to associate with the key * * Assigns arbitrary data to an XML node specified by a @key. */ void ipatch_xml_set_data (GNode *node, const char *key, gpointer data) { g_return_if_fail (node != NULL); return (g_datalist_set_data (QDATA (node), key, data)); } /** * ipatch_xml_set_data_full: * @node: XML node * @key: Name of the key * @data: Data to associate with the key * * Assigns arbitrary data to an XML node specified by a @key. Also assigns a * @destroy_func callback to destroy the data when it is removed. */ void ipatch_xml_set_data_full (GNode *node, const char *key, gpointer data, GDestroyNotify destroy_func) { g_return_if_fail (node != NULL); return (g_datalist_set_data_full (QDATA (node), key, data, destroy_func)); } /** * ipatch_xml_steal_data: * @node: XML node * @key: Name of the key * * Remove keyed data from an XML node, but don't call the data's destroy notify. * Caller is thus given the ownership of the data. * * Returns: The data pointer or %NULL if not set */ gpointer ipatch_xml_steal_data (GNode *node, const char *key) { gpointer data; GQuark quark; g_return_val_if_fail (node != NULL, NULL); quark = g_quark_try_string (key); if (!quark) return (NULL); data = g_datalist_id_get_data (QDATA (node), quark); if (data) g_datalist_id_remove_no_notify (QDATA (node), quark); return (data); } /** * ipatch_xml_get_data: * @node: XML node * @quark: Quark key * * Lookup data assigned to an XML node using a quark. This is faster than * ipatch_xml_get_data() since the key must be converted to a quark anyways. * * Returns: The data pointer or %NULL if not set */ gpointer ipatch_xml_get_qdata (GNode *node, GQuark quark) { g_return_val_if_fail (node != NULL, NULL); return (g_datalist_id_get_data (QDATA (node), quark)); } /** * ipatch_xml_set_qdata: * @node: XML node * @quark: Quark key * @data: Data to associate with the key * * Assigns arbitrary data to an XML node specified by a @quark key. This is * faster than ipatch_xml_set_data() since the key must be converted to a quark * anyways. */ void ipatch_xml_set_qdata (GNode *node, GQuark quark, gpointer data) { g_return_if_fail (node != NULL); return (g_datalist_id_set_data (QDATA (node), quark, data)); } /** * ipatch_xml_set_qdata_full: * @node: XML node * @quark: Quark key * @data: Data to associate with the key * * Assigns arbitrary data to an XML node specified by a @key. Also assigns a * @destroy_func callback to destroy the data when it is removed. This is * faster than ipatch_xml_set_data_full() since the key must be converted to a quark * anyways. */ void ipatch_xml_set_qdata_full (GNode *node, GQuark quark, gpointer data, GDestroyNotify destroy_func) { g_return_if_fail (node != NULL); return (g_datalist_id_set_data_full (QDATA (node), quark, data, destroy_func)); } /** * ipatch_xml_steal_qdata: * @node: XML node * @quark: Quark key * * Remove keyed data from an XML node, but don't call the data's destroy notify. * Caller is thus given the ownership of the data. This is faster than * ipatch_xml_steal_data() since the key must be converted to a quark * anyways. * * Returns: The data pointer or %NULL if not set */ gpointer ipatch_xml_steal_qdata (GNode *node, GQuark quark) { gpointer data; g_return_val_if_fail (node != NULL, NULL); data = g_datalist_id_get_data (QDATA (node), quark); if (data) g_datalist_id_remove_no_notify (QDATA (node), quark); return (data); } /** * ipatch_xml_destroy: * @node: Root of XML tree/sub tree to destroy * * Free an XML tree (a root @node and all its children). Does not need to be * the actual root of a tree, i.e., can remove a sub tree. */ void ipatch_xml_destroy (GNode *node) { g_node_traverse (node, G_PRE_ORDER, G_TRAVERSE_ALL, -1, xml_destroy_traverse_func, NULL); g_node_destroy (node); } static gboolean xml_destroy_traverse_func (GNode *node, gpointer data) { ipatch_xml_node_free (node->data); return (FALSE); } /** * ipatch_xml_copy: * @node: XML tree to copy * * Perform a deep copy on an XML tree. * * Returns: New duplicate XML tree. */ GNode * ipatch_xml_copy (GNode *node) { g_return_val_if_fail (node != NULL, NULL); return (g_node_copy_deep (node, (GCopyFunc)ipatch_xml_node_duplicate, NULL)); } /** * ipatch_xml_set_name: * @node: XML node * @name: Name to assign * * Set the name of an XML node. */ void ipatch_xml_set_name (GNode *node, const char *name) { IpatchXmlNode *xmlnode; g_return_if_fail (node != NULL); g_return_if_fail (name != NULL); xmlnode = node->data; g_free (xmlnode->name); xmlnode->name = g_strdup (name); } /** * ipatch_xml_set_value: * @node: XML node * @value: Text value to assign or %NULL to clear it * * Set the text value of an XML node. */ void ipatch_xml_set_value (GNode *node, const char *value) { IpatchXmlNode *xmlnode; g_return_if_fail (node != NULL); xmlnode = node->data; g_free (xmlnode->value); xmlnode->value = g_strdup (value); } /** * ipatch_xml_set_value_printf: * @node: XML node * @format: Printf format * @...: Printf arguments * * Assign a value to an XML node using a printf format and arguments. */ void ipatch_xml_set_value_printf (GNode *node, const char *format, ...) { va_list var_args; char *value; g_return_if_fail (node != NULL); g_return_if_fail (format != NULL); va_start (var_args, format); value = g_strdup_vprintf (format, var_args); va_end (var_args); ipatch_xml_take_value (node, value); } /** * ipatch_xml_take_name: * @node: XML node * @name: Name to assign or %NULL to clear it * * Like ipatch_xml_set_name() but takes over the allocation of @name rather than * duplicating it. */ void ipatch_xml_take_name (GNode *node, char *name) { IpatchXmlNode *xmlnode; g_return_if_fail (node != NULL); g_return_if_fail (name != NULL); xmlnode = node->data; g_free (xmlnode->name); xmlnode->name = name; } /** * ipatch_xml_take_value: * @node: XML node * @value: Text value to assign * * Like ipatch_xml_set_value() but takes over the allocation of @value rather than * duplicating it. */ void ipatch_xml_take_value (GNode *node, char *value) { IpatchXmlNode *xmlnode; g_return_if_fail (node != NULL); xmlnode = node->data; g_free (xmlnode->value); xmlnode->value = value; } /** * ipatch_xml_get_name: * @node: XML node to get name of * * Get the name of an XML node. * * Returns: Name of XML node which is internal and should not be modified or freed. */ G_CONST_RETURN char * ipatch_xml_get_name (GNode *node) { g_return_val_if_fail (node != NULL, NULL); return (((IpatchXmlNode *)(node->data))->name); } /** * ipatch_xml_test_name: * @node: XML node to get name of * @cmpname: Name to compare to * * Test if the node has the given name. * * Returns: %TRUE if the node has the given name, %FALSE otherwise */ gboolean ipatch_xml_test_name (GNode *node, const char *cmpname) { const char *name; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (cmpname != NULL, FALSE); name = ipatch_xml_get_name (node); return (name && strcmp (name, cmpname) == 0); } /** * ipatch_xml_get_value: * @node: XML node to get value of * * Get the text value of an XML node. * * Returns: Value of XML node or %NULL, which is internal and should not be * modified or freed. */ G_CONST_RETURN char * ipatch_xml_get_value (GNode *node) { g_return_val_if_fail (node != NULL, NULL); return (((IpatchXmlNode *)(node->data))->value); } /** * ipatch_xml_dup_value: * @node: XML node to duplicate value of * * Duplicate the text value of an XML node. Like ipatch_xml_get_value() but * makes a copy of the value which the caller owns. * * Returns: Newly allocated duplicate value of XML node or %NULL. */ char * ipatch_xml_dup_value (GNode *node) { g_return_val_if_fail (node != NULL, NULL); return (g_strdup (((IpatchXmlNode *)(node->data))->value)); } /** * ipatch_xml_test_value: * @node: XML node to get name of * @cmpvalue: Value to compare to * * Test if the node has the given value. * * Returns: %TRUE if the node has the given value, %FALSE otherwise */ gboolean ipatch_xml_test_value (GNode *node, const char *cmpvalue) { const char *value; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (cmpvalue != NULL, FALSE); value = ipatch_xml_get_value (node); return (value && strcmp (value, cmpvalue) == 0); } /** * ipatch_xml_set_attribute: * @node: XML node * @attr_name: Attribute name to assign to * @attr_value: Attribute value to assign or %NULL to unset * * Set or unset an attribute of an XML node. If there is already an existing * attribute with the given @attr_name, its value will be replaced. */ void ipatch_xml_set_attribute (GNode *node, const char *attr_name, const char *attr_value) { IpatchXmlNode *xmlnode; IpatchXmlAttr *attr; GList *p; g_return_if_fail (node != NULL); g_return_if_fail (attr_name != NULL); xmlnode = (IpatchXmlNode *)(node->data); for (p = xmlnode->attributes; p; p = p->next) { attr = (IpatchXmlAttr *)(p->data); if (strcmp (attr->name, attr_name) == 0) { if (attr_value) { g_free (attr->value); attr->value = g_strdup (attr_value); } else { ipatch_xml_attr_free (attr); xmlnode->attributes = g_list_delete_link (xmlnode->attributes, p); } return; } } attr = ipatch_xml_attr_new (); attr->name = g_strdup (attr_name); attr->value = g_strdup (attr_value); xmlnode->attributes = g_list_append (xmlnode->attributes, attr); } /** * ipatch_xml_set_attributes: * @node: XML node * @attr_name: First attribute name * @attr_value: First attribute value * @...: Additional name/value attribute strings, terminated by a %NULL name * * Set one or more attributes of an XML node. */ void ipatch_xml_set_attributes (GNode *node, const char *attr_name, const char *attr_value, const char *attr2_name, ...) { va_list var_args; char *vname; g_return_if_fail (node != NULL); g_return_if_fail (attr_name != NULL); ipatch_xml_set_attribute (node, attr_name, attr_value); if (!attr2_name) return; va_start (var_args, attr2_name); ipatch_xml_set_attribute (node, attr2_name, va_arg (var_args, char *)); while ((vname = va_arg (var_args, char *))) ipatch_xml_set_attribute (node, vname, va_arg (var_args, char *)); va_end (var_args); } /** * ipatch_xml_get_attribute: * @node: XML node * @attr_name: Name of attribute * * Get the value of an attribute of an XML node. * * Returns: Value of the named attribute or %NULL if not found, value is internal * and should not be modified or freed. */ G_CONST_RETURN char * ipatch_xml_get_attribute (GNode *node, const char *attr_name) { IpatchXmlAttr *attr; GList *p; g_return_val_if_fail (node != NULL, NULL); g_return_val_if_fail (attr_name != NULL, NULL); for (p = ((IpatchXmlNode *)(node->data))->attributes; p; p = p->next) { attr = (IpatchXmlAttr *)(p->data); if (strcmp (attr->name, attr_name) == 0) return (attr->value); } return (NULL); } /** * ipatch_xml_test_attribute: * @node: XML node * @attr_name: Name of attribute * @cmpval: Value to compare attribute to (%NULL to just check existence). * * Test if an attribute of an XML node is a given value or exists (@cmpval = %NULL). * * Returns: %TRUE if attribute exists and matches @cmpval (if set). */ gboolean ipatch_xml_test_attribute (GNode *node, const char *attr_name, const char *cmpval) { const char *attr_val; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (attr_name != NULL, FALSE); attr_val = ipatch_xml_get_attribute (node, attr_name); return (attr_val && (!cmpval || strcmp (attr_val, cmpval) == 0)); } /** * ipatch_xml_find_child: * @node: XML node * @name: Node name of child to find * * Find a child node with the given @name. Only searches the children of @node * and does not search recursively. * * Returns: Matching node or %NULL if not found. */ GNode * ipatch_xml_find_child (GNode *node, const char *name) { IpatchXmlNode *xmlnode; GNode *n; g_return_val_if_fail (node != NULL, NULL); g_return_val_if_fail (name != NULL, NULL); for (n = node->children; n; n = n->next) { xmlnode = (IpatchXmlNode *)(n->data); if (strcmp (xmlnode->name, name) == 0) return (n); } return (NULL); } /** * ipatch_xml_find_by_path: * @node: XML node * @path: Path specification in the form "name1.name2.name3" where each child * of a node is separated by a '.' character. * * Get a node in a tree from a path string. * * Returns: Matching node or %NULL if not found. */ GNode * ipatch_xml_find_by_path (GNode *node, const char *path) { g_return_val_if_fail (node != NULL, NULL); g_return_val_if_fail (path != NULL, NULL); return (ipatch_xml_find_by_path_recurse (node, path)); } static GNode * ipatch_xml_find_by_path_recurse (GNode *node, const char *path) { IpatchXmlNode *xmlnode; char *dot; int len; GNode *n; dot = index (path, '.'); len = dot ? dot - path : strlen (path); for (n = node->children; n; n = n->next) { xmlnode = (IpatchXmlNode *)(n->data); if (strncmp (xmlnode->name, path, len) == 0) { if (!dot) return (n); else return (ipatch_xml_find_by_path_recurse (n, dot + 1)); } } return (NULL); } /** * ipatch_xml_to_str: * @node: XML node * @indent: Number of spaces of indent per level (0 for no indent) * * Render an XML tree to a string. * * Returns: Newly allocated string of XML content representing @node, free with * g_free() when done using it. */ char * ipatch_xml_to_str (GNode *node, guint indent) { GString *str; g_return_val_if_fail (node != NULL, NULL); str = g_string_new (""); ipatch_xml_to_str_recurse (str, node, 0, indent); return (g_string_free (str, FALSE)); } static void ipatch_xml_to_str_recurse (GString *str, GNode *node, guint indent, guint inc) { IpatchXmlNode *xmlnode; char *esc; GNode *n; int i; xmlnode = (IpatchXmlNode *)(node->data); for (i = 0; i < indent; i++) g_string_append_c (str, ' '); g_string_append_printf (str, "<%s", xmlnode->name); if (xmlnode->attributes) { IpatchXmlAttr *attr; GList *p; for (p = xmlnode->attributes; p; p = p->next) { attr = (IpatchXmlAttr *)(p->data); esc = g_markup_escape_text (attr->value, -1); /* ++ alloc */ g_string_append_printf (str, " %s=\"%s\"", attr->name, esc); g_free (esc); /* -- free */ } } if (!xmlnode->value && !node->children) { g_string_append (str, "/>\n"); return; } else g_string_append (str, ">"); if (xmlnode->value) { esc = g_markup_escape_text (xmlnode->value, -1); /* ++ alloc */ g_string_append (str, esc); g_free (esc); /* -- free */ } if (node->children) { g_string_append_c (str, '\n'); for (n = node->children; n; n = n->next) ipatch_xml_to_str_recurse (str, n, indent + inc, inc); for (i = 0; i < indent; i++) g_string_append_c (str, ' '); } g_string_append_printf (str, "\n", xmlnode->name); } /** * ipatch_xml_save_to_file: * @node: XML tree to save * @indent: Number of spaces to indent per level * @filename: File name to save to * @err: Location to store error info or %NULL to ignore * * Store an XML tree to a file. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set) */ gboolean ipatch_xml_save_to_file (GNode *node, guint indent, const char *filename, GError **err) { gboolean retval; char *s; s = ipatch_xml_to_str (node, indent); /* ++ alloc */ if (!s) return (FALSE); retval = g_file_set_contents (filename, s, -1, err); g_free (s); /* -- free */ return (retval); } /** * ipatch_xml_from_str: * @str: XML content to parse * @err: Location to store error info or %NULL to ignore * * Parse XML content into an XML node tree. * * Returns: Newly allocated XML node tree or %NULL on error (@err may be set), * can be freed with ipatch_xml_destroy(). */ GNode * ipatch_xml_from_str (const char *str, GError **err) { GMarkupParseContext *ctx; GMarkupParser parser = { start_element: xml_start_element, end_element: xml_end_element, text: xml_text }; GNode *root = NULL; ctx = g_markup_parse_context_new (&parser, 0, &root, NULL); if (!g_markup_parse_context_parse (ctx, str, -1, err) || !g_markup_parse_context_end_parse (ctx, err)) { g_markup_parse_context_free (ctx); if (root) { root = g_node_get_root (root); ipatch_xml_destroy (root); } return (NULL); } g_markup_parse_context_free (ctx); return (root); } static void xml_start_element (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, GError **error) { GNode **node = (GNode **)user_data; *node = ipatch_xml_new_node_strv (*node, element_name, NULL, attribute_names, attribute_values); } static void xml_end_element (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error) { GNode **node = (GNode **)user_data; if ((*node)->parent) *node = (*node)->parent; } static void xml_text (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, GError **error) { GNode **node = (GNode **)user_data; IpatchXmlNode *xmlnode; xmlnode = (IpatchXmlNode *)((*node)->data); g_free (xmlnode->value); xmlnode->value = g_strdup (text); } /** * ipatch_xml_load_from_file: * @filename: File name containing XML content to parse * @err: Location to store error info or %NULL to ignore * * Parse an XML file into an XML node tree. * * Returns: Newly allocated XML node tree or %NULL on error (@err may be set), * can be freed with ipatch_xml_destroy(). */ GNode * ipatch_xml_load_from_file (const char *filename, GError **err) { GNode *node; char *str; g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (!err || !*err, NULL); if (!g_file_get_contents (filename, &str, NULL, err)) /* ++ alloc */ return (NULL); node = ipatch_xml_from_str (str, err); g_free (str); return (node); } /** * ipatch_xml_node_new: * * Create a new XML node structure. Not normally used. * * Returns: New XML node structure, which should be added to a GNode. */ IpatchXmlNode * ipatch_xml_node_new (void) { IpatchXmlNode *xmlnode; xmlnode = g_slice_new0 (IpatchXmlNode); g_datalist_init (&xmlnode->qdata); return (xmlnode); } /** * ipatch_xml_node_free: * @xmlnode: XML node structure to free * * Free an XML node structure and its contents. Not normally used. */ void ipatch_xml_node_free (IpatchXmlNode *xmlnode) { GList *p; g_return_if_fail (xmlnode != NULL); g_free (xmlnode->name); g_free (xmlnode->value); g_datalist_clear (&xmlnode->qdata); for (p = xmlnode->attributes; p; p = g_list_delete_link (p, p)) ipatch_xml_attr_free (p->data); g_slice_free (IpatchXmlNode, xmlnode); } /** * ipatch_xml_node_duplicate: * @xmlnode: XML node structure to duplicate * * Duplicate an XML node structure and its contents. Not normally used. * Note that arbitrary user data assigned to the XML node will not be duplicated. * * Returns: New duplicate of @xmlnode. */ IpatchXmlNode * ipatch_xml_node_duplicate (const IpatchXmlNode *xmlnode) { IpatchXmlNode *dupnode; IpatchXmlAttr *dupattr; GList *p; g_return_val_if_fail (xmlnode != NULL, NULL); dupnode = ipatch_xml_node_new (); dupnode->name = g_strdup (xmlnode->name); dupnode->value = g_strdup (xmlnode->value); for (p = xmlnode->attributes; p; p = p->next) { dupattr = ipatch_xml_attr_duplicate (p->data); dupnode->attributes = g_list_prepend (dupnode->attributes, dupattr); } dupnode->attributes = g_list_reverse (dupnode->attributes); return (dupnode); } /** * ipatch_xml_attr_new: * * Create a new XML attribute structure. Not normally used. * * Returns: New XML attribute structure which should be added to an #IpatchXmlNode * attributes list. */ IpatchXmlAttr * ipatch_xml_attr_new (void) { return (g_slice_new0 (IpatchXmlAttr)); } /** * ipatch_xml_attr_free: * @attr: Attribute structure to free * * Free an XML attribute structure. Not normally used. */ void ipatch_xml_attr_free (IpatchXmlAttr *attr) { g_return_if_fail (attr != NULL); g_free (attr->name); g_free (attr->value); g_slice_free (IpatchXmlAttr, attr); } /** * ipatch_xml_attr_duplicate: * @attr: Attribute structure to duplicate * * Duplicate an XML attribute structure. Not normally used. * * Returns: New duplicate attribute structure */ IpatchXmlAttr * ipatch_xml_attr_duplicate (const IpatchXmlAttr *attr) { IpatchXmlAttr *dupattr; g_return_val_if_fail (attr != NULL, NULL); dupattr = ipatch_xml_attr_new (); dupattr->name = g_strdup (attr->name); dupattr->value = g_strdup (attr->value); return (dupattr); } libinstpatch-1.0.0/libinstpatch/IpatchSF2Gen.c0000644000175000017500000004040111461332142016116 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include /* for conversion functions */ #include #include #include "IpatchSF2Gen.h" #include "IpatchParamProp.h" #include "IpatchRange.h" #include "IpatchUnit.h" #include "ipatch_priv.h" #include "builtin_enums.h" #include "util.h" /* default arrays for offset and absolute (preset/instrument zones). For fast initialization of generator arrays. */ IpatchSF2GenArray *ipatch_sf2_gen_ofs_array = NULL; IpatchSF2GenArray *ipatch_sf2_gen_abs_array = NULL; /* masks of valid generators for offset or absolute arrays */ guint64 ipatch_sf2_gen_ofs_valid_mask; guint64 ipatch_sf2_gen_abs_valid_mask; /* a mask for generators that can be added together (ofs_mask ! ranges) */ guint64 ipatch_sf2_gen_add_mask; /* array of property names by generator ID */ static const char **gen_property_names = NULL; /* names [IPATCH_SF2_GEN_COUNT] */ void _ipatch_sf2_gen_init (void) { GEnumClass *enum_class; GEnumValue *enum_val; guint64 v; int i; /* initialize valid generator masks */ for (i = 0, v = 0x1; i < IPATCH_SF2_GEN_COUNT; i++, v <<= 1) { switch (i) { case IPATCH_SF2_GEN_SAMPLE_START: case IPATCH_SF2_GEN_SAMPLE_END: case IPATCH_SF2_GEN_SAMPLE_LOOP_START: case IPATCH_SF2_GEN_SAMPLE_LOOP_END: case IPATCH_SF2_GEN_SAMPLE_COARSE_START: case IPATCH_SF2_GEN_SAMPLE_COARSE_END: case IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START: case IPATCH_SF2_GEN_FIXED_NOTE: case IPATCH_SF2_GEN_FIXED_VELOCITY: case IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END: case IPATCH_SF2_GEN_SAMPLE_MODES: case IPATCH_SF2_GEN_EXCLUSIVE_CLASS: case IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE: ipatch_sf2_gen_abs_valid_mask |= v; /* OK for absolute generators */ break; case IPATCH_SF2_GEN_UNUSED1: case IPATCH_SF2_GEN_UNUSED2: case IPATCH_SF2_GEN_UNUSED3: case IPATCH_SF2_GEN_UNUSED4: case IPATCH_SF2_GEN_RESERVED1: case IPATCH_SF2_GEN_RESERVED2: case IPATCH_SF2_GEN_RESERVED3: case IPATCH_SF2_GEN_INSTRUMENT_ID: /* we don't use these in the API */ case IPATCH_SF2_GEN_SAMPLE_ID: /* they get saved to files though */ break; /* not valid for any generator type */ default: /* valid for either generator type */ ipatch_sf2_gen_ofs_valid_mask |= v; ipatch_sf2_gen_abs_valid_mask |= v; break; } } /* create generator add mask (gens that can be directly summed) */ ipatch_sf2_gen_add_mask = ipatch_sf2_gen_ofs_valid_mask; /* I don't trust constants to be 64 bit (LL perhaps?), so .. */ v = 1; v <<= IPATCH_SF2_GEN_NOTE_RANGE; ipatch_sf2_gen_add_mask &= ~v; v = 1; v <<= IPATCH_SF2_GEN_VELOCITY_RANGE; ipatch_sf2_gen_add_mask &= ~v; /* initialize default offset array values */ ipatch_sf2_gen_ofs_array = ipatch_sf2_gen_array_new (TRUE); ipatch_sf2_gen_ofs_array->values[IPATCH_SF2_GEN_NOTE_RANGE].range.low = 0; ipatch_sf2_gen_ofs_array->values[IPATCH_SF2_GEN_NOTE_RANGE].range.high = 127; ipatch_sf2_gen_ofs_array->values[IPATCH_SF2_GEN_VELOCITY_RANGE].range.low =0; ipatch_sf2_gen_ofs_array->values[IPATCH_SF2_GEN_VELOCITY_RANGE].range.high = 127; /* initialize absolute generator default values */ ipatch_sf2_gen_abs_array = ipatch_sf2_gen_array_new (TRUE); for (i = 0; i < IPATCH_SF2_GEN_COUNT; i++) ipatch_sf2_gen_abs_array->values[i] = ipatch_sf2_gen_info[i].def; /* init flags to all valid generators for the given type */ ipatch_sf2_gen_ofs_array->flags = ipatch_sf2_gen_ofs_valid_mask; ipatch_sf2_gen_abs_array->flags = ipatch_sf2_gen_abs_valid_mask; /* initialize array mapping generator IDs to property names */ gen_property_names = g_malloc (sizeof (char *) * IPATCH_SF2_GEN_COUNT); enum_class = g_type_class_ref (IPATCH_TYPE_SF2_GEN_TYPE); if (log_if_fail (enum_class != NULL)) /* shouldn't happen.. just in case */ { for (i = 0; i < IPATCH_SF2_GEN_COUNT; i++) gen_property_names[i] = NULL; return; } for (i = 0; i < IPATCH_SF2_GEN_COUNT; i++) { enum_val = g_enum_get_value (enum_class, i); gen_property_names[i] = enum_val ? enum_val->value_nick : NULL; } } /** * ipatch_sf2_gen_is_valid: * @genid: Generator ID to check * @propstype: Generator property type (instrument/preset + global) * * Checks if a generator is valid for the given @propstype. * * Returns: %TRUE if valid, %FALSE otherwise */ gboolean ipatch_sf2_gen_is_valid (guint genid, IpatchSF2GenPropsType propstype) { if (genid == IPATCH_SF2_GEN_SAMPLE_MODES && propstype == IPATCH_SF2_GEN_PROPS_INST_GLOBAL) return (FALSE); else if ((propstype & 0x1) == IPATCH_SF2_GEN_PROPS_INST) return ((ipatch_sf2_gen_abs_valid_mask & ((guint64)0x1 << genid)) != 0); else return ((ipatch_sf2_gen_ofs_valid_mask & ((guint64)0x1 << genid)) != 0); } /* IpatchSF2GenArray boxed type */ GType ipatch_sf2_gen_array_get_type (void) { static GType type = 0; if (!type) type = g_boxed_type_register_static ("IpatchSF2GenArray", (GBoxedCopyFunc)ipatch_sf2_gen_array_duplicate, (GBoxedFreeFunc)ipatch_sf2_gen_array_free); return (type); } /** * ipatch_sf2_gen_array_new: * @clear: If %TRUE then array will be cleared, %FALSE will not initalize it * and it is up to the caller to do so. * * Create a new generator array object. A convenience function really, * because one could just allocate an IpatchSF2GenArray structure instead. * * Returns: New generator */ IpatchSF2GenArray * ipatch_sf2_gen_array_new (gboolean clear) { if (!clear) return (g_new (IpatchSF2GenArray, 1)); else return (g_new0 (IpatchSF2GenArray, 1)); } /** * ipatch_sf2_gen_free: * @array: Generator array to free * * Frees a generator array structure. */ void ipatch_sf2_gen_array_free (IpatchSF2GenArray *array) { g_return_if_fail (array != NULL); g_free (array); } /** * ipatch_sf2_gen_array_duplicate: * @array: Generator array to duplicate * * Duplicates a generator array structure. * * Returns: A newly allocated generator array structure which is a duplicate * of @array. */ IpatchSF2GenArray * ipatch_sf2_gen_array_duplicate (const IpatchSF2GenArray *array) { IpatchSF2GenArray *new; g_return_val_if_fail (array != NULL, NULL); new = g_new (IpatchSF2GenArray, 1); memcpy (new, array, sizeof (IpatchSF2GenArray)); return (new); } /** * ipatch_sf2_gen_array_init: * @array: Generator array * @offset: %TRUE = initialize to Preset offset (zero) values, * %FALSE = initialize to instrument default values * @set: %TRUE to set flags indicating generator values are set, %FALSE to * clear all flag "set" bits * * Initialize a generator array to default values. */ void ipatch_sf2_gen_array_init (IpatchSF2GenArray *array, gboolean offset, gboolean set) { IpatchSF2GenArray *duparray; g_return_if_fail (array != NULL); duparray = offset ? ipatch_sf2_gen_ofs_array : ipatch_sf2_gen_abs_array; memcpy (array->values, duparray->values, sizeof (array->values)); if (set) array->flags = duparray->flags; else array->flags = 0; } /** * ipatch_sf2_gen_array_offset: * @abs_array: Destination generator amount array that contains absolute * (Instrument) generator values * @ofs_array: Source generator amount array that contains offset (Preset) * generator values * * Offsets the generators amount array in @abs_array by adding the * values in @ofs_array to it. Values are clamped to their valid ranges. * * Returns: %FALSE if note or velocity range does not intersect (in which case * the non-intersecting ranges are left unassigned), %TRUE otherwise */ gboolean ipatch_sf2_gen_array_offset (IpatchSF2GenArray *abs_array, const IpatchSF2GenArray *ofs_array) { IpatchSF2GenAmount *abs_vals; const IpatchSF2GenAmount *ofs_vals; gboolean retval; guint64 v; gint32 temp; int i; abs_vals = abs_array->values; ofs_vals = ofs_array->values; for (i = 0, v = 0x1; i < IPATCH_SF2_GEN_COUNT; i++, v <<= 1) { /* generator in add_mask and offset value set? */ if ((ipatch_sf2_gen_add_mask & v) && (ofs_array->flags & v)) { temp = (gint32)(abs_vals[i].sword) + (gint32)(ofs_vals[i].sword); if (temp < (gint32)ipatch_sf2_gen_info[i].min.sword) temp = ipatch_sf2_gen_info[i].min.sword; else if (temp > (gint32)ipatch_sf2_gen_info[i].max.sword) temp = ipatch_sf2_gen_info[i].max.sword; abs_vals[i].sword = (gint16)temp; abs_array->flags |= v; /* generator now set */ } } retval = ipatch_sf2_gen_range_intersect (&abs_vals[IPATCH_SF2_GEN_NOTE_RANGE], &ofs_vals[IPATCH_SF2_GEN_NOTE_RANGE]); return retval && ipatch_sf2_gen_range_intersect (&abs_vals[IPATCH_SF2_GEN_VELOCITY_RANGE], &ofs_vals[IPATCH_SF2_GEN_VELOCITY_RANGE]); } /** * ipatch_sf2_gen_array_intersect_test: * @array1: First generator amount array * @array2: Second generator amount array * * Checks if the note and velocity ranges in two generator arrays intersect. * * Returns: %TRUE if both ranges intersect, %FALSE if one or both do not. */ gboolean ipatch_sf2_gen_array_intersect_test (const IpatchSF2GenArray *array1, const IpatchSF2GenArray *array2) { if (!ipatch_sf2_gen_range_intersect_test (&array1->values[IPATCH_SF2_GEN_NOTE_RANGE], &array2->values[IPATCH_SF2_GEN_NOTE_RANGE])) return (FALSE); return (ipatch_sf2_gen_range_intersect_test (&array1->values[IPATCH_SF2_GEN_VELOCITY_RANGE], &array2->values[IPATCH_SF2_GEN_VELOCITY_RANGE])); } /** * ipatch_sf2_gen_array_count_set: * @array: Generator array * * Get count of "set" generators in a generator array. * * Returns: Count of "set" generators. */ guint ipatch_sf2_gen_array_count_set (IpatchSF2GenArray *array) { guint count = 0; guint64 v; g_return_val_if_fail (array != NULL, 0); for (v = array->flags; v; v >>= 1) if (v & 0x1) count++; return (count); } /** * ipatch_sf2_gen_amount_to_value: * @genid: Generator ID * @amt: Generator amount for given @genid * @value: Uninitialized GValue to set to @amt * * Converts a generator amount to a GValue. Value will be initialized to * one of two types: G_TYPE_INT for signed/unsigned integers or * IPATCH_TYPE_RANGE for velocity or note split ranges. */ void ipatch_sf2_gen_amount_to_value (guint genid, const IpatchSF2GenAmount *amt, GValue *value) { g_return_if_fail (genid < IPATCH_SF2_GEN_COUNT); g_return_if_fail (amt != NULL); g_return_if_fail (value != NULL); if (ipatch_sf2_gen_info [genid].unit != IPATCH_UNIT_TYPE_RANGE) { g_value_init (value, G_TYPE_INT); g_value_set_int (value, amt->sword); } else { IpatchRange range; range.low = amt->range.low; range.high = amt->range.high; g_value_init (value, IPATCH_TYPE_RANGE); ipatch_value_set_range (value, &range); } } /** * ipatch_sf2_gen_default_value: * @genid: Generator ID * @ispreset: TRUE for preset generators, FALSE for instrument * @out_amt: A pointer to store the default amount into * * Get default value for a generator ID for the specified (@ispreset) zone * type. */ void ipatch_sf2_gen_default_value (guint genid, gboolean ispreset, IpatchSF2GenAmount *out_amt) { g_return_if_fail (out_amt != NULL); out_amt->sword = 0; /* in case we fail, user gets 0 amount */ g_return_if_fail (ipatch_sf2_gen_is_valid (genid, ispreset)); if (ispreset) { if (ipatch_sf2_gen_info[genid].unit == IPATCH_UNIT_TYPE_RANGE) { out_amt->range.low = 0; out_amt->range.high = 127; } /* else: Amount already set to 0, which is default for preset gens */ } else *out_amt = ipatch_sf2_gen_info[genid].def; } /** * ipatch_sf2_gen_offset: * @genid: ID of Generator to offset. Must be a valid preset generator. * @dst: Pointer to the initial amount to offset, result is stored back * into this parameter. * @ofs: Pointer to offset amount. * * Offsets a generator amount. Result of offset is clamped to maximum and * minimum values for the given generator ID. In the case of note or * velocity ranges a return value of %TRUE (clamped) means that the ranges * don't intersect (contrary return value to other range related functions). * * Returns: %TRUE if value was clamped, %FALSE otherwise. */ gboolean ipatch_sf2_gen_offset (guint genid, IpatchSF2GenAmount *dst, const IpatchSF2GenAmount *ofs) { gint32 temp; gboolean clamped = FALSE; g_return_val_if_fail (dst != NULL, FALSE); g_return_val_if_fail (ofs != NULL, FALSE); g_return_val_if_fail (ipatch_sf2_gen_is_valid (genid, TRUE), FALSE); if (genid != IPATCH_SF2_GEN_NOTE_RANGE && genid != IPATCH_SF2_GEN_VELOCITY_RANGE) { temp = (gint32)(dst->sword) + (gint32)(ofs->sword); if (temp < (gint32)ipatch_sf2_gen_info[genid].min.sword) { temp = ipatch_sf2_gen_info[genid].min.sword; clamped = TRUE; } else if (temp > (gint32)ipatch_sf2_gen_info[genid].max.sword) { temp = ipatch_sf2_gen_info[genid].max.sword; clamped = TRUE; } dst->sword = (gint16)temp; } else clamped = !ipatch_sf2_gen_range_intersect (dst, ofs); return (clamped); } /** * ipatch_sf2_gen_clamp: * @genid: Generator ID (#IpatchSF2GenType) * @sfval: Generator value to clamp (changed in place) * @ispreset: TRUE if its a Preset generator, FALSE if Instrument * * Clamp a generators value to its valid range. */ void ipatch_sf2_gen_clamp (guint genid, int *sfval, gboolean ispreset) { int ofsrange; /* used only for offset gens, range of value */ g_return_if_fail (ipatch_sf2_gen_is_valid (genid, ispreset)); if (ispreset) { ofsrange = ipatch_sf2_gen_info[genid].max.sword - ipatch_sf2_gen_info[genid].min.sword; if (*sfval < -ofsrange) *sfval = -ofsrange; else if (*sfval > ofsrange) *sfval = ofsrange; } else { if (*sfval < ipatch_sf2_gen_info[genid].min.sword) *sfval = ipatch_sf2_gen_info[genid].min.sword; else if (*sfval > ipatch_sf2_gen_info[genid].max.sword) *sfval = ipatch_sf2_gen_info[genid].max.sword; } } /** * ipatch_sf2_gen_range_intersect: * @dst: First generator amount range, result is also stored here * @src: Second generator amount range * * Find intersection of two generator ranges (common shared range). * If ranges don't share anything in common @dst is not assigned. * * Returns: %FALSE if ranges don't share any range in common. */ gboolean ipatch_sf2_gen_range_intersect (IpatchSF2GenAmount *dst, const IpatchSF2GenAmount *src) { guint8 dl, dh, sl, sh; dl = dst->range.low; dh = dst->range.high; sl = src->range.low; sh = src->range.high; /* Nothing in common? */ if (dh < sl || sh < dl) return (FALSE); dst->range.low = MAX (dl, sl); dst->range.high = MIN (dh, sh); return (TRUE); } /** * ipatch_sf2_gen_range_intersect_test: * @amt1: First generator amount range * @amt2: Second generator amount range * * Test if two ranges intersect. * * Returns: %FALSE if ranges don't share any range in common, %TRUE otherwise */ gboolean ipatch_sf2_gen_range_intersect_test (const IpatchSF2GenAmount *amt1, const IpatchSF2GenAmount *amt2) { return (!(amt1->range.high < amt2->range.low || amt2->range.high < amt1->range.low)); } /** * ipatch_sf2_gen_get_prop_name: * @genid: Generator ID * * Get the GObject property name for a given generator ID. * * Returns: Property name or %NULL if no property name for @genid. * The returned string is internal and should not be modified or freed. */ G_CONST_RETURN char * ipatch_sf2_gen_get_prop_name (guint genid) { g_return_val_if_fail (genid < IPATCH_SF2_GEN_COUNT, NULL); return (gen_property_names[genid]); } libinstpatch-1.0.0/libinstpatch/IpatchGig.c0000644000175000017500000001011611461332142015600 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchGig.h" #include "IpatchGigInst.h" #include "IpatchGigSample.h" #include "IpatchContainer.h" #include "IpatchVirtualContainer_types.h" #include "i18n.h" static void ipatch_gig_class_init (IpatchGigClass *klass); static void ipatch_gig_finalize (GObject *object); static void ipatch_gig_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static const GType *ipatch_gig_container_child_types (void); static const GType *ipatch_gig_container_virtual_types (void); static GObjectClass *parent_class = NULL; static GType gig_child_types[3] = { 0 }; static GType gig_virt_types[4] = { 0 }; GType ipatch_gig_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchGigClass), NULL, NULL, (GClassInitFunc) ipatch_gig_class_init, NULL, NULL, sizeof (IpatchGig), 0, (GInstanceInitFunc) NULL, }; item_type = g_type_register_static (IPATCH_TYPE_DLS2, "IpatchGig", &item_info, 0); } return (item_type); } static void ipatch_gig_class_init (IpatchGigClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS (klass); parent_class = g_type_class_peek_parent (klass); obj_class->finalize = ipatch_gig_finalize; item_class->copy = ipatch_gig_item_copy; container_class->child_types = ipatch_gig_container_child_types; container_class->virtual_types = ipatch_gig_container_virtual_types; gig_child_types[0] = IPATCH_TYPE_GIG_INST; gig_child_types[1] = IPATCH_TYPE_GIG_SAMPLE; gig_virt_types[0] = IPATCH_TYPE_VIRTUAL_GIG_MELODIC; gig_virt_types[1] = IPATCH_TYPE_VIRTUAL_GIG_PERCUSSION; gig_virt_types[2] = IPATCH_TYPE_VIRTUAL_GIG_SAMPLES; } static void ipatch_gig_finalize (GObject *object) { IpatchGig *gig = IPATCH_GIG (object); GSList *p; IPATCH_ITEM_WLOCK (object); /* free sample group names */ p = gig->group_names; while (p) { g_free (p->data); p = g_slist_delete_link (p, p); } IPATCH_ITEM_WUNLOCK (object); parent_class->finalize (object); } static void ipatch_gig_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchGig *src_gig, *dest_gig; GSList *p; src_gig = IPATCH_GIG (src); dest_gig = IPATCH_GIG (dest); IPATCH_ITEM_CLASS (parent_class)->copy (dest, src, link_func, user_data); IPATCH_ITEM_RLOCK (src_gig); /* duplicate group names */ p = src_gig->group_names; while (p) { dest_gig->group_names = g_slist_append (dest_gig->group_names, g_strdup ((char *)(p->data))); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (src_gig); } static const GType * ipatch_gig_container_child_types (void) { return (gig_child_types); } static const GType * ipatch_gig_container_virtual_types (void) { return (gig_virt_types); } /** * ipatch_gig_new: * * Create a new GigaSampler object. * * Returns: New GigaSampler object with a ref count of 1 which the caller * owns. */ IpatchGig * ipatch_gig_new (void) { return (IPATCH_GIG (g_object_new (IPATCH_TYPE_GIG, NULL))); } libinstpatch-1.0.0/libinstpatch/IpatchSF2.c0000644000175000017500000011101011461332142015457 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include #include "IpatchParamProp.h" #include "IpatchSF2.h" #include "IpatchSF2File.h" #include "IpatchSF2Preset.h" #include "IpatchSF2Zone.h" #include "IpatchTypeProp.h" #include "IpatchVirtualContainer_types.h" #include "ipatch_priv.h" #include "version.h" /* the Info properties below shouldn't conflict, since they are composed of their 4 byte RIFF chunk ID */ enum { PROP_0, PROP_SAMPLES_24BIT /* indicates that samples should be saved in 24 bit */ }; /* !! Keep in order with IpatchSF2InfoType in IpatchSF2.h */ static guint info_ids[] = { IPATCH_SF2_VERSION, IPATCH_SF2_ENGINE, IPATCH_SF2_NAME, IPATCH_SF2_ROM_NAME, IPATCH_SF2_ROM_VERSION, IPATCH_SF2_DATE, IPATCH_SF2_AUTHOR, IPATCH_SF2_PRODUCT, IPATCH_SF2_COPYRIGHT, IPATCH_SF2_COMMENT, IPATCH_SF2_SOFTWARE }; /* parameter specs for each info property */ static GParamSpec *info_prop_pspecs[IPATCH_SF2_INFO_COUNT]; #define ERR_MSG_INVALID_INFO_ID_1 "Invalid SoundFont info ID (%d)" static void ipatch_sf2_class_init (IpatchSF2Class *klass); static void ipatch_sf2_init (IpatchSF2 *sfont); static void ipatch_sf2_finalize (GObject *gobject); static void ipatch_sf2_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sf2_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sf2_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static void ipatch_sf2_info_hash_foreach (gpointer key, gpointer value, gpointer user_data); static const GType *ipatch_sf2_container_child_types (void); static const GType *ipatch_sf2_container_virtual_types (void); static gboolean ipatch_sf2_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type); static void ipatch_sf2_container_make_unique (IpatchContainer *container, IpatchItem *item); static void ipatch_sf2_base_find_unused_locale (IpatchBase *base, int *bank, int *program, const IpatchItem *exclude, gboolean percussion); static int locale_gcompare_func (gconstpointer a, gconstpointer b); static IpatchItem * ipatch_sf2_base_find_item_by_locale (IpatchBase *base, int bank, int program); static void ipatch_sf2_real_set_info (IpatchSF2 *sf, IpatchSF2InfoType id, const char *val); static void ipatch_sf2_foreach_info_GHFunc (gpointer key, gpointer value, gpointer data); static int ipatch_sf2_info_array_qsort (const void *a, const void *b); static gpointer parent_class = NULL; static IpatchItemClass *base_item_class; static GType sf2_child_types[4] = { 0 }; static GType sf2_virt_types[6] = { 0 }; /* SoundFont item type creation function */ GType ipatch_sf2_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchSF2Class), NULL, NULL, (GClassInitFunc)ipatch_sf2_class_init, NULL, NULL, sizeof (IpatchSF2), 0, (GInstanceInitFunc)ipatch_sf2_init, }; item_type = g_type_register_static (IPATCH_TYPE_BASE, "IpatchSF2", &item_info, 0); } return (item_type); } static void ipatch_sf2_class_init (IpatchSF2Class *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS (klass); IpatchBaseClass *base_class = IPATCH_BASE_CLASS (klass); GParamSpec **sp = &info_prop_pspecs[0]; /* save original base class for chaining file-name property */ base_item_class = IPATCH_ITEM_CLASS (g_type_class_ref (IPATCH_TYPE_BASE)); parent_class = g_type_class_ref (IPATCH_TYPE_BASE); obj_class->finalize = ipatch_sf2_finalize; obj_class->get_property = ipatch_sf2_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_sf2_set_property; item_class->copy = ipatch_sf2_item_copy; container_class->child_types = ipatch_sf2_container_child_types; container_class->virtual_types = ipatch_sf2_container_virtual_types; container_class->init_iter = ipatch_sf2_container_init_iter; container_class->make_unique = ipatch_sf2_container_make_unique; base_class->find_unused_locale = ipatch_sf2_base_find_unused_locale; base_class->find_item_by_locale = ipatch_sf2_base_find_item_by_locale; g_object_class_install_property (obj_class, PROP_SAMPLES_24BIT, g_param_spec_boolean ("samples-24bit", _("Samples 24bit"), _("Enable 24 bit samples"), FALSE, G_PARAM_READWRITE)); g_object_class_override_property (obj_class, IPATCH_SF2_NAME, "title"); *sp = g_param_spec_string ("version", _("Version"), _("SoundFont version (\"major.minor\")"), "2.01", G_PARAM_READWRITE); g_object_class_install_property (obj_class, IPATCH_SF2_VERSION, *sp++); *sp = ipatch_param_set (g_param_spec_string ("engine", _("Engine"), _("Sound synthesis engine identifier"), "EMU8000", G_PARAM_READWRITE), "string-max-length", 255, NULL); g_object_class_install_property (obj_class, IPATCH_SF2_ENGINE, *sp++); *sp = ipatch_param_set (g_param_spec_string ("name", _("Name"), _("SoundFont name"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL); g_object_class_install_property (obj_class, IPATCH_SF2_NAME, *sp++); *sp = ipatch_param_set (g_param_spec_string ("rom-name", _("ROM name"), _("ROM name identifier"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL); g_object_class_install_property (obj_class, IPATCH_SF2_ROM_NAME, *sp++); *sp = ipatch_param_set (g_param_spec_string ("rom-version", _("ROM version"), _("ROM version \"major.minor\""), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL); g_object_class_install_property (obj_class, IPATCH_SF2_ROM_VERSION, *sp++); *sp = ipatch_param_set (g_param_spec_string ("date", _("Date"), _("Creation date"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL); g_object_class_install_property (obj_class, IPATCH_SF2_DATE, *sp++); *sp = ipatch_param_set (g_param_spec_string ("author", _("Author"), _("Author of SoundFont"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL); g_object_class_install_property (obj_class, IPATCH_SF2_AUTHOR, *sp++); *sp = ipatch_param_set (g_param_spec_string ("product", _("Product"), _("Product SoundFont is intended for"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL); g_object_class_install_property (obj_class, IPATCH_SF2_PRODUCT, *sp++); *sp = ipatch_param_set (g_param_spec_string ("copyright", _("Copyright"), _("Copyright"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL); g_object_class_install_property (obj_class, IPATCH_SF2_COPYRIGHT, *sp++); *sp = ipatch_param_set (g_param_spec_string ("comment", _("Comments"), _("Comments"), NULL, G_PARAM_READWRITE), "string-max-length", 65535, NULL); g_object_class_install_property (obj_class, IPATCH_SF2_COMMENT, *sp++); *sp = ipatch_param_set (g_param_spec_string ("software", _("Software"), _("Software 'created by:modified by'"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL); g_object_class_install_property (obj_class, IPATCH_SF2_SOFTWARE, *sp); sf2_child_types[0] = IPATCH_TYPE_SF2_PRESET; sf2_child_types[1] = IPATCH_TYPE_SF2_INST; sf2_child_types[2] = IPATCH_TYPE_SF2_SAMPLE; sf2_virt_types[0] = IPATCH_TYPE_VIRTUAL_SF2_MELODIC; sf2_virt_types[1] = IPATCH_TYPE_VIRTUAL_SF2_PERCUSSION; sf2_virt_types[2] = IPATCH_TYPE_VIRTUAL_SF2_INST; sf2_virt_types[3] = IPATCH_TYPE_VIRTUAL_SF2_SAMPLES; sf2_virt_types[4] = IPATCH_TYPE_VIRTUAL_SF2_ROM; } static void ipatch_sf2_init (IpatchSF2 *sfont) { sfont->ver_major = 2; sfont->ver_minor = 1; /* we convert 4 char info IDs to INTs, also set up hash table to free allocated string values */ sfont->info = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_free); /* set required SoundFont info to default values */ ipatch_sf2_set_info (sfont, IPATCH_SF2_NAME, _(IPATCH_BASE_DEFAULT_NAME)); ipatch_sf2_set_info (sfont, IPATCH_SF2_ENGINE, IPATCH_SF2_DEFAULT_ENGINE); ipatch_sf2_set_info (sfont, IPATCH_SF2_SOFTWARE, "libInstPatch v" IPATCH_VERSION ":"); ipatch_item_clear_flags (IPATCH_ITEM (sfont), IPATCH_BASE_CHANGED); } /* function called when SoundFont is being destroyed */ static void ipatch_sf2_finalize (GObject *gobject) { IpatchSF2 *sf = IPATCH_SF2 (gobject); IPATCH_ITEM_WLOCK (sf); g_hash_table_destroy (sf->info); /* destroy SoundFont info */ sf->info = NULL; IPATCH_ITEM_WUNLOCK (sf); if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (gobject); } static void ipatch_sf2_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSF2 *sf; gboolean b; g_return_if_fail (IPATCH_IS_SF2 (object)); sf = IPATCH_SF2 (object); if (property_id == PROP_SAMPLES_24BIT) { b = g_value_get_boolean (value); if (b) ipatch_item_set_flags (IPATCH_ITEM (sf), IPATCH_SF2_SAMPLES_24BIT); else ipatch_item_clear_flags (IPATCH_ITEM (sf), IPATCH_SF2_SAMPLES_24BIT); } else if (property_id == IPATCH_SF2_VERSION || property_id == IPATCH_SF2_ROM_VERSION) { guint major, minor; if (sscanf (g_value_get_string (value), "%u.%u", &major, &minor) != 2) { g_critical ("SoundFont version property parse error"); return; } if (property_id == IPATCH_SF2_VERSION) { IPATCH_ITEM_WLOCK (sf); sf->ver_major = major; sf->ver_minor = minor; IPATCH_ITEM_WUNLOCK (sf); } else { IPATCH_ITEM_WLOCK (sf); sf->romver_major = major; sf->romver_minor = minor; IPATCH_ITEM_WUNLOCK (sf); } } else if (ipatch_sf2_info_id_is_valid (property_id)) { ipatch_sf2_real_set_info (sf, property_id, g_value_get_string (value)); /* need to do a title property notify? */ if (property_id == IPATCH_SF2_NAME) ipatch_item_prop_notify ((IpatchItem *)sf, ipatch_item_pspec_title, value, NULL); } else G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } static void ipatch_sf2_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSF2 *sf; char *s; g_return_if_fail (IPATCH_IS_SF2 (object)); sf = IPATCH_SF2 (object); if (property_id == PROP_SAMPLES_24BIT) { g_value_set_boolean (value, (ipatch_item_get_flags (IPATCH_ITEM (sf)) & IPATCH_SF2_SAMPLES_24BIT) != 0); } else if (property_id == IPATCH_SF2_VERSION || property_id == IPATCH_SF2_ROM_VERSION) { int major, minor; IPATCH_ITEM_RLOCK (sf); if (property_id == IPATCH_SF2_VERSION) { major = sf->ver_major; minor = sf->ver_minor; } else { major = sf->romver_major; minor = sf->romver_minor; } IPATCH_ITEM_RUNLOCK (sf); s = g_strdup_printf ("%d.%d", major, minor); g_value_take_string (value, s); } else if (ipatch_sf2_info_id_is_valid (property_id)) g_value_take_string (value, ipatch_sf2_get_info (sf, property_id)); else G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } /* item copy function, note that this is an #IpatchBase derived object, so link_func is not used */ static void ipatch_sf2_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchSF2 *src_sf, *dest_sf; IpatchItem *newitem; GHashTable *repl_samples, *repl_insts; gboolean has_linked = FALSE; GSList *p; src_sf = IPATCH_SF2 (src); dest_sf = IPATCH_SF2 (dest); /* create item replacement hash */ repl_samples = g_hash_table_new (NULL, NULL); repl_insts = g_hash_table_new (NULL, NULL); IPATCH_ITEM_RLOCK (src_sf); if (ipatch_item_get_flags (src) & IPATCH_SF2_SAMPLES_24BIT) ipatch_item_set_flags (dest, IPATCH_SF2_SAMPLES_24BIT); else ipatch_item_clear_flags (dest, IPATCH_SF2_SAMPLES_24BIT); dest_sf->ver_major = src_sf->ver_major; dest_sf->ver_minor = src_sf->ver_minor; dest_sf->romver_major = src_sf->romver_major; dest_sf->romver_minor = src_sf->romver_minor; if (IPATCH_BASE (src_sf)->file) ipatch_base_set_file (IPATCH_BASE (dest_sf), IPATCH_BASE (src_sf)->file); /* duplicate the info variables */ g_hash_table_foreach (src_sf->info, ipatch_sf2_info_hash_foreach, dest_sf); p = src_sf->samples; while (p) /* duplicate samples */ { /* ++ ref new duplicate sample, !! sample list takes it over */ newitem = ipatch_item_duplicate ((IpatchItem *)(p->data)); dest_sf->samples = g_slist_prepend (dest_sf->samples, newitem); ipatch_item_set_parent (newitem, IPATCH_ITEM (dest_sf)); /* add to sample pointer replacement hash */ g_hash_table_insert (repl_samples, p->data, newitem); /* check if sample is stereo linked */ if (((IpatchSF2Sample *)newitem)->linked) has_linked = TRUE; p = g_slist_next (p); } /* if any linked samples exist, we must replace old linked pointers, duplicate "replace" hash wont work since samples reference items in the same list */ if (has_linked) { IpatchSF2Sample *linked; p = dest_sf->samples; while (p) { IpatchSF2Sample *sample = (IpatchSF2Sample *)(p->data); linked = ipatch_sf2_sample_peek_linked (sample); if (linked) { linked = g_hash_table_lookup (repl_samples, linked); ipatch_sf2_sample_set_linked (sample, linked); } p = g_slist_next (p); } } p = src_sf->insts; while (p) /* duplicate instruments */ { /* ++ ref new duplicate instrument, !! instrument list takes it over * duplicate instrument and replace referenced sample pointers. */ newitem = ipatch_item_duplicate_replace ((IpatchItem *)(p->data), repl_samples); dest_sf->insts = g_slist_prepend (dest_sf->insts, newitem); ipatch_item_set_parent (newitem, IPATCH_ITEM (dest_sf)); /* add to instrument pointer replacement hash */ g_hash_table_insert (repl_insts, p->data, newitem); p = g_slist_next (p); } p = src_sf->presets; while (p) /* duplicate presets */ { /* ++ ref new duplicate preset, !! preset list takes it over * duplicate preset and replace referenced instrument pointers. */ newitem = ipatch_item_duplicate_replace ((IpatchItem *)(p->data), repl_insts); dest_sf->presets = g_slist_prepend (dest_sf->presets, newitem); ipatch_item_set_parent (newitem, IPATCH_ITEM (dest_sf)); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (src_sf); dest_sf->presets = g_slist_reverse (dest_sf->presets); dest_sf->insts = g_slist_reverse (dest_sf->insts); dest_sf->samples = g_slist_reverse (dest_sf->samples); g_hash_table_destroy (repl_samples); g_hash_table_destroy (repl_insts); } static void ipatch_sf2_info_hash_foreach (gpointer key, gpointer value, gpointer user_data) { char *val = (char *)value; IpatchSF2 *dup = (IpatchSF2 *)user_data; ipatch_sf2_set_info (dup, GPOINTER_TO_UINT (key), val); } static const GType * ipatch_sf2_container_child_types (void) { return (sf2_child_types); } static const GType * ipatch_sf2_container_virtual_types (void) { return (sf2_virt_types); } /* container is locked by caller */ static gboolean ipatch_sf2_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type) { IpatchSF2 *sfont = IPATCH_SF2 (container); if (g_type_is_a (type, IPATCH_TYPE_SF2_PRESET)) ipatch_iter_GSList_init (iter, &sfont->presets); else if (g_type_is_a (type, IPATCH_TYPE_SF2_INST)) ipatch_iter_GSList_init (iter, &sfont->insts); else if (g_type_is_a (type, IPATCH_TYPE_SF2_SAMPLE)) ipatch_iter_GSList_init (iter, &sfont->samples); else { g_critical ("Invalid child type '%s' for parent of type '%s'", g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); return (FALSE); } return (TRUE); } static void ipatch_sf2_container_make_unique (IpatchContainer *container, IpatchItem *item) { IpatchSF2 *sfont = IPATCH_SF2 (container); char *name, *newname; IPATCH_ITEM_WLOCK (sfont); if (IPATCH_IS_SF2_PRESET (item)) { int bank, newbank, program, newprogram; ipatch_sf2_preset_get_midi_locale (IPATCH_SF2_PRESET (item), &bank, &program); newbank = bank; newprogram = program; ipatch_base_find_unused_midi_locale (IPATCH_BASE (sfont), &newbank, &newprogram, item, newbank == 128); if (bank != newbank || program != newprogram) ipatch_sf2_preset_set_midi_locale (IPATCH_SF2_PRESET (item), newbank, newprogram); } else if (!IPATCH_IS_SF2_INST (item) && !IPATCH_IS_SF2_SAMPLE (item)) { g_critical ("Invalid child type '%s' for IpatchSF2 object", g_type_name (G_TYPE_FROM_INSTANCE (item))); return; } g_object_get (item, "name", &name, NULL); newname = ipatch_sf2_make_unique_name (sfont, G_TYPE_FROM_INSTANCE (item), name, NULL); if (!name || strcmp (name, newname) != 0) g_object_set (item, "name", newname, NULL); IPATCH_ITEM_WUNLOCK (sfont); g_free (name); g_free (newname); } /* base method to find an unused MIDI bank:program locale */ static void ipatch_sf2_base_find_unused_locale (IpatchBase *base, int *bank, int *program, const IpatchItem *exclude, gboolean percussion) { IpatchSF2 *sf = IPATCH_SF2 (base); GSList *locale_list = NULL; IpatchSF2Preset *pset; GSList *p; int b, n; /* Stores current bank and program number */ guint lbank, lprogram; if (percussion) *bank = 128; /* fill array with bank and program numbers */ IPATCH_ITEM_RLOCK (sf); p = sf->presets; while (p) { pset = (IpatchSF2Preset *)(p->data); /* only add to locale list if not the exclude item */ if ((gpointer)pset != (gpointer)exclude) locale_list = g_slist_prepend (locale_list, GUINT_TO_POINTER (((guint32)pset->bank << 16) | pset->program)); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (sf); if (!locale_list) return; locale_list = g_slist_sort (locale_list, (GCompareFunc)locale_gcompare_func); b = *bank; n = *program; /* loop through sorted list of bank:programs */ p = locale_list; while (p) { lprogram = GPOINTER_TO_UINT (p->data); lbank = lprogram >> 16; lprogram &= 0xFFFF; if (lbank > b || (lbank == b && lprogram > n)) break; if (lbank >= b) { if (++n > 127) { n = 0; b++; } } p = g_slist_delete_link (p, p); /* delete and advance */ } *bank = b; *program = n; if (p) g_slist_free (p); /* free remainder of list */ } /* function used to do a temporary sort on preset list for ipatch_sf2_base_find_unused_locale */ static int locale_gcompare_func (gconstpointer a, gconstpointer b) { return (GPOINTER_TO_UINT (a) - GPOINTER_TO_UINT (b)); } static IpatchItem * ipatch_sf2_base_find_item_by_locale (IpatchBase *base, int bank, int program) { IpatchSF2Preset *preset; preset = ipatch_sf2_find_preset (IPATCH_SF2 (base), NULL, bank, program, NULL); return ((IpatchItem *)preset); } /** * ipatch_sf2_new: * * Create a new SoundFont base object. * * Returns: New SoundFont base object with a reference count of 1. Caller * owns the reference and removing it will destroy the item. */ IpatchSF2 * ipatch_sf2_new (void) { return (IPATCH_SF2 (g_object_new (IPATCH_TYPE_SF2, NULL))); } /** * ipatch_sf2_set_file: * @sf: SoundFont to set file object of * @file: File object to use with the SoundFont. * * Sets the file object of a SoundFont. SoundFont files are kept open * for sample data that references the file. This function sets a * SoundFonts authoritive file object. A convenience function, as * ipatch_base_set_file() does the same thing (albeit without more specific * type casting). */ void ipatch_sf2_set_file (IpatchSF2 *sf, IpatchSF2File *file) { g_return_if_fail (IPATCH_IS_SF2 (sf)); g_return_if_fail (IPATCH_IS_SF2_FILE (file)); ipatch_base_set_file (IPATCH_BASE (sf), IPATCH_FILE (file)); } /** * ipatch_sf2_get_file: * @sf: SoundFont to get file object of * * Gets the file object of a SoundFont. The returned SoundFont file object's * reference count has incremented. The caller owns the reference and is * responsible for removing it with g_object_unref(). * A convenience function as ipatch_base_get_file() does the same thing * (albeit without more specific type casting). * * Returns: The SoundFont file object or %NULL if @sf is not open. Remember * to unref the file object with g_object_unref() when * done with it. */ IpatchSF2File * ipatch_sf2_get_file (IpatchSF2 *sf) { IpatchFile *file; g_return_val_if_fail (IPATCH_IS_SF2 (sf), NULL); file = ipatch_base_get_file (IPATCH_BASE (sf)); if (file) return (IPATCH_SF2_FILE (file)); else return (NULL); } /** * ipatch_sf2_get_info: * @sf: SoundFont to get info from * @id: RIFF FOURCC id * * Get a SoundFont info string by RIFF FOURCC ID. * * Returns: New allocated info string value or %NULL if no info with the * given @id. String should be freed when finished with it. */ char * ipatch_sf2_get_info (IpatchSF2 *sf, IpatchSF2InfoType id) { char *val; g_return_val_if_fail (IPATCH_IS_SF2 (sf), NULL); IPATCH_ITEM_RLOCK (sf); val = g_hash_table_lookup (sf->info, GUINT_TO_POINTER (id)); if (val) val = g_strdup (val); IPATCH_ITEM_RUNLOCK (sf); return (val); } /** * ipatch_sf2_set_info: * @sf: SoundFont to set info of * @id: RIFF FOURCC id * @val: Value to set info to or %NULL to unset (clear) info. * * Set SoundFont info. Validates @id and ensures @val does not exceed * the maximum allowed length for the given info type. * * Emits changed signal on SoundFont. */ void ipatch_sf2_set_info (IpatchSF2 *sf, IpatchSF2InfoType id, const char *val) { GParamSpec *pspec; GValue oldval = { 0 }, newval = { 0 }; int i; g_return_if_fail (IPATCH_IS_SF2 (sf)); for (i = 0; i < G_N_ELEMENTS (info_ids); i++) if (info_ids[i] == id) break; if (i == G_N_ELEMENTS (info_ids)) { g_return_if_fail (ipatch_sf2_info_id_is_valid (id)); /* for debugging */ return; } pspec = info_prop_pspecs[i]; g_value_init (&oldval, G_TYPE_STRING); g_value_take_string (&oldval, ipatch_sf2_get_info (sf, id)); ipatch_sf2_real_set_info (sf, id, val); g_value_init (&newval, G_TYPE_STRING); g_value_set_static_string (&newval, val); ipatch_item_prop_notify ((IpatchItem *)sf, pspec, &newval, &oldval); /* need to do a title property notify? */ if (id == IPATCH_SF2_NAME) ipatch_item_prop_notify ((IpatchItem *)sf, ipatch_item_pspec_title, &newval, &oldval); g_value_unset (&oldval); g_value_unset (&newval); } /* the real set info by id routine, user routine does a property notify */ static void ipatch_sf2_real_set_info (IpatchSF2 *sf, IpatchSF2InfoType id, const char *val) { char *newval = NULL; int maxlen; maxlen = ipatch_sf2_get_info_max_size (id); /* value exceeds max length? */ if (maxlen > 0 && val && strlen (val) > maxlen - 1) { g_warning ("IpatchSF2Info string with id '%.4s' truncated", (char *)&id); newval = g_strndup (val, maxlen - 1); } else if (val) newval = g_strdup (val); /* we set up the hash table to free old string values */ IPATCH_ITEM_WLOCK (sf); if (newval) g_hash_table_insert (sf->info, GINT_TO_POINTER (id), newval); else g_hash_table_remove (sf->info, GINT_TO_POINTER (id)); IPATCH_ITEM_WUNLOCK (sf); /* newval has been taken over by hash table */ } /* a bag for ipatch_sf2_get_info_array() */ typedef struct { int count; IpatchSF2Info *info; } InfoArrayBag; /** * ipatch_sf2_get_info_array: * @sf: SoundFont to get all info strings from * * Get all string info (not IPATCH_SF2_VERSION or IPATCH_SF2_ROM_VERSION) * from a SoundFont object. The array is sorted in the order recommended * by the SoundFont standard for saving. * * Returns: A newly allocated array of info structures terminated by * an array member with 0 valued id * field. Remember to free the array with ipatch_sf2_free_info_array() * when finished with it. */ IpatchSF2Info * ipatch_sf2_get_info_array (IpatchSF2 *sf) { IpatchSF2Info *array; InfoArrayBag bag; g_return_val_if_fail (IPATCH_IS_SF2 (sf), NULL); /* allocate max expected info elements + 1 for terminator */ array = g_malloc ((IPATCH_SF2_INFO_COUNT + 1) * sizeof (IpatchSF2Info)); bag.count = 0; bag.info = array; IPATCH_ITEM_RLOCK (sf); g_hash_table_foreach (sf->info, ipatch_sf2_foreach_info_GHFunc, &bag); IPATCH_ITEM_RUNLOCK (sf); qsort (array, bag.count, sizeof (IpatchSF2Info), ipatch_sf2_info_array_qsort); /* terminate array */ array[bag.count].id = 0; array[bag.count].val = NULL; /* re-allocate for actual size */ return (g_realloc (array, (bag.count + 1) * sizeof (IpatchSF2Info))); } static void ipatch_sf2_foreach_info_GHFunc (gpointer key, gpointer value, gpointer data) { InfoArrayBag *bag = (InfoArrayBag *)data; /* shouldn't happen, but just in case */ if (bag->count >= IPATCH_SF2_INFO_COUNT) return; /* store the info ID and string in the info array */ bag->info[bag->count].id = GPOINTER_TO_UINT (key); bag->info[bag->count].val = g_strdup ((char *)value); bag->count++; /* advance to next index */ } /* sorts an info array according to recommended SoundFont order */ static int ipatch_sf2_info_array_qsort (const void *a, const void *b) { IpatchSF2Info *ainfo = (IpatchSF2Info *)a; IpatchSF2Info *binfo = (IpatchSF2Info *)b; int andx, bndx; /* find index in info ID array */ for (andx = 0; andx < G_N_ELEMENTS (info_ids); andx++) if (info_ids[andx] == ainfo->id) break; for (bndx = 0; bndx < G_N_ELEMENTS (info_ids); bndx++) if (info_ids[bndx] == binfo->id) break; return (andx - bndx); } /** * ipatch_sf2_free_info_array: * @array: SoundFont info array * * Frees an info array returned by ipatch_sf2_get_info_array(). */ void ipatch_sf2_free_info_array (IpatchSF2Info *array) { int i; g_return_if_fail (array != NULL); for (i = 0; array[i].id; i++) g_free (array[i].val); g_free (array); } /** * ipatch_sf2_info_id_is_valid: * @id: RIFF FOURCC id (see #IpatchSF2InfoType) * * Check if a given RIFF FOURCC id is a valid SoundFont info id. * * Returns: %TRUE if @id is a valid info id, %FALSE otherwise */ gboolean ipatch_sf2_info_id_is_valid (guint32 id) { int i; for (i = 0; i < G_N_ELEMENTS (info_ids) ; i++) if (info_ids[i] == id) return (TRUE); return (FALSE); } /** * ipatch_sf2_get_info_max_size: * @infotype: An info enumeration * * Get maximum chunk size for info chunks. * * NOTE: Max size includes terminating NULL character so subtract one from * returned value to get max allowed string length. * * Returns: Maximum info chunk size or 0 if invalid or variable length * info chunk type. Subtract one to get max allowed string length (if * returned value was not 0). */ int ipatch_sf2_get_info_max_size (IpatchSF2InfoType infotype) { if (!ipatch_sf2_info_id_is_valid (infotype)) return (0); if (infotype == IPATCH_SF2_COMMENT) /* comments can have up to 64k bytes */ return (65536); if (infotype == IPATCH_SF2_VERSION /* versions take up 4 bytes */ || infotype == IPATCH_SF2_ROM_VERSION) return (4); return (256); /* all other valid info types allow 256 bytes max */ } /** * ipatch_sf2_find_preset: * @sf: SoundFont to search in * @name: Name of preset to find or %NULL to match any name * @bank: MIDI bank number of preset to search for or -1 to not search by * MIDI bank:program numbers * @program: MIDI program number of preset to search for, only used * if @bank is 0-128 * @exclude: A preset to exclude from the search or %NULL * * Find a preset by name or bank:preset MIDI numbers. If preset @name * and @bank:@program are specified then match for either condition. * If a preset is found its reference count is incremented before it * is returned. The caller is responsible for removing the reference * with g_object_unref() when finished with it. * * Returns: The matching preset or %NULL if not found. Remember to unref * the item when finished with it. */ IpatchSF2Preset * ipatch_sf2_find_preset (IpatchSF2 *sf, const char *name, int bank, int program, const IpatchSF2Preset *exclude) { IpatchSF2Preset *pset; gboolean bynum = FALSE; GSList *p; g_return_val_if_fail (IPATCH_IS_SF2 (sf), NULL); /* if bank and program are valid, then search by number */ if (bank >= 0 && bank <= 128 && program >= 0 && program < 128) bynum = TRUE; IPATCH_ITEM_RLOCK (sf); p = sf->presets; while (p) { pset = (IpatchSF2Preset *)(p->data); IPATCH_ITEM_RLOCK (pset); /* MT - Recursive LOCK */ if (pset != exclude /* if exclude is NULL it will never == pset */ && ((bynum && pset->bank == bank && pset->program == program) || (name && strcmp (pset->name, name) == 0))) { g_object_ref (pset); IPATCH_ITEM_RUNLOCK (pset); IPATCH_ITEM_RUNLOCK (sf); return (pset); } IPATCH_ITEM_RUNLOCK (pset); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (sf); return (NULL); } /** * ipatch_sf2_find_inst: * @sf: SoundFont to search in * @name: Name of Instrument to find * @exclude: An instrument to exclude from the search or %NULL * * Find an instrument by @name in a SoundFont. If a matching instrument * is found, its reference count is incremented before it is returned. * The caller is responsible for removing the reference with g_object_unref() * when finished with it. * * Returns: The matching instrument or %NULL if not found. Remember to unref * the item when finished with it. */ IpatchSF2Inst * ipatch_sf2_find_inst (IpatchSF2 *sf, const char *name, const IpatchSF2Inst *exclude) { IpatchSF2Inst *inst; GSList *p; g_return_val_if_fail (IPATCH_IS_SF2 (sf), NULL); g_return_val_if_fail (name != NULL, NULL); IPATCH_ITEM_RLOCK (sf); p = sf->insts; while (p) { inst = (IpatchSF2Inst *)(p->data); IPATCH_ITEM_RLOCK (inst); /* MT - Recursive LOCK */ if (inst != exclude && strcmp (inst->name, name) == 0) { g_object_ref (inst); IPATCH_ITEM_RUNLOCK (inst); IPATCH_ITEM_RUNLOCK (sf); return (inst); } IPATCH_ITEM_RUNLOCK (inst); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (sf); return (NULL); } /** * ipatch_sf2_find_sample: * @sf: SoundFont to search in * @name: Name of sample to find * @exclude: A sample to exclude from the search or %NULL * * Find a sample by @name in a SoundFont. If a sample is found its * reference count is incremented before it is returned. The caller * is responsible for removing the reference with g_object_unref() * when finished with it. * * Returns: The matching sample or %NULL if not found. Remember to unref * the item when finished with it. */ IpatchSF2Sample * ipatch_sf2_find_sample (IpatchSF2 *sf, const char *name, const IpatchSF2Sample *exclude) { IpatchSF2Sample *sample; GSList *p; g_return_val_if_fail (IPATCH_IS_SF2 (sf), NULL); g_return_val_if_fail (name != NULL, NULL); IPATCH_ITEM_RLOCK (sf); p = sf->samples; while (p) { sample = (IpatchSF2Sample *)(p->data); IPATCH_ITEM_RLOCK (sample); /* MT - Recursive LOCK */ if (sample != exclude && strcmp (sample->name, name) == 0) { g_object_ref (sample); IPATCH_ITEM_RUNLOCK (sample); IPATCH_ITEM_RUNLOCK (sf); return (sample); } IPATCH_ITEM_RUNLOCK (sample); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (sf); return (NULL); } /** * ipatch_sf2_get_zone_references: * @item: Item to locate referencing zones of, must be of type #IpatchSF2Inst * or #IpatchSF2Sample and be parented to an #IpatchSF2 object. * * Get list of zones referencing an IpatchSF2Inst or IpatchSF2Sample. * * Returns: New object list containing #IpatchSF2Zone objects that * refer to @item. The new list object has a reference count of 1 * which the caller owns, unreference to free the list. */ IpatchList * ipatch_sf2_get_zone_references (IpatchItem *item) { IpatchList *reflist, *itemlist, *zonelist; IpatchSF2 *sf; IpatchSF2Zone *zone; IpatchIter iter, zone_iter; IpatchItem *pitem; g_return_val_if_fail (IPATCH_IS_SF2_INST (item) || IPATCH_IS_SF2_SAMPLE (item), NULL); pitem = ipatch_item_get_parent (item); g_return_val_if_fail (IPATCH_IS_SF2 (pitem), NULL); sf = IPATCH_SF2 (pitem); /* ++ ref item list */ if (IPATCH_IS_SF2_INST (item)) /* is an instrument? */ itemlist = ipatch_sf2_get_presets (sf); else itemlist = ipatch_sf2_get_insts (sf); /* its a sample */ reflist = ipatch_list_new (); /* ++ ref new list */ ipatch_list_init_iter (itemlist, &iter); pitem = ipatch_item_first (&iter); while (pitem) /* loop on item list */ { /* ++ ref new zone list */ zonelist = ipatch_container_get_children ((IpatchContainer *)(pitem), IPATCH_TYPE_SF2_ZONE); ipatch_list_init_iter (zonelist, &zone_iter); zone = ipatch_sf2_zone_first (&zone_iter); while (zone) { if (ipatch_sf2_zone_peek_link_item (zone) == item) { g_object_ref (zone); /* ++ ref zone for new list */ reflist->items = g_list_prepend (reflist->items, zone); } zone = ipatch_sf2_zone_next (&zone_iter); } g_object_unref (zonelist); /* -- unref zone list */ pitem = ipatch_item_next (&iter); } g_object_unref (itemlist); /* -- unref item list */ return (reflist); /* !! caller takes over reference */ } /* In theory there is still a chance of duplicates if another item's name is set to the generated unique one (by another thread) while in this routine */ /** * ipatch_sf2_make_unique_name: * @sfont: SoundFont item * @child_type: A child type of @sfont to search for a unique name in * @name: An initial name to use or NULL * @exclude: An item to exclude from search or NULL * * Generates a unique name for the given @child_type in @sfont. The @name * parameter is used as a base and is modified, by appending a number, to * make it unique (if necessary). The @exclude parameter is used to exclude * an existing @sfont child item from the search. * * MT-Note: To ensure that an item is actually unique before being * added to a SoundFont object, ipatch_container_add_unique() should be * used. * * Returns: A new unique name which should be freed when finished with it. */ char * ipatch_sf2_make_unique_name (IpatchSF2 *sfont, GType child_type, const char *name, const IpatchItem *exclude) { GSList **list, *p; char curname[IPATCH_SFONT_NAME_SIZE + 1]; int name_ofs; int count = 2; g_return_val_if_fail (IPATCH_IS_SF2 (sfont), NULL); if (child_type == IPATCH_TYPE_SF2_PRESET) { list = &sfont->presets; name_ofs = G_STRUCT_OFFSET (IpatchSF2Preset, name); if (!name) name = _("New Preset"); } else if (child_type == IPATCH_TYPE_SF2_INST) { list = &sfont->insts; name_ofs = G_STRUCT_OFFSET (IpatchSF2Inst, name); if (!name) name = _("New Instrument"); } else if (child_type == IPATCH_TYPE_SF2_SAMPLE) { list = &sfont->samples; name_ofs = G_STRUCT_OFFSET (IpatchSF2Sample, name); if (!name) name = _("New Sample"); } else { g_critical (IPATCH_CONTAINER_ERRMSG_INVALID_CHILD_2, g_type_name (child_type), g_type_name (IPATCH_TYPE_SF2)); return (NULL); } g_strlcpy (curname, name, sizeof (curname)); IPATCH_ITEM_RLOCK (sfont); p = *list; while (p) /* check for duplicate */ { IPATCH_ITEM_RLOCK (p->data); /* MT - Recursive LOCK */ if (p->data != exclude && strcmp (G_STRUCT_MEMBER (char *, p->data, name_ofs), curname) == 0) { /* duplicate name */ IPATCH_ITEM_RUNLOCK (p->data); ipatch_strconcat_num (name, count++, curname, sizeof (curname)); p = *list; /* start over */ continue; } IPATCH_ITEM_RUNLOCK (p->data); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (sfont); return (g_strdup (curname)); } libinstpatch-1.0.0/libinstpatch/md5.h0000644000175000017500000000306311456655761014461 00000000000000/* * This is the header file for the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * IpatchMD5 structure, pass it to ipatch_md5_init, call ipatch_md5_update as * needed on buffers full of bytes, and then call ipatch_md5_final, which * will fill a supplied 16-byte array with the digest. * * Changed so as no longer to depend on Colin Plumb's `usual.h' * header definitions; now uses stuff from dpkg's config.h * - Ian Jackson . * Still in the public domain. * * Josh Coalson: made some changes to integrate with libFLAC. * Still in the public domain. * * Josh Green: made some changes to integrate with libInstPatch. * Still in the public domain. */ /** * SECTION: md5 * @short_description: MD5 hashing functions * @see_also: * @stability: Stable */ #ifndef __IPATCH__MD5_H__ #define __IPATCH__MD5_H__ #include typedef struct { guint32 buf[4]; guint32 bytes[2]; guint32 in[16]; } IpatchMD5; void ipatch_md5_init (IpatchMD5 *ctx); void ipatch_md5_update (IpatchMD5 *ctx, guint8 const *buf, unsigned len); void ipatch_md5_final (IpatchMD5 *ctx, guint8 digest[16]); #endif /* !MD5_H */ libinstpatch-1.0.0/libinstpatch/IpatchDLS2Region.c0000644000175000017500000010016011461332142016741 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchDLS2Region.h" #include "IpatchGigRegion.h" #include "IpatchRange.h" #include "IpatchSample.h" #include "IpatchTypeProp.h" #include "builtin_enums.h" #include "ipatch_priv.h" enum { PROP_0, PROP_TITLE, PROP_NOTE_RANGE, PROP_VELOCITY_RANGE, PROP_KEY_GROUP, PROP_LAYER_GROUP, PROP_PHASE_GROUP, PROP_CHANNEL, PROP_LINK_ITEM, PROP_SAMPLE_INFO_OVERRIDE, /* sample info override boolean */ /* IpatchItem flags (no one needs to know that though) */ PROP_SELF_NON_EXCLUSIVE, PROP_PHASE_MASTER, PROP_MULTI_CHANNEL, /* IpatchSample interface properties */ PROP_SAMPLE_SIZE, PROP_SAMPLE_FORMAT, PROP_SAMPLE_RATE, PROP_SAMPLE_DATA }; enum { SET_CONN, UNSET_CONN, LAST_SIGNAL }; static void ipatch_dls2_region_sample_iface_init (IpatchSampleIface *sample_iface); static gboolean ipatch_dls2_region_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_dls2_region_class_init (IpatchDLS2RegionClass *klass); static void ipatch_dls2_region_init (IpatchDLS2Region *region); static void ipatch_dls2_region_finalize (GObject *gobject); static void ipatch_dls2_region_get_title (IpatchDLS2Region *region, GValue *value); static void ipatch_dls2_region_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_dls2_region_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_dls2_region_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static void ipatch_dls2_region_real_set_sample (IpatchDLS2Region *region, IpatchDLS2Sample *sample, gboolean sample_notify); static void ipatch_dls2_region_get_sample_info (IpatchDLS2Region *region, IpatchDLS2SampleInfo *info); /* cached param specs to speed up prop notifies */ static GParamSpec *link_item_pspec; G_DEFINE_TYPE_WITH_CODE (IpatchDLS2Region, ipatch_dls2_region, IPATCH_TYPE_ITEM, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_dls2_region_sample_iface_init)) /* sample interface initialization */ static void ipatch_dls2_region_sample_iface_init (IpatchSampleIface *sample_iface) { sample_iface->open = ipatch_dls2_region_sample_iface_open; sample_iface->loop_types = ipatch_sample_loop_types_standard_release; } static gboolean ipatch_dls2_region_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchDLS2Region *region = IPATCH_DLS2_REGION (handle->sample); g_return_val_if_fail (region->sample != NULL, FALSE); return (ipatch_sample_handle_cascade_open (handle, IPATCH_SAMPLE (region->sample), err)); } static void ipatch_dls2_region_class_init (IpatchDLS2RegionClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->finalize = ipatch_dls2_region_finalize; obj_class->get_property = ipatch_dls2_region_get_property; item_class->item_set_property = ipatch_dls2_region_set_property; item_class->copy = ipatch_dls2_region_item_copy; g_object_class_override_property (obj_class, PROP_TITLE, "title"); g_object_class_install_property (obj_class, PROP_NOTE_RANGE, ipatch_param_spec_range ("note-range", _("Note range"), _("MIDI note range"), 0, 127, 0, 127, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_VELOCITY_RANGE, ipatch_param_spec_range ("velocity-range", _("Velocity range"), _("MIDI velocity range"), 0, 127, 0, 127, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_KEY_GROUP, g_param_spec_int ("key-group", _("Key group"), _("Percussion key group"), 0, 15, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_LAYER_GROUP, g_param_spec_int ("layer-group", _("Layer group"), _("Layer group"), 0, G_MAXUSHORT, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_PHASE_GROUP, g_param_spec_int ("phase-group", _("Phase group"), _("Phase locked sample group"), 0, G_MAXUSHORT, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_CHANNEL, g_param_spec_int ("channel", _("Channel"), _("DLS audio channel identifier"), 0, 0x03FFFF, 0, G_PARAM_READWRITE)); link_item_pspec = g_param_spec_object ("link-item", _("Link item"), _("Link item"), IPATCH_TYPE_DLS2_SAMPLE, G_PARAM_READWRITE); g_object_class_install_property (obj_class, PROP_LINK_ITEM, link_item_pspec); g_object_class_install_property (obj_class, PROP_SAMPLE_INFO_OVERRIDE, g_param_spec_boolean ("sample-info-override", _("Override sample info"), _("Override sample info"), FALSE, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_SELF_NON_EXCLUSIVE, g_param_spec_boolean ("self-non-exclusive", _("Non exclusive"), _("Self non exclusive"), FALSE, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_PHASE_MASTER, g_param_spec_boolean ("phase-master", _("Phase master"), _("Multi channel phase lock master"), FALSE, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_MULTI_CHANNEL, g_param_spec_boolean ("multi-channel", _("Multi channel"), _("Multi channel"), FALSE, G_PARAM_READWRITE)); /* IpatchSample interface properties */ ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_SIZE, "sample-size"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_FORMAT, "sample-format"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_RATE, "sample-rate"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_DATA, "sample-data"); ipatch_dls2_info_install_class_properties (obj_class); ipatch_dls2_sample_info_install_class_properties (obj_class); } static void ipatch_dls2_region_init (IpatchDLS2Region *region) { region->note_range_low = 0; region->note_range_high = 127; region->velocity_range_low = 0; region->velocity_range_high = 127; region->key_group = 0; region->layer_group = 0; region->phase_group = 0; region->channel = 0; region->info = NULL; region->sample_info = NULL; region->sample = NULL; region->conns = NULL; } static void ipatch_dls2_region_finalize (GObject *gobject) { IpatchDLS2Region *region = IPATCH_DLS2_REGION (gobject); GSList *p; IPATCH_ITEM_WLOCK (region); if (region->sample_info) { ipatch_dls2_sample_info_free (region->sample_info); region->sample_info = NULL; } if (region->sample) { g_object_unref (region->sample); region->sample = NULL; } p = region->conns; while (p) { ipatch_dls2_conn_free ((IpatchDLS2Conn *)(p->data)); p = g_slist_delete_link (p, p); } region->conns = NULL; IPATCH_ITEM_WUNLOCK (region); if (G_OBJECT_CLASS (ipatch_dls2_region_parent_class)->finalize) G_OBJECT_CLASS (ipatch_dls2_region_parent_class)->finalize (gobject); } static void ipatch_dls2_region_get_title (IpatchDLS2Region *region, GValue *value) { IpatchDLS2Sample *sample; char *s = NULL; sample = ipatch_dls2_region_get_sample (region); /* ++ ref sample */ if (sample) { g_object_get (sample, "name", &s, NULL); g_object_unref (sample); /* -- unref sample */ } g_value_take_string (value, s); } static void ipatch_dls2_region_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchDLS2Region *region = IPATCH_DLS2_REGION (object); IpatchDLS2SampleInfo saminfo = IPATCH_DLS2_SAMPLE_INFO_INIT; IpatchDLS2SampleInfo oldinfo, newinfo; IpatchRange *range; gboolean is_samprop; gboolean retval; switch (property_id) { case PROP_NOTE_RANGE: range = ipatch_value_get_range (value); if (range) { IPATCH_ITEM_WLOCK (region); region->note_range_low = range->low; region->note_range_high = range->high; IPATCH_ITEM_WUNLOCK (region); } break; case PROP_VELOCITY_RANGE: range = ipatch_value_get_range (value); if (range) { IPATCH_ITEM_WLOCK (region); region->velocity_range_low = range->low; region->velocity_range_high = range->high; IPATCH_ITEM_WUNLOCK (region); } break; case PROP_KEY_GROUP: region->key_group = g_value_get_int (value); break; case PROP_LAYER_GROUP: region->layer_group = g_value_get_int (value); break; case PROP_PHASE_GROUP: region->phase_group = g_value_get_int (value); break; case PROP_CHANNEL: region->channel = g_value_get_int (value); break; case PROP_LINK_ITEM: ipatch_dls2_region_real_set_sample (region, IPATCH_DLS2_SAMPLE (g_value_get_object (value)), FALSE); break; case PROP_SAMPLE_INFO_OVERRIDE: ipatch_dls2_region_get_sample_info (region, &oldinfo); if (g_value_get_boolean (value)) ipatch_item_set_flags ((IpatchItem *)region, IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE); else ipatch_item_clear_flags ((IpatchItem *)region, IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE); ipatch_dls2_region_get_sample_info (region, &newinfo); ipatch_dls2_sample_info_notify_changes ((IpatchItem *)region, &newinfo, &oldinfo); break; case PROP_SELF_NON_EXCLUSIVE: if (g_value_get_boolean (value)) ipatch_item_set_flags (IPATCH_ITEM (object), IPATCH_DLS2_REGION_SELF_NON_EXCLUSIVE); else ipatch_item_clear_flags (IPATCH_ITEM (object), IPATCH_DLS2_REGION_SELF_NON_EXCLUSIVE); break; case PROP_PHASE_MASTER: if (g_value_get_boolean (value)) ipatch_item_set_flags (IPATCH_ITEM (object), IPATCH_DLS2_REGION_PHASE_MASTER); else ipatch_item_clear_flags (IPATCH_ITEM (object), IPATCH_DLS2_REGION_PHASE_MASTER); break; case PROP_MULTI_CHANNEL: if (g_value_get_boolean (value)) ipatch_item_set_flags (IPATCH_ITEM (object), IPATCH_DLS2_REGION_MULTI_CHANNEL); else ipatch_item_clear_flags (IPATCH_ITEM (object), IPATCH_DLS2_REGION_MULTI_CHANNEL); break; default: is_samprop = ipatch_dls2_sample_info_is_property_id_valid (property_id); /* check if region override info valid but override flag not set. If so then copy sample info to static 'saminfo'. OK to test region without locking it (worst that happens is default values get used). */ if (is_samprop && region->sample_info && !(ipatch_item_get_flags (region) & IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE)) ipatch_dls2_region_get_sample_info (region, &saminfo); IPATCH_ITEM_WLOCK (region); /* is override sample_info valid but override flag not set and it is in fact a sample info property? - Copy values from sample (or defaults) */ if (is_samprop && region->sample_info && !(ipatch_item_get_flags (region) & IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE)) *region->sample_info = saminfo; retval = ipatch_dls2_sample_info_set_property (®ion->sample_info, property_id, value); if (retval) /* sample info set, set override flag */ ipatch_item_set_flags (region, IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE); else retval = ipatch_dls2_info_set_property (®ion->info, property_id, value); IPATCH_ITEM_WUNLOCK (region); if (!retval) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } break; } } static void ipatch_dls2_region_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchDLS2Region *region = IPATCH_DLS2_REGION (object); IpatchDLS2Sample *sample = NULL; IpatchRange range; gboolean bool, retval = 0; gboolean get_from_sample = FALSE; switch (property_id) { case PROP_TITLE: ipatch_dls2_region_get_title (region, value); break; case PROP_NOTE_RANGE: IPATCH_ITEM_RLOCK (region); range.low = region->note_range_low; range.high = region->note_range_high; IPATCH_ITEM_RUNLOCK (region); ipatch_value_set_range (value, &range); break; case PROP_VELOCITY_RANGE: IPATCH_ITEM_RLOCK (region); range.low = region->velocity_range_low; range.high = region->velocity_range_high; IPATCH_ITEM_RUNLOCK (region); ipatch_value_set_range (value, &range); break; case PROP_KEY_GROUP: g_value_set_int (value, region->key_group); break; case PROP_LAYER_GROUP: g_value_set_int (value, region->layer_group); break; case PROP_PHASE_GROUP: g_value_set_int (value, region->phase_group); break; case PROP_CHANNEL: g_value_set_int (value, region->channel); break; case PROP_LINK_ITEM: g_value_take_object (value, ipatch_dls2_region_get_sample (region)); break; case PROP_SAMPLE_INFO_OVERRIDE: g_value_set_boolean (value, (ipatch_item_get_flags ((IpatchItem *)region) & IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE) != 0); break; case PROP_SELF_NON_EXCLUSIVE: bool = (ipatch_item_get_flags (IPATCH_ITEM (object)) & IPATCH_DLS2_REGION_SELF_NON_EXCLUSIVE) > 0; g_value_set_boolean (value, bool); break; case PROP_PHASE_MASTER: bool = (ipatch_item_get_flags (IPATCH_ITEM (object)) & IPATCH_DLS2_REGION_PHASE_MASTER) > 0; g_value_set_boolean (value, bool); break; case PROP_MULTI_CHANNEL: bool = (ipatch_item_get_flags (IPATCH_ITEM (object)) & IPATCH_DLS2_REGION_MULTI_CHANNEL) > 0; g_value_set_boolean (value, bool); break; case PROP_SAMPLE_SIZE: sample = ipatch_dls2_region_get_sample (region); /* ++ ref sample */ g_return_if_fail (sample != NULL); g_object_get_property ((GObject *)sample, "sample-size", value); g_object_unref (sample); /* -- unref sample */ break; case PROP_SAMPLE_FORMAT: sample = ipatch_dls2_region_get_sample (region); /* ++ ref sample */ g_return_if_fail (sample != NULL); g_object_get_property ((GObject *)sample, "sample-size", value); g_object_unref (sample); /* -- unref sample */ break; case PROP_SAMPLE_RATE: sample = ipatch_dls2_region_get_sample (region); /* ++ ref sample */ g_return_if_fail (sample != NULL); g_object_get_property ((GObject *)sample, "sample-rate", value); g_object_unref (sample); /* -- unref sample */ break; case PROP_SAMPLE_DATA: sample = ipatch_dls2_region_get_sample (region); /* ++ ref sample */ g_return_if_fail (sample != NULL); g_object_get_property ((GObject *)sample, "sample-data", value); g_object_unref (sample); /* -- unref sample */ break; default: IPATCH_ITEM_RLOCK (region); /* a sample info property? */ if (property_id >= IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID && property_id < (IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID + IPATCH_DLS2_SAMPLE_INFO_PROPERTY_COUNT)) { if (ipatch_item_get_flags (region) & IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE && region->sample_info) retval = ipatch_dls2_sample_info_get_property (region->sample_info, property_id, value); else { get_from_sample = TRUE; sample = region->sample ? g_object_ref (region->sample) : NULL; } } /* not sample info, is it a DLS text info property? */ else retval = ipatch_dls2_info_get_property (region->info, property_id, value); IPATCH_ITEM_RUNLOCK (region); if (get_from_sample) /* get sample info from linked sample? */ { if (sample) { IPATCH_ITEM_RLOCK (sample); ipatch_dls2_sample_info_get_property (sample->sample_info, property_id, value); IPATCH_ITEM_RUNLOCK (sample); g_object_unref (sample); } else ipatch_dls2_sample_info_get_property (NULL, property_id, value); } else if (!retval) G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_dls2_region_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchDLS2Region *src_reg, *dest_reg; IpatchDLS2Sample *refsample; src_reg = IPATCH_DLS2_REGION (src); dest_reg = IPATCH_DLS2_REGION (dest); IPATCH_ITEM_RLOCK (src_reg); /* duplicate the flags */ ipatch_item_set_flags (dest_reg, ipatch_item_get_flags (src_reg) & IPATCH_DLS2_REGION_FLAG_MASK); dest_reg->note_range_low = src_reg->note_range_low; dest_reg->note_range_high = src_reg->note_range_high; dest_reg->velocity_range_low = src_reg->velocity_range_low; dest_reg->velocity_range_high = src_reg->velocity_range_high; dest_reg->key_group = src_reg->key_group; dest_reg->layer_group = src_reg->layer_group; dest_reg->phase_group = src_reg->phase_group; dest_reg->channel = src_reg->channel; dest_reg->info = ipatch_dls2_info_duplicate (src_reg->info); dest_reg->sample_info = src_reg->sample_info ? ipatch_dls2_sample_info_duplicate (src_reg->sample_info) : NULL; /* pass the link to the link handler (if any) */ refsample = (IpatchDLS2Sample *) IPATCH_ITEM_COPY_LINK_FUNC (IPATCH_ITEM (dest_reg), IPATCH_ITEM (src_reg->sample), link_func, user_data); if (refsample) ipatch_dls2_region_set_sample (dest_reg, refsample); /* duplicate the connection list */ dest_reg->conns = ipatch_dls2_conn_list_duplicate (src_reg->conns); IPATCH_ITEM_RUNLOCK (src_reg); } /** * ipatch_dls2_region_new: * * Create a new DLS region object. * * Returns: Newly created DLS region with a ref count of 1 which the caller * owns. */ IpatchDLS2Region * ipatch_dls2_region_new (void) { return (IPATCH_DLS2_REGION (g_object_new (IPATCH_TYPE_DLS2_REGION, NULL))); } /** * ipatch_dls2_region_first: * @iter: Patch item iterator containing #IpatchDLS2Region items * * Gets the first item in a region iterator. A convenience * wrapper for ipatch_iter_first(). * * Returns: The first region in @iter or %NULL if empty. */ IpatchDLS2Region * ipatch_dls2_region_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_DLS2_REGION (obj)); else return (NULL); } /** * ipatch_dls2_region_next: * @iter: Patch item iterator containing #IpatchDLS2Region items * * Gets the next item in a region iterator. A convenience wrapper * for ipatch_iter_next(). * * Returns: The next region in @iter or %NULL if at the end of * the list. */ IpatchDLS2Region * ipatch_dls2_region_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_DLS2_REGION (obj)); else return (NULL); } /** * ipatch_dls2_region_get_info: * @region: DLS region to get info from * @fourcc: FOURCC integer id of INFO to get * * Get a DLS region info string by FOURCC integer ID (integer * representation of a 4 character RIFF chunk ID, see * #IpatchRiff). * * Returns: New allocated info string value or %NULL if no info with the * given @fourcc ID. String should be freed when finished with it. */ char * ipatch_dls2_region_get_info (IpatchDLS2Region *region, guint32 fourcc) { char *val; g_return_val_if_fail (IPATCH_IS_DLS2_REGION (region), NULL); IPATCH_ITEM_RLOCK (region); val = ipatch_dls2_info_get (region->info, fourcc); IPATCH_ITEM_RUNLOCK (region); return (val); } /** * ipatch_dls2_region_set_info: * @region: DLS region to set info of * @fourcc: FOURCC integer ID of INFO to set * @val: Value to set info to or %NULL to unset (clear) info. * * Sets an INFO value in a DLS region object. * Emits changed signal. */ void ipatch_dls2_region_set_info (IpatchDLS2Region *region, guint32 fourcc, const char *val) { GValue newval = { 0 }, oldval = { 0 }; g_return_if_fail (IPATCH_IS_DLS2_REGION (region)); g_value_init (&newval, G_TYPE_STRING); g_value_set_static_string (&newval, val); g_value_init (&oldval, G_TYPE_STRING); g_value_take_string (&oldval, ipatch_dls2_region_get_info (region, fourcc)); IPATCH_ITEM_WLOCK (region); ipatch_dls2_info_set (®ion->info, fourcc, val); IPATCH_ITEM_WUNLOCK (region); ipatch_dls2_info_notify ((IpatchItem *)region, fourcc, &newval, &oldval); g_value_unset (&oldval); g_value_unset (&newval); } /** * ipatch_dls2_region_set_sample: * @region: Region to set sample of * @sample: Sample to set region to * * Sets the referenced sample of a region. */ void ipatch_dls2_region_set_sample (IpatchDLS2Region *region, IpatchDLS2Sample *sample) { g_return_if_fail (IPATCH_IS_DLS2_REGION (region)); g_return_if_fail (IPATCH_IS_DLS2_SAMPLE (sample)); ipatch_dls2_region_real_set_sample (region, sample, TRUE); } static void ipatch_dls2_region_real_set_sample (IpatchDLS2Region *region, IpatchDLS2Sample *sample, gboolean sample_notify) { GValue newval = { 0 }, oldval = { 0 }; IpatchDLS2SampleInfo oldinfo, newinfo; if (sample_notify) ipatch_item_get_property_fast ((IpatchItem *)region, link_item_pspec, &oldval); /* get all values of current sample info */ ipatch_dls2_region_get_sample_info (region, &oldinfo); IPATCH_ITEM_WLOCK (region); if (region->sample) g_object_unref (region->sample); if (sample) g_object_ref (sample); region->sample = sample; IPATCH_ITEM_WUNLOCK (region); if (sample_notify) { g_value_init (&newval, IPATCH_TYPE_DLS2_SAMPLE); g_value_set_object (&newval, sample); ipatch_item_prop_notify ((IpatchItem *)region, link_item_pspec, &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } /* notify title property change */ g_value_init (&newval, G_TYPE_STRING); ipatch_dls2_region_get_title (region, &newval); ipatch_item_prop_notify ((IpatchItem *)region, ipatch_item_pspec_title, &newval, NULL); g_value_unset (&newval); /* notify for sample info properties */ ipatch_dls2_region_get_sample_info (region, &newinfo); ipatch_dls2_sample_info_notify_changes ((IpatchItem *)region, &newinfo, &oldinfo); } static void ipatch_dls2_region_get_sample_info (IpatchDLS2Region *region, IpatchDLS2SampleInfo *info) { IpatchDLS2Sample *sample = NULL; gboolean info_set = TRUE; IPATCH_ITEM_RLOCK (region); if (ipatch_item_get_flags (region) & IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE && region->sample_info) *info = *region->sample_info; else if (region->sample) sample = g_object_ref (region->sample); else info_set = FALSE; IPATCH_ITEM_RUNLOCK (region); if (sample) { IPATCH_ITEM_RLOCK (sample); if (sample->sample_info) *info = *sample->sample_info; else info_set = FALSE; IPATCH_ITEM_RUNLOCK (sample); g_object_unref (sample); } if (!info_set) ipatch_dls2_sample_info_init (info); } /** * ipatch_dls2_region_get_sample: * @region: Region to get referenced sample from * * Gets the referenced sample from a region. The returned item's * reference count is incremented and the caller is responsible for * unrefing it with g_object_unref(). * * Returns: Region's referenced sample or %NULL if not set yet. Remember to * unreference the item with g_object_unref() when done with it. */ IpatchDLS2Sample * ipatch_dls2_region_get_sample (IpatchDLS2Region *region) { IpatchDLS2Sample *sample; g_return_val_if_fail (IPATCH_IS_DLS2_REGION (region), NULL); IPATCH_ITEM_RLOCK (region); sample = region->sample; if (sample) g_object_ref (sample); IPATCH_ITEM_RUNLOCK (region); return (sample); } /** * ipatch_dls2_region_peek_sample: * @region: Region to get referenced sample from * * Like ipatch_dls2_region_get_sample() but does not add a reference to * the returned item. This function should only be used if a reference * of the returned item is ensured or only the pointer value is of * interest. * * Returns: Region's referenced sample or %NULL if not set yet. Remember that * the item has NOT been referenced. */ IpatchDLS2Sample * ipatch_dls2_region_peek_sample (IpatchDLS2Region *region) { IpatchDLS2Sample *sample; g_return_val_if_fail (IPATCH_IS_DLS2_REGION (region), NULL); IPATCH_ITEM_RLOCK (region); sample = region->sample; IPATCH_ITEM_RUNLOCK (region); return (sample); } /** * ipatch_dls2_region_set_note_range: * @region: Region to set note range of * @low: Low value of range (MIDI note # between 0 and 127) * @high: High value of range (MIDI note # between 0 and 127) * * Set the MIDI note range that a region is active on. */ void ipatch_dls2_region_set_note_range (IpatchDLS2Region *region, int low, int high) { g_return_if_fail (IPATCH_IS_DLS2_REGION (region)); g_return_if_fail (low >= 0 && low <= 127); g_return_if_fail (high >= 0 && high <= 127); if (low > high) /* swap if backwards */ { int temp = low; low = high; high = temp; } IPATCH_ITEM_WLOCK (region); region->note_range_low = low; region->note_range_high = high; IPATCH_ITEM_WUNLOCK (region); } /** * ipatch_dls2_region_set_velocity_range: * @region: Region to set velocity range of * @low: Low value of range (MIDI velocity # between 0 and 127) * @high: High value of range (MIDI velocity # between 0 and 127) * * Set the MIDI velocity range that a region is active on. */ void ipatch_dls2_region_set_velocity_range (IpatchDLS2Region *region, int low, int high) { g_return_if_fail (IPATCH_IS_DLS2_REGION (region)); g_return_if_fail (low >= 0 && low <= 127); g_return_if_fail (high >= 0 && high <= 127); if (low > high) /* swap if backwards */ { int temp = low; low = high; high = temp; } IPATCH_ITEM_WLOCK (region); region->velocity_range_low = low; region->velocity_range_high = high; IPATCH_ITEM_WUNLOCK (region); } /** * ipatch_dls2_region_in_range: * @region: Region to check if in range * @note: MIDI note number or -1 for wildcard * @velocity: MIDI velocity or -1 for wildcard * * Check if a note and velocity falls in a region's ranges * * Returns: %TRUE if region is in note and velocity range, %FALSE otherwise */ gboolean ipatch_dls2_region_in_range (IpatchDLS2Region *region, int note, int velocity) { gboolean in_range; g_return_val_if_fail (IPATCH_IS_DLS2_REGION (region), FALSE); IPATCH_ITEM_RLOCK (region); in_range = (note == -1 || (note >= region->note_range_low && note <= region->note_range_high)) && (velocity == -1 || (velocity >= region->velocity_range_low && velocity <= region->velocity_range_high)); IPATCH_ITEM_RUNLOCK (region); return (in_range); } /** * ipatch_dls2_region_set_param: * @region: Region to set parameter of * @param: Parameter to set * @val: Value for parameter * * Sets an effect parameter of a DLS2 Region. DLS2 defines a standard set * of connections (effect parameters). Any non-standard connections can be * manipulated with the connection related functions. */ void ipatch_dls2_region_set_param (IpatchDLS2Region *region, IpatchDLS2Param param, gint32 val) { g_return_if_fail (IPATCH_IS_DLS2_REGION (region)); g_return_if_fail (param < IPATCH_DLS2_PARAM_COUNT); /* no need to lock, since write of 32 bit int is atomic */ region->params.values[param] = val; } /** * @region: Region to set parameter of * @array: Array of parameter values to copy to region * * Sets all effect parameters of a DLS2 Region. */ void ipatch_dls2_region_set_param_array (IpatchDLS2Region *region, IpatchDLS2ParamArray *array) { g_return_if_fail (IPATCH_IS_DLS2_REGION (region)); g_return_if_fail (array != NULL); int i; /* Write of each parameter is atomic. */ for (i = 0; i < IPATCH_DLS2_PARAM_COUNT; i++) region->params.values[i] = array->values[i]; } /** * ipatch_dls2_region_get_conns: * @region: Region to get connections from * * Gets a list of connections from a DLS region. List should be freed with * ipatch_dls2_conn_list_free() (free_conns set to %TRUE) when finished * with it. * * Returns: New list of connections (#IpatchDLS2Conn) in @region or * %NULL if no connections. Remember to free it when finished. */ GSList * ipatch_dls2_region_get_conns (IpatchDLS2Region *region) { GSList *newlist; g_return_val_if_fail (IPATCH_IS_DLS2_REGION (region), NULL); IPATCH_ITEM_RLOCK (region); newlist = ipatch_dls2_conn_list_duplicate (region->conns); IPATCH_ITEM_RUNLOCK (region); return (newlist); } /** * ipatch_dls2_region_set_conn: * @region: DLS region * @conn: Connection * * Set a DLS connection in a region. See ipatch_dls2_conn_list_set() for * more details. */ void ipatch_dls2_region_set_conn (IpatchDLS2Region *region, const IpatchDLS2Conn *conn) { g_return_if_fail (IPATCH_IS_DLS2_REGION (region)); g_return_if_fail (conn != NULL); IPATCH_ITEM_WLOCK (region); ipatch_dls2_conn_list_set (®ion->conns, conn); IPATCH_ITEM_WUNLOCK (region); } /** * ipatch_dls2_region_unset_conn: * @region: DLS region * @conn: Connection * * Remove a DLS connection from a region. See ipatch_dls2_conn_list_unset() * for more details. */ void ipatch_dls2_region_unset_conn (IpatchDLS2Region *region, const IpatchDLS2Conn *conn) { g_return_if_fail (IPATCH_IS_DLS2_REGION (region)); g_return_if_fail (conn != NULL); IPATCH_ITEM_WLOCK (region); ipatch_dls2_conn_list_unset (®ion->conns, conn); IPATCH_ITEM_WUNLOCK (region); } /** * ipatch_dls2_region_unset_all_conns: * @region: DLS region * * Remove all connections in a region. */ void ipatch_dls2_region_unset_all_conns (IpatchDLS2Region *region) { g_return_if_fail (IPATCH_IS_DLS2_REGION (region)); IPATCH_ITEM_WLOCK (region); ipatch_dls2_conn_list_free (region->conns, TRUE); region->conns = NULL; IPATCH_ITEM_WUNLOCK (region); } /** * ipatch_dls2_region_conn_count: * @region: Region to count connections in * * Count number of connections in a region * * Returns: Count of connections */ guint ipatch_dls2_region_conn_count (IpatchDLS2Region *region) { guint i; IPATCH_ITEM_RLOCK (region); i = g_slist_length (region->conns); IPATCH_ITEM_RUNLOCK (region); return (i); } /** * ipatch_dls2_region_channel_map_stereo: * @chan: Channel steering enum * * Map a DLS2 channel steering enumeration (surround sound capable) to stereo * steering. * * Returns: -1 = left, 0 = center, 1 = right */ int ipatch_dls2_region_channel_map_stereo (IpatchDLS2RegionChannelType chan) { switch (chan) { case IPATCH_DLS2_REGION_CHANNEL_LEFT: case IPATCH_DLS2_REGION_CHANNEL_SURROUND_LEFT: case IPATCH_DLS2_REGION_CHANNEL_LEFT_OF_CENTER: case IPATCH_DLS2_REGION_CHANNEL_SIDE_LEFT: case IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_LEFT: case IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_LEFT: return (-1); case IPATCH_DLS2_REGION_CHANNEL_RIGHT: case IPATCH_DLS2_REGION_CHANNEL_SURROUND_RIGHT: case IPATCH_DLS2_REGION_CHANNEL_RIGHT_OF_CENTER: case IPATCH_DLS2_REGION_CHANNEL_SIDE_RIGHT: case IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_RIGHT: case IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_RIGHT: return (1); case IPATCH_DLS2_REGION_CHANNEL_CENTER: case IPATCH_DLS2_REGION_CHANNEL_LOW_FREQ: case IPATCH_DLS2_REGION_CHANNEL_SURROUND_CENTER: case IPATCH_DLS2_REGION_CHANNEL_TOP: case IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_CENTER: case IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_CENTER: return (0); default: return (0); } } libinstpatch-1.0.0/libinstpatch/IpatchVBankRegion.h0000644000175000017500000001050311461332142017244 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchVBankRegion * @short_description: Virtual bank instrument region * @see_also: #IpatchVBankInst, #IpatchVBank * @stability: Stable * * Virtual bank regions are children to #IpatchVBankInst objects and reference * synthesizable #IpatchItem objects from other files. This object forms the * bases for constructing new instruments from one or more items in other * instrument bank files. */ #ifndef __IPATCH_VBANK_REGION_H__ #define __IPATCH_VBANK_REGION_H__ #include #include #include #include /* forward type declarations */ typedef struct _IpatchVBankRegion IpatchVBankRegion; typedef struct _IpatchVBankRegionClass IpatchVBankRegionClass; #define IPATCH_TYPE_VBANK_REGION (ipatch_vbank_region_get_type ()) #define IPATCH_VBANK_REGION(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_VBANK_REGION, \ IpatchVBankRegion)) #define IPATCH_VBANK_REGION_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_VBANK_REGION, \ IpatchVBankRegionClass)) #define IPATCH_IS_VBANK_REGION(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VBANK_REGION)) #define IPATCH_IS_VBANK_REGION_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_VBANK_REGION)) #define IPATCH_VBANK_REGION_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_VBANK_REGION, \ IpatchVBankRegionClass)) /* Virtual bank region */ struct _IpatchVBankRegion { IpatchItem parent_instance; /*< private >*/ IpatchItem *item; /* Referenced item or NULL (if unresolved) */ char **id_props; /* prop/val pairs which ID item or NULL (if resolved) */ guint file_index; /* Index of file in IpatchVBank parent (if unresolved) */ IpatchRange note_range; /* MIDI note range of this region */ guint8 note_range_mode; /* #IpatchVBankRegionNoteRangeMode */ gint8 root_note; /* MIDI root note value */ guint8 root_note_mode; /* #IpatchVBankRegionRootNoteMode */ }; struct _IpatchVBankRegionClass { IpatchItemClass parent_class; }; /** * IpatchVBankNoteRangeMode: * @IPATCH_VBANK_REGION_NOTE_RANGE_MODE_INTERSECT: Note range is applied as an * intersection with existing voice note ranges (only those notes shared by * both ranges will become the final range, a logic AND operation). * @IPATCH_VBANK_REGION_NOTE_RANGE_MODE_ASSIGN: Note range of all voices is * overridden by new range. * * Determines mode in which a virtual bank region's note range is applied to the * affected synthesis voices. */ typedef enum { IPATCH_VBANK_REGION_NOTE_RANGE_MODE_INTERSECT = 0, IPATCH_VBANK_REGION_NOTE_RANGE_MODE_OVERRIDE = 1 } IpatchVBankRegionNoteRangeMode; /** * IpatchVBankRootNoteMode: * @IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OFFSET: Offset the root note parameters of * affected synthesis voices by a given signed integer amount. * @IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OVERRIDE: Override root note parameters of * affected synthesis voices. */ typedef enum { IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OFFSET = 0, IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OVERRIDE = 1 } IpatchVBankRegionRootNoteMode; GType ipatch_vbank_region_get_type (void); IpatchVBankRegion *ipatch_vbank_region_new (void); IpatchVBankRegion *ipatch_vbank_region_first (IpatchIter *iter); IpatchVBankRegion *ipatch_vbank_region_next (IpatchIter *iter); void ipatch_vbank_region_set_id_props (IpatchVBankRegion *region, char **id_props); char **ipatch_vbank_region_get_id_props (IpatchVBankRegion *region, guint *n_elements); #endif libinstpatch-1.0.0/libinstpatch/marshals.list0000644000175000017500000000233711456655761016335 00000000000000# see glib-genmarshal(1) for a detailed description of the file format, # possible parameter types are: # VOID indicates no return type, or no extra # parameters. if VOID is used as the parameter # list, no additional parameters may be present. # BOOLEAN for boolean types (gboolean) # CHAR for signed char types (gchar) # UCHAR for unsigned char types (guchar) # INT for signed integer types (gint) # UINT for unsigned integer types (guint) # LONG for signed long integer types (glong) # ULONG for unsigned long integer types (gulong) # ENUM for enumeration types (gint) # FLAGS for flag enumeration types (guint) # FLOAT for single-precision float types (gfloat) # DOUBLE for double-precision float types (gdouble) # STRING for string types (gchar*) # PARAM for GParamSpec or derived types (GParamSpec*) # BOXED for boxed (anonymous but reference counted) types (GBoxed*) # POINTER for anonymous pointer types (gpointer) # OBJECT for GObject or derived types (GObject*) # NONE deprecated alias for VOID # BOOL deprecated alias for BOOLEAN ENUM:FLAGS libinstpatch-1.0.0/libinstpatch/IpatchDLS2Sample.h0000644000175000017500000001210711461332142016747 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchDLS2Sample * @short_description: DLS audio sample object * @see_also: #IpatchDLS, #IpatchDLSRegion * @stability: Stable * * Object which defines a DLS audio sample. These objects are contained in * #IpatchDLS objects and linked (referenced) from #IpatchDLSRegion objects. */ #ifndef __IPATCH_DLS2_SAMPLE_H__ #define __IPATCH_DLS2_SAMPLE_H__ #include #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchDLS2Sample IpatchDLS2Sample; typedef struct _IpatchDLS2SampleClass IpatchDLS2SampleClass; typedef struct _IpatchDLS2SampleInfo IpatchDLS2SampleInfo; #define IPATCH_TYPE_DLS2_SAMPLE (ipatch_dls2_sample_get_type ()) #define IPATCH_DLS2_SAMPLE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_DLS2_SAMPLE, \ IpatchDLS2Sample)) #define IPATCH_DLS2_SAMPLE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_DLS2_SAMPLE, \ IpatchDLS2SampleClass)) #define IPATCH_IS_DLS2_SAMPLE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_DLS2_SAMPLE)) #define IPATCH_IS_DLS2_SAMPLE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_DLS2_SAMPLE)) #define IPATCH_DLS2_SAMPLE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_DLS2_SAMPLE, \ IpatchDLS2SampleClass)) /* SoundFont sample item */ struct _IpatchDLS2Sample { IpatchItem parent_instance; int rate; /* sample rate */ IpatchDLS2SampleInfo *sample_info; /* sample data info (optional) */ IpatchDLS2Info *info; /* info string values */ IpatchSampleData *sample_data; /* sample data object */ guint8 *dlid; /* 16 byte unique ID or NULL */ }; struct _IpatchDLS2SampleClass { IpatchItemClass parent_class; }; /* DLS2 sample info, can also be defined in regions */ struct _IpatchDLS2SampleInfo { guint8 options; /* IpatchSampleLoopType and IpatchDLS2SampleFlags */ guint8 root_note; /* root MIDI note number */ gint16 fine_tune; /* fine tuning */ gint32 gain; /* gain to apply to sample */ guint32 loop_start; /* loop start offset (in samples) */ guint32 loop_end; /* loop end offset (in samples) */ }; /* default values to initialize static IpatchDLS2SampleInfo with */ #define IPATCH_DLS2_SAMPLE_INFO_INIT { 0, 60, 0, 0, 0, 0 } /* since sample info is also used by regions, we define a non-conflicting property ID here for the first sample info property */ #define IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID 256 /* count of sample info properties */ #define IPATCH_DLS2_SAMPLE_INFO_PROPERTY_COUNT 7 /* flags crammed into sample info options field */ typedef enum { IPATCH_DLS2_SAMPLE_NO_TRUNCATION = 1 << 6, IPATCH_DLS2_SAMPLE_NO_COMPRESSION = 1 << 7 } IpatchDLS2SampleFlags; #define IPATCH_DLS2_SAMPLE_LOOP_MASK 0x03 #define IPATCH_DLS2_SAMPLE_FLAGS_MASK 0x0C0 GType ipatch_dls2_sample_get_type (void); IpatchDLS2Sample *ipatch_dls2_sample_new (void); IpatchDLS2Sample *ipatch_dls2_sample_first (IpatchIter *iter); IpatchDLS2Sample *ipatch_dls2_sample_next (IpatchIter *iter); void ipatch_dls2_sample_set_data (IpatchDLS2Sample *sample, IpatchSampleData *sampledata); IpatchSampleData *ipatch_dls2_sample_get_data (IpatchDLS2Sample *sample); IpatchSampleData *ipatch_dls2_sample_peek_data (IpatchDLS2Sample *sample); void ipatch_dls2_sample_set_blank (IpatchDLS2Sample *sample); IpatchDLS2SampleInfo *ipatch_dls2_sample_info_new (void); void ipatch_dls2_sample_info_free (IpatchDLS2SampleInfo *sample_info); IpatchDLS2SampleInfo *ipatch_dls2_sample_info_duplicate (IpatchDLS2SampleInfo *sample_info); void ipatch_dls2_sample_info_init (IpatchDLS2SampleInfo *sample_info); void ipatch_dls2_sample_info_install_class_properties (GObjectClass *obj_class); gboolean ipatch_dls2_sample_info_is_property_id_valid (guint property_id); gboolean ipatch_dls2_sample_info_set_property (IpatchDLS2SampleInfo **sample_info, guint property_id, const GValue *value); gboolean ipatch_dls2_sample_info_get_property (IpatchDLS2SampleInfo *sample_info, guint property_id, GValue *value); void ipatch_dls2_sample_info_notify_changes (IpatchItem *item, IpatchDLS2SampleInfo *newinfo, IpatchDLS2SampleInfo *oldinfo); #endif libinstpatch-1.0.0/libinstpatch/IpatchUnit.c0000644000175000017500000003273211461332142016021 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchUnit.h" #include "IpatchRange.h" #include "ipatch_priv.h" #include "i18n.h" G_LOCK_DEFINE_STATIC (unit_info); static GHashTable *unit_id_hash = NULL; /* unit registry (id) */ static GHashTable *unit_name_hash = NULL; /* secondary key (name -> id) */ /* unit class mappings (srcId:classType -> destInfo) */ static GHashTable *class_map_hash = NULL; static GHashTable *conversion_hash = NULL; /* conversion function hash */ /* next dynamic unit type ID (increment) */ static guint16 last_unit_id = IPATCH_UNIT_TYPE_FIRST_DYNAMIC_ID; void _ipatch_unit_generic_init (void); void _ipatch_unit_dls_init (void); void _ipatch_unit_sf2_init (void); /* initialize unit system */ void _ipatch_unit_init (void) { unit_id_hash = g_hash_table_new (NULL, NULL); unit_name_hash = g_hash_table_new (g_str_hash, g_str_equal); class_map_hash = g_hash_table_new (NULL, NULL); conversion_hash = g_hash_table_new (NULL, NULL); /* initialize unit types and conversion handlers */ _ipatch_unit_generic_init (); _ipatch_unit_dls_init (); _ipatch_unit_sf2_init (); } /** * ipatch_unit_info_new: * * Allocate a unit info structure for registering unit types with * ipatch_unit_register(). Using this function should minimize API changes * if additional fields are added to #IpatchUnitInfo. Free the returned * structure with ipatch_unit_free() when finished registering unit types. * * Returns: The newly allocated unit info structure. */ IpatchUnitInfo * ipatch_unit_info_new (void) { return (g_slice_new0 (IpatchUnitInfo)); } /** * ipatch_unit_info_free: * @info: Unit info to free * * Free a unit info structure that was created with ipatch_unit_info_new(). */ void ipatch_unit_info_free (IpatchUnitInfo *info) { g_slice_free (IpatchUnitInfo, info); } /** * ipatch_unit_register: * @info: Unit info (shallow copied) * * Add a new unit type to the unit registry. Note that the @info structure * is shallow copied, so strings should be constant or guaranteed to not * be freed. If the id field is already set * (non-zero) in @info, then it is used (should be 0 for dynamic unit * types). If the label field of the @info * structure is %NULL then it is set to the i18n translated string for * name. Unit types can not be un-registered. * Unit IDs of dynamic (non built-in types) should not be relied apon to * always be the same between program executions. * * Returns: New unit ID */ guint16 ipatch_unit_register (const IpatchUnitInfo *info) { IpatchUnitInfo *newinfo; g_return_val_if_fail (info != NULL, 0); g_return_val_if_fail (info->name != NULL, 0); /* allocate the new unit info, so that the pointer is constant and can be * returned to the user out of lock (not safe if it was in a GArray) */ newinfo = ipatch_unit_info_new (); *newinfo = *info; /* if label not set, use i18n translated name */ if (!info->label) newinfo->label = _(info->name); G_LOCK (unit_info); if (!newinfo->id) newinfo->id = last_unit_id++; g_hash_table_insert (unit_id_hash, /* hash by id */ GUINT_TO_POINTER ((guint32)(newinfo->id)), newinfo); g_hash_table_insert (unit_name_hash, newinfo->name, newinfo); /* hash by name */ G_UNLOCK (unit_info); return (newinfo->id); } /** * ipatch_unit_lookup: * @id: Unit ID * * Looks up unit info by ID. * * Returns: Unit info structure with @id or %NULL if not found, * returned structure is internal and should not be modified or freed */ IpatchUnitInfo * ipatch_unit_lookup (guint16 id) { IpatchUnitInfo *info; G_LOCK (unit_info); info = g_hash_table_lookup (unit_id_hash, GUINT_TO_POINTER ((guint32)id)); G_UNLOCK (unit_info); return (info); } /** * ipatch_unit_lookup_by_name: * @name: Unit name identifier * * Looks up unit info by name. * * Returns: Unit info structure with @name or %NULL if not found, * returned structure is internal and should not be modified or freed */ IpatchUnitInfo * ipatch_unit_lookup_by_name (const char *name) { IpatchUnitInfo *info; G_LOCK (unit_info); info = g_hash_table_lookup (unit_name_hash, name); G_UNLOCK (unit_info); return (info); } /** * ipatch_unit_class_register_map: * @class_type: Class type (see #IpatchUnitClassType) * @src_units: Source unit type of mapping * @dest_units: Destination unit type for this map * * Register a unit class mapping. Unit class types define domains of * conversion, an example is the "user" unit class * (#IPATCH_UNIT_CLASS_USER) which is used to convert values to units * digestable by a human. A conversion class is essentially a mapping * between unit types, which can then be used to lookup conversion * functions. */ void ipatch_unit_class_register_map (guint16 class_type, guint16 src_units, guint16 dest_units) { IpatchUnitInfo *src_info, *dest_info; guint32 hashval; g_return_if_fail (class_type > IPATCH_UNIT_CLASS_NONE); g_return_if_fail (class_type < IPATCH_UNIT_CLASS_COUNT); hashval = class_type | (src_units << 16); G_LOCK (unit_info); src_info = g_hash_table_lookup (unit_id_hash, GUINT_TO_POINTER ((guint32)src_units)); dest_info = g_hash_table_lookup (unit_id_hash, GUINT_TO_POINTER ((guint32)dest_units)); /* only insert map if unit types are valid */ if (src_info != NULL && dest_info != NULL) g_hash_table_insert (class_map_hash, GUINT_TO_POINTER (hashval), dest_info); G_UNLOCK (unit_info); g_return_if_fail (src_info != NULL); g_return_if_fail (dest_info != NULL); } /** * ipatch_unit_class_lookup_map: * @class_type: Class type (see #IpatchUnitClassType) * @src_units: Source unit type of mapping to lookup * * Lookup a unit class mapping (see ipatch_unit_class_register_map ()). * * Returns: Pointer to destination unit info structure, or %NULL if not found. */ IpatchUnitInfo * ipatch_unit_class_lookup_map (guint16 class_type, guint16 src_units) { IpatchUnitInfo *dest_info; guint32 hashval; g_return_val_if_fail (class_type > IPATCH_UNIT_CLASS_NONE, 0); g_return_val_if_fail (class_type < IPATCH_UNIT_CLASS_COUNT, 0); hashval = class_type | (src_units << 16); G_LOCK (unit_info); dest_info = g_hash_table_lookup (class_map_hash, GUINT_TO_POINTER (hashval)); G_UNLOCK (unit_info); return (dest_info); } /** * ipatch_unit_conversion_register: * @src_units: Source unit type * @dest_units: Destination unit type * @func: Conversion function handler or %NULL for unity conversion (the * value type will be converted but not the actual value, example: * float -> int). * * Register a parameter unit conversion function. */ void ipatch_unit_conversion_register (guint16 src_units, guint16 dest_units, IpatchValueTransform func) { guint32 hashkey; hashkey = src_units | (dest_units << 16); func += 1; /* store as func + 1 to differentiate between NULL and invalid */ G_LOCK (unit_info); g_hash_table_insert (conversion_hash, GUINT_TO_POINTER (hashkey), func); G_UNLOCK (unit_info); } /** * ipatch_unit_conversion_lookup: * @src_units: Source unit type * @dest_units: Destination unit type * @set: Location to store a boolean value indicating if the conversion is * set, to differentiate between a %NULL conversion function and an invalid * conversion. Can be %NULL in which case this parameter is ignored. * * Lookup a conversion function by source and destination unit types. * * Returns: Conversion function pointer or %NULL if a unity conversion or * no matching handlers (use @set to determine which). */ IpatchValueTransform ipatch_unit_conversion_lookup (guint16 src_units, guint16 dest_units, gboolean *set) { IpatchValueTransform func; guint32 hashkey; hashkey = src_units | (dest_units << 16); G_LOCK (unit_info); func = g_hash_table_lookup (conversion_hash, GUINT_TO_POINTER (hashkey)); G_UNLOCK (unit_info); if (set) *set = func != NULL; return (func != NULL ? func - 1 : NULL); /* we store as func + 1 */ } /** * ipatch_unit_convert: * @src_units: Source unit type ID * @dest_units: Destination unit type ID * @src_val: Source value (type should be compatible with the source unit's * value type) * @dest_val: Destination value (value should be initialized to a type that is * compatible with the destination unit's value type) * * Convert a value from one unit type to another. * * Returns: %TRUE if value was successfully converted, %FALSE * otherwise (the only reasons for failure are invalid function * parameters, no conversion function for the given unit types, or * incompatible GValue types in conversion, therefore the return value * can be safely ignored if the caller is sure the parameters and * types are OK). */ gboolean ipatch_unit_convert (guint16 src_units, guint16 dest_units, const GValue *src_val, GValue *dest_val) { IpatchValueTransform convert_func; IpatchUnitInfo *src_info, *dest_info; const GValue *sv; GValue tmpsv = { 0 }, tmpdv = { 0 }, *dv; guint32 hashkey; gboolean retval; hashkey = src_units | (dest_units << 16); G_LOCK (unit_info); src_info = g_hash_table_lookup (unit_id_hash, GUINT_TO_POINTER ((guint32)src_units)); dest_info = g_hash_table_lookup (unit_id_hash, GUINT_TO_POINTER ((guint32)dest_units)); convert_func = g_hash_table_lookup (conversion_hash, GUINT_TO_POINTER (hashkey)); G_UNLOCK (unit_info); g_return_val_if_fail (src_info != NULL, FALSE); g_return_val_if_fail (dest_info != NULL, FALSE); g_return_val_if_fail (convert_func != NULL, FALSE); convert_func -= 1; /* we store as func + 1 */ if (G_UNLIKELY (!convert_func)) /* unity conversion? */ { retval = g_value_transform (src_val, dest_val); if (G_UNLIKELY (!retval)) { g_critical ("%s: Failed to transform value type '%s' to type '%s'", G_STRLOC, g_type_name (G_VALUE_TYPE (src_val)), g_type_name (G_VALUE_TYPE (dest_val))); return (FALSE); } return (TRUE); } /* source value needs to be transformed? */ if (G_UNLIKELY (G_VALUE_TYPE (src_val) != src_info->value_type)) { g_value_init (&tmpsv, src_info->value_type); retval = g_value_transform (src_val, &tmpsv); sv = &tmpsv; if (G_UNLIKELY (!retval)) { g_value_unset (&tmpsv); g_critical ("%s: Failed to transform value type '%s' to type '%s'", G_STRLOC, g_type_name (G_VALUE_TYPE (src_val)), g_type_name (src_info->value_type)); return (FALSE); } } else sv = src_val; /* same type, just use it */ /* destination value needs to be transformed? */ if (G_LIKELY (G_VALUE_TYPE (dest_val) == dest_info->value_type)) { /* same type, just reset value and use it */ g_value_reset (dest_val); dv = dest_val; } else if (!g_value_type_transformable (dest_info->value_type, G_VALUE_TYPE (dest_val))) { g_critical ("%s: Failed to transform value type '%s' to type '%s'", G_STRLOC, g_type_name (dest_info->value_type), g_type_name (G_VALUE_TYPE (dest_val))); return (FALSE); } else /* initialize temp value to native type (transformed later) */ { g_value_init (&tmpdv, dest_info->value_type); dv = &tmpdv; } /* do the conversion */ (*convert_func)(sv, dv); /* free the converted source value if needed */ if (G_UNLIKELY (sv == &tmpsv)) g_value_unset (&tmpsv); if (G_UNLIKELY (dv == &tmpdv)) /* transform the destination value if needed */ { g_value_transform (dv, dest_val); g_value_unset (&tmpdv); } return (TRUE); } /** * ipatch_unit_user_class_convert: * @src_units: Source unit type ID * @src_val: Source value (type should be compatible with the source unit's * value type) * * Converts a value to "user" units. User units are unit types that * are adequate for human consumption. The #IPATCH_UNIT_CLASS_USER * map is used to lookup the corresponding user type to convert to. * Not all unit types have an associated user type or the @src_units * type can itself be a user type; in either of these cases the * @src_val is converted as is (possibly converted from another value * type to double). * * Returns: The value converted to user units. */ double ipatch_unit_user_class_convert (guint16 src_units, const GValue *src_val) { IpatchUnitInfo *dest_info; guint16 dest_units; GValue v = { 0 }; double retval; g_return_val_if_fail (src_val != NULL, 0.0); dest_info = ipatch_unit_class_lookup_map (IPATCH_UNIT_CLASS_USER, src_units); dest_units = dest_info ? dest_info->id : src_units; g_value_init (&v, G_TYPE_DOUBLE); ipatch_unit_convert (src_units, dest_units, src_val, &v); retval = g_value_get_double (&v); g_value_unset (&v); /* probably not necessary, but its the right way (TM) */ return (retval); } libinstpatch-1.0.0/libinstpatch/IpatchItem.c0000644000175000017500000012623111461332142015776 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchItem.h" #include "IpatchIter.h" #include "IpatchContainer.h" #include "IpatchBase.h" /* IPATCH_BASE_CHANGED flag */ #include "IpatchParamProp.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" #include "i18n.h" #include "util.h" enum { PROP_0, PROP_FLAGS, PROP_PARENT, PROP_BASE, PROP_TITLE }; /* for unique property caching */ typedef struct { GParamSpec **pspecs; /* unique prop paramspecs (groups are consecutive) */ guint32 groups; /* 1 bit per pspec, pspecs of same group are the same */ } UniqueBag; /* a private bag structure for ipatch_item_set_parent */ typedef struct { IpatchItem *base; int hooks_active; } SetParentBag; /* defined in IpatchItemProp.c */ extern void _ipatch_item_prop_init (void); /* defined in IpatchBase.c */ extern GParamSpec *ipatch_base_pspec_changed; static void ipatch_item_base_init (IpatchItemClass *klass); static void ipatch_item_class_init (IpatchItemClass *klass); static void ipatch_item_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_item_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_item_set_property_override (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_item_init (IpatchItem *item); static void ipatch_item_finalize (GObject *object); static void ipatch_item_recursive_base_set (IpatchContainer *container, SetParentBag *bag); static void ipatch_item_recursive_base_unset (IpatchContainer *container); static void copy_hash_to_list_GHFunc (gpointer key, gpointer value, gpointer user_data); static UniqueBag *item_lookup_unique_bag (GType type); static gint unique_group_list_sort_func (gconstpointer a, gconstpointer b); static GObjectClass *parent_class = NULL; /* item class for fast hook function method calls */ static IpatchItemClass *real_item_class = NULL; /* define the lock for the unique property cache hash */ G_LOCK_DEFINE_STATIC (unique_prop_cache); /* cache of IpatchItem unique properties (hash: GType => UniqueBag) */ static GHashTable *unique_prop_cache = NULL; /* a dummy bag pointer used to indicate that an item type has no unique props */ static UniqueBag no_unique_props; /* store title property GParamSpec as a convenience to derived types */ GParamSpec *ipatch_item_pspec_title = NULL; GType ipatch_item_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchItemClass), (GBaseInitFunc) ipatch_item_base_init, NULL, (GClassInitFunc) ipatch_item_class_init, NULL, NULL, sizeof (IpatchItem), 0, (GInstanceInitFunc)ipatch_item_init, }; item_type = g_type_register_static (G_TYPE_OBJECT, "IpatchItem", &item_info, G_TYPE_FLAG_ABSTRACT); /* create unique property cache (elements are never removed) */ unique_prop_cache = g_hash_table_new (NULL, NULL); _ipatch_item_prop_init (); /* Initialize property change callback system */ } return (item_type); } static void ipatch_item_base_init (IpatchItemClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); /* override the set property method for all derived IpatchItem types */ obj_class->set_property = ipatch_item_set_property_override; } /* set_property override method that calls item_set_property method, derived * classes should use the item_set_property method instead of set_property. */ static void ipatch_item_set_property_override (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchItemClass *klass; GObjectClass *obj_class; gboolean hooks_active; GValue oldval = { 0 }; GType type, prev_type; /* Get the class for the owning type of this parameter. * NOTE: This wont work for interfaces (handled below) or overridden * properties. FIXME - Not sure how to handle overridden properties. */ klass = g_type_class_peek (pspec->owner_type); /* property belongs to an interface? */ if (!klass && G_TYPE_IS_INTERFACE (pspec->owner_type)) { /* Unfortunately GObject doesn't give us an easy way to determine which * class implements an interface in an object's derived ancestry, so we're * left with this hack.. */ prev_type = G_OBJECT_TYPE (object); type = prev_type; /* find type in object's ancestry that implements the interface by searching * for the type just before the first parent which doesn't conform to the * interface. */ while ((type = g_type_parent (type))) { if (!g_type_is_a (type, pspec->owner_type)) break; prev_type = type; } if (prev_type) klass = g_type_class_peek (prev_type); } g_return_if_fail (klass != NULL); g_return_if_fail (klass->item_set_property != NULL); /* hook functions can be inactive for greater performance */ hooks_active = (ipatch_item_get_flags (object) & IPATCH_ITEM_HOOKS_ACTIVE) != 0; /* fetch parameter's current value to use as oldval in property notify */ if (hooks_active) { obj_class = (GObjectClass *)klass; g_return_if_fail (obj_class->get_property != NULL); g_value_init (&oldval, G_PARAM_SPEC_VALUE_TYPE (pspec)); obj_class->get_property (object, property_id, &oldval, pspec); } klass->item_set_property (object, property_id, value, pspec); /* call property change */ if (hooks_active) { ipatch_item_prop_notify ((IpatchItem *)object, pspec, value, &oldval); g_value_unset (&oldval); } } static void ipatch_item_class_init (IpatchItemClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); real_item_class = klass; parent_class = g_type_class_peek_parent (klass); klass->item_set_property = ipatch_item_set_property; obj_class->get_property = ipatch_item_get_property; obj_class->finalize = ipatch_item_finalize; g_object_class_install_property (obj_class, PROP_FLAGS, g_param_spec_uint ("flags", _("Flags"), _("Flags"), 0, G_MAXUINT, 0, G_PARAM_READWRITE | IPATCH_PARAM_HIDE | IPATCH_PARAM_NO_SAVE_CHANGE | IPATCH_PARAM_NO_SAVE)); g_object_class_install_property (obj_class, PROP_PARENT, g_param_spec_object ("parent", _("Parent"), _("Parent"), IPATCH_TYPE_ITEM, G_PARAM_READWRITE | IPATCH_PARAM_NO_SAVE)); g_object_class_install_property (obj_class, PROP_BASE, g_param_spec_object ("base", _("Base"), _("Base"), IPATCH_TYPE_BASE, G_PARAM_READABLE | IPATCH_PARAM_NO_SAVE)); ipatch_item_pspec_title = g_param_spec_string ("title", _("Title"), _("Title"), NULL, G_PARAM_READABLE | IPATCH_PARAM_NO_SAVE_CHANGE | IPATCH_PARAM_NO_SAVE); g_object_class_install_property (obj_class, PROP_TITLE, ipatch_item_pspec_title); } static void ipatch_item_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchItem *item = IPATCH_ITEM (object); switch (property_id) { case PROP_FLAGS: ipatch_item_set_flags (item, g_value_get_uint (value)); break; case PROP_PARENT: ipatch_item_set_parent (item, IPATCH_ITEM (g_value_get_object (value))); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_item_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchItem *item = IPATCH_ITEM (object); char *name; switch (property_id) { case PROP_FLAGS: g_value_set_uint (value, ipatch_item_get_flags (item)); break; case PROP_PARENT: g_value_take_object (value, ipatch_item_get_parent (item)); break; case PROP_BASE: g_value_take_object (value, ipatch_item_get_base (item)); break; case PROP_TITLE: /* see if the "name" type property is set */ ipatch_type_object_get ((GObject *)item, "name", &name, NULL); if (name) g_value_take_string (value, name); else g_value_set_string (value, IPATCH_UNTITLED); /* "untitled" */ break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_item_init (IpatchItem *item) { IpatchItemClass *klass; klass = IPATCH_ITEM_GET_CLASS (item); /* always assign a mutex, will be freed and set to parent's mutex if the class has mutex_slave set (during ipatch_item_set_parent) */ item->mutex = g_malloc (sizeof (GStaticRecMutex)); g_static_rec_mutex_init (item->mutex); ipatch_item_set_flags (item, IPATCH_ITEM_FREE_MUTEX); } static void ipatch_item_finalize (GObject *object) { IpatchItem *item = IPATCH_ITEM (object); if (ipatch_item_get_flags (item) & IPATCH_ITEM_FREE_MUTEX) { g_static_rec_mutex_free (item->mutex); g_free (item->mutex); } item->mutex = NULL; if (parent_class->finalize) parent_class->finalize (object); } /** * ipatch_item_set_parent: * @item: Item to set parent of (should not have a parent). * @parent: New parent of item. * * Usually only used by #IpatchItem type implementations. Sets the * parent of a patch item. Also recursively sets base parent and * #IPATCH_ITEM_HOOKS_ACTIVE flag if set in @parent. Also assigns the item's * thread mutex to that of the parent if its class has mutex_slave set. * The @parent container is responsible for adding a reference to @item - this * function does not do so. * * NOTE: If the @item has mutex_slave set in its class then the item will use * @parent object's mutex. During the call to this function @item should not * be accessed by any other threads, otherwise problems may occur when the * mutex is changed. Normally this shouldn't be much of an issue, since new * item's are often only accessed by 1 thread until being parented. */ void ipatch_item_set_parent (IpatchItem *item, IpatchItem *parent) { IpatchItemClass *klass; gboolean is_container; SetParentBag bag; guint depth; int i; g_return_if_fail (IPATCH_IS_ITEM (item)); g_return_if_fail (IPATCH_IS_ITEM (parent)); g_return_if_fail (item != parent); bag.base = ipatch_item_get_base (parent); /* ++ ref base patch item */ is_container = IPATCH_IS_CONTAINER (item); /* get value of parent's hook flag */ bag.hooks_active = ipatch_item_get_flags (parent) & IPATCH_ITEM_HOOKS_ACTIVE; IPATCH_ITEM_WLOCK (item); if (log_if_fail (item->parent == NULL)) { IPATCH_ITEM_WUNLOCK (item); if (bag.base) g_object_unref (bag.base); return; } klass = IPATCH_ITEM_GET_CLASS (item); if (klass->mutex_slave) { depth = g_static_rec_mutex_unlock_full (item->mutex); if (ipatch_item_get_flags (item) & IPATCH_ITEM_FREE_MUTEX) { g_static_rec_mutex_free (item->mutex); g_free (item->mutex); } item->mutex = parent->mutex; ipatch_item_clear_flags (item, IPATCH_ITEM_FREE_MUTEX); /* lock it the number of times old mutex was locked, we don't use g_static_rec_mutex_lock_full because it could set depth rather than add to it */ for (i = 0; i < depth; i++) g_static_rec_mutex_lock (item->mutex); } item->parent = parent; if (bag.base) item->base = bag.base; /* inherit base parent item if set */ /* inherit active hooks flag, has no effect if not set */ ipatch_item_set_flags (item, bag.hooks_active); /* if item is a container and base or hooks active flag is set, recursively set children hooks active flags */ if (is_container && (bag.base || bag.hooks_active)) ipatch_item_recursive_base_set ((IpatchContainer *)item, &bag); IPATCH_ITEM_WUNLOCK (item); if (bag.base) g_object_unref (bag.base); /* -- unref base patch item */ } /* recursively sets base field of a tree of items, expects container to be write locked */ static void ipatch_item_recursive_base_set (IpatchContainer *container, SetParentBag *bag) { IpatchIter iter; GObject *child; const GType *types; /* get container child list types */ types = ipatch_container_get_child_types (container); while (*types) /* loop over list types */ { /* initialize iterator to child list */ ipatch_container_init_iter (container, &iter, *types); child = ipatch_iter_first (&iter); while (child) /* loop over child list */ { IPATCH_ITEM_WLOCK (child); if (bag->base) /* inherit base pointer if set */ ((IpatchItem *)child)->base = bag->base; /* inherit active hooks flag, has no effect if not set */ ipatch_item_set_flags (child, bag->hooks_active); if (IPATCH_IS_CONTAINER (child)) /* recurse if a container */ ipatch_item_recursive_base_set ((IpatchContainer *)child, bag); IPATCH_ITEM_WUNLOCK (child); child = ipatch_iter_next (&iter); } /* child loop */ types++; } /* child type loop */ } /** * ipatch_item_unparent: * @item: Item to unparent * * Usually only used by #IpatchItem type implementations. Unparent an * item. Also recursively unsets base parent and * #IPATCH_ITEM_HOOKS_ACTIVE flag. Parent container object is * responsible for removing reference of @item - this function does * not do so. */ void ipatch_item_unparent (IpatchItem *item) { gboolean is_container; g_return_if_fail (IPATCH_IS_ITEM (item)); is_container = IPATCH_IS_CONTAINER (item); IPATCH_ITEM_WLOCK (item); if (!item->parent) { IPATCH_ITEM_WUNLOCK (item); return; } /* clear parent, base and active hooks flag of item */ item->parent = NULL; item->base = NULL; ipatch_item_clear_flags (item, IPATCH_ITEM_HOOKS_ACTIVE); /* recursively unset base field and active hooks flag of all children */ if (is_container) ipatch_item_recursive_base_unset ((IpatchContainer *)item); IPATCH_ITEM_WUNLOCK (item); } /* recursively unsets base field of a tree of items, expects container to be write locked */ static void ipatch_item_recursive_base_unset (IpatchContainer *container) { IpatchIter iter; GObject *child; const GType *types; types = ipatch_container_get_child_types (container); while (*types) /* loop over list types */ { /* initialize iterator to child list */ ipatch_container_init_iter (container, &iter, *types); child = ipatch_iter_first (&iter); while (child) /* loop over child list */ { IPATCH_ITEM_WLOCK (child); /* unset base pointer and clear active hooks flag */ ((IpatchItem *)child)->base = NULL; ipatch_item_clear_flags (child, IPATCH_ITEM_HOOKS_ACTIVE); if (IPATCH_IS_CONTAINER (child)) /* recurse if a container */ ipatch_item_recursive_base_unset ((IpatchContainer *)child); IPATCH_ITEM_WUNLOCK (child); child = ipatch_iter_next (&iter); } /* child loop */ types++; } /* child type loop */ } /** * ipatch_item_get_parent: * @item: Item to get parent of * * Gets the parent of @item after incrementing its reference count. The * caller is responsible for decrementing the reference count with * g_object_unref when finished with it. This function is useful because * all code paths must contain references to the items that they are working * with in a multi-thread environment (there is no guarantee an item won't * be destroyed unless a refcount is held). * * Returns: The parent of @item or %NULL if not parented or a root item. If * not %NULL then the reference count of parent has been incremented and the * caller is responsible for removing it when finished with parent. */ IpatchItem * ipatch_item_get_parent (IpatchItem *item) { IpatchItem *parent; g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); IPATCH_ITEM_RLOCK (item); parent = item->parent; if (parent) g_object_ref (parent); IPATCH_ITEM_RUNLOCK (item); return (parent); } /** * ipatch_item_peek_parent: * @item: Item to get the parent of * * This function is the same as ipatch_item_get_parent() (gets an * item's parent) but does not increment the parent's ref * count. Therefore this function should only be used when the caller * already holds a reference or when only the value of the pointer * will be used (not the contents), to avoid multi-thread problems. * * Returns: The parent of @item or %NULL if not parented or a root item. */ IpatchItem * ipatch_item_peek_parent (IpatchItem *item) { g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); return (item->parent); } /** * ipatch_item_get_base: * @item: Item to get base parent of * * Gets the base parent of @item (toplevel patch file object) after * incrementing its reference count. The caller is responsible for * decrementing the reference count with g_object_unref when finished * with it. If @item is itself a #IpatchBase object then it is returned. * * Returns: The base parent of @item or %NULL if no #IpatchBase type * in parent ancestry. If not %NULL then the reference count of * parent has been incremented and the caller is responsible for * removing it when finished with the base parent. */ IpatchItem * ipatch_item_get_base (IpatchItem *item) { IpatchItem *base; g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); /* return the item if it is itself an #IpatchBase object */ if (IPATCH_IS_BASE (item)) return (g_object_ref (item)); IPATCH_ITEM_RLOCK (item); base = item->base; if (base) g_object_ref (base); IPATCH_ITEM_RUNLOCK (item); return (base); } /** * ipatch_item_peek_base: * @item: Item to get the base parent of * * This function is the same as ipatch_item_get_base() (gets an * item's toplevel base parent) but does not increment the parent's ref * count. Therefore this function should only be used when the caller * already holds a reference or when only the value of the pointer * will be used (not the contents), to avoid multi-thread problems. * * Returns: The base parent of @item or %NULL if no #IpatchBase type * in parent ancestry. */ IpatchItem * ipatch_item_peek_base (IpatchItem *item) { g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); /* return the item if it is itself an #IpatchBase object */ if (IPATCH_IS_BASE (item)) return (item); return (item->base); } /** * ipatch_item_get_ancestor_by_type: * @item: Item to search for parent of a given type * @ancestor_type: Type of parent in the @item object's ancestry * * Searches for the first parent item that is derived from * @ancestor_type in the @item object's ancestry. @ancestor_type must * be an #IpatchItem derived type (as well as the ancestry of * @item). Of note is that @item can also match. The returned item's * reference count has been incremented and it is the responsiblity of * the caller to remove it with g_object_unref() when finished with * it. * * Returns: The matched item (can be the @item itself) or %NULL if no * item matches @ancestor_type in the ancestry. Remember to unref the * matched item when done with it. */ IpatchItem * ipatch_item_get_ancestor_by_type (IpatchItem *item, GType ancestor_type) { #define MAX_ITEM_DEPTH 10 IpatchItem *p, *ancestry[MAX_ITEM_DEPTH]; int i, depth = -1; g_return_val_if_fail (IPATCH_ITEM (item), NULL); g_return_val_if_fail (g_type_is_a (ancestor_type, IPATCH_TYPE_ITEM), NULL); p = item; do { if (g_type_is_a (G_OBJECT_TYPE (p), ancestor_type)) break; depth++; g_assert (depth < MAX_ITEM_DEPTH); p = ancestry[depth] = ipatch_item_get_parent (p); } while (p); if (depth >= 0) /* unreference ancestry */ for (i = 0; i <= depth; i++) if (ancestry[i] != p) g_object_unref (ancestry[i]); if (p == item) g_object_ref (p); return (p); } /** * ipatch_item_peek_ancestor_by_type: * @item: Item to search for parent of a given type * @ancestor_type: Type of parent in the @item object's ancestry * * Just like ipatch_item_get_ancestor_by_type() but doesn't ref returned item. * This should only be used when caller already owns a reference or only the * pointer value is of importance, since otherwise there is a potential * multi-thread race condition. * * Returns: The matched item (can be the @item itself) or %NULL if no * item matches @ancestor_type in the ancestry. Remember that the returned * item is not referenced. */ IpatchItem * ipatch_item_peek_ancestor_by_type (IpatchItem *item, GType ancestor_type) { IpatchItem *match; match = ipatch_item_get_ancestor_by_type (item, ancestor_type); if (match) g_object_unref (match); return (match); } /** * ipatch_item_remove: * @item: Item to remove * * This function removes an item from its parent container and removes other * references from within the same patch (e.g., a #IpatchSF2Sample * will be removed from its parent #IpatchSF2 and all #IpatchSF2IZone objects * referencing the sample will also be removed). */ void ipatch_item_remove (IpatchItem *item) { IpatchItemClass *klass; IpatchItem *parent; g_return_if_fail (IPATCH_IS_ITEM (item)); klass = IPATCH_ITEM_GET_CLASS (item); if (!klass->remove) /* use default remove method? */ { parent = ipatch_item_get_parent (item); if (parent) { /* just remove the item from its parent */ ipatch_container_remove (IPATCH_CONTAINER (parent), item); g_object_unref (parent); } } else (*klass->remove)(item); /* call the remove class method */ } /** * ipatch_item_changed: * @item: Item that has changed * * This function should be called when an item's saveable state (what ends * up in a patch file) has changed. Causes the @item object's base parent * to have its changed flag set, indicating that the file has changes that * have not been saved. Note that this function is automatically called when * an ipatch_item_prop_notify() occurs for a property without the * #IPATCH_PARAM_NO_SAVE_CHANGE flag in its #GParamSpec and therefore this * function should not be called additionally. */ void ipatch_item_changed (IpatchItem *item) { IpatchItem *base = NULL; g_return_if_fail (IPATCH_IS_ITEM (item)); IPATCH_ITEM_RLOCK (item); if (item->base) base = item->base; else if (IPATCH_IS_BASE (item)) base = item; if (base && !(base->flags & IPATCH_BASE_CHANGED)) { g_object_ref (base); /* ++ ref base object */ ipatch_item_set_flags (base, IPATCH_BASE_CHANGED); } else base = NULL; IPATCH_ITEM_RUNLOCK (item); if (base) /* do property notify for base "changed" flag */ { ipatch_item_prop_notify (base, ipatch_base_pspec_changed, ipatch_util_value_bool_true, ipatch_util_value_bool_false); g_object_unref (base); /* -- unref base parent object */ } } /** * ipatch_item_get_property_fast: * @item: Item to get property value from * @pspec: Parameter spec of property to get * @value: Uninitialized caller supplied value to store the current value in. * Remember to call g_value_unset when done with it. * * Usually only used by #IpatchItem implementations. A faster way to retrieve * an object property. Often used for fetching current value for property * notifies. Notice that this function currently doesn't work with interface * or class overridden properties. */ void ipatch_item_get_property_fast (IpatchItem *item, GParamSpec *pspec, GValue *value) { GObjectClass *obj_class; g_return_if_fail (IPATCH_IS_ITEM (item)); g_return_if_fail (G_IS_PARAM_SPEC (pspec)); g_return_if_fail (value != NULL); obj_class = g_type_class_peek (pspec->owner_type); g_return_if_fail (obj_class != NULL); g_return_if_fail (obj_class->get_property != NULL); g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)); obj_class->get_property ((GObject *)item, IPATCH_PARAM_SPEC_ID (pspec), value, pspec); } /** * ipatch_item_copy: * @dest: New destination item to copy to (should be same type or derived * from @src type) * @src: Item to copy from * * Copy an item using the item class' "copy" method. Object links are * copied as is, meaning the resulting object is a local object to the same * #IpatchBase. */ void ipatch_item_copy (IpatchItem *dest, IpatchItem *src) { IpatchItemClass *klass; GType dest_type, src_type; g_return_if_fail (IPATCH_IS_ITEM (dest)); g_return_if_fail (IPATCH_IS_ITEM (src)); dest_type = G_OBJECT_TYPE (dest); src_type = G_OBJECT_TYPE (src); g_return_if_fail (g_type_is_a (dest_type, src_type)); klass = IPATCH_ITEM_GET_CLASS (src); g_return_if_fail (klass->copy != NULL); klass->copy (dest, src, NULL, NULL); } /** * ipatch_item_copy_link_func: * @dest: New destination item to copy to (should be same type or derived * from @src type) * @src: Item to copy from * @link_func: Function to call for each object link pointer in @src. This * function can alter the copied link if desired. * @user_data: User defined data to pass to @link_func. * * Copy an item using the item class' "copy" method. Like ipatch_item_copy() * but takes a @link_func which can be used for handling replication of * externally linked objects (recursively deep duplicate for example, although * there is ipatch_item_duplicate_deep() specifically for that). */ void ipatch_item_copy_link_func (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchItemClass *klass; GType dest_type, src_type; g_return_if_fail (IPATCH_IS_ITEM (dest)); g_return_if_fail (IPATCH_IS_ITEM (src)); dest_type = G_OBJECT_TYPE (dest); src_type = G_OBJECT_TYPE (src); g_return_if_fail (g_type_is_a (dest_type, src_type)); klass = IPATCH_ITEM_GET_CLASS (src); g_return_if_fail (klass->copy != NULL); klass->copy (dest, src, link_func, user_data); } /** * ipatch_item_copy_replace: * @dest: New destination item to copy to (should be same type or derived * from @src type) * @src: Item to copy from * @repl_hash: Hash of link pointer substitutions. The original link pointer * is the hash key, and the hash value is the replacement pointer. * * Like ipatch_item_copy() but takes a link replacement hash, which can be * used for substituting different objects for object links. See * ipatch_item_copy_link_func() if even more flexibility is desired. */ void ipatch_item_copy_replace (IpatchItem *dest, IpatchItem *src, GHashTable *repl_hash) { IpatchItemClass *klass; GType dest_type, src_type; g_return_if_fail (IPATCH_IS_ITEM (dest)); g_return_if_fail (IPATCH_IS_ITEM (src)); dest_type = G_OBJECT_TYPE (dest); src_type = G_OBJECT_TYPE (src); g_return_if_fail (g_type_is_a (dest_type, src_type)); klass = IPATCH_ITEM_GET_CLASS (src); g_return_if_fail (klass->copy != NULL); klass->copy (dest, src, ipatch_item_copy_link_func_hash, repl_hash); } /** * ipatch_item_duplicate: * @item: Item to duplicate * * A convenience function to duplicate an item. Like ipatch_item_copy() but * creates a new duplicate item, rather than using an existing item. Note * that externally linked objects are not duplicated for non #IpatchBase * derived types, making the item local to the same #IpatchBase object. * * Returns: New duplicate item. Caller owns the reference to the new item. */ IpatchItem * ipatch_item_duplicate (IpatchItem *item) { IpatchItem *newitem; g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); newitem = g_object_new (G_OBJECT_TYPE (item), NULL); /* ++ ref new item */ g_return_val_if_fail (newitem != NULL, NULL); ipatch_item_copy (newitem, item); return (newitem); /* !! caller owns reference */ } /** * ipatch_item_duplicate_link_func: * @item: Item to duplicate * @link_func: Function to call for each object link pointer in @item. This * function can alter the copied link if desired. * @user_data: User defined data to pass to @link_func. * * Like ipatch_item_copy_link_func() but duplicates the item instead of * copying to an existing item. * * Returns: New duplicate item. Caller owns the reference to the new item. */ IpatchItem * ipatch_item_duplicate_link_func (IpatchItem *item, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchItem *newitem; g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); newitem = g_object_new (G_OBJECT_TYPE (item), NULL); /* ++ ref new item */ g_return_val_if_fail (newitem != NULL, NULL); ipatch_item_copy_link_func (newitem, item, link_func, user_data); return (newitem); /* !! caller owns reference */ } /** * ipatch_item_duplicate_replace: * @item: Item to duplicate * @repl_hash: Hash of link pointer substitutions. The original link pointer * is the hash key, and the hash value is the replacement pointer. * * Like ipatch_item_copy_replace() but duplicates the item instead of * copying it to an already created item. * * Returns: New duplicate item. Caller owns the reference to the new item. */ IpatchItem * ipatch_item_duplicate_replace (IpatchItem *item, GHashTable *repl_hash) { IpatchItem *newitem; g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); newitem = g_object_new (G_OBJECT_TYPE (item), NULL); /* ++ ref new item */ g_return_val_if_fail (newitem != NULL, NULL); ipatch_item_copy_replace (newitem, item, repl_hash); return (newitem); /* !! caller owns reference */ } /** * ipatch_item_duplicate_deep: * @item: Item to deep duplicate * * Recursively duplicate an item (i.e., its dependencies also). * * Returns: List of duplicated @item and dependencies (duplicated @item is the * first in the list). List object is owned by the caller and should be * unreferenced when finished using it. */ IpatchList * ipatch_item_duplicate_deep (IpatchItem *item) { IpatchItemClass *klass; IpatchItem *newitem; IpatchList *list; GHashTable *linkhash; /* link substitutions */ g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); klass = IPATCH_ITEM_GET_CLASS (item); g_return_val_if_fail (klass->copy != NULL, NULL); newitem = g_object_new (G_OBJECT_TYPE (item), NULL); /* ++ ref new item */ g_return_val_if_fail (newitem != NULL, NULL); /* create hash to track new duplicated items */ linkhash = g_hash_table_new (NULL, NULL); g_hash_table_insert (linkhash, item, newitem); /* do the copy using the deep copy link function callback */ klass->copy (newitem, item, ipatch_item_copy_link_func_deep, linkhash); list = ipatch_list_new (); /* ++ref new list */ /* remove newitem, before convert to list */ g_hash_table_remove (linkhash, newitem); /* convert hash to IpatchList (!! list takes over references) */ g_hash_table_foreach (linkhash, copy_hash_to_list_GHFunc, list); /* prepend newitem (!! List takes over creator's reference) */ list->items = g_list_prepend (list->items, newitem); g_hash_table_destroy (linkhash); return (list); } /* GHFunc to convert hash table to IpatchList */ static void copy_hash_to_list_GHFunc (gpointer key, gpointer value, gpointer user_data) { IpatchList *list = (IpatchList *)user_data; list->items = g_list_prepend (list->items, value); } /* IpatchItemCopyLinkFunc for deep duplicating an object and dependencies */ IpatchItem * ipatch_item_copy_link_func_deep (IpatchItem *item, IpatchItem *link, gpointer user_data) { GHashTable *linkhash = (GHashTable *)user_data; IpatchItem *dup = NULL; if (!link) return (NULL); /* look up link item in duplicate hash. */ if (linkhash) dup = g_hash_table_lookup (linkhash, link); if (!dup) /* link not in hash? - Duplicate link and add it to hash. */ { dup = g_object_new (G_OBJECT_TYPE (link), NULL); /* ++ ref new item */ g_return_val_if_fail (dup != NULL, NULL); /* !! hash table takes over reference */ g_hash_table_insert (linkhash, link, dup); ipatch_item_copy_link_func (dup, link, ipatch_item_copy_link_func_deep, user_data); } return (dup); } /** * ipatch_item_copy_link_func_hash: * @item: Item which is being linked (contains a reference to @link). * @link: The item being referenced. * @user_data: User data supplied to copy/duplicate function. * * A predefined #IpatchItemCopyLinkFunc which takes a hash for the @user_data * component, which is used for replacing link pointers. @link is used as the * hash key, the hash value is used in its place if present otherwise @link is * used unchanged. * * Returns: Value in hash (@user_data) if @link is present in hash, or @link * itself if not. */ IpatchItem * ipatch_item_copy_link_func_hash (IpatchItem *item, IpatchItem *link, gpointer user_data) { GHashTable *hash = (GHashTable *)user_data; IpatchItem *repl = NULL; if (!link) return (NULL); if (hash) repl = g_hash_table_lookup (hash, link); return (repl ? repl : link); } /** * ipatch_item_type_can_conflict: * @item_type: Type to test * * Test if a given #IpatchItem derived type can conflict with another item * (only applies to items of the same type in the same #IpatchBase object). * * Returns: %TRUE if @item_type can conflict (has properties which should be * unique among its siblings), %FALSE otherwise. */ gboolean ipatch_item_type_can_conflict (GType item_type) { UniqueBag *unique; unique = item_lookup_unique_bag (item_type); return (unique != NULL); } /** * ipatch_item_type_get_unique_specs: * @item_type: Type to get unique parameter specs for * @groups: Location to store an integer describing groups. Each bit * corresponds to a GParamSpec in the returned array. GParamSpecs of the * same group will have the same bit value (0 or 1) and be consecutive. * Unique properties in the same group must all match (logic AND) for a * conflict to occur. Pass %NULL to ignore. * * Get the list of unique parameter specs which can conflict for a given * item type. * * Returns: %NULL terminated list of parameter specs or %NULL if @item_type * can never conflict. The returned array is internal and should not be * modified or freed. */ GParamSpec ** ipatch_item_type_get_unique_specs (GType item_type, guint32 *groups) { UniqueBag *unique; unique = item_lookup_unique_bag (item_type); if (unique) { if (groups) *groups = unique->groups; return (unique->pspecs); } else { if (groups) *groups = 0; return (NULL); } } /** * ipatch_item_get_unique_props: * @item: Item to get unique properties of * * Get the values of the unique properties for @item. This is useful when * doing conflict detection processing and more flexibility is desired than * with ipatch_item_test_conflict(). * * Returns: GValueArray of the unique property values of @item in the same * order as the parameter specs returned by ipatch_item_type_get_unique_specs(). * %NULL is returned if @item doesn't have any unique properties. * Use g_value_array_free() to free the array when finished using it. */ GValueArray * ipatch_item_get_unique_props (IpatchItem *item) { GParamSpec **ps; UniqueBag *unique; GValueArray *vals; GValue *value; int count, i; g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); /* item has any unique properties? */ unique = item_lookup_unique_bag (G_OBJECT_TYPE (item)); if (!unique) return (NULL); /* count param specs */ for (count = 0, ps = unique->pspecs; *ps; count++, ps++); vals = g_value_array_new (count); for (i = 0, ps = unique->pspecs; i < count; i++, ps++) { /* NULL will append an unset value, saves a value copy operation */ g_value_array_append (vals, NULL); value = g_value_array_get_nth (vals, i); ipatch_item_get_property_fast (item, *ps, value); } return (vals); } /** * ipatch_item_test_conflict: * @item1: First item to test * @item2: Second item to test * * Test if two items would conflict if they were siblings (doesn't actually * test if they are siblings). * * Returns: Flags of unique properties which conflict. The bit index * corresponds to the parameter index in the array returned by * ipatch_item_type_get_unique_specs(). 0 is returned if the items do not * conflict. */ guint ipatch_item_test_conflict (IpatchItem *item1, IpatchItem *item2) { GValue val1 = { 0 }, val2 = { 0 }; UniqueBag *unique; GParamSpec *pspec; GType type; guint conflicts; guint mask; int i, count, toggle, groupcount; g_return_val_if_fail (IPATCH_IS_ITEM (item1), 0); g_return_val_if_fail (IPATCH_IS_ITEM (item2), 0); type = G_OBJECT_TYPE (item1); /* can't conflict if items not the same type */ if (type != G_OBJECT_TYPE (item2)) return (0); unique = item_lookup_unique_bag (type); if (!unique) return (0); /* no unique properties? */ conflicts = 0; for (i = 0; TRUE; i++) { pspec = unique->pspecs[i]; if (!pspec) break; ipatch_item_get_property_fast (item1, pspec, &val1); ipatch_item_get_property_fast (item2, pspec, &val2); if (g_param_values_cmp (pspec, &val1, &val2) == 0) conflicts |= (1 << i); g_value_unset (&val1); g_value_unset (&val2); } /* mask out any unique groups which don't have all its props conflicting */ count = i; mask = 1; groupcount = 1; toggle = (unique->groups & 1); /* to track group changes */ for (i = 1; i < count; i++) { /* same group as prev. property? */ if (toggle == ((unique->groups & (1 << i)) != 0)) { mask |= (1 << i); /* add another mask bit */ groupcount++; /* increment group property count */ } else /* group changed */ { /* prev group is larger than 1 prop. and not all props conflicting? */ if (groupcount > 1 && (conflicts & mask) != mask) conflicts &= ~mask; /* clear all conflicts for prev group */ toggle ^= 1; mask = (1 << i); groupcount = 1; } } /* check if last gorup is larger than 1 prop. and not all props conflicting */ if (groupcount > 1 && (conflicts & mask) != mask) conflicts &= ~mask; /* clear all conflicts for last group */ return (conflicts); } /* lookup cached unique property info for a given type */ static UniqueBag * item_lookup_unique_bag (GType type) { GParamSpec **pspecs, *ps; GList *speclist = NULL; /* sorted spec list (sorted by unique group) */ UniqueBag *unique; gpointer klass; guint n_props, count; guint i; G_LOCK (unique_prop_cache); unique = g_hash_table_lookup (unique_prop_cache, GUINT_TO_POINTER (type)); if (!unique) /* has not been cached yet? */ { klass = g_type_class_ref (type); g_return_val_if_fail (klass != NULL, NULL); /* get property list and add unique properties to speclist */ pspecs = g_object_class_list_properties (klass, &n_props); for (i = 0, count = 0; i < n_props; i++) { ps = pspecs[i]; if (ps->flags & IPATCH_PARAM_UNIQUE) /* unique property? */ { /* add to speclist sorted by unique group (0 = nogroup) */ speclist = g_list_insert_sorted (speclist, ps, unique_group_list_sort_func); count++; } } g_free (pspecs); if (speclist) /* any unique properties? */ { guint group, lastgroup = 0; int toggle = 0; GList *p; /* create unique bag */ unique = g_new (UniqueBag, 1); unique->pspecs = g_new (GParamSpec *, count + 1); unique->groups = 0; /* add pointers to unique spec array and set group bit toggle field */ for (i = 0, p = speclist; i < count; i++, p = p->next) { unique->pspecs[i] = (GParamSpec *)(p->data); ipatch_param_get ((GParamSpec *)(p->data), "unique-group-id", &group, NULL); if (group != lastgroup) toggle ^= 1; if (toggle) unique->groups |= (1 << i); lastgroup = group; } unique->pspecs[count] = NULL; /* NULL terminated */ } else unique = &no_unique_props; /* indicate no unique properties */ g_hash_table_insert (unique_prop_cache, GUINT_TO_POINTER (type), unique); } G_UNLOCK (unique_prop_cache); if (unique == &no_unique_props) /* no unique properties? */ unique = NULL; return (unique); } /* sort GParamSpec pointers by their unique group id (0 = no group) */ static gint unique_group_list_sort_func (gconstpointer a, gconstpointer b) { GParamSpec *aspec = (GParamSpec *)a, *bspec = (GParamSpec *)b; int agroup, bgroup; ipatch_param_get (aspec, "unique-group-id", &agroup, NULL); ipatch_param_get (bspec, "unique-group-id", &bgroup, NULL); return (agroup - bgroup); } /** * ipatch_item_set_atomic: * @item: IpatchItem derived object to set properties of * @first_property_name: Name of first property * @Varargs: Variable list of arguments that should start with the value to * set @first_property_name to, followed by property name/value pairs. List is * terminated with a %NULL property name. * * Sets properties on a patch item atomically (i.e. item is * multi-thread locked while all properties are set). This avoids * critical parameter sync problems when multiple threads are * accessing the same item. See g_object_set() for more information on * setting properties. */ void ipatch_item_set_atomic (gpointer item, const char *first_property_name, ...) { va_list args; g_return_if_fail (IPATCH_IS_ITEM (item)); va_start (args, first_property_name); IPATCH_ITEM_WLOCK (item); g_object_set_valist (G_OBJECT (item), first_property_name, args); IPATCH_ITEM_WUNLOCK (item); va_end (args); } /** * ipatch_item_get_atomic: * @item: IpatchItem derived object to get properties from * @first_property_name: Name of first property * @Varargs: Variable list of arguments that should start with a * pointer to store the value from @first_property_name, followed by * property name/value pointer pairs. List is terminated with a %NULL * property name. * * Gets properties from a patch item atomically (i.e. item is * multi-thread locked while all properties are retrieved). This * avoids critical parameter sync problems when multiple threads are * accessing the same item. See g_object_get() for more information on * getting properties. */ void ipatch_item_get_atomic (gpointer item, const char *first_property_name, ...) { va_list args; g_return_if_fail (IPATCH_IS_ITEM (item)); va_start (args, first_property_name); IPATCH_ITEM_WLOCK (item); g_object_get_valist (G_OBJECT (item), first_property_name, args); IPATCH_ITEM_WUNLOCK (item); va_end (args); } /** * ipatch_item_first: * @iter: Patch item iterator containing #IpatchItem items * * Gets the first item in a patch item iterator. A convenience wrapper for * ipatch_iter_first(). * * Returns: The first item in @iter or %NULL if empty. */ IpatchItem * ipatch_item_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_ITEM (obj)); else return (NULL); } /** * ipatch_item_next: * @iter: Patch item iterator containing #IpatchItem items * * Gets the next item in a patch item iterator. A convenience wrapper for * ipatch_iter_next(). * * Returns: The next item in @iter or %NULL if no more items. */ IpatchItem * ipatch_item_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_ITEM (obj)); else return (NULL); } libinstpatch-1.0.0/libinstpatch/IpatchSF2Inst.c0000644000175000017500000003372711461332142016337 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSF2Inst.h" #include "IpatchSF2IZone.h" #include "IpatchSF2GenItem.h" #include "IpatchSF2ModItem.h" #include "IpatchSF2.h" #include "IpatchSF2File.h" #include "IpatchParamProp.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" /* properties */ enum { /* generator IDs are used for lower numbers */ PROP_NAME = IPATCH_SF2_GEN_ITEM_FIRST_PROP_USER_ID, PROP_MODULATORS }; static void ipatch_sf2_inst_class_init (IpatchSF2InstClass *klass); static void ipatch_sf2_inst_gen_item_iface_init (IpatchSF2GenItemIface *genitem_iface); static void ipatch_sf2_inst_mod_item_iface_init (IpatchSF2ModItemIface *moditem_iface); static void ipatch_sf2_inst_init (IpatchSF2Inst *inst); static void ipatch_sf2_inst_finalize (GObject *gobject); static void ipatch_sf2_inst_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sf2_inst_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sf2_inst_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static void ipatch_sf2_inst_item_remove (IpatchItem *item); static const GType *ipatch_sf2_inst_container_child_types (void); static gboolean ipatch_sf2_inst_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type); static void ipatch_sf2_inst_real_set_name (IpatchSF2Inst *inst, const char *name, gboolean name_notify); static gpointer parent_class = NULL; static GType inst_child_types[2] = { 0 }; static GParamSpec *name_pspec; /* For passing data from class init to gen item interface init */ static GParamSpec **gen_item_specs = NULL; static GParamSpec **gen_item_setspecs = NULL; /* For passing between class init and mod item interface init */ static GParamSpec *modulators_spec = NULL; GType ipatch_sf2_inst_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchSF2InstClass), NULL, NULL, (GClassInitFunc)ipatch_sf2_inst_class_init, NULL, NULL, sizeof (IpatchSF2Inst), 0, (GInstanceInitFunc)ipatch_sf2_inst_init, }; static const GInterfaceInfo genitem_iface = { (GInterfaceInitFunc) ipatch_sf2_inst_gen_item_iface_init, NULL, NULL }; static const GInterfaceInfo moditem_iface = { (GInterfaceInitFunc) ipatch_sf2_inst_mod_item_iface_init, NULL, NULL }; item_type = g_type_register_static (IPATCH_TYPE_CONTAINER, "IpatchSF2Inst", &item_info, 0); g_type_add_interface_static (item_type, IPATCH_TYPE_SF2_GEN_ITEM, &genitem_iface); g_type_add_interface_static (item_type, IPATCH_TYPE_SF2_MOD_ITEM, &moditem_iface); } return (item_type); } static void ipatch_sf2_inst_class_init (IpatchSF2InstClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS (klass); parent_class = g_type_class_ref (IPATCH_TYPE_CONTAINER); obj_class->finalize = ipatch_sf2_inst_finalize; obj_class->get_property = ipatch_sf2_inst_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_sf2_inst_set_property; item_class->copy = ipatch_sf2_inst_item_copy; item_class->remove = ipatch_sf2_inst_item_remove; container_class->child_types = ipatch_sf2_inst_container_child_types; container_class->init_iter = ipatch_sf2_inst_container_init_iter; g_object_class_override_property (obj_class, PROP_NAME, "title"); name_pspec = ipatch_param_set (g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE), "string-max-length", IPATCH_SFONT_NAME_SIZE, /* max string length */ NULL); g_object_class_install_property (obj_class, PROP_NAME, name_pspec); g_object_class_override_property (obj_class, PROP_MODULATORS, "modulators"); modulators_spec = g_object_class_find_property (obj_class, "modulators"); inst_child_types[0] = IPATCH_TYPE_SF2_IZONE; /* install generator properties */ ipatch_sf2_gen_item_iface_install_properties (obj_class, IPATCH_SF2_GEN_PROPS_INST_GLOBAL, &gen_item_specs, &gen_item_setspecs); } /* gen item interface initialization */ static void ipatch_sf2_inst_gen_item_iface_init (IpatchSF2GenItemIface *genitem_iface) { genitem_iface->genarray_ofs = G_STRUCT_OFFSET (IpatchSF2Inst, genarray); genitem_iface->propstype = IPATCH_SF2_GEN_PROPS_INST_GLOBAL; g_return_if_fail (gen_item_specs != NULL); g_return_if_fail (gen_item_setspecs != NULL); memcpy (&genitem_iface->specs, gen_item_specs, sizeof (genitem_iface->specs)); memcpy (&genitem_iface->setspecs, gen_item_setspecs, sizeof (genitem_iface->setspecs)); g_free (gen_item_specs); g_free (gen_item_setspecs); } /* mod item interface initialization */ static void ipatch_sf2_inst_mod_item_iface_init (IpatchSF2ModItemIface *moditem_iface) { moditem_iface->modlist_ofs = G_STRUCT_OFFSET (IpatchSF2Inst, mods); /* cache the modulators property for fast notifications */ moditem_iface->mod_pspec = modulators_spec; } static void ipatch_sf2_inst_init (IpatchSF2Inst *inst) { inst->name = NULL; inst->zones = NULL; ipatch_sf2_gen_array_init (&inst->genarray, FALSE, FALSE); } static void ipatch_sf2_inst_finalize (GObject *gobject) { IpatchSF2Inst *inst = IPATCH_SF2_INST (gobject); IPATCH_ITEM_WLOCK (inst); g_free (inst->name); inst->name = NULL; ipatch_sf2_mod_list_free (inst->mods, TRUE); inst->mods = NULL; IPATCH_ITEM_WUNLOCK (inst); if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (gobject); } static void ipatch_sf2_inst_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSF2Inst *inst = IPATCH_SF2_INST (object); IpatchSF2ModList *list; /* generator property? */ if (ipatch_sf2_gen_item_iface_set_property ((IpatchSF2GenItem *)inst, property_id, value)) return; switch (property_id) { case PROP_NAME: ipatch_sf2_inst_real_set_name (inst, g_value_get_string (value), FALSE); break; case PROP_MODULATORS: list = (IpatchSF2ModList *)g_value_get_boxed (value); ipatch_sf2_mod_item_set_mods (IPATCH_SF2_MOD_ITEM (inst), list, IPATCH_SF2_MOD_NO_NOTIFY); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_sf2_inst_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSF2Inst *inst = IPATCH_SF2_INST (object); IpatchSF2ModList *list; /* generator property? */ if (ipatch_sf2_gen_item_iface_get_property ((IpatchSF2GenItem *)inst, property_id, value)) return; switch (property_id) { case PROP_NAME: g_value_take_string (value, ipatch_sf2_inst_get_name (inst)); break; case PROP_MODULATORS: list = ipatch_sf2_mod_item_get_mods (IPATCH_SF2_MOD_ITEM (inst)); g_value_take_boxed (value, list); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_sf2_inst_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchSF2Inst *src_inst, *dest_inst; IpatchItem *zitem; GSList *p; src_inst = IPATCH_SF2_INST (src); dest_inst = IPATCH_SF2_INST (dest); IPATCH_ITEM_RLOCK (src_inst); dest_inst->name = g_strdup (src_inst->name); dest_inst->genarray = src_inst->genarray; dest_inst->mods = ipatch_sf2_mod_list_duplicate (src_inst->mods); p = src_inst->zones; while (p) /* duplicate zones */ { /* ++ ref new instrument zone, !! zone list takes it over */ zitem = ipatch_item_duplicate_link_func (IPATCH_ITEM (p->data), link_func, user_data); dest_inst->zones = g_slist_prepend (dest_inst->zones, zitem); ipatch_item_set_parent (zitem, IPATCH_ITEM (dest_inst)); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (src_inst); dest_inst->zones = g_slist_reverse (dest_inst->zones); } static void ipatch_sf2_inst_item_remove (IpatchItem *item) { IpatchItem *parent, *zitem, *temp; IpatchList *list; IpatchIter iter; list = ipatch_sf2_get_zone_references (item); /* ++ ref zone list */ ipatch_list_init_iter (list, &iter); zitem = ipatch_item_first (&iter); while (zitem) { temp = zitem; zitem = ipatch_item_next (&iter); ipatch_item_remove (temp); } g_object_unref (list); /* -- unref list */ parent = ipatch_item_get_parent (item); /* ++ ref parent */ if (parent) { ipatch_container_remove (IPATCH_CONTAINER (parent), item); g_object_unref (parent); /* -- unref parent */ } } static const GType * ipatch_sf2_inst_container_child_types (void) { return (inst_child_types); } /* container is locked by caller */ static gboolean ipatch_sf2_inst_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type) { IpatchSF2Inst *inst = IPATCH_SF2_INST (container); if (!g_type_is_a (type, IPATCH_TYPE_SF2_IZONE)) { g_critical ("Invalid child type '%s' for parent of type '%s'", g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); return (FALSE); } ipatch_iter_GSList_init (iter, &inst->zones); return (TRUE); } /** * ipatch_sf2_inst_new: * * Create a new SoundFont instrument object. * * Returns: New SoundFont instrument with a reference count of 1. Caller * owns the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchSF2Inst * ipatch_sf2_inst_new (void) { return (IPATCH_SF2_INST (g_object_new (IPATCH_TYPE_SF2_INST, NULL))); } /** * ipatch_sf2_inst_first: * @iter: Patch item iterator containing #IpatchSF2Inst items * * Gets the first item in an instrument iterator. A convenience wrapper for * ipatch_iter_first(). * * Returns: The first instrument in @iter or %NULL if empty. */ IpatchSF2Inst * ipatch_sf2_inst_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_SF2_INST (obj)); else return (NULL); } /** * ipatch_sf2_inst_next: * @iter: Patch item iterator containing #IpatchSF2Inst items * * Gets the next item in an instrument iterator. A convenience wrapper for * ipatch_iter_next(). * * Returns: The next instrument in @iter or %NULL if at the end of the list. */ IpatchSF2Inst * ipatch_sf2_inst_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_SF2_INST (obj)); else return (NULL); } /** * ipatch_sf2_inst_new_zone: * @inst: SoundFont instrument * @sample: Referenced sample for new zone * * A convenience function for quickly creating a new instrument zone, adding it * to @inst and setting the zone's referenced sample to @sample. */ void ipatch_sf2_inst_new_zone (IpatchSF2Inst *inst, IpatchSF2Sample *sample) { IpatchSF2IZone *izone; g_return_if_fail (IPATCH_IS_SF2_INST (inst)); g_return_if_fail (IPATCH_IS_SF2_SAMPLE (sample)); izone = ipatch_sf2_izone_new (); /* ++ ref new zone */ ipatch_sf2_zone_set_link_item (IPATCH_SF2_ZONE (izone), IPATCH_ITEM (sample)); ipatch_container_append (IPATCH_CONTAINER (inst), IPATCH_ITEM (izone)); g_object_unref (izone); /* -- unref zone */ } /** * ipatch_sf2_inst_set_name: * @inst: Instrument to set name of * @name: Value to set name to * * Sets the name of a SoundFont instrument. */ void ipatch_sf2_inst_set_name (IpatchSF2Inst *inst, const char *name) { g_return_if_fail (IPATCH_IS_SF2_INST (inst)); ipatch_sf2_inst_real_set_name (inst, name, TRUE); } /* the real inst name set routine */ static void ipatch_sf2_inst_real_set_name (IpatchSF2Inst *inst, const char *name, gboolean name_notify) { GValue oldval = { 0 }, newval = { 0 }; char *newname, *oldname; newname = g_strdup (name); IPATCH_ITEM_WLOCK (inst); oldname = inst->name; inst->name = newname; IPATCH_ITEM_WUNLOCK (inst); g_value_init (&oldval, G_TYPE_STRING); g_value_take_string (&oldval, oldname); g_value_init (&newval, G_TYPE_STRING); g_value_set_static_string (&newval, name); if (name_notify) ipatch_item_prop_notify ((IpatchItem *)inst, name_pspec, &newval, &oldval); ipatch_item_prop_notify ((IpatchItem *)inst, ipatch_item_pspec_title, &newval, &oldval); g_value_unset (&oldval); g_value_unset (&newval); } /** * ipatch_sf2_inst_get_name: * @inst: Instrument to get name of * * Gets the name of a SoundFont instrument. * * Returns: Name of instrument or %NULL if not set. String value should be * freed when finished with it. */ char * ipatch_sf2_inst_get_name (IpatchSF2Inst *inst) { char *name = NULL; g_return_val_if_fail (IPATCH_IS_SF2_INST (inst), NULL); IPATCH_ITEM_RLOCK (inst); if (inst->name) name = g_strdup (inst->name); IPATCH_ITEM_RUNLOCK (inst); return (name); } libinstpatch-1.0.0/libinstpatch/IpatchGigSubRegion.c0000644000175000017500000004074311461332142017427 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchGigSubRegion.h" #include "IpatchSample.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" enum { PROP_0, PROP_TITLE, PROP_LINK_ITEM, PROP_SAMPLE_INFO_OVERRIDE, PROP_SAMPLE_SIZE, PROP_SAMPLE_FORMAT, PROP_SAMPLE_RATE, PROP_SAMPLE_DATA }; static void ipatch_gig_sub_region_sample_iface_init (IpatchSampleIface *sample_iface); static gboolean ipatch_gig_sub_region_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_gig_sub_region_class_init (IpatchGigSubRegionClass *klass); static void ipatch_gig_sub_region_get_title (IpatchGigSubRegion *gig_region, GValue *value); static void ipatch_gig_sub_region_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_gig_sub_region_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_gig_sub_region_init (IpatchGigSubRegion *gig_region); static void ipatch_gig_sub_region_finalize (GObject *gobject); static void ipatch_gig_sub_region_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static void ipatch_gig_sub_region_real_set_sample (IpatchGigSubRegion *subregion, IpatchGigSample *sample, gboolean sample_notify); static void ipatch_gig_sub_region_get_sample_info (IpatchGigSubRegion *subregion, IpatchDLS2SampleInfo *info); static GParamSpec *link_item_pspec; G_DEFINE_TYPE_WITH_CODE (IpatchGigSubRegion, ipatch_gig_sub_region, IPATCH_TYPE_ITEM, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_gig_sub_region_sample_iface_init)) /* sample interface initialization */ static void ipatch_gig_sub_region_sample_iface_init (IpatchSampleIface *sample_iface) { sample_iface->open = ipatch_gig_sub_region_sample_iface_open; sample_iface->loop_types = ipatch_sample_loop_types_standard_release; } static gboolean ipatch_gig_sub_region_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchGigSubRegion *region = IPATCH_GIG_SUB_REGION (handle->sample); g_return_val_if_fail (region->sample != NULL, FALSE); return (ipatch_sample_handle_cascade_open (handle, IPATCH_SAMPLE (region->sample), err)); } static void ipatch_gig_sub_region_class_init (IpatchGigSubRegionClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->finalize = ipatch_gig_sub_region_finalize; obj_class->get_property = ipatch_gig_sub_region_get_property; item_class->item_set_property = ipatch_gig_sub_region_set_property; item_class->copy = ipatch_gig_sub_region_item_copy; /* use parent's mutex (IpatchGigRegion) */ item_class->mutex_slave = TRUE; g_object_class_override_property (obj_class, PROP_TITLE, "title"); link_item_pspec = g_param_spec_object ("link-item", _("Link item"), _("Link item"), IPATCH_TYPE_GIG_SAMPLE, G_PARAM_READWRITE); g_object_class_install_property (obj_class, PROP_LINK_ITEM, link_item_pspec); g_object_class_install_property (obj_class, PROP_SAMPLE_INFO_OVERRIDE, g_param_spec_boolean ("sample-info-override", _("Sample info override"), _("Override sample info"), FALSE, G_PARAM_READWRITE)); /* IpatchSample interface properties */ ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_SIZE, "sample-size"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_FORMAT, "sample-format"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_RATE, "sample-rate"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_DATA, "sample-data"); ipatch_dls2_sample_info_install_class_properties (obj_class); } static void ipatch_gig_sub_region_get_title (IpatchGigSubRegion *gig_region, GValue *value) { IpatchGigSample *sample; char *s = NULL; g_object_get (gig_region, "link-item", &sample, NULL); /* ++ ref sample */ if (sample) { g_object_get (sample, "name", &s, NULL); /* caller takes over alloc. */ g_object_unref (sample); /* -- unref sample */ } g_value_take_string (value, s); } static void ipatch_gig_sub_region_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchGigSubRegion *subregion = IPATCH_GIG_SUB_REGION (object); IpatchDLS2SampleInfo saminfo = IPATCH_DLS2_SAMPLE_INFO_INIT; IpatchDLS2SampleInfo oldinfo, newinfo; gboolean retval, is_samprop; switch (property_id) { case PROP_LINK_ITEM: ipatch_gig_sub_region_real_set_sample (subregion, IPATCH_GIG_SAMPLE (g_value_get_object (value)), FALSE); break; case PROP_SAMPLE_INFO_OVERRIDE: ipatch_gig_sub_region_get_sample_info (subregion, &oldinfo); if (g_value_get_boolean (value)) ipatch_item_set_flags ((IpatchItem *)subregion, IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE); else ipatch_item_clear_flags ((IpatchItem *)subregion, IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE); ipatch_gig_sub_region_get_sample_info (subregion, &newinfo); ipatch_dls2_sample_info_notify_changes ((IpatchItem *)subregion, &newinfo, &oldinfo); break; default: is_samprop = ipatch_dls2_sample_info_is_property_id_valid (property_id); /* check if region override info valid but override flag not set. If so then copy sample info to static 'saminfo'. OK to test region without locking it (worst that happens is default values get used). */ if (is_samprop && subregion->sample_info && !(ipatch_item_get_flags (subregion) & IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE)) ipatch_gig_sub_region_get_sample_info (subregion, &saminfo); IPATCH_ITEM_WLOCK (subregion); /* is override sample_info valid but override flag not set and it is in fact a sample info property? - Copy values from sample (or defaults) */ if (is_samprop && subregion->sample_info && !(ipatch_item_get_flags (subregion) & IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE)) *subregion->sample_info = saminfo; retval = ipatch_dls2_sample_info_set_property (&subregion->sample_info, property_id, value); if (retval) /* sample info set, set override flag */ ipatch_item_set_flags (subregion, IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE); IPATCH_ITEM_WUNLOCK (subregion); if (!retval) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } break; } } static void ipatch_gig_sub_region_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchGigSubRegion *subregion = IPATCH_GIG_SUB_REGION (object); IpatchDLS2Sample *sample = NULL; gboolean retval = FALSE, get_from_sample = FALSE; switch (property_id) { case PROP_TITLE: ipatch_gig_sub_region_get_title (subregion, value); break; case PROP_LINK_ITEM: g_value_take_object (value, ipatch_gig_sub_region_get_sample (subregion)); break; case PROP_SAMPLE_INFO_OVERRIDE: g_value_set_boolean (value, (ipatch_item_get_flags ((IpatchItem *)subregion) & IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE) != 0); break; case PROP_SAMPLE_SIZE: /* ++ ref sample */ sample = (IpatchDLS2Sample *)ipatch_gig_sub_region_get_sample (subregion); g_return_if_fail (sample != NULL); g_object_get_property ((GObject *)sample, "sample-size", value); g_object_unref (sample); /* -- unref sample */ break; case PROP_SAMPLE_FORMAT: /* ++ ref sample */ sample = (IpatchDLS2Sample *)ipatch_gig_sub_region_get_sample (subregion); g_return_if_fail (sample != NULL); g_object_get_property ((GObject *)sample, "sample-format", value); g_object_unref (sample); /* -- unref sample */ break; case PROP_SAMPLE_RATE: /* ++ ref sample */ sample = (IpatchDLS2Sample *)ipatch_gig_sub_region_get_sample (subregion); g_return_if_fail (sample != NULL); g_object_get_property ((GObject *)sample, "sample-rate", value); g_object_unref (sample); /* -- unref sample */ break; case PROP_SAMPLE_DATA: /* ++ ref sample */ sample = (IpatchDLS2Sample *)ipatch_gig_sub_region_get_sample (subregion); g_return_if_fail (sample != NULL); g_object_get_property ((GObject *)sample, "sample-data", value); g_object_unref (sample); /* -- unref sample */ break; default: /* a sample info property? */ if (property_id >= IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID && property_id < (IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID + IPATCH_DLS2_SAMPLE_INFO_PROPERTY_COUNT)) { IPATCH_ITEM_RLOCK (subregion); /* sample override info is valid? */ if ((ipatch_item_get_flags (subregion) & IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE) && subregion->sample_info) retval = ipatch_dls2_sample_info_get_property (subregion->sample_info, property_id, value); else { get_from_sample = TRUE; sample = (IpatchDLS2Sample *)(subregion->sample); } IPATCH_ITEM_RUNLOCK (subregion); } if (get_from_sample) { if (sample) { IPATCH_ITEM_RLOCK (sample); ipatch_dls2_sample_info_get_property (sample->sample_info, property_id, value); IPATCH_ITEM_RUNLOCK (sample); g_object_unref (sample); } else ipatch_dls2_sample_info_get_property (sample->sample_info, property_id, value); } else if (!retval) G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_gig_sub_region_init (IpatchGigSubRegion *subregion) { ipatch_gig_effects_init (&subregion->effects); } static void ipatch_gig_sub_region_finalize (GObject *gobject) { IpatchGigSubRegion *subregion = IPATCH_GIG_SUB_REGION (gobject); IPATCH_ITEM_WLOCK (subregion); if (subregion->sample) g_object_unref (subregion->sample); if (subregion->sample_info) ipatch_dls2_sample_info_free (subregion->sample_info); subregion->sample = NULL; subregion->sample_info = NULL; IPATCH_ITEM_WUNLOCK (subregion); if (G_OBJECT_CLASS (ipatch_gig_sub_region_parent_class)->finalize) G_OBJECT_CLASS (ipatch_gig_sub_region_parent_class)->finalize (gobject); } static void ipatch_gig_sub_region_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchGigSubRegion *src_sub, *dest_sub; IpatchGigSample *sample; src_sub = IPATCH_GIG_SUB_REGION (src); dest_sub = IPATCH_GIG_SUB_REGION (dest); IPATCH_ITEM_RLOCK (src_sub); dest_sub->effects = src_sub->effects; if (src_sub->sample) { sample = (IpatchGigSample *) IPATCH_ITEM_COPY_LINK_FUNC (IPATCH_ITEM (dest_sub), IPATCH_ITEM (src_sub->sample), link_func, user_data); if (sample) dest_sub->sample = g_object_ref (sample); /* ++ ref sample */ } if (src_sub->sample_info) dest_sub->sample_info = ipatch_dls2_sample_info_duplicate (src_sub->sample_info); IPATCH_ITEM_RUNLOCK (src_sub); } /** * ipatch_gig_sub_region_new: * * Create a new GigaSampler sub region. * * Returns: New GigaSampler sub region with a ref count of 1 which the caller * owns. */ IpatchGigSubRegion * ipatch_gig_sub_region_new (void) { return (IPATCH_GIG_SUB_REGION (g_object_new (IPATCH_TYPE_GIG_SUB_REGION, NULL))); } /** * ipatch_gig_sub_region_first: * @iter: Patch item iterator containing #IpatchGigSubRegion items * * Gets the first item in a sub region iterator. A convenience * wrapper for ipatch_iter_first(). * * Returns: The first sub region in @iter or %NULL if empty. */ IpatchGigSubRegion * ipatch_gig_sub_region_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_GIG_SUB_REGION (obj)); else return (NULL); } /** * ipatch_gig_sub_region_next: * @iter: Patch item iterator containing #IpatchGigSubRegion items * * Gets the next item in a sub region iterator. A convenience wrapper * for ipatch_iter_next(). * * Returns: The next sub region in @iter or %NULL if at the end of * the list. */ IpatchGigSubRegion * ipatch_gig_sub_region_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_GIG_SUB_REGION (obj)); else return (NULL); } /** * ipatch_gig_sub_region_get_sample: * @subregion: GigaSampler sub region to get sample of * * Returns: The sub region's sample, referenced for the caller, unref * it when finished. */ IpatchGigSample * ipatch_gig_sub_region_get_sample (IpatchGigSubRegion *subregion) { IpatchGigSample *sample; g_return_val_if_fail (IPATCH_IS_GIG_SUB_REGION (subregion), NULL); IPATCH_ITEM_RLOCK (subregion); sample = g_object_ref (subregion->sample); IPATCH_ITEM_WUNLOCK (subregion); return (sample); } /** * ipatch_gig_sub_region_set_sample: * @subregion: GigaSampler sub region to set sample of * @sample: Sample to assign to the sub region * * Set the referenced sample of a sub region. */ void ipatch_gig_sub_region_set_sample (IpatchGigSubRegion *subregion, IpatchGigSample *sample) { g_return_if_fail (IPATCH_IS_GIG_SUB_REGION (subregion)); g_return_if_fail (IPATCH_IS_GIG_SAMPLE (sample)); ipatch_gig_sub_region_real_set_sample (subregion, sample, TRUE); } static void ipatch_gig_sub_region_real_set_sample (IpatchGigSubRegion *subregion, IpatchGigSample *sample, gboolean sample_notify) { GValue newval = { 0 }, oldval = { 0 }; IpatchDLS2SampleInfo oldinfo, newinfo; IpatchGigSample *oldsample; /* get all values of current sample info */ ipatch_gig_sub_region_get_sample_info (subregion, &oldinfo); if (sample) g_object_ref (sample); IPATCH_ITEM_WLOCK (subregion); oldsample = subregion->sample; subregion->sample = sample; IPATCH_ITEM_WUNLOCK (subregion); if (sample_notify) { g_value_init (&oldval, IPATCH_TYPE_GIG_SAMPLE); g_value_take_object (&oldval, oldsample); g_value_init (&newval, IPATCH_TYPE_GIG_SAMPLE); g_value_set_object (&newval, sample); ipatch_item_prop_notify ((IpatchItem *)subregion, link_item_pspec, &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } else if (oldsample) g_object_unref (oldsample); /* -- unref old sample */ /* do the title notify */ g_value_init (&newval, G_TYPE_STRING); ipatch_gig_sub_region_get_title (subregion, &newval); ipatch_item_prop_notify ((IpatchItem *)subregion, ipatch_item_pspec_title, &newval, NULL); g_value_unset (&newval); /* notify for sample info properties */ ipatch_gig_sub_region_get_sample_info (subregion, &newinfo); ipatch_dls2_sample_info_notify_changes ((IpatchItem *)subregion, &newinfo, &oldinfo); } /* fetch active sample info from a Gig sub region */ static void ipatch_gig_sub_region_get_sample_info (IpatchGigSubRegion *subregion, IpatchDLS2SampleInfo *info) { IpatchDLS2Sample *sample = NULL; gboolean info_set = TRUE; IPATCH_ITEM_RLOCK (subregion); if (ipatch_item_get_flags (subregion) & IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE && subregion->sample_info) *info = *subregion->sample_info; else if (subregion->sample) sample = g_object_ref (subregion->sample); else info_set = FALSE; IPATCH_ITEM_RUNLOCK (subregion); if (sample) { IPATCH_ITEM_RLOCK (sample); if (sample->sample_info) *info = *sample->sample_info; else info_set = FALSE; IPATCH_ITEM_RUNLOCK (sample); g_object_unref (sample); } if (!info_set) ipatch_dls2_sample_info_init (info); } libinstpatch-1.0.0/libinstpatch/IpatchSF2Sample.c0000644000175000017500000006023111461332142016631 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchSF2Sample.h" #include "IpatchSample.h" #include "IpatchSampleData.h" #include "IpatchSF2.h" #include "IpatchSF2File.h" #include "IpatchParamProp.h" #include "IpatchTypeProp.h" #include "IpatchSF2VoiceCache.h" #include "builtin_enums.h" #include "ipatch_priv.h" /* properties */ enum { PROP_0, PROP_NAME, PROP_SAMPLE_SIZE, PROP_SAMPLE_FORMAT, PROP_SAMPLE_RATE, PROP_LOOP_TYPE, PROP_LOOP_START, PROP_LOOP_END, PROP_ROOT_NOTE, PROP_FINE_TUNE, PROP_CHANNEL, PROP_ROM, PROP_SAMPLE_DATA, PROP_LINKED_SAMPLE }; static void ipatch_sf2_sample_iface_init (IpatchSampleIface *sample_iface); static gboolean ipatch_sf2_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_sf2_sample_finalize (GObject *gobject); static void ipatch_sf2_sample_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sf2_sample_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sf2_sample_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static void ipatch_sf2_sample_item_remove (IpatchItem *item); static int ipatch_sf2_sample_voice_cache_update_handler (IpatchSF2VoiceCache *cache, int *select_values, GObject *cache_item, GObject *item, GParamSpec *pspec, const GValue *value, IpatchSF2VoiceUpdate *updates, guint max_updates); static void ipatch_sf2_sample_real_set_name (IpatchSF2Sample *sample, const char *name, gboolean name_notify); static void ipatch_sf2_sample_real_set_data (IpatchSF2Sample *sample, IpatchSampleData *sampledata, gboolean data_notify); static void ipatch_sf2_sample_real_set_linked (IpatchSF2Sample *sample, IpatchSF2Sample *linked, gboolean linked_notify); /* cached parameter spec values for speed */ static GParamSpec *name_pspec; static GParamSpec *sample_data_pspec; static GParamSpec *linked_sample_pspec; G_DEFINE_TYPE_WITH_CODE (IpatchSF2Sample, ipatch_sf2_sample, IPATCH_TYPE_ITEM, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sf2_sample_iface_init)) /* sample interface initialization */ static void ipatch_sf2_sample_iface_init (IpatchSampleIface *sample_iface) { sample_iface->open = ipatch_sf2_sample_iface_open; } static gboolean ipatch_sf2_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchSF2Sample *sample = IPATCH_SF2_SAMPLE (handle->sample); g_return_val_if_fail (sample->sample_data != NULL, FALSE); return (ipatch_sample_handle_cascade_open (handle, (IpatchSample *)(sample->sample_data), err)); } static void ipatch_sf2_sample_class_init (IpatchSF2SampleClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); GParamSpec *pspec; obj_class->finalize = ipatch_sf2_sample_finalize; obj_class->get_property = ipatch_sf2_sample_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_sf2_sample_set_property; item_class->copy = ipatch_sf2_sample_item_copy; item_class->remove = ipatch_sf2_sample_item_remove; /* "name" property is used as the title */ g_object_class_override_property (obj_class, PROP_NAME, "title"); name_pspec = g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE); ipatch_param_set (name_pspec, "string-max-length", IPATCH_SFONT_NAME_SIZE, /* max length */ NULL); g_object_class_install_property (obj_class, PROP_NAME, name_pspec); /* properties defined by IpatchSample interface */ ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_SIZE, "sample-size"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_FORMAT, "sample-format"); pspec = ipatch_sample_install_property (obj_class, PROP_SAMPLE_RATE, "sample-rate"); pspec->flags |= IPATCH_PARAM_SYNTH; /* IpatchSF2Sample object's don't have a loop type field really */ ipatch_sample_install_property_readonly (obj_class, PROP_LOOP_TYPE, "loop-type"); pspec = ipatch_sample_install_property (obj_class, PROP_LOOP_START, "loop-start"); pspec->flags |= IPATCH_PARAM_SYNTH | IPATCH_PARAM_SYNTH_REALTIME; pspec = ipatch_sample_install_property (obj_class, PROP_LOOP_END, "loop-end"); pspec->flags |= IPATCH_PARAM_SYNTH | IPATCH_PARAM_SYNTH_REALTIME; pspec = ipatch_sample_install_property (obj_class, PROP_ROOT_NOTE, "root-note"); pspec->flags |= IPATCH_PARAM_SYNTH; pspec = ipatch_sample_install_property (obj_class, PROP_FINE_TUNE, "fine-tune"); pspec->flags |= IPATCH_PARAM_SYNTH | IPATCH_PARAM_SYNTH_REALTIME; g_object_class_install_property (obj_class, PROP_CHANNEL, g_param_spec_enum ("channel", _("Channel orientation"), _("Channel orientation"), IPATCH_TYPE_SF2_SAMPLE_CHANNEL, IPATCH_SF2_SAMPLE_CHANNEL_MONO, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_ROM, g_param_spec_boolean ("rom", _("ROM sample flag"), _("ROM sample flag"), FALSE, G_PARAM_READWRITE)); sample_data_pspec = ipatch_sample_install_property (obj_class, PROP_SAMPLE_DATA, "sample-data"); linked_sample_pspec = g_param_spec_object ("linked-sample", _("Linked sample"), _("Stereo linked sample object"), IPATCH_TYPE_SF2_SAMPLE, G_PARAM_READWRITE); g_object_class_install_property (obj_class, PROP_LINKED_SAMPLE, linked_sample_pspec); /* install IpatchSF2VoiceCache update handler for real time effects */ ipatch_type_set (IPATCH_TYPE_SF2_SAMPLE, "sf2voice-update-func", ipatch_sf2_sample_voice_cache_update_handler, NULL); } static void ipatch_sf2_sample_init (IpatchSF2Sample *sample) { ipatch_sf2_sample_set_blank (sample); sample->rate = IPATCH_SAMPLE_RATE_DEFAULT; } static void ipatch_sf2_sample_finalize (GObject *gobject) { IpatchSF2Sample *sample = IPATCH_SF2_SAMPLE (gobject); /* nothing should reference the sample after this, but we set pointers to NULL to help catch invalid references. Locking of sample is required since in reality all its children do still hold references */ IPATCH_ITEM_WLOCK (sample); if (sample->sample_data) { g_object_unref (sample->sample_data); sample->sample_data = NULL; } if (sample->linked) { g_object_unref (sample->linked); sample->linked = NULL; } g_free (sample->name); sample->name = NULL; IPATCH_ITEM_WUNLOCK (sample); if (G_OBJECT_CLASS (ipatch_sf2_sample_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sf2_sample_parent_class)->finalize (gobject); } static void ipatch_sf2_sample_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSF2Sample *sample = IPATCH_SF2_SAMPLE (object); switch (property_id) { case PROP_NAME: ipatch_sf2_sample_real_set_name (sample, g_value_get_string (value), FALSE); /* don't do name notify */ break; case PROP_SAMPLE_RATE: IPATCH_ITEM_WLOCK (sample); sample->rate = g_value_get_int (value); IPATCH_ITEM_WUNLOCK (sample); break; case PROP_LOOP_START: IPATCH_ITEM_WLOCK (sample); sample->loop_start = g_value_get_uint (value); IPATCH_ITEM_WUNLOCK (sample); break; case PROP_LOOP_END: IPATCH_ITEM_WLOCK (sample); sample->loop_end = g_value_get_uint (value); IPATCH_ITEM_WUNLOCK (sample); break; case PROP_ROOT_NOTE: IPATCH_ITEM_WLOCK (sample); sample->root_note = g_value_get_int (value); IPATCH_ITEM_WUNLOCK (sample); break; case PROP_FINE_TUNE: IPATCH_ITEM_WLOCK (sample); sample->fine_tune = g_value_get_int (value); IPATCH_ITEM_WUNLOCK (sample); break; case PROP_CHANNEL: sample->channel = g_value_get_enum (value); break; case PROP_ROM: ipatch_item_set_flags ((IpatchItem *)object, g_value_get_boolean (value) << IPATCH_SF2_SAMPLE_FLAG_ROM); break; case PROP_SAMPLE_DATA: ipatch_sf2_sample_real_set_data (sample, (IpatchSampleData *) g_value_get_object (value), FALSE); break; case PROP_LINKED_SAMPLE: ipatch_sf2_sample_real_set_linked (sample, (IpatchSF2Sample *) g_value_get_object (value), FALSE); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_sf2_sample_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSF2Sample *sample; g_return_if_fail (IPATCH_IS_SF2_SAMPLE (object)); sample = IPATCH_SF2_SAMPLE (object); switch (property_id) { case PROP_NAME: g_value_take_string (value, ipatch_sf2_sample_get_name (sample)); break; case PROP_SAMPLE_SIZE: g_return_if_fail (sample->sample_data != NULL); g_value_set_uint (value, ipatch_sample_get_size ((IpatchSample *)(sample->sample_data), NULL)); break; case PROP_SAMPLE_FORMAT: g_return_if_fail (sample->sample_data != NULL); g_value_set_int (value, ipatch_sample_get_format ((IpatchSample *)(sample->sample_data))); break; case PROP_SAMPLE_RATE: IPATCH_ITEM_RLOCK (sample); g_value_set_int (value, sample->rate); IPATCH_ITEM_RUNLOCK (sample); break; case PROP_LOOP_TYPE: /* IpatchSF2Sample objects don't have loop type, just use normal loop */ g_value_set_enum (value, IPATCH_SAMPLE_LOOP_STANDARD); break; case PROP_LOOP_START: IPATCH_ITEM_RLOCK (sample); g_value_set_uint (value, sample->loop_start); IPATCH_ITEM_RUNLOCK (sample); break; case PROP_LOOP_END: IPATCH_ITEM_RLOCK (sample); g_value_set_uint (value, sample->loop_end); IPATCH_ITEM_RUNLOCK (sample); break; case PROP_ROOT_NOTE: g_value_set_int (value, sample->root_note); break; case PROP_FINE_TUNE: g_value_set_int (value, sample->fine_tune); break; case PROP_CHANNEL: g_value_set_enum (value, sample->channel); break; case PROP_ROM: g_value_set_boolean (value, (ipatch_item_get_flags ((IpatchItem *)object) & IPATCH_SF2_SAMPLE_FLAG_ROM) != 0); break; case PROP_SAMPLE_DATA: g_value_take_object (value, ipatch_sf2_sample_get_data (sample)); break; case PROP_LINKED_SAMPLE: g_value_take_object (value, ipatch_sf2_sample_get_linked (sample)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_sf2_sample_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchSF2Sample *src_sam, *dest_sam; IpatchItem *linked; src_sam = IPATCH_SF2_SAMPLE (src); dest_sam = IPATCH_SF2_SAMPLE (dest); IPATCH_ITEM_RLOCK (src_sam); ipatch_sf2_sample_set_data (dest_sam, src_sam->sample_data); dest_sam->name = g_strdup (src_sam->name); dest_sam->rate = src_sam->rate; dest_sam->loop_start = src_sam->loop_start; dest_sam->loop_end = src_sam->loop_end; dest_sam->root_note = src_sam->root_note; dest_sam->fine_tune = src_sam->fine_tune; dest_sam->channel = src_sam->channel; if (ipatch_item_get_flags (src_sam) & IPATCH_SF2_SAMPLE_FLAG_ROM) ipatch_item_set_flags (dest_sam, IPATCH_SF2_SAMPLE_FLAG_ROM); linked = IPATCH_ITEM_COPY_LINK_FUNC (dest, IPATCH_ITEM (src_sam->linked), link_func, user_data); if (linked) ipatch_sf2_sample_set_linked (dest_sam, IPATCH_SF2_SAMPLE (linked)); IPATCH_ITEM_RUNLOCK (src_sam); } static void ipatch_sf2_sample_item_remove (IpatchItem *item) { IpatchList *list; IpatchSF2Sample *linked; IpatchItem *zitem, *parent, *temp; IpatchIter iter; list = ipatch_sf2_get_zone_references (item); /* ++ ref zone list */ ipatch_list_init_iter (list, &iter); zitem = ipatch_item_first (&iter); while (zitem) { temp = zitem; zitem = ipatch_item_next (&iter); ipatch_item_remove (temp); } g_object_unref (list); /* -- unref list */ linked = ipatch_sf2_sample_get_linked (IPATCH_SF2_SAMPLE (item)); /* ++ ref */ if (linked) { ipatch_sf2_sample_set_linked (linked, NULL); /* clear link to item */ g_object_unref (linked); /* -- unref linked sample */ } parent = ipatch_item_get_parent (item); /* ++ ref parent */ if (parent) { ipatch_container_remove (IPATCH_CONTAINER (parent), item); g_object_unref (parent); /* -- unref parent */ } } /* IpatchSF2VoiceCache update function for realtime effects */ static int ipatch_sf2_sample_voice_cache_update_handler (IpatchSF2VoiceCache *cache, int *select_values, GObject *cache_item, GObject *item, GParamSpec *pspec, const GValue *value, IpatchSF2VoiceUpdate *updates, guint max_updates) { IpatchSF2Voice *voice; guint8 genid, genid2 = 255; gint16 val = 0, val2 = 0; int ival; g_return_val_if_fail (cache->voices->len > 0, 0); voice = IPATCH_SF2_VOICE_CACHE_GET_VOICE (cache, 0); switch (IPATCH_PARAM_SPEC_ID (pspec)) { case PROP_LOOP_START: genid = IPATCH_SF2_GEN_SAMPLE_LOOP_START; genid2 = IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START; ival = (int)g_value_get_uint (value) - voice->loop_start; val = ival % 32768; val2 = ival / 32768; break; case PROP_LOOP_END: genid = IPATCH_SF2_GEN_SAMPLE_LOOP_END; genid2 = IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END; ival = (int)g_value_get_uint (value) - voice->loop_end; val = ival % 32768; val2 = ival / 32768; break; case PROP_FINE_TUNE: genid = IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE; ival = g_value_get_int (value); break; default: return (0); } updates->voice = 0; updates->genid = genid; updates->ival = val; if (genid2 != 255 && max_updates >= 2) { updates[1].voice = 0; updates[1].genid = genid2; updates[1].ival = val2; return (2); } else return (1); } /** * ipatch_sf2_sample_new: * * Create a new SoundFont sample object. * * Returns: New SoundFont sample with a reference count of 1. Caller * owns the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchSF2Sample * ipatch_sf2_sample_new (void) { return (IPATCH_SF2_SAMPLE (g_object_new (IPATCH_TYPE_SF2_SAMPLE, NULL))); } /** * ipatch_sf2_sample_first: * @iter: Patch item iterator containing #IpatchSF2Sample items * * Gets the first item in a sample iterator. A convenience wrapper for * ipatch_iter_first(). * * Returns: The first sample in @iter or %NULL if empty. */ IpatchSF2Sample * ipatch_sf2_sample_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_SF2_SAMPLE (obj)); else return (NULL); } /** * ipatch_sf2_sample_next: * @iter: Patch item iterator containing #IpatchSF2Sample items * * Gets the next item in a sample iterator. A convenience wrapper for * ipatch_iter_next(). * * Returns: The next sample in @iter or %NULL if at the end of the list. */ IpatchSF2Sample * ipatch_sf2_sample_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_SF2_SAMPLE (obj)); else return (NULL); } /** * ipatch_sf2_sample_set_name: * @sample: Sample to set name of * @name: Value to set name to * * Sets the name of a SoundFont sample. */ void ipatch_sf2_sample_set_name (IpatchSF2Sample *sample, const char *name) { g_return_if_fail (IPATCH_IS_SF2_SAMPLE (sample)); ipatch_sf2_sample_real_set_name (sample, name, TRUE); } /* also called from item_set_property method so "name_notify" can be used to stop double emission of name notify */ static void ipatch_sf2_sample_real_set_name (IpatchSF2Sample *sample, const char *name, gboolean name_notify) { GValue oldval = { 0 }, newval = { 0 }; char *newname; g_value_init (&oldval, G_TYPE_STRING); newname = g_strdup (name); IPATCH_ITEM_WLOCK (sample); g_value_take_string (&oldval, sample->name); sample->name = newname; IPATCH_ITEM_WUNLOCK (sample); g_value_init (&newval, G_TYPE_STRING); g_value_set_static_string (&newval, name); ipatch_item_prop_notify ((IpatchItem *)sample, ipatch_item_pspec_title, &newval, &oldval); if (name_notify) ipatch_item_prop_notify ((IpatchItem *)sample, name_pspec, &newval, &oldval); g_value_unset (&oldval); g_value_unset (&newval); } /** * ipatch_sf2_sample_get_name: * @sample: Sample to get name of * * Gets the name of a SoundFont sample. * * Returns: Name of sample or %NULL if not set. String value should be freed * when finished with it. */ char * ipatch_sf2_sample_get_name (IpatchSF2Sample *sample) { char *name = NULL; g_return_val_if_fail (IPATCH_IS_SF2_SAMPLE (sample), NULL); IPATCH_ITEM_RLOCK (sample); if (sample->name) name = g_strdup (sample->name); IPATCH_ITEM_RUNLOCK (sample); return (name); } /** * ipatch_sf2_sample_set_data: * @sample: Sample to set sample data of * @sampledata: Sample data to set sample to * * Set a sample's sample data object. */ void ipatch_sf2_sample_set_data (IpatchSF2Sample *sample, IpatchSampleData *sampledata) { g_return_if_fail (IPATCH_IS_SF2_SAMPLE (sample)); g_return_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata)); ipatch_sf2_sample_real_set_data (sample, sampledata, TRUE); } /* the actual setting of sample data, user routine does a g_object_notify */ static void ipatch_sf2_sample_real_set_data (IpatchSF2Sample *sample, IpatchSampleData *sampledata, gboolean data_notify) { GValue oldval = { 0 }, newval = { 0 }; if (data_notify) g_value_init (&oldval, IPATCH_TYPE_SAMPLE_DATA); if (sampledata) g_object_ref (sampledata); IPATCH_ITEM_WLOCK (sample); if (data_notify) g_value_take_object (&oldval, sample->sample_data); else if (sample->sample_data) g_object_unref (sample->sample_data); sample->sample_data = sampledata; IPATCH_ITEM_WUNLOCK (sample); if (data_notify) { g_value_init (&newval, IPATCH_TYPE_SAMPLE_DATA); g_value_set_object (&newval, sampledata); ipatch_item_prop_notify ((IpatchItem *)sample, sample_data_pspec, &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } } /** * ipatch_sf2_sample_get_data: * @sample: Sample to get sample data from * * Get the #IpatchSampleData item of a sample. Sample data item is referenced * before returning and caller is responsible for unreferencing it with * g_object_unref() when finished with it. * * Returns: Sample data object of sample or %NULL if none. Remember to * unreference with g_object_unref() when finished with it. */ IpatchSampleData * ipatch_sf2_sample_get_data (IpatchSF2Sample *sample) { IpatchSampleData *sampledata; g_return_val_if_fail (IPATCH_IS_SF2_SAMPLE (sample), NULL); IPATCH_ITEM_RLOCK (sample); sampledata = sample->sample_data; if (sampledata) g_object_ref (sampledata); IPATCH_ITEM_RUNLOCK (sample); return (sampledata); } /** * ipatch_sf2_sample_peek_data: * @sample: Sample to get sample data from * * Get the #IpatchSampleData item of a sample. Like * ipatch_sf2_sample_get_data() but sample data object is not referenced. * This function should only be used if a reference of the sample data object * is ensured or only the pointer value is of importance. * * Returns: Sample data object of sample or %NULL if none. Remember that a * reference is NOT added. */ IpatchSampleData * ipatch_sf2_sample_peek_data (IpatchSF2Sample *sample) { IpatchSampleData *sampledata; g_return_val_if_fail (IPATCH_IS_SF2_SAMPLE (sample), NULL); IPATCH_ITEM_RLOCK (sample); sampledata = sample->sample_data; IPATCH_ITEM_RUNLOCK (sample); return (sampledata); } /** * ipatch_sf2_sample_set_linked: * @sample: Sample to set linked sample of * @linked: Sample that is stereo linked to @sample or %NULL to unset. * * Sets the stereo linked sample of a sample item. */ void ipatch_sf2_sample_set_linked (IpatchSF2Sample *sample, IpatchSF2Sample *linked) { g_return_if_fail (IPATCH_IS_SF2_SAMPLE (sample)); g_return_if_fail (!linked || IPATCH_IS_SF2_SAMPLE (linked)); ipatch_sf2_sample_real_set_linked (sample, linked, TRUE); } /* real set linked sample */ static void ipatch_sf2_sample_real_set_linked (IpatchSF2Sample *sample, IpatchSF2Sample *linked, gboolean linked_notify) { GValue oldval = { 0 }, newval = { 0 }; if (linked_notify) g_value_init (&oldval, IPATCH_TYPE_SF2_SAMPLE); if (linked) g_object_ref (linked); IPATCH_ITEM_WLOCK (sample); if (linked_notify) g_value_take_object (&oldval, sample->linked); else if (sample->linked) g_object_unref (sample->linked); sample->linked = linked; IPATCH_ITEM_WUNLOCK (sample); if (linked_notify) { g_value_init (&newval, IPATCH_TYPE_SF2_SAMPLE); g_value_set_object (&newval, linked); ipatch_item_prop_notify ((IpatchItem *)sample, sample_data_pspec, &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } } /** * ipatch_sf2_sample_get_linked: * @sample: Sample to get linked sample from * * Get the stereo linked sample from @sample. If a sample is returned the * caller owns a reference and should unref it with g_object_unref() * when finished with it. * * Returns: The linked stereo sample or %NULL if no linked sample. Remember to * unref the returned sample with g_object_unref() when finished with it. */ IpatchSF2Sample * ipatch_sf2_sample_get_linked (IpatchSF2Sample *sample) { IpatchSF2Sample *linked; IPATCH_ITEM_RLOCK (sample); linked = sample->linked; if (linked) g_object_ref (linked); IPATCH_ITEM_RUNLOCK (sample); return (linked); } /** * ipatch_sf2_sample_peek_linked: * @sample: Sample to get linked sample from * * Get the stereo linked sample from @sample. Like * ipatch_sf2_sample_get_linked() but sample object is not referenced. * This function should only be used if a reference of the sample object * is ensured or only the pointer value is of importance. * * Returns: Linked sample object of sample or %NULL if none. Remember that a * reference is NOT added. */ IpatchSF2Sample * ipatch_sf2_sample_peek_linked (IpatchSF2Sample *sample) { IpatchSF2Sample *linked; g_return_val_if_fail (IPATCH_IS_SF2_SAMPLE (sample), NULL); IPATCH_ITEM_RLOCK (sample); linked = sample->linked; IPATCH_ITEM_RUNLOCK (sample); return (linked); } /** * ipatch_sf2_sample_set_blank: * @sample: Sample to set to blank sample data * * Set the sample data of a sample item to blank data. */ void ipatch_sf2_sample_set_blank (IpatchSF2Sample *sample) { IpatchSampleData *sampledata; g_return_if_fail (IPATCH_IS_SF2_SAMPLE (sample)); sampledata = ipatch_sample_data_get_blank (); ipatch_item_set_atomic (sample, "sample-data", sampledata, "loop-start", 8, "loop-end", 40, "root-note", 60, "fine-tune", 0, "channel", IPATCH_SF2_SAMPLE_CHANNEL_MONO, "rom", FALSE, "linked-sample", NULL, NULL); g_object_unref (sampledata); } libinstpatch-1.0.0/libinstpatch/ipatch_priv.h0000644000175000017500000000512411461332142016261 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /* * ipatch_priv.h - Private header file */ #ifndef __IPATCH_PRIV_H__ #define __IPATCH_PRIV_H__ #include #include "IpatchItem.h" #include "marshals.h" #include "misc.h" #include "i18n.h" #define IPATCH_UNTITLED _("Untitled") /* macro for getting a GParamSpec property ID (FIXME - its a private field!) */ #define IPATCH_PARAM_SPEC_ID(pspec) ((pspec)->param_id) /* size of buffers used for transfering sample data (in bytes) Must be a multiple of 16 bytes */ #define IPATCH_SAMPLE_COPY_BUFFER_SIZE (32 * 1024) /* Size of transform buffers used by IpatchSampleTransform objects in pool */ #define IPATCH_SAMPLE_TRANS_BUFFER_SIZE (32 * 1024) /* size of buffers used for copying data */ #define IPATCH_COPY_BUFFER_SIZE (32 * 1024) /* So we can start using the glib 2.10 allocator now */ #ifndef g_slice_new #define g_slice_new(type) g_new (type, 1) #define g_slice_new0(type) g_new0 (type, 1) #define g_slice_free(type, mem) g_free (mem) #define g_slice_alloc(size) g_malloc(size) #define g_slice_free1(size, mem) g_free (mem) #endif /* can be used in place of g_assert_not_reached, for g_return(_val)_if_fail to print error and return instead of terminating program */ #define NOT_REACHED 0 #ifdef __GNUC__ #define log_if_fail(expr) (!(expr) && \ _ret_g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ "file %s: line %d (%s): assertion `%s' failed.", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, \ #expr)) #else /* !GNUC */ #define log_if_fail(expr) (!(expr) && \ _ret_g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ "file %s: line %d: assertion `%s' failed.", \ __FILE__, __LINE__, \ #expr)) #endif int _ret_g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...); #endif libinstpatch-1.0.0/libinstpatch/IpatchVBank.h0000644000175000017500000000564411461332142016112 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchVBank * @short_description: Virtual bank object * @see_also: * @stability: Stable * * Virtual banks provide the capability of creating new instrument MIDI * maps from components from other files of possibly different types. */ #ifndef __IPATCH_VBANK_H__ #define __IPATCH_VBANK_H__ #include #include #include #include /* forward type declarations */ typedef struct _IpatchVBank IpatchVBank; typedef struct _IpatchVBankClass IpatchVBankClass; #include #define IPATCH_TYPE_VBANK (ipatch_vbank_get_type ()) #define IPATCH_VBANK(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_VBANK, \ IpatchVBank)) #define IPATCH_VBANK_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_VBANK, \ IpatchVBankClass)) #define IPATCH_IS_VBANK(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VBANK)) #define IPATCH_IS_VBANK_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_VBANK)) #define IPATCH_VBANK_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_VBANK, \ IpatchVBankClass)) /** * IPATCH_VBANK_INFO_COUNT: * * Count of info strings */ /* !! Keep synchronized with count of properties in IpatchVBank.c */ #define IPATCH_VBANK_INFO_COUNT 7 /* Virtual bank */ struct _IpatchVBank { IpatchBase parent_instance; /*< private >*/ char *info[IPATCH_VBANK_INFO_COUNT]; GSList *insts; }; struct _IpatchVBankClass { IpatchBaseClass parent_class; }; /** * IPATCH_VBANK_PARSER_VERSION: * * Current IVBank parser version. */ #define IPATCH_VBANK_PARSER_VERSION "1.0" GType ipatch_vbank_get_type (void); IpatchVBank *ipatch_vbank_new (void); #define ipatch_vbank_get_insts(vbank) \ ipatch_container_get_children (IPATCH_CONTAINER (vbank), \ IPATCH_TYPE_VBANK_INST) IpatchVBankInst * ipatch_vbank_find_inst (IpatchVBank *vbank, const char *name, int bank, int program, const IpatchVBankInst *exclude); char * ipatch_vbank_make_unique_name (IpatchVBank *vbank, const char *name, const IpatchVBankInst *exclude); #endif libinstpatch-1.0.0/libinstpatch/IpatchUnit_DLS.c0000644000175000017500000003375611461332142016532 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchUnit_DLS.h" #include "IpatchUnit.h" #include "i18n.h" static void ipatch_unit_dls_percent_to_percent_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_percent_to_dls_percent_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_dls_gain_to_decibels_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_decibels_to_dls_gain_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_dls_abs_time_to_seconds_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_seconds_to_dls_abs_time_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_dls_rel_time_to_time_cents_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_time_cents_to_dls_rel_time_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_dls_abs_pitch_to_hertz_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_hertz_to_dls_abs_pitch_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_dls_rel_pitch_to_cents_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_cents_to_dls_rel_pitch_value (const GValue *src_val, GValue *dest_val); void _ipatch_unit_dls_init (void) { IpatchUnitInfo *info; info = ipatch_unit_info_new (); info->label = NULL; info->descr = NULL; info->value_type = G_TYPE_INT; info->digits = 0; info->id = IPATCH_UNIT_TYPE_DLS_PERCENT; info->name = "DLSPercent"; ipatch_unit_register (info); info->id = IPATCH_UNIT_TYPE_DLS_GAIN; info->name = "DLSGain"; ipatch_unit_register (info); info->id = IPATCH_UNIT_TYPE_DLS_ABS_TIME; info->name = "DLSAbsTime"; ipatch_unit_register (info); info->id = IPATCH_UNIT_TYPE_DLS_REL_TIME; info->name = "DLSRelTime"; ipatch_unit_register (info); info->id = IPATCH_UNIT_TYPE_DLS_ABS_PITCH; info->name = "DLSAbsPitch"; ipatch_unit_register (info); info->id = IPATCH_UNIT_TYPE_DLS_REL_PITCH; info->name = "DLSRelPitch"; ipatch_unit_register (info); ipatch_unit_info_free (info); /* done with unit info structure, free it */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DLS_PERCENT, IPATCH_UNIT_TYPE_PERCENT, ipatch_unit_dls_percent_to_percent_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_PERCENT, IPATCH_UNIT_TYPE_DLS_PERCENT, ipatch_unit_percent_to_dls_percent_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DLS_GAIN, IPATCH_UNIT_TYPE_DECIBELS, ipatch_unit_dls_gain_to_decibels_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DECIBELS, IPATCH_UNIT_TYPE_DLS_GAIN, ipatch_unit_decibels_to_dls_gain_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DLS_ABS_TIME, IPATCH_UNIT_TYPE_SECONDS, ipatch_unit_dls_abs_time_to_seconds_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_SECONDS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, ipatch_unit_seconds_to_dls_abs_time_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DLS_REL_TIME, IPATCH_UNIT_TYPE_TIME_CENTS, ipatch_unit_dls_rel_time_to_time_cents_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_TIME_CENTS, IPATCH_UNIT_TYPE_DLS_REL_TIME, ipatch_unit_time_cents_to_dls_rel_time_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DLS_ABS_PITCH, IPATCH_UNIT_TYPE_HERTZ, ipatch_unit_dls_abs_pitch_to_hertz_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_HERTZ, IPATCH_UNIT_TYPE_DLS_ABS_PITCH, ipatch_unit_hertz_to_dls_abs_pitch_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DLS_REL_PITCH, IPATCH_UNIT_TYPE_CENTS, ipatch_unit_dls_rel_pitch_to_cents_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, ipatch_unit_cents_to_dls_rel_pitch_value); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_DLS_PERCENT, IPATCH_UNIT_TYPE_PERCENT); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_DLS_GAIN, IPATCH_UNIT_TYPE_DECIBELS); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_DLS_ABS_TIME, IPATCH_UNIT_TYPE_SECONDS); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_DLS_REL_TIME, IPATCH_UNIT_TYPE_TIME_CENTS); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_DLS_ABS_PITCH, IPATCH_UNIT_TYPE_HERTZ); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_DLS_REL_PITCH, IPATCH_UNIT_TYPE_CENTS); } /** * ipatch_unit_dls_class_convert: * @src_units: Source unit type ID * @src_val: Source value (type should be compatible with the source unit's * value type) * * Converts a value to "DLS" units. DLS units are unit types that * are used by DLS (Downloadable Sounds) patches. The #IPATCH_UNIT_CLASS_DLS * map is used to lookup the corresponding type to convert to. * Only some types have an associated DLS type. It is an error to pass a * @src_units type that has no DLS mapping (note that this is contrary to the * behavior of ipatch_unit_user_class_convert()). * * Returns: The value converted to DLS units. */ int ipatch_unit_dls_class_convert (guint16 src_units, const GValue *src_val) { IpatchUnitInfo *dest_info; GValue v = { 0 }; int retval; g_return_val_if_fail (src_val != NULL, 0); dest_info = ipatch_unit_class_lookup_map (IPATCH_UNIT_CLASS_DLS, src_units); g_return_val_if_fail (dest_info != NULL, 0); g_value_init (&v, G_TYPE_INT); ipatch_unit_convert (src_units, dest_info->id, src_val, &v); retval = g_value_get_int (&v); g_value_unset (&v); /* probably not needed, for the sake of extra paranoia (TM) */ return (retval); } /** * ipatch_unit_dls_percent_to_percent: * @dls_percent: Value in DLS percent units * * Convert value in DLS percent units to percent. * * percent = dls_percent / (10 * 65536) * * Returns: Value in percent */ double ipatch_unit_dls_percent_to_percent (int dls_percent) { return ((double)dls_percent / 655360.0); } /** * ipatch_unit_percent_to_dls_percent: * @percent: Value in percent * * Convert percent to DLS percent. * * dls_percent = percent * 10 * 65536 * * Returns: Converted integer in DLS percent */ int ipatch_unit_percent_to_dls_percent (double percent) { return (percent * 655360.0 + 0.5); /* +0.5 for rounding */ } /** * ipatch_unit_dls_gain_to_decibels: * @dls_gain: Value in DLS gain units * * Converts a value from DLS gain to decibels. * * dls_gain = 200 * 65536 * log10 (V / v) * decibels = 20 * log10 (V / v) * * Returns: Value converted to decibels */ double ipatch_unit_dls_gain_to_decibels (int dls_gain) { return ((double)dls_gain / 655360.0); } /** * ipatch_unit_decibels_to_dls_gain: * @db: Value in decibels * * Converts a value from decibels to DLS gain. * See ipatch_unit_dls_gain_to_decibel() * * Returns: Value converted to DLS gain */ int ipatch_unit_decibels_to_dls_gain (double db) { return (db * 655360.0 + 0.5); } /** * ipatch_unit_dls_abs_time_to_seconds: * @dls_abs_time: Value in DLS absolute time * * Converts a value from DLS absolute time to seconds. * seconds = 2^(dls_abs_time / (1200 * 65536)) * * 0x80000000 is used as a 0 value. * * Returns: Value converted to seconds */ double ipatch_unit_dls_abs_time_to_seconds (int dls_abs_time) { if (dls_abs_time == IPATCH_UNIT_DLS_ABS_TIME_0SECS) return (0.0); return (pow (2.0, (double)dls_abs_time / (1200 * 65536))); } /** * ipatch_unit_seconds_to_dls_abs_time: * @seconds: Value in seconds * * Converts a value from seconds to DLS absolute time. * dls_rel_time = 1200 * log2 (seconds) * 65536 * * Returns: Value converted to DLS relative time */ int ipatch_unit_seconds_to_dls_abs_time (double seconds) { if (seconds == 0.0) return (IPATCH_UNIT_DLS_ABS_TIME_0SECS); return ((double)1200.0 * (log (seconds) / log (2.0)) * 65536.0 + 0.5); } /** * ipatch_unit_dls_rel_time_to_time_cents: * @dls_rel_time: Value in DLS relative time * * Converts a value from DLS relative time to time cents. * time_cents = dls_rel_time / 65536 * * Returns: Value converted to time cents */ double ipatch_unit_dls_rel_time_to_time_cents (int dls_rel_time) { return (dls_rel_time / 65536.0); } /** * ipatch_unit_time_cents_to_dls_rel_time: * @time_cents: Value in time cents * * Converts a value from time_cents to DLS relative time. * dls_rel_time = time_cents * 65536 * * Returns: Value converted to DLS relative time */ int ipatch_unit_time_cents_to_dls_rel_time (double time_cents) { return (time_cents * 65536.0 + 0.5); } /** * ipatch_unit_dls_abs_pitch_to_hertz: * @dls_abs_pitch: Value in DLS absolute pitch * * Converts a value from DLS absolute pitch to hertz. * hertz = 440 * 2^((dls_abs_pitch / 65536 - 6900) / 1200) * * Returns: Value converted to hertz */ double ipatch_unit_dls_abs_pitch_to_hertz (int dls_abs_pitch) { return ((double)440.0 * pow (2.0, (dls_abs_pitch / 65536.0 - 6900.0) / 1200.0)); } /** * ipatch_unit_hertz_to_dls_abs_pitch: * @hertz: Value in hertz * * Converts a value from hertz to DLS absolute pitch. * dls_abs_pitch = (1200 * log2(hertz/440) + 6900) * 65536 * * Returns: Value converted to DLS absolute pitch */ int ipatch_unit_hertz_to_dls_abs_pitch (double hertz) { return (((double)1200.0 * (log (hertz / 440.0) / log (2)) + 6900.0) * 65536.0 + 0.5); } /** * ipatch_unit_dls_rel_pitch_to_cents: * @dls_rel_pitch: Value in DLS relative pitch * * Converts a value from DLS relative pitch to cents. * cents = dls_rel_pitch / 65536 * * Returns: Value converted to cents */ double ipatch_unit_dls_rel_pitch_to_cents (int dls_rel_pitch) { return ((double)dls_rel_pitch / 65536.0); } /** * ipatch_unit_cents_to_dls_rel_pitch: * @cents: Value in cents * * Converts a value from cents to DLS relative pitch. * dls_rel_pitch = cents * 65536 * * Returns: Value converted to DLS relative pitch */ int ipatch_unit_cents_to_dls_rel_pitch (double cents) { return (cents * 65536.0 + 0.5); } /* ================================================= GValue conversion functions, duplicated for speed ================================================= */ static void ipatch_unit_dls_percent_to_percent_value (const GValue *src_val, GValue *dest_val) { int dls_percent = g_value_get_int (src_val); g_value_set_double (dest_val, (double)dls_percent / 655360.0); } static void ipatch_unit_percent_to_dls_percent_value (const GValue *src_val, GValue *dest_val) { double percent = g_value_get_double (src_val); g_value_set_int (dest_val, percent * 655360.0 + 0.5); } static void ipatch_unit_dls_gain_to_decibels_value (const GValue *src_val, GValue *dest_val) { int dls_gain = g_value_get_int (src_val); g_value_set_double (dest_val, (double)dls_gain / 655360.0); } static void ipatch_unit_decibels_to_dls_gain_value (const GValue *src_val, GValue *dest_val) { double db = g_value_get_double (src_val); g_value_set_int (dest_val, db * 655360.0 + 0.5); } static void ipatch_unit_dls_abs_time_to_seconds_value (const GValue *src_val, GValue *dest_val) { int dls_abs_time = g_value_get_int (src_val); double secs; if (dls_abs_time != IPATCH_UNIT_DLS_ABS_TIME_0SECS) secs = pow (2.0, (double)dls_abs_time / (1200 * 65536)); else secs = 0.0; g_value_set_double (dest_val, secs); } static void ipatch_unit_seconds_to_dls_abs_time_value (const GValue *src_val, GValue *dest_val) { double secs = g_value_get_double (src_val); int dls_abs_time; if (secs != 0.0) dls_abs_time = (double)1200.0 * (log (secs) / log (2.0)) * 65536.0 + 0.5; else dls_abs_time = IPATCH_UNIT_DLS_ABS_TIME_0SECS; g_value_set_int (dest_val, dls_abs_time); } static void ipatch_unit_dls_rel_time_to_time_cents_value (const GValue *src_val, GValue *dest_val) { int dls_rel_time = g_value_get_int (src_val); g_value_set_double (dest_val, (double)dls_rel_time / 65536.0); } static void ipatch_unit_time_cents_to_dls_rel_time_value (const GValue *src_val, GValue *dest_val) { double time_cents = g_value_get_double (src_val); g_value_set_int (dest_val, time_cents * 65536.0 + 0.5); } static void ipatch_unit_dls_abs_pitch_to_hertz_value (const GValue *src_val, GValue *dest_val) { int dls_abs_pitch = g_value_get_int (src_val); g_value_set_double (dest_val, 440.0 * pow (2.0, ((double)dls_abs_pitch / 65536.0 - 6900.0) / 1200.0)); } static void ipatch_unit_hertz_to_dls_abs_pitch_value (const GValue *src_val, GValue *dest_val) { double hertz = g_value_get_double (src_val); g_value_set_int (dest_val, ((double)1200.0 * (log (hertz / 440.0) / log (2)) + 6900.0) * 65536.0 + 0.5); } static void ipatch_unit_dls_rel_pitch_to_cents_value (const GValue *src_val, GValue *dest_val) { int dls_rel_pitch = g_value_get_int (src_val); g_value_set_double (dest_val, (double)dls_rel_pitch / 65536.0); } static void ipatch_unit_cents_to_dls_rel_pitch_value (const GValue *src_val, GValue *dest_val) { double cents = g_value_get_double (src_val); g_value_set_int (dest_val, cents * 65536.0 + 0.5); } libinstpatch-1.0.0/libinstpatch/marshals.c0000644000175000017500000000760611456656123015601 00000000000000/* Autogenerated file (add to marshals.list and 'make update-marshals') */ #include #ifdef G_ENABLE_DEBUG #define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) #define g_marshal_value_peek_char(v) g_value_get_char (v) #define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) #define g_marshal_value_peek_int(v) g_value_get_int (v) #define g_marshal_value_peek_uint(v) g_value_get_uint (v) #define g_marshal_value_peek_long(v) g_value_get_long (v) #define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) #define g_marshal_value_peek_int64(v) g_value_get_int64 (v) #define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) #define g_marshal_value_peek_enum(v) g_value_get_enum (v) #define g_marshal_value_peek_flags(v) g_value_get_flags (v) #define g_marshal_value_peek_float(v) g_value_get_float (v) #define g_marshal_value_peek_double(v) g_value_get_double (v) #define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) #define g_marshal_value_peek_param(v) g_value_get_param (v) #define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) #define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) #define g_marshal_value_peek_object(v) g_value_get_object (v) #else /* !G_ENABLE_DEBUG */ /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. * Do not access GValues directly in your code. Instead, use the * g_value_get_*() functions */ #define g_marshal_value_peek_boolean(v) (v)->data[0].v_int #define g_marshal_value_peek_char(v) (v)->data[0].v_int #define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint #define g_marshal_value_peek_int(v) (v)->data[0].v_int #define g_marshal_value_peek_uint(v) (v)->data[0].v_uint #define g_marshal_value_peek_long(v) (v)->data[0].v_long #define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong #define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 #define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 #define g_marshal_value_peek_enum(v) (v)->data[0].v_long #define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong #define g_marshal_value_peek_float(v) (v)->data[0].v_float #define g_marshal_value_peek_double(v) (v)->data[0].v_double #define g_marshal_value_peek_string(v) (v)->data[0].v_pointer #define g_marshal_value_peek_param(v) (v)->data[0].v_pointer #define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer #define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer #define g_marshal_value_peek_object(v) (v)->data[0].v_pointer #endif /* !G_ENABLE_DEBUG */ /* ENUM:FLAGS (marshals.list:25) */ void ipatch_marshal_ENUM__FLAGS (GClosure *closure, GValue *return_value G_GNUC_UNUSED, guint n_param_values, const GValue *param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data) { typedef gint (*GMarshalFunc_ENUM__FLAGS) (gpointer data1, guint arg_1, gpointer data2); register GMarshalFunc_ENUM__FLAGS callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; gint v_return; g_return_if_fail (return_value != NULL); g_return_if_fail (n_param_values == 2); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = g_value_peek_pointer (param_values + 0); } else { data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } callback = (GMarshalFunc_ENUM__FLAGS) (marshal_data ? marshal_data : cc->callback); v_return = callback (data1, g_marshal_value_peek_flags (param_values + 1), data2); g_value_set_enum (return_value, v_return); } libinstpatch-1.0.0/libinstpatch/IpatchBase.c0000644000175000017500000002620411461352216015755 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. * */ #include #include #include #include "IpatchBase.h" #include "IpatchParamProp.h" #include "ipatch_priv.h" enum { PROP_0, PROP_CHANGED, PROP_SAVED, PROP_FILENAME, PROP_FILE }; static void ipatch_base_finalize (GObject *gobject); static void ipatch_base_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_base_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_base_real_set_file (IpatchBase *base, IpatchFile *file); static void ipatch_base_real_set_file_name (IpatchBase *base, const char *file_name); /* private var used by IpatchItem, for fast "changed" property notifies */ GParamSpec *ipatch_base_pspec_changed; /* cached parameter specs to speed up prop notifies */ static GParamSpec *file_pspec; static GParamSpec *file_name_pspec; G_DEFINE_ABSTRACT_TYPE (IpatchBase, ipatch_base, IPATCH_TYPE_CONTAINER); static void ipatch_base_class_init (IpatchBaseClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); item_class->item_set_property = ipatch_base_set_property; obj_class->get_property = ipatch_base_get_property; obj_class->finalize = ipatch_base_finalize; ipatch_base_pspec_changed = g_param_spec_boolean ("changed", "Changed", "Changed Flag", TRUE, G_PARAM_READWRITE | IPATCH_PARAM_NO_SAVE_CHANGE | IPATCH_PARAM_NO_SAVE); g_object_class_install_property (obj_class, PROP_CHANGED, ipatch_base_pspec_changed); g_object_class_install_property (obj_class, PROP_SAVED, g_param_spec_boolean ("saved", "Saved", "Been Saved Flag", FALSE, G_PARAM_READWRITE | IPATCH_PARAM_NO_SAVE_CHANGE | IPATCH_PARAM_NO_SAVE)); file_name_pspec = g_param_spec_string ("file-name", "File Name", "File Name", "untitled", G_PARAM_READWRITE | IPATCH_PARAM_NO_SAVE_CHANGE); g_object_class_install_property (obj_class, PROP_FILENAME, file_name_pspec); file_pspec = g_param_spec_object ("file", "File", "File Object", IPATCH_TYPE_FILE, G_PARAM_READWRITE | IPATCH_PARAM_NO_SAVE | IPATCH_PARAM_HIDE | IPATCH_PARAM_NO_SAVE_CHANGE); g_object_class_install_property (obj_class, PROP_FILE, file_pspec); } static void ipatch_base_init (IpatchBase *base) { } /* function called when a patch is being destroyed */ static void ipatch_base_finalize (GObject *gobject) { IpatchBase *base = IPATCH_BASE (gobject); IPATCH_ITEM_WLOCK (base); if (base->file) g_object_unref (base->file); base->file = NULL; IPATCH_ITEM_WUNLOCK (base); if (G_OBJECT_CLASS (ipatch_base_parent_class)->finalize) G_OBJECT_CLASS (ipatch_base_parent_class)->finalize (gobject); } static void ipatch_base_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchBase *base = IPATCH_BASE (object); switch (property_id) { case PROP_CHANGED: if (g_value_get_boolean (value)) ipatch_item_set_flags (IPATCH_ITEM (base), IPATCH_BASE_CHANGED); else ipatch_item_clear_flags (IPATCH_ITEM (base), IPATCH_BASE_CHANGED); break; case PROP_SAVED: if (g_value_get_boolean (value)) ipatch_item_set_flags (IPATCH_ITEM (base), IPATCH_BASE_SAVED); else ipatch_item_clear_flags (IPATCH_ITEM (base), IPATCH_BASE_SAVED); break; case PROP_FILENAME: ipatch_base_real_set_file_name (base, g_value_get_string (value)); break; case PROP_FILE: ipatch_base_real_set_file (base, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_base_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchBase *base; g_return_if_fail (IPATCH_IS_BASE (object)); base = IPATCH_BASE (object); switch (property_id) { case PROP_CHANGED: g_value_set_boolean (value, ipatch_item_get_flags (IPATCH_ITEM (base)) & IPATCH_BASE_CHANGED); break; case PROP_SAVED: g_value_set_boolean (value, ipatch_item_get_flags (IPATCH_ITEM (base)) & IPATCH_BASE_SAVED); break; case PROP_FILENAME: g_value_take_string (value, ipatch_base_get_file_name (base)); break; case PROP_FILE: g_value_take_object (value, ipatch_base_get_file (base)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } /** * ipatch_base_set_file: * @base: Patch base object to set file object of * @file: File object * * Sets the file object associated with a patch. */ void ipatch_base_set_file (IpatchBase *base, IpatchFile *file) { GValue value = { 0 }, oldval = { 0 }; g_return_if_fail (IPATCH_IS_BASE (base)); g_return_if_fail (IPATCH_IS_FILE (file)); g_value_init (&value, IPATCH_TYPE_FILE); g_value_set_object (&value, file); ipatch_item_get_property_fast ((IpatchItem *)base, file_pspec, &oldval); ipatch_base_real_set_file (base, file); ipatch_item_prop_notify ((IpatchItem *)base, file_pspec, &value, &oldval); g_value_unset (&value); g_value_unset (&oldval); } static void ipatch_base_real_set_file (IpatchBase *base, IpatchFile *file) { IPATCH_ITEM_WLOCK (base); g_object_ref (file); if (base->file) g_object_unref (base->file); base->file = file; IPATCH_ITEM_WUNLOCK (base); } /** * ipatch_base_get_file: * @base: Patch base object to get file object from * * Get the file object associated with a patch base object. Caller owns a * reference to the returned file object and it should be unrefed when * done with it. * * Returns: File object or %NULL if not set. Remember to unref it when done * with it. */ IpatchFile * ipatch_base_get_file (IpatchBase *base) { IpatchFile *file; g_return_val_if_fail (IPATCH_IS_BASE (base), NULL); IPATCH_ITEM_RLOCK (base); file = base->file; if (file) g_object_ref (file); IPATCH_ITEM_RLOCK (base); return (file); } /** * ipatch_base_set_file_name: * @base: Patch base object to set file name of * @file_name: Path and name to set filename to * * Sets the file name of the file object in a patch base object. File object * should have been set before calling this function (otherwise request is * silently ignored). A convenience function as one could get the file object * and set it directly. */ void ipatch_base_set_file_name (IpatchBase *base, const char *file_name) { GValue value = { 0 }, oldval = { 0 }; g_return_if_fail (IPATCH_IS_BASE (base)); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, file_name); ipatch_item_get_property_fast ((IpatchItem *)base, file_name_pspec, &oldval); ipatch_base_real_set_file_name (base, file_name); ipatch_item_prop_notify ((IpatchItem *)base, file_name_pspec, &value, &oldval); g_value_unset (&value); g_value_unset (&oldval); } /* the real set file name routine, user routine does a notify */ static void ipatch_base_real_set_file_name (IpatchBase *base, const char *file_name) { IPATCH_ITEM_RLOCK (base); if (!base->file) /* silently fail */ { IPATCH_ITEM_RUNLOCK (base); return; } ipatch_file_set_name (base->file, file_name); IPATCH_ITEM_WUNLOCK (base); } /** * ipatch_base_get_file_name: * @base: Base patch item to get file name from. * * Get the file name of the file object in a base patch item. A convenience * function. * * Returns: New allocated file name or %NULL if not set or file object * not set. String should be freed when finished with it. */ char * ipatch_base_get_file_name (IpatchBase *base) { char *file_name = NULL; g_return_val_if_fail (IPATCH_IS_BASE (base), NULL); IPATCH_ITEM_RLOCK (base); if (base->file) file_name = ipatch_file_get_name (base->file); IPATCH_ITEM_RUNLOCK (base); return (file_name); } /** * ipatch_base_find_unused_midi_locale: * @base: Patch base object * @bank: MIDI bank number (input and output parameter) * @program: MIDI program number (input and output parameter) * @exclude: Child of @base with MIDI locale to exclude or %NULL * @percussion: Set to %TRUE to find a free percussion MIDI locale * * Finds an unused MIDI locale (bank:program number pair) in a patch * base object. The way in which MIDI bank and program numbers are * used is implementation dependent. Percussion instruments often * affect the bank parameter (for example SoundFont uses bank 128 for * percussion presets). On input the @bank and @program parameters * set the initial locale to start from (set to 0:0 to find the first * free value). If the @percussion parameter is set it may affect * @bank, if its not set, bank will not be modified (e.g., if bank is * a percussion value it will be used). The exclude parameter can be * set to a child item of @base to exclude from the list of "used" * locales (useful when making an item unique that is already parented * to @base). On return @bank and @program will be set to an unused * MIDI locale based on the input criteria. */ void ipatch_base_find_unused_midi_locale (IpatchBase *base, int *bank, int *program, const IpatchItem *exclude, gboolean percussion) { IpatchBaseClass *klass; g_return_if_fail (IPATCH_IS_BASE (base)); g_return_if_fail (bank != NULL); g_return_if_fail (program != NULL); *bank = 0; *program = 0; klass = IPATCH_BASE_GET_CLASS (base); if (klass && klass->find_unused_locale) klass->find_unused_locale (base, bank, program, exclude, percussion); } /** * ipatch_base_find_item_by_midi_locale: * @base: Patch base object * @bank: MIDI bank number of item to search for * @program: MIDI program number of item to search for * * Find a child object in a base patch object which matches the given MIDI * locale (@bank and @program numbers). * * Returns: The item or %NULL if not found. The caller owns a reference to the * returned object, and is responsible for unref'ing when finished. */ IpatchItem * ipatch_base_find_item_by_midi_locale (IpatchBase *base, int bank, int program) { IpatchBaseClass *klass; g_return_val_if_fail (IPATCH_IS_BASE (base), NULL); klass = IPATCH_BASE_GET_CLASS (base); if (klass && klass->find_item_by_locale) return (klass->find_item_by_locale (base, bank, program)); else return (NULL); } libinstpatch-1.0.0/libinstpatch/IpatchSF2Zone.h0000644000175000017500000000757511461332142016344 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2Zone * @short_description: Abstract base class for SoundFont zones * @see_also: * @stability: Stable * * Zones are children of #IpatchSF2Preset and #IpatchSF2Inst and define * synthesis parameters and a linked item (#IpatchSF2Inst in the case of * #IpatchSF2PZone and #IpatchSF2Sample in the case of #IpatchSF2IZone). */ #ifndef __IPATCH_SF2_ZONE_H__ #define __IPATCH_SF2_ZONE_H__ #include #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchSF2Zone IpatchSF2Zone; typedef struct _IpatchSF2ZoneClass IpatchSF2ZoneClass; #define IPATCH_TYPE_SF2_ZONE (ipatch_sf2_zone_get_type ()) #define IPATCH_SF2_ZONE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_ZONE, \ IpatchSF2Zone)) #define IPATCH_SF2_ZONE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_ZONE, \ IpatchSF2ZoneClass)) #define IPATCH_IS_SF2_ZONE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_ZONE)) #define IPATCH_IS_SF2_ZONE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2_ZONE)) #define IPATCH_SF2_ZONE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SF2_ZONE, \ IpatchSF2ZoneClass)) /* SoundFont zone item */ struct _IpatchSF2Zone { IpatchItem parent_instance; /*< private >*/ IpatchItem *item; /* referenced item */ GSList *mods; /* modulators */ IpatchSF2GenArray genarray; /* generator array */ }; struct _IpatchSF2ZoneClass { IpatchItemClass parent_class; }; /* reserve 2 flags */ #define IPATCH_SF2_ZONE_UNUSED_FLAG_SHIFT (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 2) /* a macro for getting or setting a generator value directly, normally ipatch_sf2_zone_(get/set)_gen should be used instead, zone is not locked and no flags are set (should only be used on zones with exclusive access) */ #define IPATCH_SF2_ZONE_GEN_AMT(zone, genid) \ ((IpatchSF2Zone *)zone)->genarray.values[genid] /* macros for manipulating zone generator set flags directly, should not normally be used except in the case of exclusive access, not locked, etc */ #define IPATCH_SF2_ZONE_GEN_TEST_FLAG(zone, genid) \ IPATCH_SF2_GEN_ARRAY_TEST_FLAG (&((IpatchSF2Zone *)(zone))->genarray, genid) #define IPATCH_SF2_ZONE_GEN_SET_FLAG(zone, genid) \ IPATCH_SF2_GEN_ARRAY_SET_FLAG (&((IpatchSF2Zone *)(zone))->genarray, genid) #define IPATCH_SF2_ZONE_GEN_CLEAR_FLAG(zone, genid) \ IPATCH_SF2_GEN_ARRAY_CLEAR_FLAG (&((IpatchSF2Zone *)(zone))->genarray, genid) GType ipatch_sf2_zone_get_type (void); IpatchSF2Zone *ipatch_sf2_zone_first (IpatchIter *iter); IpatchSF2Zone *ipatch_sf2_zone_next (IpatchIter *iter); void ipatch_sf2_zone_set_link_item (IpatchSF2Zone *zone, IpatchItem *item); gboolean ipatch_sf2_zone_set_link_item_no_notify (IpatchSF2Zone *zone, IpatchItem *item, IpatchItem **olditem); IpatchItem *ipatch_sf2_zone_get_link_item (IpatchSF2Zone *zone); IpatchItem *ipatch_sf2_zone_peek_link_item (IpatchSF2Zone *zone); #endif libinstpatch-1.0.0/libinstpatch/IpatchConverterSF2VoiceCache.h0000644000175000017500000000472411461332142021303 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchConverterSF2VoiceCache * @short_description: Base object type used for #IpatchSF2Voice cache converters * @see_also: * @stability: Stable * * Defines a base type which other #IpatchSF2Voice converter types are derived * from. Defines some properties like "solo-item" for solo-ing a sub * component of an instrument. */ #ifndef __IPATCH_CONVERTER_SF2_VOICE_CACHE_H__ #define __IPATCH_CONVERTER_SF2_VOICE_CACHE_H__ typedef struct _IpatchConverterSF2VoiceCache IpatchConverterSF2VoiceCache; typedef struct _IpatchConverterSF2VoiceCacheClass IpatchConverterSF2VoiceCacheClass; #include #include #include #include #define IPATCH_TYPE_CONVERTER_SF2_VOICE_CACHE \ (ipatch_converter_sf2_voice_cache_get_type ()) #define IPATCH_CONVERTER_SF2_VOICE_CACHE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_CONVERTER_SF2_VOICE_CACHE, \ IpatchConverterSF2VoiceCache)) #define IPATCH_CONVERTER_SF2_VOICE_CACHE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_CONVERTER_SF2_VOICE_CACHE, \ IpatchSF2VoiceCacheClass)) #define IPATCH_IS_CONVERTER_SF2_VOICE_CACHE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_CONVERTER_SF2_VOICE_CACHE)) #define IPATCH_IS_CONVERTER_SF2_VOICE_CACHE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_CONVERTER_SF2_VOICE_CACHE)) struct _IpatchConverterSF2VoiceCache { IpatchConverter parent_instance; IpatchItem *solo_item; }; struct _IpatchConverterSF2VoiceCacheClass { IpatchConverterClass parent_class; }; GType ipatch_converter_sf2_voice_cache_get_type (void); #endif libinstpatch-1.0.0/libinstpatch/util.c0000644000175000017500000001167211461332142014726 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "util.h" #include "misc.h" #include "i18n.h" /* Convenience boolean GValue constants */ GValue *ipatch_util_value_bool_true; GValue *ipatch_util_value_bool_false; void _ipatch_util_init (void) { ipatch_util_value_bool_true = g_new0 (GValue, 1); ipatch_util_value_bool_false = g_new0 (GValue, 1); g_value_init (ipatch_util_value_bool_true, G_TYPE_BOOLEAN); g_value_init (ipatch_util_value_bool_false, G_TYPE_BOOLEAN); g_value_set_boolean (ipatch_util_value_bool_true, TRUE); g_value_set_boolean (ipatch_util_value_bool_false, FALSE); } /** * ipatch_util_value_hash: * @val: GValue to hash * * Hash a GValue. The hash value can then be used in a GHashTable for example. * * Returns: Hash value corresponding to the @val key. */ guint ipatch_util_value_hash (GValue *val) { GValueArray *valarray; GType valtype; const char *sval; /* so we can access a float value as its raw data without gcc bitching */ union { gfloat f; guint32 i; } fval; g_return_val_if_fail (G_IS_VALUE (val), 0); valtype = G_VALUE_TYPE (val); switch (G_TYPE_FUNDAMENTAL (valtype)) { case G_TYPE_CHAR: return (g_value_get_char (val)); case G_TYPE_UCHAR: return (g_value_get_uchar (val)); case G_TYPE_BOOLEAN: return (g_value_get_boolean (val)); case G_TYPE_INT: return (g_value_get_int (val)); case G_TYPE_UINT: return (g_value_get_uint (val)); case G_TYPE_LONG: return (g_value_get_long (val)); case G_TYPE_ULONG: return (g_value_get_ulong (val)); case G_TYPE_INT64: return (g_value_get_int64 (val)); case G_TYPE_UINT64: return (g_value_get_uint64 (val)); case G_TYPE_ENUM: return (g_value_get_enum (val)); case G_TYPE_FLAGS: return (g_value_get_flags (val)); case G_TYPE_FLOAT: fval.f = g_value_get_float (val); return (fval.i); /* use the raw float data as hash */ case G_TYPE_DOUBLE: fval.f = g_value_get_double (val); /* convert double to float */ return (fval.i); /* use the raw float data as hash */ case G_TYPE_STRING: sval = g_value_get_string (val); return (sval ? g_str_hash (sval) : 0); case G_TYPE_POINTER: return (GPOINTER_TO_UINT (g_value_get_pointer (val))); case G_TYPE_BOXED: if (valtype == G_TYPE_VALUE_ARRAY) /* value array? */ { valarray = g_value_get_boxed (val); return (ipatch_util_value_array_hash (valarray)); } else return (GPOINTER_TO_UINT (g_value_get_boxed (val))); case G_TYPE_PARAM: return (GPOINTER_TO_UINT (g_value_get_param (val))); case G_TYPE_OBJECT: return (GPOINTER_TO_UINT (g_value_get_object (val))); default: g_assert_not_reached (); return (0); /* to keep compiler happy */ } } /** * ipatch_util_value_array_hash: * @valarray: GValueArray to hash * * Hash a GValueArray. The hash value can then be used in a GHashTable for * example. * * Returns: Hash value corresponding to the sum of all values returned * by ipatch_util_value_hash() for each GValue in the array. */ guint ipatch_util_value_array_hash (GValueArray *valarray) { GValue *value; guint hashval = 0; int i; if (!valarray) return (0); for (i = 0; i < valarray->n_values; i++) { value = g_value_array_get_nth (valarray, i); hashval += ipatch_util_value_hash (value); } return (hashval); } /** * ipatch_util_file_size: * @fname: Path of file to get size of. * @err: Location to store error or NULL * * Get the size of a file (tired of using stat every time?). * * Returns: File size. Will return 0 on error, but @err must be checked if * it is set to determine if an error really occurred. */ guint64 ipatch_util_file_size (const char *fname, GError **err) { struct stat st; g_return_val_if_fail (fname != NULL, 0); g_return_val_if_fail (!err || !*err, 0); if (g_stat (fname, &st) != 0) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("Error stating file '%s': %s"), fname, g_strerror (errno)); return (0); } return (st.st_size); } libinstpatch-1.0.0/libinstpatch/version.h0000644000175000017500000000222011461360600015430 00000000000000/* * version.h - libInstPatch version information * * libInstPatch * Copyright (C) 1999-2002 Josh Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * 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., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA or point your web browser to http://www.gnu.org. */ #ifndef __IPATCH_VERSION_H__ #define __IPATCH_VERSION_H__ #define IPATCH_VERSION "1.0.0" #define IPATCH_VERSION_MAJOR 1 #define IPATCH_VERSION_MINOR 0 #define IPATCH_VERSION_MICRO 0 void ipatch_version (guint *major, guint *minor, guint *micro); #endif /* __IPATCH_VERSION_H__ */ libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreCache.c0000644000175000017500000002405511461332142020263 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSampleStoreCache.h" #include "ipatch_priv.h" #include "i18n.h" /* properties */ enum { PROP_0, PROP_LOCATION }; /* Defined in IpatchSampleData.c */ extern void _ipatch_sample_data_cache_add_unused_size (int size); static void ipatch_sample_store_cache_sample_iface_init (IpatchSampleIface *iface); static void ipatch_sample_store_cache_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sample_store_cache_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sample_store_cache_finalize (GObject *object); static gboolean ipatch_sample_store_cache_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_sample_store_cache_sample_iface_close (IpatchSampleHandle *handle); static gboolean ipatch_sample_store_cache_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err); static gboolean ipatch_sample_store_cache_sample_iface_write (IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err); G_DEFINE_TYPE_WITH_CODE (IpatchSampleStoreCache, ipatch_sample_store_cache, IPATCH_TYPE_SAMPLE_STORE, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sample_store_cache_sample_iface_init)) static void ipatch_sample_store_cache_sample_iface_init (IpatchSampleIface *iface) { iface->open = ipatch_sample_store_cache_sample_iface_open; iface->close = ipatch_sample_store_cache_sample_iface_close; iface->read = ipatch_sample_store_cache_sample_iface_read; iface->write = ipatch_sample_store_cache_sample_iface_write; } static void ipatch_sample_store_cache_class_init (IpatchSampleStoreCacheClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->finalize = ipatch_sample_store_cache_finalize; obj_class->get_property = ipatch_sample_store_cache_get_property; item_class->item_set_property = ipatch_sample_store_cache_set_property; g_object_class_install_property (obj_class, PROP_LOCATION, g_param_spec_pointer ("location", "Location", "Sample data pointer", G_PARAM_READWRITE)); } static void ipatch_sample_store_cache_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSampleStoreCache *store = IPATCH_SAMPLE_STORE_CACHE (object); switch (property_id) { case PROP_LOCATION: g_return_if_fail (store->location == NULL); /* Lock not needed, should be set only once before use */ store->location = g_value_get_pointer (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_cache_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSampleStoreCache *store = IPATCH_SAMPLE_STORE_CACHE (object); switch (property_id) { case PROP_LOCATION: /* Lock not needed, should be set only once before use */ g_value_set_pointer (value, store->location); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_cache_init (IpatchSampleStoreCache *store) { GTimeVal timeval; /* Initialize last open to current time */ g_get_current_time (&timeval); store->last_open = timeval.tv_sec; } static void ipatch_sample_store_cache_finalize (GObject *object) { IpatchSampleStoreCache *store = IPATCH_SAMPLE_STORE_CACHE (object); g_free (store->location); store->location = NULL; if (G_OBJECT_CLASS (ipatch_sample_store_cache_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sample_store_cache_parent_class)->finalize (object); } static gboolean ipatch_sample_store_cache_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchSampleStoreCache *store = IPATCH_SAMPLE_STORE_CACHE (handle->sample); guint bytes; g_return_val_if_fail (!handle->read_mode || store->location, FALSE); IPATCH_ITEM_WLOCK (store); store->last_open = 0; /* Reset time to 0 to indicate store is open */ if (store->open_count == 0) /* Recursive lock: store, sample_cache_vars */ _ipatch_sample_data_cache_add_unused_size (-(int)ipatch_sample_store_get_size_bytes ((IpatchSampleStore *)store)); g_atomic_int_inc (&store->open_count); IPATCH_ITEM_WUNLOCK (store); /* Locking not needed, since new samples will be written with audio before * being used by multiple threads */ if (!store->location) { bytes = ipatch_sample_store_get_size_bytes ((IpatchSampleStore *)store); store->location = g_malloc0 (bytes); } /* Store frame size to data1 */ handle->data1 = GUINT_TO_POINTER (ipatch_sample_format_size (ipatch_sample_store_get_format (store))); return (TRUE); } static void ipatch_sample_store_cache_sample_iface_close (IpatchSampleHandle *handle) { IpatchSampleStoreCache *store = IPATCH_SAMPLE_STORE_CACHE (handle->sample); GTimeVal timeval; IPATCH_ITEM_WLOCK (store); /* Set last open time if there are no more open handles */ if (g_atomic_int_dec_and_test (&store->open_count)) { g_get_current_time (&timeval); store->last_open = timeval.tv_sec; /* Recursive lock: store, sample_cache_vars */ _ipatch_sample_data_cache_add_unused_size (ipatch_sample_store_get_size_bytes ((IpatchSampleStore *)store)); } IPATCH_ITEM_WUNLOCK (store); } static gboolean ipatch_sample_store_cache_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err) { IpatchSampleStoreCache *store = (IpatchSampleStoreCache *)(handle->sample); guint8 frame_size = GPOINTER_TO_UINT (handle->data1); /* No need to lock, sample data should not change after initial load */ memcpy (buf, &((gint8 *)(store->location))[offset * frame_size], frames * frame_size); return (TRUE); } static gboolean ipatch_sample_store_cache_sample_iface_write (IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err) { IpatchSampleStoreCache *store = (IpatchSampleStoreCache *)(handle->sample); guint8 frame_size = GPOINTER_TO_UINT (handle->data1); /* No need to lock, sample data written only once and before used by multiple threads */ memcpy (&((gint8 *)(store->location))[offset * frame_size], buf, frames * frame_size); return (TRUE); } /** * ipatch_sample_store_cache_new: * @location: Location of existing sample data or %NULL if the sample buffer * should be allocated (in which case the sample must be written to first). * * Creates a new cached RAM sample store. If @location is provided, its allocation * is taken over by the store. * * NOTE: This store type should not be used outside of the #IpatchSampleData * implementation, as it is tightly coupled with it. * * Returns: New cached RAM sample store, cast as a #IpatchSample for convenience. */ IpatchSample * ipatch_sample_store_cache_new (gpointer location) { return (IPATCH_SAMPLE (g_object_new (IPATCH_TYPE_SAMPLE_STORE_CACHE, "location", location, NULL))); } /** * ipatch_sample_store_cache_open: * @store: Sample cache store * * A dummy open function which can be used if the location pointer will be * accessed directly, rather than opening a #IpatchSampleHandle. Keeping a * cached sample store open will ensure it isn't destroyed. Call * ipatch_sample_store_cache_close() when done with it. */ void ipatch_sample_store_cache_open (IpatchSampleStoreCache *store) { g_return_if_fail (IPATCH_IS_SAMPLE_STORE_CACHE (store)); IPATCH_ITEM_WLOCK (store); store->last_open = 0; /* Reset time to 0 to indicate store is open */ if (store->open_count == 0) /* Recursive lock: store, sample_cache_vars */ _ipatch_sample_data_cache_add_unused_size (-(int)ipatch_sample_store_get_size_bytes ((IpatchSampleStore *)store)); g_atomic_int_inc (&store->open_count); IPATCH_ITEM_WUNLOCK (store); } /** * ipatch_sample_store_cache_close: * @store: Sample cache store * * A dummy close function which is called after a sample store cache is no * longer needed after opening it with ipatch_sample_store_cache_open(). */ void ipatch_sample_store_cache_close (IpatchSampleStoreCache *store) { GTimeVal timeval; g_return_if_fail (IPATCH_IS_SAMPLE_STORE_CACHE (store)); IPATCH_ITEM_WLOCK (store); /* Set last open time if there are no more open handles */ if (g_atomic_int_dec_and_test (&store->open_count)) { g_get_current_time (&timeval); store->last_open = timeval.tv_sec; /* Recursive lock: store, sample_cache_vars */ _ipatch_sample_data_cache_add_unused_size (ipatch_sample_store_get_size_bytes ((IpatchSampleStore *)store)); } IPATCH_ITEM_WUNLOCK (store); } libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreVirtual.c0000644000175000017500000003047311461332142020707 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchSampleStoreVirtual.h" #include "ipatch_priv.h" #include "i18n.h" /* properties */ enum { PROP_0, PROP_SAMPLE_LISTS }; static void ipatch_sample_store_virtual_sample_iface_init (IpatchSampleIface *iface); static void ipatch_sample_store_virtual_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sample_store_virtual_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sample_store_virtual_finalize (GObject *object); static gboolean ipatch_sample_store_virtual_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_sample_store_virtual_sample_iface_close (IpatchSampleHandle *handle); static gboolean ipatch_sample_store_virtual_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err); G_DEFINE_TYPE_WITH_CODE (IpatchSampleStoreVirtual, ipatch_sample_store_virtual, IPATCH_TYPE_SAMPLE_STORE, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sample_store_virtual_sample_iface_init)) static void ipatch_sample_store_virtual_sample_iface_init (IpatchSampleIface *iface) { iface->open = ipatch_sample_store_virtual_sample_iface_open; iface->close = ipatch_sample_store_virtual_sample_iface_close; iface->read = ipatch_sample_store_virtual_sample_iface_read; } static void ipatch_sample_store_virtual_class_init (IpatchSampleStoreVirtualClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->finalize = ipatch_sample_store_virtual_finalize; obj_class->get_property = ipatch_sample_store_virtual_get_property; item_class->item_set_property = ipatch_sample_store_virtual_set_property; g_object_class_install_property (obj_class, PROP_SAMPLE_LISTS, g_param_spec_value_array ("sample-lists", "Sample lists", "Sample lists", g_param_spec_boxed ("value", "value", "value", IPATCH_TYPE_SAMPLE_LIST, G_PARAM_READWRITE), G_PARAM_READWRITE)); } static void ipatch_sample_store_virtual_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSampleStoreVirtual *store = IPATCH_SAMPLE_STORE_VIRTUAL (object); IpatchSampleList *list; GValueArray *array; int chan; switch (property_id) { case PROP_SAMPLE_LISTS: array = g_value_get_boxed (value); for (chan = 0; chan < 2; chan++) { if (array && chan < array->n_values) list = g_value_dup_boxed (g_value_array_get_nth (array, chan)); else list = NULL; ipatch_sample_store_virtual_set_list (store, chan, list); } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_sample_store_virtual_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSampleStoreVirtual *store = IPATCH_SAMPLE_STORE_VIRTUAL (object); GValueArray *array; GValue local_value = { 0 }; int chan; switch (property_id) { case PROP_SAMPLE_LISTS: array = g_value_array_new (0); /* ++ alloc new value array */ for (chan = 0; chan < 2 && store->lists[chan]; chan++) { g_value_init (&local_value, IPATCH_TYPE_SAMPLE_LIST); g_value_set_boxed (&local_value, store->lists[chan]); g_value_array_append (array, &local_value); g_value_unset (&local_value); } g_value_take_boxed (value, array); /* !takes over ownership of array */ break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_sample_store_virtual_init (IpatchSampleStoreVirtual *store) { } static void ipatch_sample_store_virtual_finalize (GObject *object) { IpatchSampleStoreVirtual *vstore = IPATCH_SAMPLE_STORE_VIRTUAL (object); if (vstore->lists[0]) ipatch_sample_list_free (vstore->lists[0]); if (vstore->lists[1]) ipatch_sample_list_free (vstore->lists[1]); if (G_OBJECT_CLASS (ipatch_sample_store_virtual_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sample_store_virtual_parent_class)->finalize (object); } static gboolean ipatch_sample_store_virtual_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchSampleStoreVirtual *store = IPATCH_SAMPLE_STORE_VIRTUAL (handle->sample); int format, channels; g_return_val_if_fail (store->lists[0] != NULL, FALSE); format = ipatch_sample_store_get_format (store); channels = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format); g_return_val_if_fail (channels >= 1 && channels <= 2, FALSE); handle->data1 = GINT_TO_POINTER (format); if (channels == 2) { g_return_val_if_fail (store->lists[1] != NULL, FALSE); handle->data2 = g_malloc (IPATCH_SAMPLE_TRANS_BUFFER_SIZE); /* Allocate stereo interleave buffer */ handle->data3 = GUINT_TO_POINTER (ipatch_sample_format_width (format)); /* Format width in bytes */ } return (TRUE); } static void ipatch_sample_store_virtual_sample_iface_close (IpatchSampleHandle *handle) { g_free (handle->data2); /* Free stereo interleave buffer */ } static gboolean ipatch_sample_store_virtual_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err) { IpatchSampleStoreVirtual *store = IPATCH_SAMPLE_STORE_VIRTUAL (handle->sample); int format = GPOINTER_TO_INT (handle->data1); gpointer interbuf = handle->data2; /* Stereo interleave buffer */ int bytewidth = GPOINTER_TO_INT (handle->data3); guint8 *bbuf, *bleft, *bright; guint16 *wbuf, *wleft, *wright; guint32 *dbuf, *dleft, *dright; guint64 *qbuf, *qleft, *qright; int mi, si; int block; if (!interbuf) /* Store is mono? - Just render it */ { if (!ipatch_sample_list_render (store->lists[0], buf, offset, frames, format, err)) return (FALSE); return (TRUE); } /* Stereo virtual store */ /* Max samples that can be interleaved at a time */ block = IPATCH_SAMPLE_TRANS_BUFFER_SIZE / bytewidth / 2; while (frames > 0) { if (block > frames) block = frames; if (!ipatch_sample_list_render (store->lists[0], interbuf, offset, block, format, err)) return (FALSE); if (!ipatch_sample_list_render (store->lists[1], interbuf + IPATCH_SAMPLE_TRANS_BUFFER_SIZE / 2, offset, block, format, err)) return (FALSE); /* choose interleaving based on sample width */ if (bytewidth == 1) { bbuf = (guint8 *)buf; bleft = (guint8 *)interbuf; bright = (guint8 *)(interbuf + IPATCH_SAMPLE_TRANS_BUFFER_SIZE / 2); for (mi = 0, si = 0; mi < block; mi++, si += 2) { bbuf[si] = bleft[mi]; bbuf[si+1] = bright[mi]; } buf = bbuf; } else if (bytewidth == 2) { wbuf = (guint16 *)buf; wleft = (guint16 *)interbuf; wright = (guint16 *)(interbuf + IPATCH_SAMPLE_TRANS_BUFFER_SIZE / 2); for (mi = 0, si = 0; mi < block; mi++, si += 2) { wbuf[si] = wleft[mi]; wbuf[si+1] = wright[mi]; } buf = wbuf; } else if (bytewidth == 3) /* Real 24 bit - Copy as 16 bit word and 1 byte */ { bbuf = (guint8 *)buf; bleft = (guint8 *)interbuf; bright = (guint8 *)(interbuf + IPATCH_SAMPLE_TRANS_BUFFER_SIZE / 2); for (mi = 0, si = 0; mi < block; mi += 3, si += 6) { *(guint16 *)(bbuf + si) = *(guint16 *)(bleft + mi); bbuf[si+2] = bleft[mi+2]; *(guint16 *)(bbuf + si + 3) = *(guint16 *)(bright + mi); bbuf[si+5] = bright[mi+2]; } buf = bbuf; } else if (bytewidth == 4) { dbuf = (guint32 *)buf; dleft = (guint32 *)interbuf; dright = (guint32 *)(interbuf + IPATCH_SAMPLE_TRANS_BUFFER_SIZE / 2); for (mi = 0, si = 0; mi < block; mi++, si += 2) { dbuf[si] = dleft[mi]; dbuf[si+1] = dright[mi]; } buf = dbuf; } else if (bytewidth == 8) { qbuf = (guint64 *)buf; qleft = (guint64 *)interbuf; qright = (guint64 *)(interbuf + IPATCH_SAMPLE_TRANS_BUFFER_SIZE / 2); for (mi = 0, si = 0; mi < block; mi++, si += 2) { qbuf[si] = qleft[mi]; qbuf[si+1] = qright[mi]; } buf = qbuf; } else g_return_val_if_fail (NOT_REACHED, FALSE); frames -= block; offset += block; } return (TRUE); } /** * ipatch_sample_store_virtual_new: * * Creates a new virtual sample store. * * Returns: New virtual sample store, cast as a #IpatchSample for convenience. */ IpatchSample * ipatch_sample_store_virtual_new (void) { return (IPATCH_SAMPLE (g_object_new (IPATCH_TYPE_SAMPLE_STORE_VIRTUAL, NULL))); } /** * ipatch_sample_store_virtual_get_list: * @store: Virtual store to get sample list from * @chan: Which channel to get sample list from (0 = mono or left stereo channel, * 1 = right stereo channel). * * Gets a sample list from a virtual sample store. * * Returns: The sample list for the corresponding channel or %NULL if not * assigned. The list is internal and should not be modified or freed and * should be used only as long as @store. */ IpatchSampleList * ipatch_sample_store_virtual_get_list (IpatchSampleStoreVirtual *store, guint chan) { guint chancount; int format; g_return_val_if_fail (IPATCH_IS_SAMPLE_STORE_VIRTUAL (store), NULL); format = ipatch_sample_store_get_format (store); chancount = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format); g_return_val_if_fail (chancount <= 2, NULL); g_return_val_if_fail (chan < chancount, NULL); /* no locking required - lists shouldn't be changed after store is active */ return (store->lists[chan]); } /** * ipatch_sample_store_virtual_set_list: * @store: Virtual store to set sample list of * @chan: Which channel to set sample list of (0 = mono or left stereo channel, * 1 = right stereo channel). * @list: List to assign to virtual store. The allocation is taken over by * the virtual store (if caller would like to continue using it beyond the * life of @store or modify it, it should be duplicated). * * Sets a sample list of a virtual sample store. Can only be assigned before * the sample store is active. The size of @store is set to that of @list. */ void ipatch_sample_store_virtual_set_list (IpatchSampleStoreVirtual *store, guint chan, IpatchSampleList *list) { guint chancount; int format; g_return_if_fail (IPATCH_IS_SAMPLE_STORE_VIRTUAL (store)); format = ipatch_sample_store_get_format (store); chancount = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format); g_return_if_fail (chancount <= 2); g_return_if_fail (chan < chancount); if (store->lists[chan]) ipatch_sample_list_free (store->lists[chan]); /* no locking required - lists should only be assigned by a single thread */ store->lists[chan] = list; ((IpatchSampleStore *)store)->size = list->total_size; } libinstpatch-1.0.0/libinstpatch/IpatchSF2Mod.h0000644000175000017500000001236511461332142016141 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Moderal Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Moderal Public License for more details. * * You should have received a copy of the GNU Moderal Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2Mod * @short_description: SoundFont modulators * @see_also: * @stability: Stable * * SoundFont modulators are used to define real time MIDI effect controls. */ #ifndef __IPATCH_SF2_MOD_H__ #define __IPATCH_SF2_MOD_H__ #include #include #include /* forward type declarations */ typedef struct _IpatchSF2Mod IpatchSF2Mod; typedef GSList IpatchSF2ModList; /* IpatchSF2Mod has a glib boxed type */ #define IPATCH_TYPE_SF2_MOD (ipatch_sf2_mod_get_type ()) #define IPATCH_TYPE_SF2_MOD_LIST (ipatch_sf2_mod_list_get_type ()) /* modulator structure */ struct _IpatchSF2Mod { guint16 src; /* source modulator (MIDI controller, etc) */ guint16 dest; /* destination generator */ gint16 amount; /* degree of modulation */ guint16 amtsrc; /* second source controls amount of first */ guint16 trans; /* transform function applied to source */ }; /* Compare two modulators to see if they are identical and can be combined (all fields except amount must be identical). Returns TRUE if identical, FALSE otherwise */ #define IPATCH_SF2_MOD_ARE_IDENTICAL(a, b) \ ((a)->src == (b)->src && (a)->dest == (b)->dest \ && (a)->amtsrc == (b)->amtsrc && (a)->trans == (b)->trans) /* like IPATCH_SF2_MOD_ARE_IDENTICAL but also checks if amounts are identical */ #define IPATCH_SF2_MOD_ARE_IDENTICAL_AMOUNT(a, b) \ ((a)->src == (b)->src && (a)->dest == (b)->dest \ && (a)->amtsrc == (b)->amtsrc && (a)->trans == (b)->trans \ && (a)->amount == (b)->amount) /* modulator flags */ typedef enum { IPATCH_SF2_MOD_MASK_CONTROL = 0x007F, IPATCH_SF2_MOD_MASK_CC = 0x0080, IPATCH_SF2_MOD_MASK_DIRECTION = 0x0100, IPATCH_SF2_MOD_MASK_POLARITY = 0x0200, IPATCH_SF2_MOD_MASK_TYPE = 0xFC00 } IpatchSF2ModFieldMasks; typedef enum { IPATCH_SF2_MOD_SHIFT_CONTROL = 0, IPATCH_SF2_MOD_SHIFT_CC = 7, IPATCH_SF2_MOD_SHIFT_DIRECTION = 8, IPATCH_SF2_MOD_SHIFT_POLARITY = 9, IPATCH_SF2_MOD_SHIFT_TYPE = 10 } IpatchSF2ModFieldShifts; typedef enum { IPATCH_SF2_MOD_CONTROL_NONE = 0, IPATCH_SF2_MOD_CONTROL_NOTE_ON_VELOCITY = 2, IPATCH_SF2_MOD_CONTROL_NOTE_NUMBER = 3, IPATCH_SF2_MOD_CONTROL_POLY_PRESSURE = 10, IPATCH_SF2_MOD_CONTROL_CHAN_PRESSURE = 13, IPATCH_SF2_MOD_CONTROL_PITCH_WHEEL = 14, IPATCH_SF2_MOD_CONTROL_BEND_RANGE = 16 } IpatchSF2ModControl; typedef enum { IPATCH_SF2_MOD_CC_GENERAL = (0 << IPATCH_SF2_MOD_SHIFT_CC), IPATCH_SF2_MOD_CC_MIDI = (1 << IPATCH_SF2_MOD_SHIFT_CC) } IpatchSF2ModControlPalette; typedef enum { IPATCH_SF2_MOD_DIRECTION_POSITIVE = (0 << IPATCH_SF2_MOD_SHIFT_DIRECTION), IPATCH_SF2_MOD_DIRECTION_NEGATIVE = (1 << IPATCH_SF2_MOD_SHIFT_DIRECTION) } IpatchSF2ModDirection; typedef enum { IPATCH_SF2_MOD_POLARITY_UNIPOLAR = (0 << IPATCH_SF2_MOD_SHIFT_POLARITY), IPATCH_SF2_MOD_POLARITY_BIPOLAR = (1 << IPATCH_SF2_MOD_SHIFT_POLARITY) } IpatchSF2ModPolarity; typedef enum { IPATCH_SF2_MOD_TYPE_LINEAR = (0 << IPATCH_SF2_MOD_SHIFT_TYPE), IPATCH_SF2_MOD_TYPE_CONCAVE = (1 << IPATCH_SF2_MOD_SHIFT_TYPE), IPATCH_SF2_MOD_TYPE_CONVEX = (2 << IPATCH_SF2_MOD_SHIFT_TYPE), IPATCH_SF2_MOD_TYPE_SWITCH = (3 << IPATCH_SF2_MOD_SHIFT_TYPE) } IpatchSF2ModType; typedef enum { IPATCH_SF2_MOD_TRANSFORM_LINEAR = 0 } IpatchSF2ModTransform; /* flags for ipatch_sf2_mod_class_set_mods() */ typedef enum { IPATCH_SF2_MOD_NO_DUPLICATE = 1 << 0, /* don't duplicate mod list (owned!) */ IPATCH_SF2_MOD_NO_NOTIFY = 1 << 1 /* don't do item property notify */ } IpatchSF2ModFlags; GType ipatch_sf2_mod_get_type (void); GType ipatch_sf2_mod_list_get_type (void); IpatchSF2Mod *ipatch_sf2_mod_new (void); void ipatch_sf2_mod_free (IpatchSF2Mod *mod); IpatchSF2Mod *ipatch_sf2_mod_duplicate (const IpatchSF2Mod *mod); GSList *ipatch_sf2_mod_list_duplicate (const GSList *list); GSList *ipatch_sf2_mod_list_override (const GSList *alist, const GSList *blist, gboolean copy); void ipatch_sf2_mod_list_boxed_free (GSList *list); GSList *ipatch_sf2_mod_list_insert (GSList *mods, const IpatchSF2Mod *modvals, int pos); GSList *ipatch_sf2_mod_list_remove (GSList *mods, const IpatchSF2Mod *modvals, gboolean *changed); gboolean ipatch_sf2_mod_list_change (GSList *mods, const IpatchSF2Mod *oldvals, const IpatchSF2Mod *newvals); GSList *ipatch_sf2_mod_list_offset (const GSList *alist, const GSList *blist); void ipatch_sf2_mod_list_free (GSList *list, gboolean free_mods); G_CONST_RETURN GSList *ipatch_sf2_mod_list_get_default (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchTypeProp.h0000644000175000017500000000756611461332142016700 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchTypeProp * @short_description: GObject style properties for GTypes * @see_also: * @stability: Stable * * Provides a registry system for adding GObject style properties to GTypes. * This is used to describe certain properties of different objects, such as * "category". */ #ifndef __IPATCH_TYPE_PROP_H__ #define __IPATCH_TYPE_PROP_H__ #include #include /* some built in type categories for "category" property */ enum { IPATCH_CATEGORY_NONE, /* a NULL value */ IPATCH_CATEGORY_BASE, /* patch file IpatchBase type */ IPATCH_CATEGORY_PROGRAM, /* a MIDI program type (MIDI locale) */ IPATCH_CATEGORY_INSTRUMENT, /* an instrument type (no MIDI locale) */ IPATCH_CATEGORY_INSTRUMENT_REF, /* a type referencing an Instrument */ IPATCH_CATEGORY_SAMPLE, /* sample type */ IPATCH_CATEGORY_SAMPLE_REF /* a type referencing a sample */ }; /* enum for "splits-type" to indicate that a type has key-range or velocity-range parameters or its children do */ typedef enum { IPATCH_SPLITS_NONE, /* type does not have splits */ IPATCH_SPLITS_NORMAL, /* normal splits */ IPATCH_SPLITS_NO_OVERLAP /* splits do not overlap */ } IpatchSplitsType; /** * IpatchTypePropGetFunc: * @type: The GType of the type property * @spec: The parameter specification * @value: Initialized value to store the type prop value in * @object: Object instance (might be %NULL) * * A function type used for active type property callbacks. * Allows for dynamic type properties that can return values depending * on an object's state. */ typedef void (*IpatchTypePropGetFunc)(GType type, GParamSpec *spec, GValue *value, GObject *object); void ipatch_type_install_property (GParamSpec *prop_spec); GParamSpec *ipatch_type_find_property (const char *name); GParamSpec **ipatch_type_list_properties (guint *n_properties); GType *ipatch_type_find_types_with_property (const char *name, const GValue *value, guint *n_types); void ipatch_type_set (GType type, const char *first_property_name, ...); void ipatch_type_set_valist (GType type, const char *first_property_name, va_list args); void ipatch_type_set_property (GType type, const char *property_name, const GValue *value); void ipatch_type_get (GType type, const char *first_property_name, ...); void ipatch_type_get_valist (GType type, const char *first_property_name, va_list args); void ipatch_type_get_property (GType type, const char *property_name, GValue *value); void ipatch_type_object_get (GObject *object, const char *first_property_name, ...); void ipatch_type_object_get_valist (GObject *object, const char *first_property_name, va_list args); void ipatch_type_object_get_property (GObject *object, const char *property_name, GValue *value); void ipatch_type_set_dynamic_func (GType type, const char *property_name, IpatchTypePropGetFunc func); IpatchTypePropGetFunc ipatch_type_get_dynamic_func (GType type, const char *property_name); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2.h0000644000175000017500000001301211461332142015467 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2 * @short_description: SoundFont instrument file object * @see_also: #IpatchSF2Preset, #IpatchSF2Inst, #IpatchSF2Sample * @stability: Stable * * SoundFont version 2 instrument file object. Parent to #IpatchSF2Preset, * #IpatchSF2Inst and #IpatchSF2Sample objects. */ #ifndef __IPATCH_SF2_H__ #define __IPATCH_SF2_H__ #include #include #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchSF2 IpatchSF2; typedef struct _IpatchSF2Class IpatchSF2Class; #define IPATCH_TYPE_SF2 (ipatch_sf2_get_type ()) #define IPATCH_SF2(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2, IpatchSF2)) #define IPATCH_SF2_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2, IpatchSF2Class)) #define IPATCH_IS_SF2(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2)) #define IPATCH_IS_SF2_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2)) #define IPATCH_SF2_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SF2, IpatchSF2Class)) /* SoundFont object */ struct _IpatchSF2 { /*< public >*/ IpatchBase parent_instance; guint16 ver_major, ver_minor; /* SoundFont version */ guint16 romver_major, romver_minor; /* ROM version (if any) */ GHashTable *info; /* hash of info strings by 4 char ID */ GSList *presets; /* list of #IpatchSF2Preset structures */ GSList *insts; /* list of #IpatchSF2Inst structures */ GSList *samples; /* list of #IpatchSF2Sample structures */ }; /* SoundFont class */ struct _IpatchSF2Class { IpatchBaseClass parent_class; }; typedef enum { /* SoundFont 24 bit samples enabled flag */ IPATCH_SF2_SAMPLES_24BIT = 1 << IPATCH_BASE_UNUSED_FLAG_SHIFT } IpatchSF2Flags; /* we reserve a couple flags for backwards compatible expansion */ #define IPATCH_SF2_UNUSED_FLAG_SHIFT (IPATCH_BASE_UNUSED_FLAG_SHIFT + 3) /* SoundFont INFO enums (keep order synced with IpatchSF2.c) */ typedef enum { IPATCH_SF2_UNKNOWN, /* unknown chunk ("NULL" value) */ IPATCH_SF2_VERSION = IPATCH_SFONT_FOURCC_IFIL, /* SoundFont version */ IPATCH_SF2_ENGINE = IPATCH_SFONT_FOURCC_ISNG,/* target sound engine */ IPATCH_SF2_NAME = IPATCH_SFONT_FOURCC_INAM, /* SoundFont name */ IPATCH_SF2_ROM_NAME = IPATCH_SFONT_FOURCC_IROM, /* ROM name */ IPATCH_SF2_ROM_VERSION = IPATCH_SFONT_FOURCC_IVER, /* ROM version */ IPATCH_SF2_DATE = IPATCH_SFONT_FOURCC_ICRD, /* creation date */ IPATCH_SF2_AUTHOR = IPATCH_SFONT_FOURCC_IENG,/* sound designers/engineers */ IPATCH_SF2_PRODUCT = IPATCH_SFONT_FOURCC_IPRD, /* product intended for */ IPATCH_SF2_COPYRIGHT = IPATCH_SFONT_FOURCC_ICOP, /* copyright message */ IPATCH_SF2_COMMENT = IPATCH_SFONT_FOURCC_ICMT, /* comments */ IPATCH_SF2_SOFTWARE = IPATCH_SFONT_FOURCC_ISFT /* software "create:modify" */ }IpatchSF2InfoType; #define IPATCH_SF2_INFO_COUNT 11 #define IPATCH_SF2_DEFAULT_ENGINE "EMU8000" /* structure used for ipatch_sf2_get_info_array */ typedef struct { guint32 id; /* FOURCC info id */ char *val; /* info string value */ } IpatchSF2Info; GType ipatch_sf2_get_type (void); IpatchSF2 *ipatch_sf2_new (void); #define ipatch_sf2_get_presets(sfont) \ ipatch_container_get_children (IPATCH_CONTAINER (sfont), \ IPATCH_TYPE_SF2_PRESET) #define ipatch_sf2_get_insts(sfont) \ ipatch_container_get_children (IPATCH_CONTAINER (sfont), \ IPATCH_TYPE_SF2_INST) #define ipatch_sf2_get_samples(sfont) \ ipatch_container_get_children (IPATCH_CONTAINER (sfont), \ IPATCH_TYPE_SF2_SAMPLE) void ipatch_sf2_set_file (IpatchSF2 *sf, IpatchSF2File *file); IpatchSF2File *ipatch_sf2_get_file (IpatchSF2 *sf); char *ipatch_sf2_get_info (IpatchSF2 *sf, IpatchSF2InfoType id); void ipatch_sf2_set_info (IpatchSF2 *sf, IpatchSF2InfoType id, const char *val); IpatchSF2Info *ipatch_sf2_get_info_array (IpatchSF2 *sf); void ipatch_sf2_free_info_array (IpatchSF2Info *array); gboolean ipatch_sf2_info_id_is_valid (guint32 id); int ipatch_sf2_get_info_max_size (IpatchSF2InfoType infotype); IpatchSF2Preset *ipatch_sf2_find_preset (IpatchSF2 *sf, const char *name, int bank, int program, const IpatchSF2Preset *exclude); IpatchSF2Inst *ipatch_sf2_find_inst (IpatchSF2 *sf, const char *name, const IpatchSF2Inst *exclude); IpatchSF2Sample *ipatch_sf2_find_sample (IpatchSF2 *sf, const char *name, const IpatchSF2Sample *exclude); IpatchList *ipatch_sf2_get_zone_references (IpatchItem *item); char *ipatch_sf2_make_unique_name (IpatchSF2 *sfont, GType child_type, const char *name, const IpatchItem *exclude); #endif libinstpatch-1.0.0/libinstpatch/IpatchVirtualContainer_types.c0000644000175000017500000000562411461332142021617 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchVirtualContainer_types.h" #include "IpatchDLS2Inst.h" #include "IpatchDLS2Sample.h" #include "IpatchGigInst.h" #include "IpatchGigSample.h" #include "IpatchSF2Preset.h" #include "IpatchSF2Inst.h" #include "IpatchSF2Sample.h" #include "IpatchTypeProp.h" #include "i18n.h" IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_dls2_melodic, IpatchVirtualDLS2Melodic, _("Melodic Instruments"), _("Non percussion instruments"), IPATCH_TYPE_DLS2_INST); IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_dls2_percussion, IpatchVirtualDLS2Percussion, _("Percussion Instruments"), _("Percussion Instruments"), IPATCH_TYPE_DLS2_INST); IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_dls2_samples, IpatchVirtualDLS2Samples, _("Samples"), _("Samples"), IPATCH_TYPE_DLS2_SAMPLE); IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_gig_melodic, IpatchVirtualGigMelodic, _("Melodic Instruments"), _("Non percussion instruments"), IPATCH_TYPE_GIG_INST); IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_gig_percussion, IpatchVirtualGigPercussion, _("Percussion Instruments"), _("Percussion Instruments"), IPATCH_TYPE_GIG_INST); IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_gig_samples, IpatchVirtualGigSamples, _("Samples"), _("Samples"), IPATCH_TYPE_GIG_SAMPLE); IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_sf2_inst, IpatchVirtualSF2Inst, _("Instruments"), _("Instruments"), IPATCH_TYPE_SF2_INST); IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_sf2_melodic, IpatchVirtualSF2Melodic, _("Melodic Presets"), _("Non percussion presets"), IPATCH_TYPE_SF2_PRESET); IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_sf2_percussion, IpatchVirtualSF2Percussion, _("Percussion Presets"), _("Percussion Presets"), IPATCH_TYPE_SF2_PRESET); IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_sf2_samples, IpatchVirtualSF2Samples, _("Samples"), _("Samples"), IPATCH_TYPE_SF2_SAMPLE); IPATCH_VIRTUAL_CONTAINER_CREATE (ipatch_virtual_sf2_rom, IpatchVirtualSF2Rom, _("ROM Samples"), _("ROM Samples"), IPATCH_TYPE_SF2_SAMPLE); libinstpatch-1.0.0/libinstpatch/IpatchSF2VoiceCache_Gig.h0000644000175000017500000000366011461332142020177 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2VoiceCache_Gig * @short_description: Voice cache converters for GigaSampler object types * @see_also: #IpatchSF2VoiceCache * @stability: Stable */ #ifndef __IPATCH_SF2_VOICE_CACHE_GIG_H__ #define __IPATCH_SF2_VOICE_CACHE_GIG_H__ #include #include #include #include typedef IpatchConverterSF2VoiceCache IpatchConverterGigInstToSF2VoiceCache; typedef IpatchConverterSF2VoiceCacheClass IpatchConverterGigInstToSF2VoiceCacheClass; typedef IpatchConverterSF2VoiceCache IpatchConverterGigSampleToSF2VoiceCache; typedef IpatchConverterSF2VoiceCacheClass IpatchConverterGigSampleToSF2VoiceCacheClass; #define IPATCH_TYPE_CONVERTER_GIG_INST_TO_SF2_VOICE_CACHE \ (ipatch_converter_gig_inst_to_sf2_voice_cache_get_type ()) #define IPATCH_TYPE_CONVERTER_GIG_SAMPLE_TO_SF2_VOICE_CACHE \ (ipatch_converter_gig_sample_to_sf2_voice_cache_get_type ()) GType ipatch_converter_gig_inst_to_sf2_voice_cache_get_type (void); GType ipatch_converter_gig_sample_to_sf2_voice_cache_get_type (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchVBankRegion.c0000644000175000017500000002752511461332142017253 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchVBankRegion.h" #include "ipatch_priv.h" #include "builtin_enums.h" enum { PROP_0, PROP_TITLE, PROP_LINK_ITEM, /* Region linked synthesis item */ PROP_ID_PROPS, /* Identification properties */ PROP_FILE_INDEX, /* Referenced file index in IpatchVBank parent */ PROP_NOTE_RANGE, /* Note range */ PROP_NOTE_RANGE_MODE, /* Mode of note range */ PROP_ROOT_NOTE, /* Root note */ PROP_ROOT_NOTE_MODE /* Mode of root note */ }; static void ipatch_vbank_region_get_title (IpatchVBankRegion *region, GValue *value); static void ipatch_vbank_region_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_vbank_region_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_vbank_region_finalize (GObject *object); static void ipatch_vbank_region_real_set_id_props (IpatchVBankRegion *region, char **id_props, gboolean notify); G_DEFINE_TYPE (IpatchVBankRegion, ipatch_vbank_region, IPATCH_TYPE_ITEM); static void ipatch_vbank_region_class_init (IpatchVBankRegionClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->get_property = ipatch_vbank_region_get_property; obj_class->finalize = ipatch_vbank_region_finalize; item_class->item_set_property = ipatch_vbank_region_set_property; g_object_class_override_property (obj_class, PROP_TITLE, "title"); g_object_class_install_property (obj_class, PROP_LINK_ITEM, g_param_spec_object ("link-item", _("Link item"), _("Link item"), IPATCH_TYPE_ITEM, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_ID_PROPS, g_param_spec_value_array ("id-props", _("ID props"), _("Identification properties"), g_param_spec_string ("name-value", "Name value", "Name value pairs", NULL, G_PARAM_READWRITE), G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_FILE_INDEX, g_param_spec_uint ("file-index", _("File index"), _("File index"), 0, G_MAXUINT, 0, G_PARAM_READABLE)); g_object_class_install_property (obj_class, PROP_NOTE_RANGE, ipatch_param_spec_range ("note-range", _("Note range"), _("Note range"), 0, 127, 0, 127, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_NOTE_RANGE_MODE, g_param_spec_enum ("note-range-mode", _("Note range mode"), _("Note range mode"), IPATCH_TYPE_VBANK_REGION_NOTE_RANGE_MODE, IPATCH_VBANK_REGION_NOTE_RANGE_MODE_INTERSECT, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_ROOT_NOTE, g_param_spec_int ("root-note", _("Root note"), _("Root note"), -127, 127, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_ROOT_NOTE_MODE, g_param_spec_enum ("root-note-mode", _("Root note mode"), _("Root note mode"), IPATCH_TYPE_VBANK_REGION_ROOT_NOTE_MODE, IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OFFSET, G_PARAM_READWRITE)); } static void ipatch_vbank_region_get_title (IpatchVBankRegion *region, GValue *value) { IpatchItem *ref; char *s = NULL; g_object_get (region, "link-item", &ref, NULL); /* ++ ref region linked item */ if (ref) { g_object_get (ref, "title", &s, NULL); g_object_unref (ref); /* -- unref region linked item */ g_value_take_string (value, s); } else g_value_set_static_string (value, _("")); } static void ipatch_vbank_region_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchVBankRegion *region = IPATCH_VBANK_REGION (object); GValueArray *valarray; IpatchRange *range; GObject *obj; char **strv; int i; switch (property_id) { case PROP_LINK_ITEM: obj = g_value_get_object (value); g_return_if_fail (!obj || IPATCH_IS_ITEM (obj)); if (obj) g_object_ref (obj); IPATCH_ITEM_WLOCK (region); if (region->item) g_object_unref (region->item); region->item = (IpatchItem *)obj; IPATCH_ITEM_WUNLOCK (region); break; case PROP_ID_PROPS: valarray = g_value_get_boxed (value); if (valarray) { strv = g_new (char *, valarray->n_values + 1); /* ++ alloc */ for (i = 0; i < valarray->n_values; i++) strv[i] = (char *)g_value_get_string (g_value_array_get_nth (valarray, i)); strv[valarray->n_values] = NULL; ipatch_vbank_region_real_set_id_props (region, strv, FALSE); g_free (strv); /* -- free - strings themselves were not allocated */ } break; case PROP_NOTE_RANGE: range = ipatch_value_get_range (value); IPATCH_ITEM_WLOCK (region); region->note_range = *range; IPATCH_ITEM_WUNLOCK (region); break; case PROP_NOTE_RANGE_MODE: region->note_range_mode = g_value_get_enum (value); break; case PROP_ROOT_NOTE: region->root_note = g_value_get_int (value); break; case PROP_ROOT_NOTE_MODE: region->root_note_mode = g_value_get_enum (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_vbank_region_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchVBankRegion *region = IPATCH_VBANK_REGION (object); GValueArray *valarray; IpatchRange range; guint n_elements; GObject *obj; char **strv; GValue val = { 0 }; int i; switch (property_id) { case PROP_TITLE: ipatch_vbank_region_get_title (region, value); break; case PROP_LINK_ITEM: IPATCH_ITEM_RLOCK (region); obj = (GObject *)(region->item); if (obj) g_object_ref (obj); IPATCH_ITEM_RUNLOCK (region); g_value_take_object (value, obj); break; case PROP_ID_PROPS: strv = ipatch_vbank_region_get_id_props (region, &n_elements); /* ++ alloc */ if (strv) { valarray = g_value_array_new (n_elements); /* ++ alloc */ g_value_init (&val, G_TYPE_STRING); for (i = 0; i < n_elements; i++) { g_value_set_string (&val, strv[i]); /* ++ alloc */ g_value_array_append (valarray, &val); g_value_reset (&val); /* -- free */ } g_value_unset (&val); g_value_take_boxed (value, valarray); /* !! owned */ g_strfreev (strv); /* -- free */ } else g_value_set_boxed (value, NULL); break; case PROP_FILE_INDEX: g_value_set_uint (value, region->file_index); break; case PROP_NOTE_RANGE: IPATCH_ITEM_WLOCK (region); range = region->note_range; IPATCH_ITEM_WUNLOCK (region); ipatch_value_set_range (value, &range); break; case PROP_NOTE_RANGE_MODE: g_value_set_enum (value, region->note_range_mode); break; case PROP_ROOT_NOTE: g_value_set_int (value, region->root_note); break; case PROP_ROOT_NOTE_MODE: g_value_set_enum (value, region->root_note_mode); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_vbank_region_init (IpatchVBankRegion *region) { region->note_range.low = 0; region->note_range.high = 127; } static void ipatch_vbank_region_finalize (GObject *object) { IpatchVBankRegion *region = IPATCH_VBANK_REGION (object); if (region->item) g_object_unref (region->item); g_strfreev (region->id_props); if (G_OBJECT_CLASS (ipatch_vbank_region_parent_class)->finalize) G_OBJECT_CLASS (ipatch_vbank_region_parent_class)->finalize (object); } /** * ipatch_vbank_region_new: * * Create a new virtual bank region object. * * Returns: New virtual bank region with a reference count of 1. Caller * owns the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchVBankRegion * ipatch_vbank_region_new (void) { return (IPATCH_VBANK_REGION (g_object_new (IPATCH_TYPE_VBANK_REGION, NULL))); } /** * ipatch_vbank_region_first: * @iter: Patch item iterator containing #IpatchVBankRegion items * * Gets the first item in a virtual bank region iterator. A convenience * wrapper for ipatch_iter_first(). * * Returns: The first virtual bank region in @iter or %NULL if empty. */ IpatchVBankRegion * ipatch_vbank_region_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_VBANK_REGION (obj)); else return (NULL); } /** * ipatch_vbank_region_next: * @iter: Patch item iterator containing #IpatchVBankRegion items * * Gets the next item in a virtual bank region iterator. A convenience wrapper * for ipatch_iter_next(). * * Returns: The next virtual bank region in @iter or %NULL if at the end of * the list. */ IpatchVBankRegion * ipatch_vbank_region_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_VBANK_REGION (obj)); else return (NULL); } /** * ipatch_vbank_region_set_id_props: * @region: VBank region * @id_props: NULL terminated array of name/value string pairs * * Set the ID properties of a virtual bank region. These are used to uniquely * identify an item in an external instrument file. This function is likely * only used by the VBank loader before an item is resolved. Normal users * will likely just assign to the "item-link" parameter. */ void ipatch_vbank_region_set_id_props (IpatchVBankRegion *region, char **id_props) { ipatch_vbank_region_real_set_id_props (region, id_props, TRUE); } /* the real set ID properties routine, takes a notify parameter to indicate if * a property notify should be done */ static void ipatch_vbank_region_real_set_id_props (IpatchVBankRegion *region, char **id_props, gboolean notify) { char **dup_id_props; g_return_if_fail (IPATCH_IS_VBANK_REGION (region)); dup_id_props = g_strdupv (id_props); /* ++ alloc */ IPATCH_ITEM_WLOCK (region); g_strfreev (region->id_props); region->id_props = dup_id_props; /* !! owned */ IPATCH_ITEM_WUNLOCK (region); if (notify) g_object_notify (G_OBJECT (region), "id-props"); } /** * ipatch_vbank_region_get_id_props: * @region: VBank region * @n_elements: Pointer to store count of elements in returned string array * or %NULL to ignore. * * Get ID properties which uniquely identify the referenced item. These are * usually only available until the item gets resolved, at which point * "item-link" is set. * * Returns: %NULL terminated array of name/value pair property strings or * %NULL if none. Free with g_strfreev() when finished using it. */ char ** ipatch_vbank_region_get_id_props (IpatchVBankRegion *region, guint *n_elements) { char **id_props; g_return_val_if_fail (IPATCH_IS_VBANK_REGION (region), NULL); IPATCH_ITEM_RLOCK (region); id_props = g_strdupv (region->id_props); /* ++ alloc */ IPATCH_ITEM_RUNLOCK (region); if (n_elements) *n_elements = id_props ? g_strv_length (id_props) : 0; return (id_props); /* !! owned */ } libinstpatch-1.0.0/libinstpatch/IpatchSF2IZone.c0000644000175000017500000005601711461332142016443 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSF2IZone.h" #include "IpatchSF2GenItem.h" #include "IpatchSample.h" #include "IpatchContainer.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" enum { /* generator IDs are used for lower numbers */ PROP_LINK_ITEM = IPATCH_SF2_GEN_ITEM_FIRST_PROP_USER_ID, PROP_SAMPLE_SIZE, PROP_SAMPLE_FORMAT, PROP_SAMPLE_RATE, PROP_SAMPLE_DATA, PROP_LOOP_TYPE, PROP_LOOP_START, PROP_LOOP_END, PROP_ROOT_NOTE, PROP_FINE_TUNE }; static void ipatch_sf2_izone_sample_iface_init (IpatchSampleIface *sample_iface); static gboolean ipatch_sf2_izone_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_sf2_izone_class_init (IpatchSF2IZoneClass *klass); static void ipatch_sf2_izone_gen_item_iface_init (IpatchSF2GenItemIface *genitem_iface); static void ipatch_sf2_izone_init (IpatchSF2IZone *izone); static inline void ipatch_sf2_izone_get_root_note (IpatchSF2IZone *izone, GValue *value); static inline void ipatch_sf2_izone_get_fine_tune (IpatchSF2IZone *izone, GValue *value); static void ipatch_sf2_izone_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sf2_izone_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); /* For quicker access without lookup */ static GParamSpec *root_note_pspec; static GParamSpec *fine_tune_pspec; /* For passing data from class init to gen item interface init */ static GParamSpec **gen_item_specs = NULL; static GParamSpec **gen_item_setspecs = NULL; G_DEFINE_TYPE_WITH_CODE (IpatchSF2IZone, ipatch_sf2_izone, IPATCH_TYPE_SF2_ZONE, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sf2_izone_sample_iface_init) G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SF2_GEN_ITEM, ipatch_sf2_izone_gen_item_iface_init)) /* sample interface initialization */ static void ipatch_sf2_izone_sample_iface_init (IpatchSampleIface *sample_iface) { sample_iface->open = ipatch_sf2_izone_sample_iface_open; sample_iface->loop_types = ipatch_sample_loop_types_standard_release; } static gboolean ipatch_sf2_izone_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchSF2Zone *zone = IPATCH_SF2_ZONE (handle->sample); IpatchItem *link_item; gboolean retval; link_item = ipatch_sf2_zone_get_link_item (zone); /* ++ ref link_item */ g_return_val_if_fail (link_item != NULL, FALSE); retval = ipatch_sample_handle_cascade_open (handle, IPATCH_SAMPLE (link_item), err); g_object_unref (link_item); /* -- unref link_item */ return (retval); } /* gen item interface initialization */ static void ipatch_sf2_izone_gen_item_iface_init (IpatchSF2GenItemIface *genitem_iface) { genitem_iface->genarray_ofs = G_STRUCT_OFFSET (IpatchSF2Zone, genarray); genitem_iface->propstype = IPATCH_SF2_GEN_PROPS_INST; g_return_if_fail (gen_item_specs != NULL); g_return_if_fail (gen_item_setspecs != NULL); memcpy (&genitem_iface->specs, gen_item_specs, sizeof (genitem_iface->specs)); memcpy (&genitem_iface->setspecs, gen_item_setspecs, sizeof (genitem_iface->setspecs)); g_free (gen_item_specs); g_free (gen_item_setspecs); } static void ipatch_sf2_izone_class_init (IpatchSF2IZoneClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->get_property = ipatch_sf2_izone_get_property; item_class->item_set_property = ipatch_sf2_izone_set_property; g_object_class_install_property (obj_class, PROP_LINK_ITEM, g_param_spec_object ("link-item", _("Link item"), _("Link item"), IPATCH_TYPE_SF2_SAMPLE, G_PARAM_READWRITE)); /* properties defined by IpatchSample interface */ ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_SIZE, "sample-size"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_FORMAT, "sample-format"); ipatch_sample_install_property (obj_class, PROP_SAMPLE_RATE, "sample-rate"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_DATA, "sample-data"); ipatch_sample_install_property (obj_class, PROP_LOOP_TYPE, "loop-type"); ipatch_sample_install_property (obj_class, PROP_LOOP_START, "loop-start"); ipatch_sample_install_property (obj_class, PROP_LOOP_END, "loop-end"); root_note_pspec = ipatch_sample_install_property (obj_class, PROP_ROOT_NOTE, "root-note"); fine_tune_pspec = ipatch_sample_install_property (obj_class, PROP_FINE_TUNE, "fine-tune"); /* install generator properties */ ipatch_sf2_gen_item_iface_install_properties (obj_class, IPATCH_SF2_GEN_PROPS_INST, &gen_item_specs, &gen_item_setspecs); } static inline void ipatch_sf2_izone_get_root_note (IpatchSF2IZone *izone, GValue *value) { IpatchSF2GenAmount amt; IpatchSF2Sample *sample; int val = 0; /* root note override not set or -1? - Get sample root note value. */ if (!ipatch_sf2_gen_item_get_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE, &amt) || amt.sword == -1) { /* root note override not set, get from sample */ sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_get (sample, "root-note", &val, NULL); g_object_unref (sample); /* -- unref sample */ } } else val = amt.uword; g_value_set_int (value, val); } static inline void ipatch_sf2_izone_get_fine_tune (IpatchSF2IZone *izone, GValue *value) { IpatchSF2GenAmount amt; IpatchSF2Sample *sample; int val = 0; /* fine tune override set? */ if (!ipatch_sf2_gen_item_get_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE, &amt)) { /* fine tune override not set, get from sample */ sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_get (sample, "fine-tune", &val, NULL); g_object_unref (sample); /* -- unref sample */ } } else val = amt.sword; g_value_set_int (value, val); } static void ipatch_sf2_izone_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSF2IZone *izone = IPATCH_SF2_IZONE (object); IpatchSF2Sample *sample; IpatchSF2GenAmount amt; GValue vals[2]; /* Gets zeroed below */ guint genid; guint uval; int val = 0; /* "root-note" and "fine-tune" sample properties get updated for IZone * override property or -set property */ if (property_id >= IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID) genid = property_id - IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID; else genid = property_id - IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID; if (genid == IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE) { memset (vals, 0, sizeof (vals)); g_value_init (&vals[0], G_TYPE_INT); ipatch_sf2_izone_get_root_note (izone, &vals[0]); } else if (genid == IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE) { memset (vals, 0, sizeof (vals)); g_value_init (&vals[0], G_TYPE_INT); ipatch_sf2_izone_get_fine_tune (izone, &vals[0]); } if (ipatch_sf2_gen_item_iface_set_property ((IpatchSF2GenItem *)object, property_id, value)) { if (genid == IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE) { g_value_init (&vals[1], G_TYPE_INT); ipatch_sf2_izone_get_root_note (izone, &vals[1]); ipatch_item_prop_notify ((IpatchItem *)object, root_note_pspec, &vals[1], &vals[0]); } else if (genid == IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE) { g_value_init (&vals[1], G_TYPE_INT); ipatch_sf2_izone_get_fine_tune (izone, &vals[1]); ipatch_item_prop_notify ((IpatchItem *)object, fine_tune_pspec, &vals[1], &vals[0]); } } else { switch (property_id) { case PROP_LINK_ITEM: sample = g_value_get_object (value); g_return_if_fail (IPATCH_IS_SF2_SAMPLE (sample)); ipatch_sf2_zone_set_link_item_no_notify ((IpatchSF2Zone *)izone, (IpatchItem *)sample, NULL); break; case PROP_SAMPLE_RATE: sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_set (sample, "sample-rate", g_value_get_int (value), NULL); g_object_unref (sample); /* -- unref sample */ } break; case PROP_LOOP_TYPE: val = g_value_get_enum (value); if (val == IPATCH_SAMPLE_LOOP_NONE) amt.uword = IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP; else if (val == IPATCH_SAMPLE_LOOP_RELEASE) amt.uword = IPATCH_SF2_GEN_SAMPLE_MODE_LOOP_RELEASE; else amt.uword = IPATCH_SF2_GEN_SAMPLE_MODE_LOOP; ipatch_sf2_gen_item_set_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_SAMPLE_MODES, &amt); break; case PROP_LOOP_START: sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_get (sample, "loop-start", &uval, NULL); val = g_value_get_uint (value) - uval; /* loop start offset */ g_object_unref (sample); /* -- unref sample */ if (val >= 0) amt.sword = val >> 15; else amt.sword = -(-val >> 15); ipatch_sf2_gen_item_set_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START, &amt); if (val >= 0) amt.sword = val & 0x7FFF; else amt.sword = -(-val & 0x7FFF); ipatch_sf2_gen_item_set_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_SAMPLE_LOOP_START, &amt); } break; case PROP_LOOP_END: sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_get (sample, "loop-end", &uval, NULL); val = g_value_get_uint (value) - uval; /* loop end offset */ g_object_unref (sample); /* -- unref sample */ if (val >= 0) amt.sword = val >> 15; else amt.sword = -(-val >> 15); ipatch_sf2_gen_item_set_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END, &amt); if (val >= 0) amt.sword = val & 0x7FFF; else amt.sword = -(-val & 0x7FFF); ipatch_sf2_gen_item_set_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_SAMPLE_LOOP_END, &amt); } break; case PROP_ROOT_NOTE: amt.uword = g_value_get_int (value); ipatch_sf2_gen_item_set_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE, &amt); break; case PROP_FINE_TUNE: amt.sword = g_value_get_int (value); ipatch_sf2_gen_item_set_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE, &amt); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } } static void ipatch_sf2_izone_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSF2IZone *izone = IPATCH_SF2_IZONE (object); IpatchSF2Sample *sample; IpatchSF2GenAmount amt; guint uval = 0; int val = 0; if (!ipatch_sf2_gen_item_iface_get_property ((IpatchSF2GenItem *)object, property_id, value)) { switch (property_id) { case PROP_LINK_ITEM: g_value_take_object (value, ipatch_sf2_zone_get_link_item ((IpatchSF2Zone *)izone)); break; case PROP_SAMPLE_SIZE: sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_get_property ((GObject *)sample, "sample-size", value); g_object_unref (sample); /* -- unref sample */ } break; case PROP_SAMPLE_FORMAT: sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_get_property ((GObject *)sample, "sample-format", value); g_object_unref (sample); /* -- unref sample */ } break; case PROP_SAMPLE_RATE: sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_get_property ((GObject *)sample, "sample-rate", value); g_object_unref (sample); /* -- unref sample */ } break; case PROP_SAMPLE_DATA: sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_get_property ((GObject *)sample, "sample-data", value); g_object_unref (sample); /* -- unref sample */ } break; case PROP_LOOP_TYPE: ipatch_sf2_gen_item_get_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_SAMPLE_MODES, &amt); if (amt.uword == IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP) val = IPATCH_SAMPLE_LOOP_NONE; else if (amt.uword == IPATCH_SF2_GEN_SAMPLE_MODE_LOOP_RELEASE) val = IPATCH_SAMPLE_LOOP_RELEASE; else val = IPATCH_SAMPLE_LOOP_STANDARD; g_value_set_enum (value, val); break; case PROP_LOOP_START: sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_get (sample, "loop-start", &uval, NULL); g_object_unref (sample); /* -- unref sample */ val = uval; } ipatch_sf2_gen_item_get_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START, &amt); val += (int)amt.sword << 15; ipatch_sf2_gen_item_get_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_SAMPLE_LOOP_START, &amt); val += amt.sword; g_value_set_uint (value, CLAMP (val, 0, G_MAXINT)); break; case PROP_LOOP_END: sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (sample) { g_object_get (sample, "loop-end", &uval, NULL); g_object_unref (sample); /* -- unref sample */ val = uval; } ipatch_sf2_gen_item_get_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END, &amt); val += (int)amt.sword << 15; ipatch_sf2_gen_item_get_amount (IPATCH_SF2_GEN_ITEM (izone), IPATCH_SF2_GEN_SAMPLE_LOOP_END, &amt); val += amt.sword; g_value_set_uint (value, CLAMP (val, 0, G_MAXINT)); break; case PROP_ROOT_NOTE: ipatch_sf2_izone_get_root_note (izone, value); break; case PROP_FINE_TUNE: ipatch_sf2_izone_get_fine_tune (izone, value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } } static void ipatch_sf2_izone_init (IpatchSF2IZone *izone) { ipatch_sf2_gen_array_init (&((IpatchSF2Zone *)izone)->genarray, FALSE, FALSE); } /** * ipatch_sf2_izone_new: * * Create a new SoundFont instrument zone object. * * Returns: New SoundFont instrument zone with a reference count of 1. Caller * owns the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchSF2IZone * ipatch_sf2_izone_new (void) { return (IPATCH_SF2_IZONE (g_object_new (IPATCH_TYPE_SF2_IZONE, NULL))); } /** * ipatch_sf2_izone_first: * @iter: Patch item iterator containing #IpatchSF2IZone items * * Gets the first item in an instrument zone iterator. A convenience * wrapper for ipatch_iter_first(). * * Returns: The first instrument zone in @iter or %NULL if empty. */ IpatchSF2IZone * ipatch_sf2_izone_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_SF2_IZONE (obj)); else return (NULL); } /** * ipatch_sf2_izone_next: * @iter: Patch item iterator containing #IpatchSF2IZone items * * Gets the next item in an instrument zone iterator. A convenience wrapper * for ipatch_iter_next(). * * Returns: The next instrument zone in @iter or %NULL if at the end of * the list. */ IpatchSF2IZone * ipatch_sf2_izone_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_SF2_IZONE (obj)); else return (NULL); } /** * ipatch_sf2_izone_set_sample: * @izone: Instrument zone to set referenced sample of * @sample: Sample to set instrument zone's referenced item to * * Sets the referenced sample of an instrument zone. */ void ipatch_sf2_izone_set_sample (IpatchSF2IZone *izone, IpatchSF2Sample *sample) { g_return_if_fail (IPATCH_IS_SF2_IZONE (izone)); g_return_if_fail (!sample || IPATCH_IS_SF2_SAMPLE (sample)); ipatch_sf2_zone_set_link_item (IPATCH_SF2_ZONE (izone), IPATCH_ITEM (sample)); } /** * ipatch_sf2_izone_get_sample: * @izone: Instrument zone to get referenced sample from * * Gets the referenced sample from an instrument zone. * The returned sample's reference count is incremented and the caller * is responsible for unrefing it with g_object_unref(). * * Returns: Instrument zone's referenced sample or %NULL if global * zone. Remember to unreference the sample with g_object_unref() when * done with it. */ IpatchSF2Sample * ipatch_sf2_izone_get_sample (IpatchSF2IZone *izone) { IpatchItem *item; g_return_val_if_fail (IPATCH_IS_SF2_IZONE (izone), NULL); item = ipatch_sf2_zone_get_link_item (IPATCH_SF2_ZONE (izone)); return (item ? IPATCH_SF2_SAMPLE (item) : NULL); } /** * ipatch_sf2_izone_get_stereo_link: * @izone: Instrument zone * * Get the stereo linked instrument zone of another zone. This is a zone which * has the same #IpatchSF2Inst parent and has its link-item set to the counter * part of @izone. * * Returns: Stereo linked instrument zone or %NULL if not stereo or it could not * be found in the same instrument. Caller owns a reference to the returned * object. */ /* FIXME - This function is kind of a hack, until stereo IpatchSF2Sample and * IpatchSF2IZones are implemented */ IpatchSF2IZone * ipatch_sf2_izone_get_stereo_link (IpatchSF2IZone *izone) { IpatchSF2IZone *linked_izone = NULL; IpatchSF2Sample *sample = NULL, *linked_sample = NULL; IpatchItem *parent = NULL; IpatchList *children = NULL; IpatchSF2GenAmount z_noterange, cmp_noterange, z_velrange, cmp_velrange; int channel; GList *p; g_return_val_if_fail (IPATCH_IS_SF2_IZONE (izone), NULL); sample = ipatch_sf2_izone_get_sample (izone); /* ++ ref sample */ if (!sample) return (NULL); g_object_get (sample, "channel", &channel, "linked-sample", &linked_sample, /* ++ ref linked sample */ NULL); if (channel == IPATCH_SF2_SAMPLE_CHANNEL_MONO || !linked_sample) goto ret; parent = ipatch_item_get_parent ((IpatchItem *)izone); /* ++ ref parent */ if (!IPATCH_IS_CONTAINER (parent)) goto ret; /* ++ ref children */ if (!(children = ipatch_container_get_children ((IpatchContainer *)parent, IPATCH_TYPE_SF2_IZONE))) goto ret; /* Check likely previous and next zone of izone for performance */ p = g_list_find (children->items, izone); if (p->prev && ipatch_sf2_zone_peek_link_item (p->prev->data) == (IpatchItem *)linked_sample) linked_izone = g_object_ref (p->prev->data); if (p->next && ipatch_sf2_zone_peek_link_item (p->next->data) == (IpatchItem *)linked_sample) { if (!linked_izone) { linked_izone = g_object_ref (p->next->data); goto ret; } /* prev is also a match, this can happen in instruments with multiple pairs * of the same stereo sample - Return zone with intersecting note/velocity * ranges or fall through to exhaustive search. */ ipatch_sf2_gen_item_get_amount ((IpatchSF2GenItem *)izone, IPATCH_SF2_GEN_NOTE_RANGE, &z_noterange); ipatch_sf2_gen_item_get_amount ((IpatchSF2GenItem *)izone, IPATCH_SF2_GEN_VELOCITY_RANGE, &z_velrange); ipatch_sf2_gen_item_get_amount ((IpatchSF2GenItem *)linked_izone, IPATCH_SF2_GEN_NOTE_RANGE, &cmp_noterange); ipatch_sf2_gen_item_get_amount ((IpatchSF2GenItem *)linked_izone, IPATCH_SF2_GEN_VELOCITY_RANGE, &cmp_velrange); if (ipatch_sf2_gen_range_intersect_test (&z_noterange, &cmp_noterange) && ipatch_sf2_gen_range_intersect_test (&z_velrange, &cmp_velrange)) goto ret; g_object_unref (linked_izone); /* -- unref linked izone */ linked_izone = NULL; ipatch_sf2_gen_item_get_amount ((IpatchSF2GenItem *)(p->next->data), IPATCH_SF2_GEN_NOTE_RANGE, &cmp_noterange); ipatch_sf2_gen_item_get_amount ((IpatchSF2GenItem *)(p->next->data), IPATCH_SF2_GEN_VELOCITY_RANGE, &cmp_velrange); if (ipatch_sf2_gen_range_intersect_test (&z_noterange, &cmp_noterange) && ipatch_sf2_gen_range_intersect_test (&z_velrange, &cmp_velrange)) { linked_izone = g_object_ref (p->next->data); goto ret; } } else { if (linked_izone) goto ret; /* prev matched, but next did not */ ipatch_sf2_gen_item_get_amount ((IpatchSF2GenItem *)izone, IPATCH_SF2_GEN_NOTE_RANGE, &z_noterange); ipatch_sf2_gen_item_get_amount ((IpatchSF2GenItem *)izone, IPATCH_SF2_GEN_VELOCITY_RANGE, &z_velrange); } /* Not previous/next or both of them match, check all items. */ for (p = children->items; p; p = p->next) { if (p->data == izone || ipatch_sf2_zone_peek_link_item (p->data) != (IpatchItem *)linked_sample) continue; ipatch_sf2_gen_item_get_amount ((IpatchSF2GenItem *)(p->data), IPATCH_SF2_GEN_NOTE_RANGE, &cmp_noterange); ipatch_sf2_gen_item_get_amount ((IpatchSF2GenItem *)(p->data), IPATCH_SF2_GEN_VELOCITY_RANGE, &cmp_velrange); if (!ipatch_sf2_gen_range_intersect_test (&z_noterange, &cmp_noterange) || !ipatch_sf2_gen_range_intersect_test (&z_velrange, &cmp_velrange)) continue; linked_izone = g_object_ref (p->data); break; } ret: if (children) g_object_unref (children); /* -- unref children */ if (parent) g_object_unref (parent); /* -- unref parent */ if (linked_sample) g_object_unref (linked_sample); /* -- unref linked sample */ g_object_unref (sample); /* -- unref sample */ return (linked_izone); } libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreRom.c0000644000175000017500000001036111461332142020010 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchSampleStoreRom.h" #include "ipatch_priv.h" enum { PROP_0, PROP_LOCATION, /* location property (used by all types) */ }; static void ipatch_sample_store_rom_sample_iface_init (IpatchSampleIface *iface); static void ipatch_sample_store_rom_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sample_store_rom_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static gboolean ipatch_sample_store_rom_sample_iface_open (IpatchSampleHandle *handle, GError **err); G_DEFINE_TYPE_WITH_CODE (IpatchSampleStoreRom, ipatch_sample_store_rom, IPATCH_TYPE_SAMPLE_STORE, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sample_store_rom_sample_iface_init)) static void ipatch_sample_store_rom_sample_iface_init (IpatchSampleIface *iface) { iface->open = ipatch_sample_store_rom_sample_iface_open; } static void ipatch_sample_store_rom_class_init (IpatchSampleStoreRomClass *klass) { GObjectClass *gobj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); gobj_class->get_property = ipatch_sample_store_rom_get_property; item_class->item_set_property = ipatch_sample_store_rom_set_property; g_object_class_install_property (gobj_class, PROP_LOCATION, g_param_spec_uint ("location", "Location", "Sample data ROM location", 0, G_MAXUINT, 0, G_PARAM_READWRITE)); } static void ipatch_sample_store_rom_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSampleStoreRom *store = IPATCH_SAMPLE_STORE_ROM (object); switch (property_id) { case PROP_LOCATION: g_return_if_fail (store->location == 0); /* Only set once, no lock required */ store->location = g_value_get_uint (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_rom_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSampleStoreRom *store = IPATCH_SAMPLE_STORE_ROM (object); switch (property_id) { case PROP_LOCATION: /* No need to lock, only set once before use */ g_value_set_uint (value, store->location); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_rom_init (IpatchSampleStoreRom *store) { } static gboolean ipatch_sample_store_rom_sample_iface_open (IpatchSampleHandle *handle, GError **err) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_PROGRAM, "ROM sample stores cannot be opened"); return (FALSE); } /** * ipatch_sample_store_rom_new: * @location: Location in ROM * * Creates a new rom sample store. No data can actually be read or written * from this store type. Its used only to keep track of ROM locations in older * SoundFont files. * * Returns: New rom sample store, cast as an #IpatchSample for convenience. */ IpatchSample * ipatch_sample_store_rom_new (guint location) { return (IPATCH_SAMPLE (g_object_new (IPATCH_TYPE_SAMPLE_STORE_ROM, "location", location, NULL))); } libinstpatch-1.0.0/libinstpatch/IpatchGigDimension.h0000644000175000017500000001165511461332142017464 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchGigDimension * @short_description: GigaSampler dimension object * @see_also: #IpatchGigInst * @stability: Stable * * Defines a GigaSampler dimension object which are the children of * #IpatchGigInst objects. */ #ifndef __IPATCH_GIG_DIMENSION_H__ #define __IPATCH_GIG_DIMENSION_H__ #include #include /* forward type declarations */ typedef struct _IpatchGigDimension IpatchGigDimension; typedef struct _IpatchGigDimensionClass IpatchGigDimensionClass; /* GigaSampler dimension type */ typedef enum { IPATCH_GIG_DIMENSION_NONE = 0x00, /* not in use (is this in files?) */ /* MIDI controllers - see IpatchGigControlType (IpatchGigEffects.h) */ IPATCH_GIG_DIMENSION_MOD_WHEEL = 0x01, IPATCH_GIG_DIMENSION_BREATH = 0x02, IPATCH_GIG_DIMENSION_FOOT = 0x04, IPATCH_GIG_DIMENSION_PORTAMENTO_TIME = 0x05, IPATCH_GIG_DIMENSION_EFFECT_1 = 0x0C, IPATCH_GIG_DIMENSION_EFFECT_2 = 0x0D, IPATCH_GIG_DIMENSION_GEN_PURPOSE_1 = 0x10, IPATCH_GIG_DIMENSION_GEN_PURPOSE_2 = 0x11, IPATCH_GIG_DIMENSION_GEN_PURPOSE_3 = 0x12, IPATCH_GIG_DIMENSION_GEN_PURPOSE_4 = 0x13, IPATCH_GIG_DIMENSION_SUSTAIN_PEDAL = 0x40, IPATCH_GIG_DIMENSION_PORTAMENTO = 0x41, IPATCH_GIG_DIMENSION_SOSTENUTO = 0x42, IPATCH_GIG_DIMENSION_SOFT_PEDAL = 0x43, IPATCH_GIG_DIMENSION_GEN_PURPOSE_5 = 0x50, IPATCH_GIG_DIMENSION_GEN_PURPOSE_6 = 0x51, IPATCH_GIG_DIMENSION_GEN_PURPOSE_7 = 0x52, IPATCH_GIG_DIMENSION_GEN_PURPOSE_8 = 0x53, IPATCH_GIG_DIMENSION_EFFECT_DEPTH_1 = 0x5B, IPATCH_GIG_DIMENSION_EFFECT_DEPTH_2 = 0x5C, IPATCH_GIG_DIMENSION_EFFECT_DEPTH_3 = 0x5D, IPATCH_GIG_DIMENSION_EFFECT_DEPTH_4 = 0x5E, IPATCH_GIG_DIMENSION_EFFECT_DEPTH_5 = 0x5F, IPATCH_GIG_DIMENSION_CHANNEL = 0x80, /* sample has more than 1 channel */ IPATCH_GIG_DIMENSION_LAYER = 0x81, /* layer up to 8 zones (cross fade 2 or 4) */ IPATCH_GIG_DIMENSION_VELOCITY = 0x82, /* key velocity (only type that allows specific ranges) */ IPATCH_GIG_DIMENSION_AFTER_TOUCH = 0x83, /* channel MIDI after touch */ IPATCH_GIG_DIMENSION_RELEASE_TRIG = 0x84, /* trigger on key release */ IPATCH_GIG_DIMENSION_KEYBOARD = 0x85, /* key switching (FIXME WTF?) */ IPATCH_GIG_DIMENSION_ROUND_ROBIN = 0x86, /* selects zones in sequence */ IPATCH_GIG_DIMENSION_RANDOM = 0x87 /* selects random zone */ } IpatchGigDimensionType; /* maximum value for dimension type */ #define IPATCH_GIG_DIMENSION_TYPE_MAX IPATCH_GIG_DIMENSION_RANDOM #include #include #define IPATCH_TYPE_GIG_DIMENSION (ipatch_gig_dimension_get_type ()) #define IPATCH_GIG_DIMENSION(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_GIG_DIMENSION, \ IpatchGigDimension)) #define IPATCH_GIG_DIMENSION_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_GIG_DIMENSION, \ IpatchGigDimensionClass)) #define IPATCH_IS_GIG_DIMENSION(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_GIG_DIMENSION)) #define IPATCH_IS_GIG_DIMENSION_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_GIG_DIMENSION)) #define IPATCH_GIG_DIMENSION_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_GIG_DIMENSION, \ IpatchGigDimensionClass)) /* GigaSampler dimension (up to 5 per IpatchGigRegion) */ struct _IpatchGigDimension { IpatchItem parent_instance; char *name; /* name of dimension or NULL */ guint8 type; /* dimension type (IpatchGigDimensionType) */ guint8 split_count; /* count of split bits for this dimension */ /* convenience variables (derivable from other info) */ guint8 split_mask; /* sub region index mask */ guint8 split_shift; /* bit shift to first set bit in mask */ }; /* GigaSampler dimension class */ struct _IpatchGigDimensionClass { IpatchItemClass parent_class; }; GType ipatch_gig_dimension_get_type (void); IpatchGigDimension *ipatch_gig_dimension_new (void); IpatchGigDimension *ipatch_gig_dimension_first (IpatchIter *iter); IpatchGigDimension *ipatch_gig_dimension_next (IpatchIter *iter); #endif libinstpatch-1.0.0/libinstpatch/util.h0000644000175000017500000000274711461332142014736 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: util * @short_description: Utility functions * @see_also: * @stability: Stable */ #ifndef __IPATCH_UTIL_H__ #define __IPATCH_UTIL_H__ #include #include extern GValue *ipatch_util_value_bool_true; extern GValue *ipatch_util_value_bool_false; /* a pointer to a constant boolean GValue for TRUE or FALSE depending on input * value. */ #define IPATCH_UTIL_VALUE_BOOL(b) \ ((b) ? ipatch_util_value_bool_true : ipatch_util_value_bool_false) guint ipatch_util_value_hash (GValue *val); guint ipatch_util_value_array_hash (GValueArray *valarray); guint64 ipatch_util_file_size (const char *fname, GError **err); #endif libinstpatch-1.0.0/libinstpatch/IpatchSample.c0000644000175000017500000011457011461332142016324 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include #include /* for g_unlink */ #include "IpatchSample.h" #include "IpatchSndFile.h" #include "IpatchSampleStoreSndFile.h" #include "builtin_enums.h" #include "sample.h" #include "i18n.h" #include "ipatch_priv.h" /* some public loop type arrays for use with IpatchSample interfaces */ int ipatch_sample_loop_types_standard[] = { IPATCH_SAMPLE_LOOP_NONE, IPATCH_SAMPLE_LOOP_STANDARD, IPATCH_SAMPLE_LOOP_TYPE_TERM /* terminator */ }; int ipatch_sample_loop_types_standard_release[] = { IPATCH_SAMPLE_LOOP_NONE, IPATCH_SAMPLE_LOOP_STANDARD, IPATCH_SAMPLE_LOOP_RELEASE, IPATCH_SAMPLE_LOOP_TYPE_TERM /* terminator */ }; static void ipatch_sample_interface_init (IpatchSampleIface *sample_iface); GType ipatch_sample_get_type (void) { static GType itype = 0; if (!itype) { static const GTypeInfo info = { sizeof (IpatchSampleIface), NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc) ipatch_sample_interface_init, (GClassFinalizeFunc) NULL }; itype = g_type_register_static (G_TYPE_INTERFACE, "IpatchSample", &info, 0); g_type_interface_add_prerequisite (itype, IPATCH_TYPE_ITEM); } return (itype); } static void ipatch_sample_interface_init (IpatchSampleIface *sample_iface) { g_object_interface_install_property (sample_iface, ipatch_sample_new_property_param_spec ("sample-data", G_PARAM_READABLE)); g_object_interface_install_property (sample_iface, ipatch_sample_new_property_param_spec ("sample-size", G_PARAM_READABLE)); g_object_interface_install_property (sample_iface, ipatch_sample_new_property_param_spec ("sample-format", G_PARAM_READABLE)); g_object_interface_install_property (sample_iface, ipatch_sample_new_property_param_spec ("sample-rate", G_PARAM_READABLE)); g_object_interface_install_property (sample_iface, ipatch_sample_new_property_param_spec ("loop-type", G_PARAM_READABLE)); g_object_interface_install_property (sample_iface, ipatch_sample_new_property_param_spec ("loop-start", G_PARAM_READABLE)); g_object_interface_install_property (sample_iface, ipatch_sample_new_property_param_spec ("loop-end", G_PARAM_READABLE)); g_object_interface_install_property (sample_iface, ipatch_sample_new_property_param_spec ("root-note", G_PARAM_READABLE)); g_object_interface_install_property (sample_iface, ipatch_sample_new_property_param_spec ("fine-tune", G_PARAM_READABLE)); } /** * ipatch_sample_get_loop_types: * @sample: Object with #IpatchSample interface * * Get an array of supported loop type enums for a sample object. * * Returns: -1 terminated array of #IpatchSampleLoopType values. If no loop * types are supported, then %NULL is returned. Array is internal and should * not be modified or freed. */ int * ipatch_sample_get_loop_types (IpatchSample *sample) { GType type; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), NULL); type = G_OBJECT_TYPE (sample); return (ipatch_sample_type_get_loop_types (type)); } /** * ipatch_sample_type_get_loop_types: * @type: A GType that has a #IpatchItem interface * * Like ipatch_sample_get_loop_types() but retrieves the supported loop types * from an object type rather than an instance of an object. * * Returns: -1 terminated array of #IpatchSampleLoopType values. If no loop * types are supported, then %NULL is returned. Array is internal and should * not be modified or freed. */ int * ipatch_sample_type_get_loop_types (GType type) { GObjectClass *obj_class; IpatchSampleIface *iface; g_return_val_if_fail (g_type_is_a (type, IPATCH_TYPE_SAMPLE), NULL); obj_class = g_type_class_ref (type); iface = g_type_interface_peek (obj_class, IPATCH_TYPE_SAMPLE); g_type_class_unref (obj_class); return (iface->loop_types); } /** * ipatch_sample_set_format: * @sample: Sample to set format of * @format: Sample format to assign to sample (see #IpatchSampleWidth, etc) * * Set sample format of a new sample. Should only be assigned once. Same as * assigning to a sample's "sample-format" property. */ void ipatch_sample_set_format (IpatchSample *sample, int format) { g_return_if_fail (IPATCH_IS_SAMPLE (sample)); g_object_set (sample, "sample-format", format, NULL); } /** * ipatch_sample_get_format: * @sample: Sample to get format of * * Get the sample format of a sample. Same as getting a sample's "sample-format" * property. * * Returns: Sample format integer (see #IpatchSampleWidth, etc). */ int ipatch_sample_get_format (IpatchSample *sample) { int format; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), 0); g_object_get (sample, "sample-format", &format, NULL); return (format); } /** * ipatch_sample_set_size: * @sample: Sample to set size of * @size: Size to assign (in frames) * * Set the size of a sample. Should be done once, and only once when created. */ void ipatch_sample_set_size (IpatchSample *sample, guint size) { g_return_if_fail (IPATCH_IS_SAMPLE (sample)); g_object_set (sample, "sample-size", size, NULL); } /** * ipatch_sample_get_size: * @sample: Sample to get size of * @bytes: Location to store sample size in bytes (size * frame size) or NULL * to ignore * * Get the size of a sample. Same as getting a sample's "sample-size" * property. * * Returns: Sample size (in frames) */ guint ipatch_sample_get_size (IpatchSample *sample, guint *bytes) { guint size; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), 0); g_object_get (sample, "sample-size", &size, NULL); if (bytes) *bytes = size * ipatch_sample_get_frame_size (sample); return (size); } /** * ipatch_sample_get_frame_size: * @sample: Sample to get data frame size of * * A convenience function to get size of a single sample frame for a given * @sample. This is useful for determining buffer allocation sizes when * reading or writing data. * * Returns: Size in bytes of a single sample frame */ int ipatch_sample_get_frame_size (IpatchSample *sample) { g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), 0); return (ipatch_sample_format_size (ipatch_sample_get_format (sample))); } /** * ipatch_sample_get_sample_data: * @sample: Sample to get sample data from * * Get sample data object from a sample. Not every sample object supports this * property, in which case %NULL is returned. * * Returns: Sample data object of the sample or %NULL if not set or unsupported * by this sample type. Caller owns a reference to the returned object. */ IpatchSampleData * ipatch_sample_get_sample_data (IpatchSample *sample) { IpatchSampleData *sampledata; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), NULL); g_object_get (sample, "sample-data", &sampledata, NULL); /* ++ ref */ return (sampledata); /* !! caller takes over ref */ } /** * ipatch_sample_set_sample_data: * @sample: Sample to set sample data of * * Set sample data object of a sample. Not every sample object supports writing * to this property, in which case %FALSE will be returned. * * Returns: %TRUE if the sample supports this property and it was assigned, * %FALSE otherwise. */ gboolean ipatch_sample_set_sample_data (IpatchSample *sample, IpatchSampleData *sampledata) { GParamSpec *pspec; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), FALSE); g_return_val_if_fail (!sampledata || IPATCH_IS_SAMPLE_DATA (sampledata), FALSE); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (sample), "sample-data"); if (!(pspec->flags & G_PARAM_WRITABLE)) return (FALSE); g_object_set (sample, "sample-data", sampledata, NULL); return (TRUE); } /** * ipatch_sample_read: * @sample: Sample to read from * @offset: Offset in frames to read from * @frames: Number of frames to read * @buf: Buffer to store sample data in (should be at least @frames * * sizeof (frame), the frame size can be had from * ipatch_sample_get_frame_size()). * @err: Location to store error info or %NULL * * Read sample data from a sample. This is a convenience function which * opens/reads/closes a #IpatchSampleHandle and is therefore not as efficient * when making multiple accesses. Sample data transform * is also not handled (see ipatch_sample_read_transform()). * * Returns: %TRUE on success, %FALSE on error (in which case * @err may be set). */ gboolean ipatch_sample_read (IpatchSample *sample, guint offset, guint frames, gpointer buf, GError **err) { IpatchSampleHandle handle; gpointer retval; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), FALSE); if (!ipatch_sample_handle_open (sample, &handle, 'r', 0, 0, err)) return (FALSE); retval = ipatch_sample_handle_read (&handle, offset, frames, buf, err); ipatch_sample_handle_close (&handle); return (retval != NULL); } /** * ipatch_sample_write: * @sample: Sample to write to * @offset: Offset in frames to write to * @frames: Number of frames to write * @buf: Buffer of sample data to write (should be at least @frames * * sizeof (frame), the frame size can be had from * ipatch_sample_get_frame_size()). * @err: Location to store error info or %NULL * * Write sample data to a sample. This is a convenience function which * opens/writes/closes a #IpatchSampleHandle and is therefore not as efficient * when making multiple accesses. Sample data transform * is also not handled (see ipatch_sample_write_transform()). * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_sample_write (IpatchSample *sample, guint offset, guint frames, gconstpointer buf, GError **err) { IpatchSampleHandle handle; gboolean retval; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), FALSE); if (!ipatch_sample_handle_open (sample, &handle, 'w', 0, 0, err)) return (FALSE); retval = ipatch_sample_handle_write (&handle, offset, frames, buf, err); ipatch_sample_handle_close (&handle); return (retval); } /** * ipatch_sample_read_transform: * @sample: Sample to read from * @offset: Offset in frames to read from * @frames: Number of frames to read * @buf: Buffer to store sample data in (should be at least @frames * * ipatch_sample_format_size() of @format). * @format: Format to transform sample data to (if its the same as the native * format of @sample no transformation occurs) * @channel_map: Channel mapping if @format is set (set to 0 otherwise), use * #IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel mapping * (see ipatch_sample_get_transform_funcs() for details). * @err: Location to store error info or %NULL * * Like ipatch_sample_read() but allows for sample transformation. * * Returns: %TRUE on success, %FALSE on error (in which case * @err may be set). */ gboolean ipatch_sample_read_transform (IpatchSample *sample, guint offset, guint frames, gpointer buf, int format, guint32 channel_map, GError **err) { IpatchSampleHandle handle; gpointer retval; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), FALSE); if (!ipatch_sample_handle_open (sample, &handle, 'r', format, channel_map, err)) return (FALSE); retval = ipatch_sample_handle_read (&handle, offset, frames, buf, err); ipatch_sample_handle_close (&handle); return (retval != NULL); } /** * ipatch_sample_write_transform: * @sample: Sample to write to * @offset: Offset in frames to write to * @frames: Number of frames to write * @buf: Buffer of sample data to write (should be at least @frames * * ipatch_sample_format_size() of @format). * @format: Format to transform sample data from (if its the same as the native * format of @sample no transformation occurs) * @channel_map: Channel mapping if @format is set (set to 0 otherwise), use * #IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel mapping * (see ipatch_sample_get_transform_funcs() for details). * @err: Location to store error info or %NULL * * Like ipatch_sample_write() but allows for sample transformation. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_sample_write_transform (IpatchSample *sample, guint offset, guint frames, gconstpointer buf, int format, guint32 channel_map, GError **err) { IpatchSampleHandle handle; gboolean retval; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), FALSE); if (!ipatch_sample_handle_open (sample, &handle, 'w', format, channel_map, err)) return (FALSE); retval = ipatch_sample_handle_write (&handle, offset, frames, buf, err); ipatch_sample_handle_close (&handle); return (retval); } /** * ipatch_sample_copy: * @dest_sample: Destination sample to copy data to * @src_sample: Source sample to copy data from * @channel_map: Channel mapping, use #IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 * channel mapping (see ipatch_sample_get_transform_funcs() for details). * @err: Location to store error information or %NULL * * Copy sample data from one sample to another. The two samples may differ * in format, in which case the sample data will be converted. The * @dest_sample must either be the same size in frames as @src_sample or not * yet assigned a size. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_sample_copy (IpatchSample *dest_sample, IpatchSample *src_sample, guint32 channel_map, GError **err) { IpatchSampleHandle dest_handle, src_handle; IpatchSampleTransform *transform; int dest_size, src_size, thissize; gpointer buf; int src_format; int sizeleft, ofs; gboolean retval = FALSE; g_return_val_if_fail (IPATCH_IS_SAMPLE (dest_sample), FALSE); g_return_val_if_fail (IPATCH_IS_SAMPLE (src_sample), FALSE); g_return_val_if_fail (!err || !*err, FALSE); dest_size = ipatch_sample_get_size (dest_sample, NULL); src_size = ipatch_sample_get_size (src_sample, NULL); g_return_val_if_fail (src_size != 0, FALSE); /* If destination size not yet set, assign it */ if (dest_size == 0) { dest_size = src_size; ipatch_sample_set_size (dest_sample, dest_size); } g_return_val_if_fail (dest_size == src_size, FALSE); src_format = ipatch_sample_get_format (src_sample); if (!ipatch_sample_handle_open (dest_sample, &dest_handle, 'w', src_format, channel_map, err)) return (FALSE); if (!ipatch_sample_handle_open (src_sample, &src_handle, 'r', 0, 0, err)) { ipatch_sample_handle_close (&dest_handle); return (FALSE); } transform = ipatch_sample_handle_get_transform (&dest_handle); /* ++ ref */ /* Transform should always be set, since we passed a format to ipatch_sample_handle_open */ g_return_val_if_fail (transform != NULL, FALSE); thissize = ipatch_sample_transform_get_max_frames (transform); ipatch_sample_transform_get_buffers (transform, &buf, NULL); sizeleft = src_size; ofs = 0; while (sizeleft > 0) { if (thissize > sizeleft) thissize = sizeleft; if (!ipatch_sample_handle_read (&src_handle, ofs, thissize, buf, err)) goto err; if (!ipatch_sample_handle_write (&dest_handle, ofs, thissize, buf, err)) goto err; ofs += thissize; sizeleft -= thissize; } retval = TRUE; err: ipatch_sample_handle_close (&src_handle); /* -- close source handle */ ipatch_sample_handle_close (&dest_handle); /* -- close destination handle */ return (retval); } /** * ipatch_sample_save_to_file: * @sample: Sample to save to file * @filename: File name to save to * @file_format: A value from the dynamic GEnum "IpatchSndFileFormat". * @sub_format: A value from the dynamic GEnum "IpatchSndFileSubFormat" or -1 * to calculate optimal value based on the format of @sample. * @err: Location to store error info or %NULL to ignore * * Convenience function to save a sample to a file using libsndfile. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_sample_save_to_file (IpatchSample *sample, const char *filename, int file_format, int sub_format, GError **err) { IpatchSample *store; int channels, samplerate, sample_format; int loop_type, loop_start, loop_end, fine_tune, root_note; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), FALSE); g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); g_object_get (sample, "sample-format", &sample_format, "sample-rate", &samplerate, NULL); channels = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (sample_format); sub_format = ipatch_snd_file_sample_format_to_sub_format (sample_format, file_format); if (sub_format == -1) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_PROGRAM, "Invalid libsndfile format parameters"); return (FALSE); } store = ipatch_sample_store_snd_file_new (filename); /* ++ ref new store */ if (!ipatch_sample_store_snd_file_init_write (IPATCH_SAMPLE_STORE_SND_FILE (store), file_format, sub_format, IPATCH_SND_FILE_ENDIAN_FILE, channels, samplerate)) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_PROGRAM, "Invalid libsndfile format parameters"); g_object_unref (store); /* -- unref store */ return (FALSE); } g_object_get (sample, "loop-type", &loop_type, "loop-start", &loop_start, "loop-end", &loop_end, "root-note", &root_note, "fine-tune", &fine_tune, NULL); g_object_set (store, "loop-type", loop_type, "loop-start", loop_start, "loop-end", loop_end, "root-note", root_note, "fine-tune", fine_tune, NULL); if (!ipatch_sample_copy (store, sample, IPATCH_SAMPLE_UNITY_CHANNEL_MAP, err)) { g_object_unref (store); /* -- unref store */ return (FALSE); } g_object_unref (store); /* -- unref store */ return (TRUE); } /** * ipatch_sample_handle_open: * @sample: Sample to open a handle to * @handle: Caller supplied structure to initialize * @mode: Access mode to sample, 'r' for reading and 'w' for writing * @format: Sample format to convert to/from (0 for no conversion or to assign * a transform object with ipatch_sample_handle_set_transform()). * @channel_map: Channel mapping if @format is set (set to 0 otherwise), use * #IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel mapping * (see ipatch_sample_get_transform_funcs() for details). * @err: Location to store error information * * Open a handle to a sample for reading or writing sample data. Can optionally * provide data conversion if @format is set. If it is desirable to have more * control over the transform object and buffer allocation, the transform object * can be assigned with ipatch_sample_handle_set_transform(). Note that a sample * transform is acquired if @format is set, even if the format is identical to * the @sample format, as a convenience to always provide a data buffer. * * Returns: %TRUE on success, %FALSE on failure (in which case @err may be set) */ gboolean ipatch_sample_handle_open (IpatchSample *sample, IpatchSampleHandle *handle, char mode, int format, guint32 channel_map, GError **err) { IpatchSampleIface *iface; int sample_format; guint size; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), FALSE); g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (mode == 'r' || mode == 'w', FALSE); g_return_val_if_fail (!format || ipatch_sample_format_verify (format), FALSE); /* Verify sample format was set */ g_object_get (sample, "sample-format", &sample_format, NULL); g_return_val_if_fail (ipatch_sample_format_verify (sample_format), FALSE); /* Verify transform formats and channel mapping, if format is set */ if (format) { if (mode == 'r') g_return_val_if_fail (ipatch_sample_format_transform_verify (sample_format, format, channel_map), FALSE); else g_return_val_if_fail (ipatch_sample_format_transform_verify (format, sample_format, channel_map), FALSE); } /* Verify sample size is set */ g_object_get (sample, "sample-size", &size, NULL); g_return_val_if_fail (size != 0, FALSE); memset (handle, 0, sizeof (IpatchSampleHandle)); handle->sample = g_object_ref (sample); /* ++ ref sample interface object */ handle->read_mode = mode == 'r'; handle->format = format ? format : sample_format; handle->channel_map = format ? channel_map : IPATCH_SAMPLE_UNITY_CHANNEL_MAP; /* Was format specified? */ if (format != 0) { /* Acquire sample data transform in the proper direction */ if (handle->read_mode) /* ++ grab transform */ handle->transform = ipatch_sample_transform_pool_acquire (sample_format, format, channel_map); else handle->transform = ipatch_sample_transform_pool_acquire (format, sample_format, channel_map); handle->release_transform = TRUE; /* Indicate that transform came from pool */ } iface = IPATCH_SAMPLE_GET_IFACE (sample); handle->read = iface->read; handle->write = iface->write; handle->close = iface->close; /* call interface open method (if any) */ if (iface->open) { if (iface->open (handle, err)) return (TRUE); /* Error occurred */ if (handle->transform) /* -- release transform */ ipatch_sample_transform_pool_release (handle->transform); g_object_unref (handle->sample); /* -- unref sample */ handle->transform = NULL; handle->sample = NULL; return (FALSE); } else return (TRUE); /* No open method, assume success */ } /** * ipatch_sample_handle_close: * @handle: Sample handle to close * * Close a handle previously opened with ipatch_sample_handle_open(). */ void ipatch_sample_handle_close (IpatchSampleHandle *handle) { IpatchSampleIface *iface; g_return_if_fail (handle != NULL); g_return_if_fail (IPATCH_IS_SAMPLE (handle->sample)); iface = IPATCH_SAMPLE_GET_IFACE (handle->sample); /* call interface close method (if any) */ if (iface->close) iface->close (handle); if (handle->transform) { /* If transform came from pool, release it, unref otherwise (user assigned) */ if (handle->release_transform) ipatch_sample_transform_pool_release (handle->transform); /* -- release transform */ else ipatch_sample_transform_free (handle->transform); /* -- free transform */ } g_object_unref (handle->sample); /* -- unref sample */ handle->transform = NULL; handle->sample = NULL; } /** * ipatch_sample_handle_get_transform: * @handle: Sample handle to get transform from * * Get sample transform from a sample handle. Only exists if sample * data conversion is taking place or even if formats are the same but was * implicitly supplied to ipatch_sample_handle_open(). Transform should not be * modified unless it was assigned via ipatch_sample_handle_set_transform(). * * Returns: Sample transform or %NULL if none. */ IpatchSampleTransform * ipatch_sample_handle_get_transform (IpatchSampleHandle *handle) { g_return_val_if_fail (handle != NULL, NULL); g_return_val_if_fail (IPATCH_IS_SAMPLE (handle->sample), NULL); return (handle->transform); } /** * ipatch_sample_handle_set_transform: * @handle: Sample handle to set transform of * @transform: Transform to assign, source format must match that of * the handle's sample (read mode) or destination format must match (write mode), * can be %NULL to de-activate sample transformation for @handle. * * Assign a sample transform to a sample handle. Provided for added * control over @transform allocation. A transform can also be automatically * created and assigned with ipatch_sample_handle_open(). Sample transform * allocation is taken over by @handle. */ void ipatch_sample_handle_set_transform (IpatchSampleHandle *handle, IpatchSampleTransform *transform) { g_return_if_fail (handle != NULL); g_return_if_fail (!transform || transform->buf1); if (handle->transform) { /* If transform came from pool, release it, free otherwise (user assigned) */ if (handle->release_transform) ipatch_sample_transform_pool_release (handle->transform); /* -- release transform */ else ipatch_sample_transform_free (handle->transform); /* -- free transform */ } if (transform) handle->transform = transform; else handle->transform = NULL; handle->release_transform = FALSE; } /** * ipatch_sample_handle_get_format: * @handle: Sample handle to get format of * * Get the sample format of a sample handle. May differ from the #IpatchSample * format of the handle, if it was opened with a different format and is * therefore being converted. * * Returns: Sample format integer (see #IpatchSampleWidth, etc). */ int ipatch_sample_handle_get_format (IpatchSampleHandle *handle) { g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (IPATCH_IS_SAMPLE (handle->sample), 0); if (handle->transform) return (handle->read_mode ? handle->transform->dest_format : handle->transform->src_format); else return (ipatch_sample_get_format (handle->sample)); } /** * ipatch_sample_handle_get_frame_size: * @handle: Sample handle to get data frame size of * * A convenience function to get size of a single sample frame for a given * sample @handle. This is useful for determining buffer allocation sizes when * reading or writing data. * * Returns: Size in bytes of a single sample frame */ int ipatch_sample_handle_get_frame_size (IpatchSampleHandle *handle) { return (ipatch_sample_format_size (ipatch_sample_handle_get_format (handle))); } /** * ipatch_sample_handle_get_max_frames: * @handle: Sample handle to get max transform frames of * * A convenience function to get the maximum transform frames that can fit * in the sample transform of @handle. * * Returns: Maximum frames that can be read or written using the sample * transform buffers. 0 if no sample transform is assigned. */ guint ipatch_sample_handle_get_max_frames (IpatchSampleHandle *handle) { g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (IPATCH_IS_SAMPLE (handle->sample), 0); if (!handle->transform) return 0; return (ipatch_sample_transform_get_max_frames (handle->transform)); } /** * ipatch_sample_handle_read: * @handle: Sample handle * @offset: Offset in frames to read from * @frames: Number of frames to read * @buf: Buffer to store sample data in (should be at least @frames * * sizeof (frame), the frame size can be had from * ipatch_sample_handle_get_frame_size()). Can be %NULL if transforming * audio data with not more than the maximum frames that can be transformed * at a time, in which case the internal transform buffer pointer will be * returned. * @err: Location to store error info or %NULL * * Read sample data from a sample handle. If the number of * frames read is within the sample transform buffer size and @buf is %NULL * then the transform buffer will be returned (extra copy not needed). * * Returns: Pointer to sample data on success, %NULL on error (in which case * @err may be set). The internal transform buffer will only be returned * if the @buf parameter is %NULL. */ gpointer ipatch_sample_handle_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err) { IpatchSampleTransform *trans; guint readframes, framesize, readbytes; gpointer transbuf, outbuf, bufptr; guint size; g_return_val_if_fail (handle != NULL, NULL); g_return_val_if_fail (IPATCH_IS_SAMPLE (handle->sample), NULL); g_return_val_if_fail (handle->read_mode, NULL); g_return_val_if_fail (!err || !*err, NULL); g_return_val_if_fail (handle->read != NULL, NULL); /* Make sure read does not exceed the sample size */ size = ipatch_sample_get_size (handle->sample, NULL); g_return_val_if_fail (offset + frames <= size, FALSE); trans = handle->transform; if (trans && !handle->manual_transform) /* transforming audio data? */ { readframes = trans->max_frames; transbuf = trans->buf1; /* buffer pointer not supplied? */ if (!buf) { /* extra descriptive for debugging purposes */ g_return_val_if_fail (buf || frames <= readframes, NULL); /* read the sample data */ if (!handle->read (handle, offset, frames, transbuf, err)) return (NULL); /* transform the sample data and return - we done! */ return (ipatch_sample_transform_convert_single (trans, frames)); } bufptr = buf; framesize = ipatch_sample_format_size (trans->dest_format); readbytes = readframes * framesize; while (frames > 0) /* must be transformed in blocks */ { if (readframes > frames) { readframes = frames; readbytes = readframes * framesize; } /* read the sample data */ if (!handle->read (handle, offset, readframes, transbuf, err)) return (NULL); /* transform the sample data */ outbuf = ipatch_sample_transform_convert_single (trans, readframes); /* copy to caller's buffer */ memcpy (bufptr, outbuf, readbytes); frames -= readframes; offset += readframes; bufptr += readbytes; } } else /* not transforming, do it all in one go */ { g_return_val_if_fail (buf != NULL, NULL); if (!handle->read (handle, offset, frames, buf, err)) return (NULL); } return (buf); } /** * ipatch_sample_handle_write: * @handle: Sample handle * @offset: Offset in frames to write to * @frames: Number of frames to write * @buf: Buffer of sample data to write (should be at least @frames * * sizeof (frame), the frame size can be had from * ipatch_sample_handle_get_frame_size()). Can be %NULL, in which case it is * assumed that the sample data has been loaded into the first buffer of the * handle's sample transform. * @err: Location to store error info or %NULL * * Write sample data to a sample handle. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_sample_handle_write (IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err) { IpatchSampleTransform *trans; guint writeframes, framesize, writebytes; gpointer transbuf, outbuf; gconstpointer bufptr; guint size; g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (IPATCH_IS_SAMPLE (handle->sample), FALSE); g_return_val_if_fail (!handle->read_mode, FALSE); g_return_val_if_fail (!err || !*err, FALSE); g_return_val_if_fail (handle->write != NULL, FALSE); /* Make sure write does not exceed the sample size */ size = ipatch_sample_get_size (handle->sample, NULL); g_return_val_if_fail (offset + frames <= size, FALSE); trans = handle->transform; if (trans && !handle->manual_transform) /* transforming audio data? */ { writeframes = trans->max_frames; transbuf = trans->buf1; /* buffer pointer not supplied or its the transform buffer? */ if (!buf || buf == transbuf) { /* extra descriptive for debugging purposes */ g_return_val_if_fail (buf || frames <= writeframes, FALSE); outbuf = ipatch_sample_transform_convert_single (trans, frames); /* write the sample data and return - we's done! */ return (handle->write (handle, offset, frames, outbuf, err)); } bufptr = buf; framesize = ipatch_sample_format_size (trans->src_format); writebytes = writeframes * framesize; while (frames > 0) /* must be transformed in blocks */ { if (writeframes > frames) { writeframes = frames; writebytes = writeframes * framesize; } /* copy the block of sample data to transform */ memcpy (transbuf, bufptr, writebytes); /* transform the sample data */ outbuf = ipatch_sample_transform_convert_single (trans, writeframes); /* write the transformed sample data */ if (!handle->write (handle, offset, writeframes, outbuf, err)) return (FALSE); frames -= writeframes; offset += writeframes; bufptr += writebytes; } } else /* not transforming, do it all in one go */ { g_return_val_if_fail (buf != NULL, FALSE); if (!handle->write (handle, offset, frames, buf, err)) return (FALSE); } return (TRUE); } /** * ipatch_sample_handle_cascade_open: * @handle: Already open handle * @sample: The cascade sample containing the actual data * @err: Location to store error information * * This can be called from #IpatchSampleIface.open methods * for objects which contain a pointer to an #IpatchSample that contains the * sample's data. * * Returns: %TRUE on success, %FALSE on failure (in which case @err may be set) */ gboolean ipatch_sample_handle_cascade_open (IpatchSampleHandle *handle, IpatchSample *sample, GError **err) { IpatchSampleIface *iface; g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), FALSE); iface = IPATCH_SAMPLE_GET_IFACE (sample); g_object_unref (handle->sample); /* -- unref old sample */ handle->sample = g_object_ref (sample); /* ++ ref cascaded sample for new handle */ handle->read = iface->read; handle->write = iface->write; handle->close = iface->close; /* call interface open method (if any) */ if (iface->open) return (iface->open (handle, err)); else return (TRUE); /* No open method, assume success */ } /** * ipatch_sample_install_property: * @oclass: Object class to install #IpatchSample property * @property_id: Property ID for set/get property class method * @property_name: #IpatchSample property name to install * * A helper function for objects that have an #IpatchSample interface. * Installs a #IpatchSample interface property for the given object class. * The parameter will be #G_PARAM_READWRITE. * * Returns: The newly created and installed parameter spec. */ GParamSpec * ipatch_sample_install_property (GObjectClass *oclass, guint property_id, const char *property_name) { GParamSpec *pspec; g_return_val_if_fail (G_IS_OBJECT_CLASS (oclass), NULL); g_return_val_if_fail (property_id != 0, NULL); pspec = ipatch_sample_new_property_param_spec (property_name, G_PARAM_READWRITE); g_return_val_if_fail (pspec != NULL, NULL); g_object_class_install_property (oclass, property_id, pspec); return (pspec); } /** * ipatch_sample_install_property_readonly: * @oclass: Object class to install #IpatchSample property * @property_id: Property ID for set/get property class method * @property_name: #IpatchSample property name to install * * A helper function for objects that have an #IpatchSample interface. * Identical to ipatch_sample_install_property() but installs the property * as readonly and uses g_object_class_override_property() instead of * creating a new #GParamSpec. * * Returns: The newly created and installed parameter spec (GParamSpecOverride). */ GParamSpec * ipatch_sample_install_property_readonly (GObjectClass *oclass, guint property_id, const char *property_name) { g_return_val_if_fail (G_IS_OBJECT_CLASS (oclass), NULL); g_return_val_if_fail (property_id != 0, NULL); g_object_class_override_property (oclass, property_id, property_name); return (g_object_class_find_property (oclass, property_name)); } /** * ipatch_sample_new_property_param_spec: * @property_name: Name of a #IpatchSample property * @flags: Flags to use for the new #GParamSpec * * Seldom used function that creates a new GParamSpec that is identical to * a #IpatchSample property by the name @property_name, except the flags * can differ. * * Returns: New GParamSpec. */ GParamSpec * ipatch_sample_new_property_param_spec (const char *property_name, GParamFlags flags) { if (strcmp (property_name, "sample-data") == 0) return g_param_spec_object ("sample-data", _("Sample data"), _("Sample data"), IPATCH_TYPE_SAMPLE_DATA, flags); else if (strcmp (property_name, "sample-size") == 0) return g_param_spec_uint ("sample-size", _("Size"), _("Size in frames"), 0, G_MAXUINT, 0, flags); else if (strcmp (property_name, "sample-format") == 0) return g_param_spec_int ("sample-format", _("Sample format"), _("Sample format"), 0, G_MAXINT, IPATCH_SAMPLE_FORMAT_DEFAULT, flags); else if (strcmp (property_name, "sample-rate") == 0) return g_param_spec_int ("sample-rate", _("Sample rate"), _("Sampling rate in Hertz"), IPATCH_SAMPLE_RATE_MIN, IPATCH_SAMPLE_RATE_MAX, IPATCH_SAMPLE_RATE_DEFAULT, flags); else if (strcmp (property_name, "loop-type") == 0) return g_param_spec_enum ("loop-type", _("Loop type"), _("Loop method type"), IPATCH_TYPE_SAMPLE_LOOP_TYPE, IPATCH_SAMPLE_LOOP_NONE, flags); else if (strcmp (property_name, "loop-start") == 0) return g_param_spec_uint ("loop-start", _("Loop start"), _("Start of loop in frames"), 0, G_MAXUINT, 0, flags); else if (strcmp (property_name, "loop-end") == 0) return g_param_spec_uint ("loop-end", _("Loop end"), _("Loop end in frames (after loop)"), 0, G_MAXUINT, 0, flags); else if (strcmp (property_name, "root-note") == 0) return g_param_spec_int ("root-note", _("Root note"), _("Root MIDI note"), 0, 127, IPATCH_SAMPLE_ROOT_NOTE_DEFAULT, flags); else if (strcmp (property_name, "fine-tune") == 0) return g_param_spec_int ("fine-tune", _("Fine tuning"), _("Fine tuning in cents"), -99, 99, 0, flags); else return (NULL); } libinstpatch-1.0.0/libinstpatch/IpatchSF2Preset.h0000644000175000017500000000704311461332142016661 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2Preset * @short_description: SoundFont preset object * @see_also: #IpatchSF2 * @stability: Stable * * SoundFont presets are children of #IpatchSF2 objects and define individual * instruments mapped to MIDI bank/program numbers. */ #ifndef __IPATCH_SF2_PRESET_H__ #define __IPATCH_SF2_PRESET_H__ #include #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchSF2Preset IpatchSF2Preset; typedef struct _IpatchSF2PresetClass IpatchSF2PresetClass; #define IPATCH_TYPE_SF2_PRESET (ipatch_sf2_preset_get_type ()) #define IPATCH_SF2_PRESET(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_PRESET, \ IpatchSF2Preset)) #define IPATCH_SF2_PRESET_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_PRESET, \ IpatchSF2PresetClass)) #define IPATCH_IS_SF2_PRESET(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_PRESET)) #define IPATCH_IS_SF2_PRESET_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2_PRESET)) #define IPATCH_SF2_PRESET_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SF2_PRESET, \ IpatchSF2PresetClass)) /* SoundFont preset item */ struct _IpatchSF2Preset { IpatchContainer parent_instance; char *name; /* name of preset */ guint16 program; /* MIDI preset map number */ guint16 bank; /* MIDI bank map number */ GSList *zones; /* list of preset zones */ GSList *mods; /* modulators for global zone */ IpatchSF2GenArray genarray; /* generator array for global zone */ guint32 library; /* Not used (preserved) */ guint32 genre; /* Not used (preserved) */ guint32 morphology; /* Not used (preserved) */ }; struct _IpatchSF2PresetClass { IpatchContainerClass parent_class; }; GType ipatch_sf2_preset_get_type (void); IpatchSF2Preset *ipatch_sf2_preset_new (void); #define ipatch_sf2_preset_get_zones(preset) \ ipatch_container_get_children (IPATCH_CONTAINER (preset), \ IPATCH_TYPE_SF2_ZONE) IpatchSF2Preset *ipatch_sf2_preset_first (IpatchIter *iter); IpatchSF2Preset *ipatch_sf2_preset_next (IpatchIter *iter); void ipatch_sf2_preset_new_zone (IpatchSF2Preset *preset, IpatchSF2Inst *inst); void ipatch_sf2_preset_set_name (IpatchSF2Preset *preset, const char *name); char *ipatch_sf2_preset_get_name (IpatchSF2Preset *preset); void ipatch_sf2_preset_set_midi_locale (IpatchSF2Preset *preset, int bank, int program); void ipatch_sf2_preset_get_midi_locale (IpatchSF2Preset *preset, int *bank, int *program); int ipatch_sf2_preset_compare (const IpatchSF2Preset *p1, const IpatchSF2Preset *p2); #endif libinstpatch-1.0.0/libinstpatch/IpatchSampleData.c0000644000175000017500000007356211461364617017137 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSampleData.h" #include "IpatchSampleStoreCache.h" #include "IpatchSampleStoreRam.h" #include "IpatchSample.h" #include "ipatch_priv.h" #include "builtin_enums.h" enum { PROP_0, PROP_TITLE, PROP_SAMPLE_SIZE, PROP_SAMPLE_FORMAT, PROP_SAMPLE_RATE, PROP_SAMPLE_DATA, PROP_LOOP_TYPE, PROP_LOOP_START, PROP_LOOP_END, PROP_ROOT_NOTE, PROP_FINE_TUNE }; #define OBJECT_REFCOUNT(obj) (((GObject *)(obj))->ref_count) #define OBJECT_REFCOUNT_VALUE(obj) g_atomic_int_get ((gint *)&OBJECT_REFCOUNT (obj)) /* Info structure used to ensure that duplicate sample caching does not occur */ typedef struct { IpatchSampleStore *store; int format; guint32 channel_map; } CachingInfo; static void ipatch_sample_data_sample_iface_init (IpatchSampleIface *iface); static gboolean ipatch_sample_data_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_sample_data_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sample_data_finalize (GObject *gobject); static gint sample_cache_clean_sort (gconstpointer a, gconstpointer b); /* master sample data list and lock */ G_LOCK_DEFINE_STATIC (sample_data_list); static GSList *sample_data_list = NULL; /* Lock for metric variables below */ G_LOCK_DEFINE_STATIC (sample_cache_vars); static guint64 sample_cache_total_size = 0; /* Total size of cached samples */ static guint64 sample_cache_unused_size = 0; /* Size of unused cached samples */ /* Variables used to ensure that duplicate sample caching does not occur */ static GMutex *caching_mutex; static GCond *caching_cond; static GSList *caching_list = NULL; G_DEFINE_TYPE_WITH_CODE (IpatchSampleData, ipatch_sample_data, IPATCH_TYPE_ITEM, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sample_data_sample_iface_init)) /** * ipatch_get_sample_data_list: * * Creates an object list copy of the master sample data list (all * existing sample data objects). * * Returns: New object list populated with all #IpatchSampleData objects * with a reference count of 1 which the caller owns, removing the reference * will free the list. */ IpatchList * ipatch_sample_data_get_list (void) { IpatchList *list; GSList *p; list = ipatch_list_new (); /* ++ ref new list */ G_LOCK (sample_data_list); for (p = sample_data_list; p; p = p->next) { list->items = g_list_prepend (list->items, p->data); g_object_ref (p->data); /* ++ ref object for list */ } G_UNLOCK (sample_data_list); return (list); /* !! caller takes over reference */ } static void ipatch_sample_data_sample_iface_init (IpatchSampleIface *iface) { iface->open = ipatch_sample_data_sample_iface_open; } static gboolean ipatch_sample_data_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchSampleData *sampledata = IPATCH_SAMPLE_DATA (handle->sample); IpatchSample *sample = NULL; gboolean retval; IPATCH_ITEM_RLOCK (sampledata); if (sampledata->samples) sample = g_object_ref (sampledata->samples->data); /* ++ ref */ IPATCH_ITEM_RUNLOCK (sampledata); g_return_val_if_fail (sample != NULL, FALSE); retval = ipatch_sample_handle_cascade_open (handle, sample, err); g_object_unref (sample); /* -- unref sample */ return (retval); } static void ipatch_sample_data_class_init (IpatchSampleDataClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); obj_class->finalize = ipatch_sample_data_finalize; obj_class->get_property = ipatch_sample_data_get_property; g_object_class_override_property (obj_class, PROP_TITLE, "title"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_SIZE, "sample-size"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_FORMAT, "sample-format"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_RATE, "sample-rate"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_DATA, "sample-data"); ipatch_sample_install_property_readonly (obj_class, PROP_LOOP_TYPE, "loop-type"); ipatch_sample_install_property_readonly (obj_class, PROP_LOOP_START, "loop-start"); ipatch_sample_install_property_readonly (obj_class, PROP_LOOP_END, "loop-end"); ipatch_sample_install_property_readonly (obj_class, PROP_ROOT_NOTE, "root-note"); ipatch_sample_install_property_readonly (obj_class, PROP_FINE_TUNE, "fine-tune"); caching_mutex = g_mutex_new (); caching_cond = g_cond_new (); } static void ipatch_sample_data_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSampleData *sampledata = IPATCH_SAMPLE_DATA (object); IpatchSampleStore *store = NULL; IPATCH_ITEM_RLOCK (sampledata); if (sampledata->samples) store = g_object_ref (sampledata->samples->data); /* ++ ref */ IPATCH_ITEM_RUNLOCK (sampledata); g_return_if_fail (store != NULL); switch (property_id) { case PROP_TITLE: g_object_get_property ((GObject *)store, "title", value); break; case PROP_SAMPLE_SIZE: g_value_set_uint (value, ipatch_sample_store_get_size (store)); break; case PROP_SAMPLE_FORMAT: g_value_set_int (value, ipatch_sample_store_get_format (store)); break; case PROP_SAMPLE_RATE: g_value_set_int (value, ipatch_sample_store_get_rate (store)); break; case PROP_SAMPLE_DATA: g_value_set_object (value, sampledata); break; case PROP_LOOP_TYPE: g_object_get_property ((GObject *)store, "loop-type", value); break; case PROP_LOOP_START: g_object_get_property ((GObject *)store, "loop-start", value); break; case PROP_LOOP_END: g_object_get_property ((GObject *)store, "loop-end", value); break; case PROP_ROOT_NOTE: g_object_get_property ((GObject *)store, "root-note", value); break; case PROP_FINE_TUNE: g_object_get_property ((GObject *)store, "fine-tune", value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } g_object_unref (store); /* -- unref store */ } static void ipatch_sample_data_init (IpatchSampleData *sampledata) { /* add to the master list */ G_LOCK (sample_data_list); sample_data_list = g_slist_prepend (sample_data_list, sampledata); G_UNLOCK (sample_data_list); } static void ipatch_sample_data_finalize (GObject *gobject) { IpatchSampleData *sampledata = IPATCH_SAMPLE_DATA (gobject); /* remove from master list */ G_LOCK (sample_data_list); sample_data_list = g_slist_remove (sample_data_list, sampledata); G_UNLOCK (sample_data_list); if (G_OBJECT_CLASS (ipatch_sample_data_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sample_data_parent_class)->finalize (gobject); } /** * ipatch_sample_data_new: * * Create a new sample data object. * * Returns: New sample data with a reference count of 1. Caller owns * the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchSampleData * ipatch_sample_data_new (void) { return (IPATCH_SAMPLE_DATA (g_object_new (IPATCH_TYPE_SAMPLE_DATA, NULL))); } /** * ipatch_sample_data_add: * @sampledata: Sample data object * @store: Sample store to add * * Add a sample to a sample data object. If no samples have yet been added, * then the added sample becomes the native sample. All samples added to a * given @sampledata object must have the same frame count and should also * have the same sample rate. This is not enforced though and is left to the * caller to ensure. */ void ipatch_sample_data_add (IpatchSampleData *sampledata, IpatchSampleStore *store) { g_return_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata)); g_return_if_fail (IPATCH_IS_SAMPLE_STORE (store)); g_object_ref (store); /* ++ ref sample for sampledata object */ /* IpatchSampleData not really a container, just set the store's parent directly */ IPATCH_ITEM (store)->parent = IPATCH_ITEM (sampledata); IPATCH_ITEM_WLOCK (sampledata); sampledata->samples = g_slist_append (sampledata->samples, store); IPATCH_ITEM_WUNLOCK (sampledata); } /** * ipatch_sample_data_remove: * @sampledata: Sample data object * @store: Sample store to remove * * Remove a sample from a sample data object. The native sample should not * be removed from an active sample data object. Use * ipatch_sample_data_replace_native_sample() if replacement is desired. */ void ipatch_sample_data_remove (IpatchSampleData *sampledata, IpatchSampleStore *store) { GSList *p, *prev = NULL; guint size_bytes; g_return_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata)); g_return_if_fail (IPATCH_IS_SAMPLE_STORE (store)); IPATCH_ITEM_WLOCK (sampledata); for (p = sampledata->samples; p; prev = p, p = p->next) { if (p->data == store) { if (prev) prev->next = p->next; else sampledata->samples = p->next; break; } } IPATCH_ITEM_WUNLOCK (sampledata); if (p) { if (IPATCH_IS_SAMPLE_STORE_CACHE (p->data)) { IpatchSampleStoreCache *store = p->data; size_bytes = ipatch_sample_store_get_size_bytes ((IpatchSampleStore *)store); IPATCH_ITEM_RLOCK (store); /* ++ lock store */ /* Recursive lock: store, sample_cache_vars */ G_LOCK (sample_cache_vars); sample_cache_total_size -= size_bytes; /* Only subtract unused size from total unused size, if no opens active */ if (store->open_count == 0) sample_cache_unused_size -= size_bytes; G_UNLOCK (sample_cache_vars); IPATCH_ITEM_RUNLOCK (store); /* -- unlock store */ } g_object_unref (p->data); /* -- unref sample */ g_slist_free_1 (p); } } /** * ipatch_sample_data_replace_native_sample: * @sampledata: Sample data object * @store: Sample store object * * Replace the native sample of a sample data object. This function can be used * even if there are no samples yet, in which case it behaves just like * ipatch_sample_data_add(). */ void ipatch_sample_data_replace_native_sample (IpatchSampleData *sampledata, IpatchSampleStore *store) { IpatchSampleStore *oldsample = NULL; g_return_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata)); g_return_if_fail (IPATCH_IS_SAMPLE_STORE (store)); g_object_ref (store); /* ++ ref sample for sampledata */ /* IpatchSampleData not really a container, just set the store's parent directly */ IPATCH_ITEM (store)->parent = IPATCH_ITEM (sampledata); IPATCH_ITEM_WLOCK (sampledata); if (sampledata->samples) { oldsample = sampledata->samples->data; sampledata->samples->data = store; } else sampledata->samples = g_slist_prepend (sampledata->samples, store); IPATCH_ITEM_WUNLOCK (sampledata); if (oldsample) g_object_unref (oldsample); /* -- unref sample */ } /** * ipatch_sample_data_get_samples: * @sampledata: Sample data object * * Get an object list of samples in a sample data object. The first sample is * the native sample. * * Returns: Newly created list of #IpatchSampleStore objects with a refcount of * 1 which the caller owns. */ IpatchList * ipatch_sample_data_get_samples (IpatchSampleData *sampledata) { IpatchList *list; GSList *p; g_return_val_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata), NULL); list = ipatch_list_new (); /* ++ ref new list */ IPATCH_ITEM_RLOCK (sampledata); for (p = sampledata->samples; p; p = p->next) { g_object_ref (p->data); /* ++ ref object for list */ list->items = g_list_prepend (list->items, p->data); /* Prepend for speed */ } IPATCH_ITEM_RUNLOCK (sampledata); list->items = g_list_reverse (list->items); /* Correct for prepend operation */ return (list); /* !! caller takes over reference */ } /** * ipatch_sample_data_get_size: * @sampledata: Sample data to get size of * * Get the size in frames of the samples in the @sampledata object. * * Returns: Size in frames of stores in sample data. */ guint ipatch_sample_data_get_size (IpatchSampleData *sampledata) { guint size = 0; g_return_val_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata), 0); IPATCH_ITEM_RLOCK (sampledata); if (sampledata->samples) size = ipatch_sample_store_get_size ((IpatchSampleStore *)(sampledata->samples->data)); IPATCH_ITEM_RUNLOCK (sampledata); return (size); } /** * ipatch_sample_data_get_native_sample: * @sampledata: Sample data object * * Get the native sample of a sample data object. * * Returns: Native sample, or %NULL if no native sample in the sample data object, * caller owns a reference. */ IpatchSampleStore * ipatch_sample_data_get_native_sample (IpatchSampleData *sampledata) { IpatchSampleStore *sample = NULL; g_return_val_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata), NULL); IPATCH_ITEM_RLOCK (sampledata); if (sampledata->samples) sample = g_object_ref (sampledata->samples->data); /* ++ ref sample */ IPATCH_ITEM_RUNLOCK (sampledata); return (sample); /* !! caller takes over ref */ } /** * ipatch_sample_data_get_native_format: * @sampledata: Sample data object * * Convenience function to get the sample format of the native sample in a * sample data object. See ipatch_sample_get_format() for more info. * * Returns: Sample format or 0 if @sampledata has no native sample. */ int ipatch_sample_data_get_native_format (IpatchSampleData *sampledata) { IpatchSampleStore *store; int format = 0; g_return_val_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata), 0); IPATCH_ITEM_RLOCK (sampledata); if (sampledata->samples) { store = sampledata->samples->data; format = ipatch_sample_store_get_format (store); } IPATCH_ITEM_RUNLOCK (sampledata); return (format); } /** * ipatch_sample_data_open_native_sample: * @sampledata: Sample data * @handle: Caller supplied structure to initialize * @mode: Access mode to sample, 'r' for reading and 'w' for writing * @format: Sample format to convert to/from (0 for no conversion or to assign * a transform object with ipatch_sample_handle_set_transform()). * @channel_map: Channel mapping if @format is set (set to 0 otherwise), use * #IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel mapping * (see ipatch_sample_get_transform_funcs() for details). * @err: Location to store error information * * A convenience function to open a handle to a @sampledata object's native sample. * See ipatch_sample_handle_open() for more details. This is identical to calling * ipatch_sample_data_get_native_sample() and then ipatch_sample_handle_open() on * the returned sample. * * Returns: %TRUE on success, %FALSE on failure (in which case @err may be set) */ gboolean ipatch_sample_data_open_native_sample (IpatchSampleData *sampledata, IpatchSampleHandle *handle, char mode, int format, guint32 channel_map, GError **err) { IpatchSampleStore *native_sample; g_return_val_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata), FALSE); native_sample = ipatch_sample_data_get_native_sample (sampledata); g_return_val_if_fail (native_sample != NULL, FALSE); return (ipatch_sample_handle_open ((IpatchSample *)native_sample, handle, mode, format, channel_map, err)); } /** * ipatch_sample_data_get_cache_sample: * @sampledata: Sample data object * @format: Sample format of cached sample to convert native sample to * @channel_map: Channel mapping to use for new cached sample when converting * from native format, use #IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel * mapping (see ipatch_sample_get_transform_funcs() for details). * @err: Location to store error information * * Get a cached version, in RAM, of a sample. If an existing cached sample * already exists with the given format and channel map, it is used. Otherwise * a new #IpatchSampleStoreCache sample is created and the native sample is * converted as necessary. If a matching cached sample is currently being * created by another thread, this function will block until it is created and * return it. * * Returns: Cached sample with the given @format for which the caller owns a * reference or %NULL if @sampledata contains no samples or a sample * conversion error occurred (I/O error for example). */ IpatchSampleStore * ipatch_sample_data_get_cache_sample (IpatchSampleData *sampledata, int format, guint32 channel_map, GError **err) { IpatchSampleStore *store; IpatchSample *c_sample; guint size_bytes; GSList *p, *prev = NULL; int src_format; guint32 maskval, src_channel_map; CachingInfo *cinfo; /* Silence gcc (why?) */ CachingInfo *new_cinfo = NULL; int i; g_return_val_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata), NULL); g_return_val_if_fail (!err || !*err, NULL); /* Mask the channel_map by the number of channels in format */ for (i = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format), maskval = 0; i > 0; i--) maskval |= 0x7 << ((i - 1) * 3); channel_map &= ~maskval; try_again: IPATCH_ITEM_WLOCK (sampledata); for (p = sampledata->samples; p; p = p->next) { store = (IpatchSampleStore *)(p->data); if (!IPATCH_IS_SAMPLE_STORE_CACHE (store)) continue; src_format = ipatch_sample_store_get_format (store); src_channel_map = ipatch_sample_store_cache_get_channel_map ((IpatchSampleStoreCache *)store); if (format == src_format && channel_map == src_channel_map) break; } if (!p) { if (sampledata->samples) store = sampledata->samples->data; else store = NULL; } if (store) g_object_ref (store); /* ++ ref the sample */ IPATCH_ITEM_WUNLOCK (sampledata); /* Sample already cached or no samples in sample data object? - Return it or NULL */ if (p || !store) { if (new_cinfo) g_slice_free (CachingInfo, new_cinfo); return (store); /* !! caller takes over reference */ } src_format = ipatch_sample_store_get_format (store); g_return_val_if_fail (ipatch_sample_format_transform_verify (src_format, format, channel_map), NULL); if (!new_cinfo) new_cinfo = g_slice_new (CachingInfo); /* Check if another thread is currently caching the same sample */ g_mutex_lock (caching_mutex); for (p = caching_list; p; p = p->next) { cinfo = p->data; if (cinfo->store == store && cinfo->format == format && cinfo->channel_map == channel_map) break; } if (p) /* Matching cache operation in progress? */ { g_cond_wait (caching_cond, caching_mutex); g_mutex_unlock (caching_mutex); goto try_again; } /* No matching active cache in progress.. - Add it */ new_cinfo->store = store; new_cinfo->format = format; new_cinfo->channel_map = channel_map; caching_list = g_slist_prepend (caching_list, new_cinfo); g_mutex_unlock (caching_mutex); /* Cache the sample outside of lock */ size_bytes = ipatch_sample_store_get_size (store) * ipatch_sample_format_size (format); /* Add to sample_cache_total_size and sample_cache_unused_size too. Do this * before ipatch_sample_copy_below() since it modifies sample_cache_unused_size */ G_LOCK (sample_cache_vars); sample_cache_total_size += size_bytes; sample_cache_unused_size += size_bytes; G_UNLOCK (sample_cache_vars); c_sample = ipatch_sample_store_cache_new (NULL); /* ++ ref new sample */ ipatch_sample_set_format (c_sample, format); ((IpatchSampleStoreCache *)c_sample)->channel_map = channel_map; if (!ipatch_sample_copy (c_sample, (IpatchSample *)store, channel_map, err)) { g_object_unref (c_sample); /* -- unref new sample */ g_object_unref (store); /* -- unref native sample */ c_sample = NULL; goto caching_err; } g_object_unref (store); /* -- unref the native sample */ ipatch_sample_get_size (c_sample, &size_bytes); /* There is a chance that a sample could have been cached by another thread, but this * is unlikely and would just lead to a duplicate cached sample which would * eventually get removed. For the sake of performance we leave out a check * for this. */ g_object_ref (c_sample); /* ++ ref sample for sampledata */ /* IpatchSampleData not really a container, just set the store's parent directly */ IPATCH_ITEM (store)->parent = IPATCH_ITEM (sampledata); IPATCH_ITEM_WLOCK (sampledata); sampledata->samples = g_slist_append (sampledata->samples, c_sample); IPATCH_ITEM_WUNLOCK (sampledata); caching_err: /* If caching operation fails, make sure we remove CachingInfo from list */ g_mutex_lock (caching_mutex); for (p = caching_list; p; prev = p, p = p->next) { cinfo = p->data; if (cinfo->store == store && cinfo->format == format && cinfo->channel_map == channel_map) { if (prev) prev->next = p->next; else caching_list = p->next; break; } } g_mutex_unlock (caching_mutex); g_slice_free (CachingInfo, cinfo); g_slist_free1 (p); return ((IpatchSampleStore *)c_sample); /* !! caller takes over reference */ } /** * ipatch_sample_data_lookup_cache_sample: * @sampledata: Sample data object * @format: Sample format * @channel_map: Channel mapping of cached sample relative to native sample format. * * Like ipatch_sample_data_get_cache_sample() but does not create a new cache * sample if it doesn't exist. * * Returns: Cached sample store with the given @format and @channel_map for * which the caller owns a reference or %NULL if @sampledata does not contain * a matching cached sample. */ IpatchSampleStore * ipatch_sample_data_lookup_cache_sample (IpatchSampleData *sampledata, int format, guint32 channel_map) { IpatchSampleStore *store; int src_format; guint32 maskval, src_channel_map; GSList *p; int i; g_return_val_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata), NULL); g_return_val_if_fail (ipatch_sample_format_verify (format), NULL); /* Mask the channel_map by the number of channels in format */ for (i = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format), maskval = 0; i > 0; i--) maskval |= 0x7 << ((i - 1) * 3); channel_map &= ~maskval; IPATCH_ITEM_WLOCK (sampledata); for (p = sampledata->samples; p; p = p->next) { store = (IpatchSampleStore *)(p->data); if (!IPATCH_IS_SAMPLE_STORE_CACHE (store)) continue; src_format = ipatch_sample_store_get_format (store); src_channel_map = ipatch_sample_store_cache_get_channel_map ((IpatchSampleStoreCache *)store); if (format == src_format && channel_map == src_channel_map) { g_object_ref (store); /* ++ ref sample */ break; } } IPATCH_ITEM_WUNLOCK (sampledata); return (p ? store : NULL); /* !! caller takes over reference */ } /** * ipatch_sample_data_open_cache_sample: * @sampledata: Sample data object * @handle: Caller supplied sample handle to initialize * @format: Sample format * @err: Location to store error information * * Like ipatch_sample_data_get_cache_sample() but opens the resulting cached * sample as a convenience. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_sample_data_open_cache_sample (IpatchSampleData *sampledata, IpatchSampleHandle *handle, int format, guint32 channel_map, GError **err) { IpatchSampleStore *store; gboolean retval; g_return_val_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata), FALSE); g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* ++ ref store */ store = ipatch_sample_data_get_cache_sample (sampledata, format, channel_map, err); if (!store) return (FALSE); retval = ipatch_sample_handle_open (IPATCH_SAMPLE (store), handle, 'r', format, IPATCH_SAMPLE_UNITY_CHANNEL_MAP, err); g_object_unref (store); /* -- unref store */ return (retval); } /** * ipatch_sample_data_cache_clean: * @max_unused_size: Maximum unused cached sample data size (0 to remove all unused samples) * @max_unused_age: Maximum age of unused cached samples in seconds (0 to disable * time based removal), this is the age since they were last in an open state. * * Should be called periodically to release unused cached samples by size and/or * age criteria. */ void ipatch_sample_cache_clean (guint64 max_unused_size, guint max_unused_age) { IpatchSampleData *sampledata; IpatchSampleStoreCache *store; guint64 cur_unused_size; GSList *unused = NULL; GTimeVal time; glong last_open; GSList *p, *p2; if (max_unused_age != 0) g_get_current_time (&time); G_LOCK (sample_cache_vars); /* ++ lock sample data list and variables */ /* Optimize case of no unused samples or not removing by age and unused size does * not exceed max_unused_size */ if (sample_cache_unused_size == 0 || (max_unused_age == 0 && sample_cache_unused_size <= max_unused_size)) { G_UNLOCK (sample_cache_vars); /* -- unlock sample data list and variables */ return; } G_UNLOCK (sample_cache_vars); /* -- unlock sample data list and variables */ G_LOCK (sample_data_list); /* Lock sample data list */ for (p = sample_data_list; p; p = p->next) { sampledata = (IpatchSampleData *)(p->data); IPATCH_ITEM_RLOCK (sampledata); for (p2 = sampledata->samples; p2; p2 = p2->next) { store = (IpatchSampleStoreCache *)(p2->data); if (IPATCH_IS_SAMPLE_STORE_CACHE (store) && ipatch_sample_store_cache_get_open_count (store) == 0) { unused = g_slist_prepend (unused, g_object_ref (store)); /* ++ ref store for list */ g_object_ref (sampledata); /* ++ ref sample data, to guarantee its existence out of lock */ } } IPATCH_ITEM_RUNLOCK (sampledata); } G_UNLOCK (sample_data_list); /* -- unlock sample data list */ /* Sort list by last open age (oldest first) */ unused = g_slist_sort (unused, sample_cache_clean_sort); /* Free samples until criteria no longer matches */ for (p = unused; p; p = p->next) { store = (IpatchSampleStoreCache *)(p->data); IPATCH_ITEM_RLOCK (store); last_open = store->last_open; IPATCH_ITEM_RUNLOCK (store); sampledata = (IpatchSampleData *)(((IpatchItem *)store)->parent); if (last_open == 0) { g_object_unref (sampledata); g_object_unref (store); continue; /* Store got opened since it was added to list? */ } G_LOCK (sample_cache_vars); cur_unused_size = sample_cache_unused_size; G_UNLOCK (sample_cache_vars); /* Once size drops below max_unused_size and max_unused_age is 0 or this * sample was used more recent than max_unused_age - we're done */ if (cur_unused_size <= max_unused_size && (max_unused_age == 0 || time.tv_sec - last_open <= max_unused_age)) break; ipatch_sample_data_remove (sampledata, (IpatchSampleStore *)store); g_object_unref (sampledata); /* -- unref sample data from list */ g_object_unref (store); /* -- unref sample store from list */ } g_slist_free (unused); /* -- free list */ } /* Sort list of unused items by age (oldest to newest) */ static gint sample_cache_clean_sort (gconstpointer a, gconstpointer b) { const IpatchSampleStoreCache *astore = a, *bstore = b; glong alast_open, blast_open; IPATCH_ITEM_RLOCK (astore); alast_open = astore->last_open; IPATCH_ITEM_RUNLOCK (astore); IPATCH_ITEM_RLOCK (bstore); blast_open = bstore->last_open; IPATCH_ITEM_RUNLOCK (bstore); /* In case store got opened since add to list */ if (alast_open == 0) return (1); if (blast_open == 0) return (-1); if (alast_open < blast_open) return (-1); if (alast_open > blast_open) return (1); return (0); } /** * ipatch_sample_data_get_blank: * * Get blank sample data object. Return's a sample data structure * with the minimum amount of data which is blank. Only creates it on * the first call, subsequent calls return the same sample data * object. Therefore it should not be modified. The blank sample data's * reference count has been incremented and should be removed by the * caller with g_object_unref() when finished with it. * * Returns: The blank sample data object. Remember to unref it when not * using it anymore with g_object_unref(). */ IpatchSampleData * ipatch_sample_data_get_blank (void) { static IpatchSampleData *blank_sampledata = NULL; IpatchSample *sample; if (!blank_sampledata) /* blank sampledata already created? */ { blank_sampledata = ipatch_sample_data_new (); /* ++ ref new item */ g_object_ref (blank_sampledata); /* ++ ref for static blank_sampledata */ sample = ipatch_sample_store_ram_get_blank (); ipatch_sample_data_add (blank_sampledata, (IpatchSampleStore *)sample); } else g_object_ref (blank_sampledata); return (blank_sampledata); } /* Function used by IpatchSampleStoreCache.c */ void _ipatch_sample_data_cache_add_unused_size (int size) { G_LOCK (sample_cache_vars); sample_cache_unused_size += size; G_UNLOCK (sample_cache_vars); } libinstpatch-1.0.0/libinstpatch/IpatchSF2Mod.c0000644000175000017500000002443511461332142016135 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Moderal Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Moderal Public License for more details. * * You should have received a copy of the GNU Moderal Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchSF2Mod.h" #include "IpatchSF2Gen.h" #include "ipatch_priv.h" /* default modulators */ static IpatchSF2Mod default_mods[] = { { 0x0502, IPATCH_SF2_GEN_ATTENUATION, 960, 0x0, 0 }, { 0x0102, IPATCH_SF2_GEN_FILTER_CUTOFF, -2400, 0xD02, 0 }, { 0x000D, IPATCH_SF2_GEN_VIB_LFO_TO_PITCH, 50, 0x0, 0 }, { 0x0081, IPATCH_SF2_GEN_VIB_LFO_TO_PITCH, 50, 0x0, 0 }, { 0x0587, IPATCH_SF2_GEN_ATTENUATION, 960, 0x0, 0 }, { 0x028A, IPATCH_SF2_GEN_PAN, 1000, 0x0, 0 }, { 0x058B, IPATCH_SF2_GEN_ATTENUATION, 960, 0x0, 0 }, { 0x00DB, IPATCH_SF2_GEN_REVERB, 200, 0x0, 0 }, { 0x00DD, IPATCH_SF2_GEN_CHORUS, 200, 0x0, 0 } // { 0x020E, InitialPitch WTF?, 12700, 0x0010, 0 }, }; GType ipatch_sf2_mod_get_type (void) { static GType type = 0; if (!type) type = g_boxed_type_register_static ("IpatchSF2Mod", (GBoxedCopyFunc)ipatch_sf2_mod_duplicate, (GBoxedFreeFunc)ipatch_sf2_mod_free); return (type); } GType ipatch_sf2_mod_list_get_type (void) { static GType type = 0; if (!type) type = g_boxed_type_register_static ("IpatchSF2ModList", (GBoxedCopyFunc)ipatch_sf2_mod_list_duplicate, (GBoxedFreeFunc)ipatch_sf2_mod_list_boxed_free); return (type); } /** * ipatch_sf2_mod_new: * * Create a new modulator * * Returns: New modulator */ IpatchSF2Mod * ipatch_sf2_mod_new (void) { return (g_slice_new0 (IpatchSF2Mod)); } /** * ipatch_sf2_mod_free: * @mod: Modulator to free, should not be referenced by any zones. * * Free an #IpatchSF2Mod structure */ void ipatch_sf2_mod_free (IpatchSF2Mod *mod) { g_return_if_fail (mod != NULL); g_slice_free (IpatchSF2Mod, mod); } /** * ipatch_sf2_mod_duplicate: * @mod: Modulator to duplicate * * Duplicate a modulator * * Returns: New duplicate modulator */ IpatchSF2Mod * ipatch_sf2_mod_duplicate (const IpatchSF2Mod *mod) { IpatchSF2Mod *newmod; g_return_val_if_fail (mod != NULL, NULL); newmod = ipatch_sf2_mod_new (); newmod->src = mod->src; newmod->dest = mod->dest; newmod->amount = mod->amount; newmod->amtsrc = mod->amtsrc; newmod->trans = mod->trans; return (newmod); } /** * ipatch_sf2_mod_list_duplicate: * @list: Modulator list to duplicate * * Duplicates a modulator list (GSList and modulator data). * * Returns: New duplicate modulator list which should be freed with * ipatch_sf2_mod_list_free() with @free_mods set to %TRUE when finished with it. */ GSList * ipatch_sf2_mod_list_duplicate (const GSList *list) { GSList *newlist = NULL; while (list) { newlist = g_slist_prepend (newlist, ipatch_sf2_mod_duplicate ((IpatchSF2Mod *)(list->data))); list = list->next; } newlist = g_slist_reverse (newlist); return (newlist); } /** * ipatch_sf2_mod_list_override: * @alist: First modulator list * @blist: Second modulator list * @copy: If %TRUE then modulator data is duplicated * * Creates a new modulator list by combining @alist and @blist. Modulators * in @blist override identical modulators in @alist. If @copy is set then * the modulator data is also duplicated (a new GSList is created). * * Returns: New GSList of combined modulator lists. Should be freed with * ipatch_sf2_mod_list_free() with the free_mods parameter set to the value of * @copy. */ GSList * ipatch_sf2_mod_list_override (const GSList *alist, const GSList *blist, gboolean copy) { GSList *newlist, *bcopy, *p; IpatchSF2Mod *amod, *bmod; if (copy) newlist = ipatch_sf2_mod_list_duplicate (blist); else newlist = g_slist_copy ((GSList *)blist); if (!newlist) /* optimize for empty blist */ { if (copy) return (ipatch_sf2_mod_list_duplicate (alist)); else return (g_slist_copy ((GSList *)alist)); } bcopy = newlist; while (alist) /* loop over alist */ { amod = (IpatchSF2Mod *)(alist->data); p = bcopy; while (p) { bmod = (IpatchSF2Mod *)(p->data); if (IPATCH_SF2_MOD_ARE_IDENTICAL (amod, bmod)) break; p = p->next; } if (!p) /* no duplicate found? */ newlist = g_slist_prepend (newlist, copy ? ipatch_sf2_mod_duplicate (amod) : amod); alist = alist->next; } return (newlist); } /** * ipatch_sf2_mod_list_offset: * @alist: First modulator list * @blist: Second modulator list * * Creates a new modulator list by combining @list and @blist. Modulators * in @blist offset (amounts are added) identical modulators in @alist. * Operation is non-destructive as a new list is created and modulator data * is duplicated. * * NOTE: Optimized for empty @blist. * * Returns: New GSList of combined modulator lists. Should be freed with * ipatch_sf2_mod_list_free() with @free_mods set to %TRUE when finished with it. */ GSList * ipatch_sf2_mod_list_offset (const GSList *alist, const GSList *blist) { GSList *newlist, *acopy, *p; IpatchSF2Mod *amod, *bmod; int add; newlist = ipatch_sf2_mod_list_duplicate (alist); if (!blist) return (newlist); /* optimize for empty blist */ acopy = newlist; while (blist) /* loop over alist */ { bmod = (IpatchSF2Mod *)(blist->data); p = acopy; while (p) { amod = (IpatchSF2Mod *)(p->data); if (IPATCH_SF2_MOD_ARE_IDENTICAL (amod, bmod)) { /* offset (add) the modulator amount */ add = amod->amount + bmod->amount; add = CLAMP (add, -32768, 32767); amod->amount = add; break; } p = p->next; } /* no duplicate found? */ if (!p) newlist = g_slist_prepend (newlist, ipatch_sf2_mod_duplicate (bmod)); blist = blist->next; } return (newlist); } /** * ipatch_sf2_mod_list_free: * @list: Modulator list to free * @free_mods: If %TRUE then the modulators themselves are freed, %FALSE * makes this function act just like g_slist_free() (only the list is * freed not the modulators). * * Free a list of modulators */ void ipatch_sf2_mod_list_free (GSList *list, gboolean free_mods) { GSList *p; if (free_mods) { p = list; while (p) { ipatch_sf2_mod_free ((IpatchSF2Mod *)(p->data)); p = g_slist_delete_link (p, p); } } else g_slist_free (list); } /** * ipatch_sf2_mod_list_free: * @list: Modulator list to free * * Like ipatch_sf2_mod_list_free() but used for boxed type declaration and so * therefore frees all modulators in the list. */ void ipatch_sf2_mod_list_boxed_free (GSList *list) { ipatch_sf2_mod_list_free (list, TRUE); } /** * ipatch_sf2_mod_list_insert: * @mods: Modulator list to insert into * @modvals: Modulator values to insert (a new modulator is created and the values * are copied to it) * @pos: Index position in zone's modulator list to insert * (0 = first, < 0 = last) * * Inserts a modulator into a modulator list. Does not check for * duplicates! The modulator is not used directly, a new one is created and * the values in @mod are copied to it. * * Returns: New start (root) of @mods list. */ GSList * ipatch_sf2_mod_list_insert (GSList *mods, const IpatchSF2Mod *modvals, int pos) { IpatchSF2Mod *newmod; g_return_val_if_fail (modvals != NULL, mods); newmod = ipatch_sf2_mod_duplicate (modvals); return (g_slist_insert (mods, newmod, pos)); } /** * ipatch_sf2_mod_list_remove: * @mods: Modulator list to remove from * @modvals: Values of modulator to remove * @changed: Pointer to store bool of whether the list was changed * (%NULL to ignore) * * Remove a modulator from a modulator list. The modulator values in @modvals * are used to search the modulator list. The first modulator * that matches all fields in @modvals is removed. */ GSList * ipatch_sf2_mod_list_remove (GSList *mods, const IpatchSF2Mod *modvals, gboolean *changed) { IpatchSF2Mod *mod; GSList *p, *prev = NULL; if (changed) *changed = FALSE; g_return_val_if_fail (modvals != NULL, mods); for (p = mods; p; prev = p, p = g_slist_next (p)) { mod = (IpatchSF2Mod *)(p->data); if (IPATCH_SF2_MOD_ARE_IDENTICAL_AMOUNT (mod, modvals)) { ipatch_sf2_mod_free (mod); if (changed) *changed = TRUE; return (g_slist_delete_link (mods, p)); } } return (mods); } /** * ipatch_sf2_mod_list_change: * @mods: Modulator list to change a modulator in * @oldvals: Current values of modulator to set * @newvals: New modulator values * * Sets the values of an existing modulator in a modulator list. The list * is searched for a modulator that matches the values in @oldvals. If a * modulator is found its values are set to those in @newvals. If it is not * found, nothing is done. * * Returns: %TRUE if changed, %FALSE otherwise (no match) */ gboolean ipatch_sf2_mod_list_change (GSList *mods, const IpatchSF2Mod *oldvals, const IpatchSF2Mod *newvals) { IpatchSF2Mod *mod; GSList *p; g_return_val_if_fail (oldvals != NULL, FALSE); g_return_val_if_fail (newvals != NULL, FALSE); for (p = mods; p; p = p->next) { mod = (IpatchSF2Mod *)(p->data); if (IPATCH_SF2_MOD_ARE_IDENTICAL_AMOUNT (mod, oldvals)) { *mod = *newvals; /* replace values in modulator */ return (TRUE); } } return (FALSE); } /** * ipatch_sf2_mod_list_get_default: * * Get the list of default instrument modulators. * * Returns: The list of default modulators. The same modulator list is * returned on subsequent calls and should not be modified or freed. */ G_CONST_RETURN GSList * ipatch_sf2_mod_list_get_default (void) { static GSList *list = NULL; int i; if (!list) for (i = sizeof (default_mods) / sizeof (IpatchSF2Mod) - 1; i >= 0 ; i--) list = g_slist_prepend (list, &default_mods[i]); return (list); } libinstpatch-1.0.0/libinstpatch/IpatchVBank.c0000644000175000017500000003620611461332142016103 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include #include "IpatchVBank.h" #include "IpatchParamProp.h" #include "i18n.h" #include "misc.h" /* !! Keep synchronized with IPATCH_VBANK_INFO_COUNT constant in IpatchVBank.h */ enum { PROP_0, PROP_PARSER_VERSION, /* IVBank version of parser which wrote the file */ PROP_REQUIRE_VERSION, /* IVBank parser version required */ PROP_ENGINE, /* Sound engine "FluidSynth 1.0.x" for example */ PROP_NAME, /* Descriptive name of bank */ PROP_DATE, /* Creation date */ PROP_AUTHOR, /* Author */ PROP_COMMENT /* Comments */ }; static void ipatch_vbank_finalize (GObject *gobject); static void ipatch_vbank_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_vbank_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_vbank_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static const GType *ipatch_vbank_container_child_types (void); static gboolean ipatch_vbank_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type); static void ipatch_vbank_container_make_unique (IpatchContainer *container, IpatchItem *item); static void ipatch_vbank_base_find_unused_locale (IpatchBase *base, int *bank, int *program, const IpatchItem *exclude, gboolean percussion); static int locale_gcompare_func (gconstpointer a, gconstpointer b); static IpatchItem * ipatch_vbank_base_find_item_by_locale (IpatchBase *base, int bank, int program); G_DEFINE_TYPE (IpatchVBank, ipatch_vbank, IPATCH_TYPE_BASE); static GType vbank_child_types[2] = { 0 }; static void ipatch_vbank_class_init (IpatchVBankClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS (klass); IpatchBaseClass *base_class = IPATCH_BASE_CLASS (klass); obj_class->finalize = ipatch_vbank_finalize; obj_class->get_property = ipatch_vbank_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_vbank_set_property; item_class->copy = ipatch_vbank_item_copy; container_class->child_types = ipatch_vbank_container_child_types; container_class->init_iter = ipatch_vbank_container_init_iter; container_class->make_unique = ipatch_vbank_container_make_unique; base_class->find_unused_locale = ipatch_vbank_base_find_unused_locale; base_class->find_item_by_locale = ipatch_vbank_base_find_item_by_locale; g_object_class_override_property (obj_class, PROP_NAME, "title"); g_object_class_install_property (obj_class, PROP_PARSER_VERSION, g_param_spec_string ("parser-version", _("Parser version"), _("Parser version"), IPATCH_VBANK_PARSER_VERSION, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_REQUIRE_VERSION, g_param_spec_string ("require-version", _("Require version"), _("Required parser version"), IPATCH_VBANK_PARSER_VERSION, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_ENGINE, ipatch_param_set (g_param_spec_string ("engine", _("Engine"), _("Synthesis engine"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL)); g_object_class_install_property (obj_class, PROP_NAME, ipatch_param_set (g_param_spec_string ("name", _("Name"), _("Descriptive name"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL)); g_object_class_install_property (obj_class, PROP_DATE, ipatch_param_set (g_param_spec_string ("date", _("Date"), _("Creation date"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL)); g_object_class_install_property (obj_class, PROP_AUTHOR, ipatch_param_set (g_param_spec_string ("author", _("Author"), _("Author of file"), NULL, G_PARAM_READWRITE), "string-max-length", 255, NULL)); g_object_class_install_property (obj_class, PROP_COMMENT, ipatch_param_set (g_param_spec_string ("comment", _("Comments"), _("Comments"), NULL, G_PARAM_READWRITE), "string-max-length", 65535, NULL)); vbank_child_types[0] = IPATCH_TYPE_VBANK_INST; } static void ipatch_vbank_init (IpatchVBank *vbank) { g_object_set (vbank, "name", _(IPATCH_BASE_DEFAULT_NAME), NULL); ipatch_item_clear_flags (IPATCH_ITEM (vbank), IPATCH_BASE_CHANGED); } /* function called when VBank is being destroyed */ static void ipatch_vbank_finalize (GObject *gobject) { IpatchVBank *vbank = IPATCH_VBANK (gobject); int i; IPATCH_ITEM_WLOCK (vbank); for (i = 0; i < IPATCH_VBANK_INFO_COUNT; i++) g_free (vbank->info[i]); IPATCH_ITEM_WUNLOCK (vbank); if (G_OBJECT_CLASS (ipatch_vbank_parent_class)->finalize) G_OBJECT_CLASS (ipatch_vbank_parent_class)->finalize (gobject); } static void ipatch_vbank_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchVBank *vbank = IPATCH_VBANK (object); if (property_id > PROP_0 && property_id <= IPATCH_VBANK_INFO_COUNT) { g_free (vbank->info[property_id - 1]); vbank->info[property_id - 1] = g_value_dup_string (value); /* need to do a title property notify? */ if (property_id == PROP_NAME) ipatch_item_prop_notify ((IpatchItem *)vbank, ipatch_item_pspec_title, value, NULL); } else G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } static void ipatch_vbank_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchVBank *vbank = IPATCH_VBANK (object); if (property_id > PROP_0 && property_id <= IPATCH_VBANK_INFO_COUNT) g_value_set_string (value, vbank->info[property_id - 1]); else G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } /* item copy function, note that this is an #IpatchBase derived object, so link_func is not used */ static void ipatch_vbank_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchVBank *src_vbank, *dest_vbank; IpatchItem *newitem; GSList *p; int i; src_vbank = IPATCH_VBANK (src); dest_vbank = IPATCH_VBANK (dest); IPATCH_ITEM_RLOCK (src_vbank); if (IPATCH_BASE (src_vbank)->file) ipatch_base_set_file (IPATCH_BASE (dest_vbank), IPATCH_BASE (src_vbank)->file); /* duplicate the info variables */ for (i = 0; i < IPATCH_VBANK_INFO_COUNT; i++) dest_vbank->info[i] = g_strdup (src_vbank->info[i]); /* duplicate instruments */ for (p = src_vbank->insts; p; p = p->next) { /* ++ ref new duplicate instrument, !! inst list takes it over */ newitem = ipatch_item_duplicate ((IpatchItem *)(p->data)); dest_vbank->insts = g_slist_prepend (dest_vbank->insts, newitem); ipatch_item_set_parent (newitem, IPATCH_ITEM (dest_vbank)); } IPATCH_ITEM_RUNLOCK (src_vbank); dest_vbank->insts = g_slist_reverse (dest_vbank->insts); } static const GType * ipatch_vbank_container_child_types (void) { return (vbank_child_types); } /* container is locked by caller */ static gboolean ipatch_vbank_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type) { IpatchVBank *vbank = IPATCH_VBANK (container); if (g_type_is_a (type, IPATCH_TYPE_VBANK_INST)) ipatch_iter_GSList_init (iter, &vbank->insts); else { g_critical ("Invalid child type '%s' for parent of type '%s'", g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); return (FALSE); } return (TRUE); } static void ipatch_vbank_container_make_unique (IpatchContainer *container, IpatchItem *item) { IpatchVBank *vbank = IPATCH_VBANK (container); char *name, *newname; IPATCH_ITEM_WLOCK (vbank); if (IPATCH_IS_VBANK_INST (item)) { int bank, newbank, program, newprogram; ipatch_vbank_inst_get_midi_locale (IPATCH_VBANK_INST (item), &bank, &program); newbank = bank; newprogram = program; ipatch_base_find_unused_midi_locale (IPATCH_BASE (vbank), &newbank, &newprogram, item, FALSE); if (bank != newbank || program != newprogram) ipatch_vbank_inst_set_midi_locale (IPATCH_VBANK_INST (item), newbank, newprogram); } else { g_critical ("Invalid child type '%s' for IpatchVBank object", g_type_name (G_TYPE_FROM_INSTANCE (item))); return; } g_object_get (item, "name", &name, NULL); newname = ipatch_vbank_make_unique_name (vbank, name, NULL); if (!name || strcmp (name, newname) != 0) g_object_set (item, "name", newname, NULL); IPATCH_ITEM_WUNLOCK (vbank); g_free (name); g_free (newname); } /* base method to find an unused MIDI bank:program locale */ static void ipatch_vbank_base_find_unused_locale (IpatchBase *base, int *bank, int *program, const IpatchItem *exclude, gboolean percussion) { IpatchVBank *vbank = IPATCH_VBANK (base); GSList *locale_list = NULL; IpatchVBankInst *inst; GSList *p; int b, n; /* Stores current bank and program number */ guint lbank, lprogram; /* fill array with bank and program numbers */ IPATCH_ITEM_RLOCK (vbank); for (p = vbank->insts; p; p = p->next) { inst = (IpatchVBankInst *)(p->data); /* only add to locale list if not the exclude item */ if ((gpointer)inst != (gpointer)exclude) locale_list = g_slist_prepend (locale_list, GUINT_TO_POINTER (((guint32)inst->bank << 16) | inst->program)); } IPATCH_ITEM_RUNLOCK (vbank); if (!locale_list) return; locale_list = g_slist_sort (locale_list, (GCompareFunc)locale_gcompare_func); b = *bank; n = *program; /* loop through sorted list of bank:programs */ p = locale_list; while (p) { lprogram = GPOINTER_TO_UINT (p->data); lbank = lprogram >> 16; lprogram &= 0xFFFF; if (lbank > b || (lbank == b && lprogram > n)) break; if (lbank >= b) { if (++n > 127) { n = 0; b++; } } p = g_slist_delete_link (p, p); /* delete and advance */ } *bank = b; *program = n; if (p) g_slist_free (p); /* free remainder of list */ } /* function used to do a temporary sort on preset list for ipatch_vbank_base_find_unused_locale */ static int locale_gcompare_func (gconstpointer a, gconstpointer b) { return (GPOINTER_TO_UINT (a) - GPOINTER_TO_UINT (b)); } static IpatchItem * ipatch_vbank_base_find_item_by_locale (IpatchBase *base, int bank, int program) { IpatchVBankInst *inst; inst = ipatch_vbank_find_inst (IPATCH_VBANK (base), NULL, bank, program, NULL); return ((IpatchItem *)inst); } /** * ipatch_vbank_new: * * Create a new virtual bank base object. * * Returns: New IVBank base object with a reference count of 1. Caller * owns the reference and removing it will destroy the item. */ IpatchVBank * ipatch_vbank_new (void) { return (IPATCH_VBANK (g_object_new (IPATCH_TYPE_VBANK, NULL))); } /** * ipatch_vbank_find_inst: * @vbank: VBank to search in * @name: Name of instrument to find or %NULL to match any name * @bank: MIDI bank number of instrument to search for or -1 to not search by * MIDI bank:program numbers * @program: MIDI program number of instrument to search for, only used * if @bank is 0-128 * @exclude: An instrument to exclude from the search or %NULL * * Find an instrument by name or bank:preset MIDI numbers. If instrument @name * and @bank:@program are specified then match for either condition. * If an instrument is found its reference count is incremented before it * is returned. The caller is responsible for removing the reference * with g_object_unref() when finished with it. * * Returns: The matching instrument or %NULL if not found. Remember to unref * the item when finished with it. */ IpatchVBankInst * ipatch_vbank_find_inst (IpatchVBank *vbank, const char *name, int bank, int program, const IpatchVBankInst *exclude) { IpatchVBankInst *inst; gboolean bynum = FALSE; GSList *p; g_return_val_if_fail (IPATCH_IS_VBANK (vbank), NULL); /* if bank and program are valid, then search by number */ if (bank >= 0 && bank <= 128 && program >= 0 && program < 128) bynum = TRUE; IPATCH_ITEM_RLOCK (vbank); for (p = vbank->insts; p; p = p->next) { inst = (IpatchVBankInst *)(p->data); IPATCH_ITEM_RLOCK (inst); /* MT - Recursive LOCK */ if (inst != exclude /* if exclude is NULL it will never == pset */ && ((bynum && inst->bank == bank && inst->program == program) || (name && strcmp (inst->name, name) == 0))) { g_object_ref (inst); IPATCH_ITEM_RUNLOCK (inst); IPATCH_ITEM_RUNLOCK (vbank); return (inst); } IPATCH_ITEM_RUNLOCK (inst); } IPATCH_ITEM_RUNLOCK (vbank); return (NULL); } /* In theory there is still a chance of duplicates if another item's name is set to the generated unique one (by another thread) while in this routine */ /** * ipatch_vbank_make_unique_name: * @vbank: VBank item * @name: An initial name to use or NULL * @exclude: An item to exclude from search or NULL * * Generates a unique instrument name for @vbank. The @name * parameter is used as a base and is modified, by appending a number, to * make it unique (if necessary). The @exclude parameter is used to exclude * an existing @vbank instrument from the search. * * MT-Note: To ensure that an item is actually unique before being * added to a VBank object, ipatch_container_add_unique() should be * used. * * Returns: A new unique name which should be freed when finished with it. */ char * ipatch_vbank_make_unique_name (IpatchVBank *vbank, const char *name, const IpatchVBankInst *exclude) { char curname[IPATCH_VBANK_INST_NAME_SIZE + 1]; IpatchVBankInst *inst; int count = 2; GSList *p; g_return_val_if_fail (IPATCH_IS_VBANK (vbank), NULL); if (!name) name = _("New Instrument"); g_strlcpy (curname, name, sizeof (curname)); IPATCH_ITEM_RLOCK (vbank); /* check for duplicate */ for (p = vbank->insts; p; p = p->next) { inst = (IpatchVBankInst *)(p->data); IPATCH_ITEM_RLOCK (inst); /* MT - Recursive LOCK */ if (p->data != exclude && strcmp (inst->name, curname) == 0) { /* duplicate name */ IPATCH_ITEM_RUNLOCK (inst); ipatch_strconcat_num (name, count++, curname, sizeof (curname)); p = vbank->insts; /* start over */ continue; } IPATCH_ITEM_RUNLOCK (inst); } IPATCH_ITEM_RUNLOCK (vbank); return (g_strdup (curname)); } libinstpatch-1.0.0/libinstpatch/IpatchConvert_DLS2.c0000644000175000017500000001366211461332142017307 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "misc.h" #include "IpatchConvert_DLS2.h" #include "IpatchConverter.h" #include "IpatchConverter_priv.h" #include "IpatchDLSFile.h" #include "IpatchDLS2.h" #include "IpatchDLSReader.h" #include "IpatchDLSWriter.h" #include "IpatchSampleData.h" #include "IpatchSampleStoreSndFile.h" #include "IpatchSample.h" #include "IpatchBase.h" #include "IpatchFile.h" #include "IpatchSndFile.h" #include "i18n.h" /* init routine for DLS conversion types */ void _ipatch_convert_DLS2_init (void) { g_type_class_ref (IPATCH_TYPE_CONVERTER_DLS2_TO_FILE); g_type_class_ref (IPATCH_TYPE_CONVERTER_FILE_TO_DLS2); g_type_class_ref (IPATCH_TYPE_CONVERTER_FILE_TO_DLS2_SAMPLE); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_DLS2_TO_FILE, 0, IPATCH_TYPE_DLS2, 0, 1, IPATCH_TYPE_DLS_FILE, IPATCH_TYPE_FILE, 1); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_FILE_TO_DLS2, 0, IPATCH_TYPE_DLS_FILE, IPATCH_TYPE_FILE, 1, IPATCH_TYPE_DLS2, IPATCH_TYPE_BASE, 0); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_FILE_TO_DLS2_SAMPLE, 0, IPATCH_TYPE_SND_FILE, IPATCH_TYPE_FILE, 1, IPATCH_TYPE_DLS2_SAMPLE, 0, 1); } static gboolean _dls2_to_file_convert (IpatchConverter *converter, GError **err) { IpatchDLS2 *dls; IpatchFile *file; IpatchFileHandle *handle; IpatchDLSWriter *writer; int retval; dls = IPATCH_DLS2 (IPATCH_CONVERTER_INPUT (converter)); file = IPATCH_FILE (IPATCH_CONVERTER_OUTPUT (converter)); handle = ipatch_file_open (IPATCH_FILE (file), NULL, "w", err); if (!handle) return (FALSE); writer = ipatch_dls_writer_new (handle, dls); /* ++ ref new writer */ retval = ipatch_dls_writer_save (writer, err); g_object_unref (writer); /* -- unref writer */ return (retval); } static gboolean _file_to_dls2_convert (IpatchConverter *converter, GError **err) { IpatchDLS2 *dls; IpatchDLSFile *file; IpatchFileHandle *handle; IpatchDLSReader *reader; file = IPATCH_DLS_FILE (IPATCH_CONVERTER_INPUT (converter)); handle = ipatch_file_open (IPATCH_FILE (file), NULL, "r", err); if (!handle) return (FALSE); reader = ipatch_dls_reader_new (handle); /* ++ ref new reader */ dls = ipatch_dls_reader_load (reader, err); /* ++ ref loaded DLS object */ g_object_unref (reader); /* -- unref reader */ if (dls) { ipatch_converter_add_output (converter, G_OBJECT (dls)); g_object_unref (dls); /* -- unref loaded DLS object */ return (TRUE); } else return (FALSE); } /* also used by IpatchConvert_Gig.c */ gboolean _file_to_dls2_sample_convert (IpatchConverter *converter, GError **err) { IpatchSndFile *file; IpatchDLS2Sample *dls2sample; IpatchSampleStoreSndFile *store; IpatchSampleData *sampledata; int format, rate, loop_type, root_note, fine_tune; guint length, loop_start, loop_end; char *filename, *title; file = IPATCH_SND_FILE (IPATCH_CONVERTER_INPUT (converter)); dls2sample = IPATCH_DLS2_SAMPLE (IPATCH_CONVERTER_OUTPUT (converter)); filename = ipatch_file_get_name (IPATCH_FILE (file)); /* ++ alloc file name */ if (!filename) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_PROGRAM, _("Sample file object must have a file name")); return (FALSE); } store = IPATCH_SAMPLE_STORE_SND_FILE (ipatch_sample_store_snd_file_new (filename)); /* ++ ref store */ if (!ipatch_sample_store_snd_file_init_read (store)) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNSUPPORTED, _("Sample file '%s' is invalid or unsupported"), filename); g_object_unref (store); /* -- unref store */ g_free (filename); /* -- free filename */ return (FALSE); } g_free (filename); /* -- free filename */ g_object_get (store, "title", &title, /* ++ alloc title */ "sample-size", &length, "sample-format", &format, "sample-rate", &rate, "loop-type", &loop_type, "loop-start", &loop_start, "loop-end", &loop_end, "root-note", &root_note, "fine-tune", &fine_tune, NULL); if (length < 4) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, _("Sample '%s' is too small"), title ? title : _("")); g_free (title); /* -- free title */ g_object_unref (store); /* -- unref store */ return (FALSE); } sampledata = ipatch_sample_data_new (); /* ++ ref sampledata */ ipatch_sample_data_add (sampledata, IPATCH_SAMPLE_STORE (store)); g_object_unref (store); /* -- unref store */ g_object_set (dls2sample, "name", title, "sample-data", sampledata, "sample-rate", rate, "root-note", (root_note != -1) ? root_note : 60, "fine-tune", fine_tune, "loop-start", loop_start, "loop-end", loop_end, NULL); g_object_unref (sampledata); /* -- unref sampledata */ g_free (title); /* -- free title */ return (TRUE); } CONVERTER_CLASS_INIT (dls2_to_file); CONVERTER_CLASS_INIT (file_to_dls2); CONVERTER_CLASS_INIT(file_to_dls2_sample); CONVERTER_GET_TYPE (dls2_to_file, DLS2ToFile); CONVERTER_GET_TYPE (file_to_dls2, FileToDLS2); CONVERTER_GET_TYPE (file_to_dls2_sample, FileToDLS2Sample); libinstpatch-1.0.0/libinstpatch/IpatchGigFile.c0000644000175000017500000000564011461332142016406 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchGigFile.h" #include "i18n.h" #include "misc.h" static gboolean ipatch_gig_file_identify_method (IpatchFile *file, IpatchFileHandle *handle, GError **err); G_DEFINE_TYPE (IpatchGigFile, ipatch_gig_file, IPATCH_TYPE_DLS_FILE); /* GigaSampler file class init function */ static void ipatch_gig_file_class_init (IpatchGigFileClass *klass) { IpatchFileClass *file_class = IPATCH_FILE_CLASS (klass); file_class->identify = ipatch_gig_file_identify_method; /* load_object method handled by parent class IpatchDLSFile */ } static void ipatch_gig_file_init (IpatchGigFile *file) { } /* GigaSampler file identification method * ^&$#@*()!!!! They went and polluted the DLS file magic namespace. Rather * than check the file data, we use the primitive file extension. One does * not actually know if its a GigaSampler file until running into one of their * proprietary chunks (usually 3lnk in an instrument region). */ static gboolean ipatch_gig_file_identify_method (IpatchFile *file, IpatchFileHandle *handle, GError **err) { char *filename; guint8 buf[3]; gboolean retval = TRUE; int len; filename = ipatch_file_get_name (file); /* ++ alloc file name */ if (!filename) return (FALSE); len = strlen (filename); if (len < 4 || g_ascii_strcasecmp (filename + len - 4, ".gig") != 0) retval = FALSE; g_free (filename); /* -- free file name */ if (handle && retval) { /* Check for DLS signature */ if (!ipatch_file_read (handle, buf, 12, err) || buf[0] != IPATCH_FOURCC_RIFF || buf[2] != IPATCH_DLS_FOURCC_DLS) retval = FALSE; } return (retval); } /** * ipatch_gig_file_new: * * Create a new GigaSampler file object. * * Returns: New GigaSampler file object with a reference count of 1. * Caller owns the reference and removing it will destroy the item. */ IpatchGigFile * ipatch_gig_file_new (void) { return (IPATCH_GIG_FILE (g_object_new (IPATCH_TYPE_GIG_FILE, NULL))); } libinstpatch-1.0.0/libinstpatch/IpatchGigInst.c0000644000175000017500000001545211461332142016446 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchGigInst.h" #include "IpatchGigRegion.h" #include "IpatchGigFile.h" #include "i18n.h" enum { PROP_0 }; static void ipatch_gig_inst_class_init (IpatchGigInstClass *klass); static void ipatch_gig_inst_init (IpatchGigInst *inst); static void ipatch_gig_inst_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_gig_inst_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_gig_inst_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static const GType *ipatch_gig_inst_container_child_types (void); static gboolean ipatch_gig_inst_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type); static gpointer parent_class = NULL; static GType inst_child_types[2] = { 0 }; GType ipatch_gig_inst_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchGigInstClass), NULL, NULL, (GClassInitFunc)ipatch_gig_inst_class_init, NULL, NULL, sizeof (IpatchGigInst), 0, (GInstanceInitFunc)ipatch_gig_inst_init, }; item_type = g_type_register_static (IPATCH_TYPE_DLS2_INST, "IpatchGigInst", &item_info, 0); } return (item_type); } static void ipatch_gig_inst_class_init (IpatchGigInstClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS (klass); parent_class = g_type_class_peek_parent (klass); obj_class->get_property = ipatch_gig_inst_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_gig_inst_set_property; item_class->copy = ipatch_gig_inst_item_copy; container_class->child_types = ipatch_gig_inst_container_child_types; container_class->init_iter = ipatch_gig_inst_container_init_iter; inst_child_types[0] = IPATCH_TYPE_GIG_REGION; } static void ipatch_gig_inst_init (IpatchGigInst *inst) { guint8 def_3ewg[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x38, 0x23 }; /* FIXME - Proper default values? */ inst->attenuate = 0; inst->effect_send = 0; inst->fine_tune = 0; inst->pitch_bend_range = 2; /* 2 semitones */ inst->dim_key_start = 0; inst->dim_key_end = 0; /* FIXME - What is it for? */ memcpy (inst->chunk_3ewg, def_3ewg, IPATCH_GIG_3EWG_SIZE); } static void ipatch_gig_inst_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { switch (property_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_gig_inst_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { switch (property_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_gig_inst_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchGigInst *src_inst, *dest_inst; src_inst = IPATCH_GIG_INST (src); dest_inst = IPATCH_GIG_INST (dest); /* call IpatchDLS2Inst class copy function */ IPATCH_ITEM_CLASS (parent_class)->copy (dest, src, link_func, user_data); /* don't need to lock for this stuff */ dest_inst->attenuate = src_inst->attenuate; dest_inst->effect_send = src_inst->effect_send; dest_inst->fine_tune = src_inst->fine_tune; dest_inst->pitch_bend_range = src_inst->pitch_bend_range; dest_inst->dim_key_start = src_inst->dim_key_start; dest_inst->dim_key_end = src_inst->dim_key_end; IPATCH_ITEM_RLOCK (src_inst); memcpy (dest_inst->chunk_3ewg, src_inst->chunk_3ewg, IPATCH_GIG_3EWG_SIZE); IPATCH_ITEM_RUNLOCK (src_inst); } static const GType * ipatch_gig_inst_container_child_types (void) { return (inst_child_types); } /* container is locked by caller */ static gboolean ipatch_gig_inst_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type) { IpatchGigInst *inst = IPATCH_GIG_INST (container); if (!g_type_is_a (type, IPATCH_TYPE_GIG_REGION)) { g_critical ("Invalid child type '%s' for parent of type '%s'", g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); return (FALSE); } ipatch_iter_GSList_init (iter, &((IpatchDLS2Inst *)inst)->regions); return (TRUE); } /** * ipatch_gig_inst_new: * * Create a new GigaSampler instrument object. * * Returns: New GigaSampler instrument with a reference count of 1. Caller * owns the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchGigInst * ipatch_gig_inst_new (void) { return (IPATCH_GIG_INST (g_object_new (IPATCH_TYPE_GIG_INST, NULL))); } /** * ipatch_gig_inst_first: * @iter: Patch item iterator containing #IpatchGigInst items * * Gets the first item in a GigaSampler instrument iterator. A convenience * wrapper for ipatch_iter_first(). * * Returns: The first GigaSampler instrument in @iter or %NULL if empty. */ IpatchGigInst * ipatch_gig_inst_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_GIG_INST (obj)); else return (NULL); } /** * ipatch_gig_inst_next: * @iter: Patch item iterator containing #IpatchGigInst items * * Gets the next item in a GigaSampler instrument iterator. A convenience * wrapper for ipatch_iter_next(). * * Returns: The next GigaSampler instrument in @iter or %NULL if at * the end of the list. */ IpatchGigInst * ipatch_gig_inst_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_GIG_INST (obj)); else return (NULL); } libinstpatch-1.0.0/libinstpatch/IpatchSF2Reader.c0000644000175000017500000012513011461332142016612 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include #include #include #include "IpatchSF2Reader.h" #include "IpatchSF2File.h" #include "IpatchSF2ModItem.h" #include "IpatchGig.h" #include "IpatchGigEffects.h" #include "IpatchGigFile.h" #include "IpatchSampleStore.h" #include "IpatchSampleStoreRam.h" #include "IpatchSampleStoreRom.h" #include "IpatchSampleStoreSplit24.h" #include "IpatchGigInst.h" #include "IpatchGigRegion.h" #include "IpatchSampleStoreFile.h" #include "IpatchUnit.h" #include "ipatch_priv.h" #include "i18n.h" /* ----- ** WARNING ** ----- We don't care about locking in here, because we are the exclusive owner of the loading SoundFont. Many fields are accessed directly, etc. This is not an example of proper use of libInstPatch.. Don't try this at home.. Blah blah. */ static void ipatch_sf2_reader_class_init (IpatchSF2ReaderClass *klass); static void ipatch_sf2_reader_init (IpatchSF2Reader *reader); static void ipatch_sf2_reader_finalize (GObject *object); static gboolean ipatch_sf2_load_level_0 (IpatchSF2Reader *reader, GError **err); static gboolean sfload_infos (IpatchSF2Reader *reader, GError **err); static gboolean sfload_phdrs (IpatchSF2Reader *reader, GError **err); static gboolean sfload_pbags (IpatchSF2Reader *reader, GError **err); static gboolean sfload_pmods (IpatchSF2Reader *reader, GError **err); static gboolean sfload_pgens (IpatchSF2Reader *reader, GError **err); static gboolean sfload_ihdrs (IpatchSF2Reader *reader, GError **err); static gboolean sfload_ibags (IpatchSF2Reader *reader, GError **err); static gboolean sfload_imods (IpatchSF2Reader *reader, GError **err); static gboolean sfload_igens (IpatchSF2Reader *reader, GError **err); static gboolean sfload_shdrs (IpatchSF2Reader *reader, GError **err); #define SFONT_ERROR_MSG "SoundFont reader error: %s" #define SET_SIZE_ERROR(riff, level, err) \ g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_SIZE_MISMATCH,\ _(SFONT_ERROR_MSG), \ ipatch_riff_message_detail(riff, -1, "Unexpected chunk size")) #define SET_DATA_ERROR(riff, level, err) \ g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_INVALID_DATA,\ _(SFONT_ERROR_MSG), \ ipatch_riff_message_detail (riff, -1, "Invalid data")) G_DEFINE_TYPE (IpatchSF2Reader, ipatch_sf2_reader, IPATCH_TYPE_RIFF) static void ipatch_sf2_reader_class_init (IpatchSF2ReaderClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); obj_class->finalize = ipatch_sf2_reader_finalize; } static void ipatch_sf2_reader_init (IpatchSF2Reader *reader) { reader->sf = NULL; } static void ipatch_sf2_reader_finalize (GObject *object) { IpatchSF2Reader *reader = IPATCH_SF2_READER (object); if (reader->sf) { g_object_unref (reader->sf); /* -- unref SoundFont */ reader->sf = NULL; } g_free (reader->pbag_table); reader->pbag_table = NULL; g_free (reader->ibag_table); reader->ibag_table = NULL; g_free (reader->inst_table); reader->inst_table = NULL; g_free (reader->sample_table); reader->sample_table = NULL; if (G_OBJECT_CLASS (ipatch_sf2_reader_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sf2_reader_parent_class)->finalize (object); } /** * ipatch_sf2_reader_new: * @handle: SoundFont 2 file handle to parse or %NULL to set later * * Create a new SoundFont file reader * * Returns: The new SoundFont file reader */ IpatchSF2Reader * ipatch_sf2_reader_new (IpatchFileHandle *handle) { IpatchSF2Reader *reader; g_return_val_if_fail (!handle || IPATCH_IS_SF2_FILE (handle->file), NULL); reader = g_object_new (IPATCH_TYPE_SF2_READER, NULL); if (handle) ipatch_sf2_reader_set_file_handle (reader, handle); return (reader); } /** * ipatch_sf2_reader_set_file_handle: * @reader: SoundFont reader object * @handle: SoundFont 2 file handle * * Set the SoundFont file handle of a SoundFont reader. A convenience * function, since ipatch_riff_set_file_handle() could also be used, albeit * without stricter type casting. */ void ipatch_sf2_reader_set_file_handle (IpatchSF2Reader *reader, IpatchFileHandle *handle) { g_return_if_fail (IPATCH_IS_SF2_READER (reader)); g_return_if_fail (handle && IPATCH_IS_SF2_FILE (handle->file)); ipatch_riff_set_file_handle (IPATCH_RIFF (reader), handle); } /** * ipatch_sf2_reader_load: * @reader: SF2 reader object * @err: Location to store error info or %NULL * * Load an SF2 file. * * Returns: New SF2 object with refcount of 1. */ IpatchSF2 * ipatch_sf2_reader_load (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff; IpatchRiffChunk *chunk; GError *local_err = NULL; int size; g_return_val_if_fail (IPATCH_IS_SF2_READER (reader), NULL); riff = IPATCH_RIFF (reader); g_return_val_if_fail (riff->handle && IPATCH_IS_SF2_FILE (riff->handle->file), NULL); /* start parsing */ if (!(chunk = ipatch_riff_start_read (riff, err))) return (NULL); if (chunk->id != IPATCH_SFONT_FOURCC_SFBK) { g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_UNEXPECTED_ID, _("Not a SoundFont file (RIFF id = '%4s')"), chunk->idstr); return (NULL); } /* verify total size of file with RIFF chunk size */ size = ipatch_file_get_size (riff->handle->file, &local_err); if (size == -1) { g_warning ("SoundFont file size check failed: %s", ipatch_gerror_message (local_err)); g_clear_error (&local_err); } else if (size != chunk->size + IPATCH_RIFF_HEADER_SIZE) { g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_SIZE_MISMATCH, _("File size mismatch (chunk size = %d, actual = %d)"), chunk->size + IPATCH_RIFF_HEADER_SIZE, size); return (NULL); } reader->sf = ipatch_sf2_new (); /* ++ ref new object */ ipatch_sf2_set_file (reader->sf, IPATCH_SF2_FILE (riff->handle->file)); if (!ipatch_sf2_load_level_0 (reader, err)) goto err; ipatch_item_clear_flags (IPATCH_ITEM (reader->sf), IPATCH_BASE_SAVED | IPATCH_BASE_CHANGED); /* ++ ref for caller, finalize() will remove reader's reference */ return (g_object_ref (reader->sf)); err: g_object_unref (reader->sf); reader->sf = NULL; return (NULL); } /** * ipatch_sf2_load_phdr: * @handle: File handle containing buffered data * @phdr: Pointer to a user supplied preset header structure * * Parses a raw preset header in file @handle with buffered data. */ void ipatch_sf2_load_phdr (IpatchFileHandle *handle, IpatchSF2Phdr *phdr) { g_return_if_fail (handle != NULL); g_return_if_fail (phdr != NULL); ipatch_file_buf_read (handle, &phdr->name, IPATCH_SFONT_NAME_SIZE); phdr->program = ipatch_file_buf_read_u16 (handle); phdr->bank = ipatch_file_buf_read_u16 (handle); phdr->bag_index = ipatch_file_buf_read_u16 (handle); phdr->library = ipatch_file_buf_read_u32 (handle); phdr->genre = ipatch_file_buf_read_u32 (handle); phdr->morphology = ipatch_file_buf_read_u32 (handle); } /** * ipatch_sf2_load_ihdr: * @handle: File handle containing buffered data * @ihdr: Pointer to a user supplied instrument header structure * * Parses a raw instrument header in file @handle with buffered data. */ void ipatch_sf2_load_ihdr (IpatchFileHandle *handle, IpatchSF2Ihdr *ihdr) { g_return_if_fail (handle != NULL); g_return_if_fail (ihdr != NULL); ipatch_file_buf_read (handle, &ihdr->name, IPATCH_SFONT_NAME_SIZE); ihdr->bag_index = ipatch_file_buf_read_u16 (handle); } /** * ipatch_sf2_load_shdr: * @handle: File handle containing buffered data * @shdr: Pointer to a user supplied sample header structure * * Parses a raw sample header in file @handle with buffered data. */ void ipatch_sf2_load_shdr (IpatchFileHandle *handle, IpatchSF2Shdr *shdr) { g_return_if_fail (handle != NULL); g_return_if_fail (shdr != NULL); ipatch_file_buf_read (handle, &shdr->name, IPATCH_SFONT_NAME_SIZE); shdr->start = ipatch_file_buf_read_u32 (handle); shdr->end = ipatch_file_buf_read_u32 (handle); shdr->loop_start = ipatch_file_buf_read_u32 (handle); shdr->loop_end = ipatch_file_buf_read_u32 (handle); shdr->rate = ipatch_file_buf_read_u32 (handle); shdr->root_note = ipatch_file_buf_read_u8 (handle); shdr->fine_tune = ipatch_file_buf_read_u8 (handle); shdr->link_index = ipatch_file_buf_read_u16 (handle); shdr->type = ipatch_file_buf_read_u16 (handle); } /** * ipatch_sf2_load_bag: * @handle: File handle containing buffered data * @bag: Pointer to a user supplied bag structure * * Parses a raw preset or instrument bag in file @handle with buffered data. */ void ipatch_sf2_load_bag (IpatchFileHandle *handle, IpatchSF2Bag *bag) { g_return_if_fail (handle != NULL); g_return_if_fail (bag != NULL); bag->gen_index = ipatch_file_buf_read_u16 (handle); bag->mod_index = ipatch_file_buf_read_u16 (handle); } /** * ipatch_sf2_load_mod: * @handle: File handle containing buffered data * @mod: Pointer to a user supplied modulator structure * * Parses a raw modulator in file @handle with buffered data. */ void ipatch_sf2_load_mod (IpatchFileHandle *handle, IpatchSF2Mod *mod) { g_return_if_fail (handle != NULL); g_return_if_fail (mod != NULL); mod->src = ipatch_file_buf_read_u16 (handle); mod->dest = ipatch_file_buf_read_u16 (handle); mod->amount = ipatch_file_buf_read_u16 (handle); mod->amtsrc = ipatch_file_buf_read_u16 (handle); mod->trans = ipatch_file_buf_read_u16 (handle); } /** * ipatch_sf2_load_gen: * @handle: File handle containing buffered data * @genid: Pointer to store the generator ID in * @amount: Pointer to a generator amount to store the amount in * * Parses a raw generator in file @handle with buffered data. */ void ipatch_sf2_load_gen (IpatchFileHandle *handle, int *genid, IpatchSF2GenAmount *amount) { g_return_if_fail (handle != NULL); g_return_if_fail (genid != NULL); g_return_if_fail (amount != NULL); *genid = ipatch_file_buf_read_u16 (handle); /* check if genid is valid (preset or inst) and is a range unit */ if (ipatch_sf2_gen_is_valid (*genid, FALSE) && ipatch_sf2_gen_info[*genid].unit == IPATCH_UNIT_TYPE_RANGE) { /* load the range */ amount->range.low = ipatch_file_buf_read_u8 (handle); amount->range.high = ipatch_file_buf_read_u8 (handle); } else amount->sword = ipatch_file_buf_read_s16 (handle); } static gboolean ipatch_sf2_load_level_0 (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; IpatchSF2File *sfont_file; /* load INFO LIST chunk */ if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_LIST, IPATCH_SFONT_FOURCC_INFO, err)) return (FALSE); if (!sfload_infos (reader, err)) return (FALSE); if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); /* load SDTA LIST chunk */ if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_LIST, IPATCH_SFONT_FOURCC_SDTA, err)) return (FALSE); /* initialize sample positions to 0 so we know if they get set or not */ sfont_file = IPATCH_SF2_FILE (IPATCH_BASE (reader->sf)->file); sfont_file->sample_pos = 0; sfont_file->sample24_pos = 0; /* smpl chunk is theoretically optional if all samples are ROM samples, but * these days thats a pretty useless SoundFont, so we assume SMPL exists. */ if (!(chunk = ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_SMPL, err))) return (FALSE); /* store offset into file of sample data (if any) */ if (chunk->size > 0) { sfont_file->sample_pos = ipatch_riff_get_position (riff); sfont_file->sample_size = chunk->size / 2; /* save size (in samples) */ } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); /* */ chunk = ipatch_riff_read_chunk (riff, err); /* check for "sm24" sample chunk (LS bytes of 24 bit audio) */ if (chunk && chunk->type == IPATCH_RIFF_CHUNK_SUB && chunk->id == IPATCH_SFONT_FOURCC_SM24) { /* verify sm24 is equal to the number of samples in */ if (chunk->size == sfont_file->sample_size || chunk->size == sfont_file->sample_size + (sfont_file->sample_size & 1)) { /* set 24 bit samples flag and store offset of chunk */ ipatch_item_set_flags (reader->sf, IPATCH_SF2_SAMPLES_24BIT); sfont_file->sample24_pos = ipatch_riff_get_position (riff); } else g_critical ("Invalid size for SoundFont sample 24 chunk, ignoring"); if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); /* */ } else if (!ipatch_riff_get_error (riff, NULL)) return (FALSE); if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); /* */ /* load PDTA LIST chunk */ if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_LIST, IPATCH_SFONT_FOURCC_PDTA, err)) return (FALSE); if (!sfload_phdrs (reader, err)) return (FALSE); /* we load all presets/instruments/samples first so no fixup is required later for numeric indexes. Save RIFF state here so we can return. */ ipatch_riff_push_state (riff); if (!ipatch_riff_skip_chunks (riff, 3, err)) /* skip pbags pmods pgens */ return (FALSE); if (!sfload_ihdrs (reader, err)) return (FALSE); if (!ipatch_riff_skip_chunks (riff, 3, err)) /* skip ibags imods igens */ return (FALSE); if (!sfload_shdrs (reader, err)) return (FALSE); /* return to preset bag chunk */ if (!ipatch_riff_pop_state (riff, err)) return (FALSE); if (!sfload_pbags (reader, err)) return (FALSE); if (!sfload_pmods (reader, err)) return (FALSE); if (!sfload_pgens (reader, err)) return (FALSE); /* skip ihdrs (already loaded above) */ if (!ipatch_riff_skip_chunks (riff, 1, err)) return (FALSE); if (!sfload_ibags (reader, err)) return (FALSE); if (!sfload_imods (reader, err)) return (FALSE); if (!sfload_igens (reader, err)) return (FALSE); return (TRUE); } static gboolean sfload_infos (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; /* loop over info chunks */ while ((chunk = ipatch_riff_read_chunk (riff, err))) { if (chunk->type == IPATCH_RIFF_CHUNK_SUB) { if (chunk->id == IPATCH_SFONT_FOURCC_IFIL) /* version chunk? */ { if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_VERSION_SIZE, err)) return (FALSE); reader->sf->ver_major = ipatch_file_buf_read_u16 (riff->handle); reader->sf->ver_minor = ipatch_file_buf_read_u16 (riff->handle); if (reader->sf->ver_major != 2) { g_critical (_("SoundFont version is %d.%02d which" " is not supported"), reader->sf->ver_major, reader->sf->ver_minor); return (FALSE); } if (reader->sf->ver_minor > 4) g_warning (_("SoundFont version is newer than 2.04," " some information might be uneditable")); } else if (chunk->id == IPATCH_SFONT_FOURCC_IVER) /* ROM version? */ { if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_VERSION_SIZE, err)) return (FALSE); reader->sf->romver_major = ipatch_file_buf_read_u16 (riff->handle); reader->sf->romver_minor = ipatch_file_buf_read_u16 (riff->handle); } else /* regular string based info chunk */ { int maxsize; char *s; if (!ipatch_sf2_info_id_is_valid (chunk->id)) g_warning (_("Unknown INFO chunk \"%.4s\""), chunk->idstr); /* make sure info chunk size is okay */ maxsize = ipatch_sf2_get_info_max_size (chunk->id); if (maxsize == 0) maxsize = 256; /* unknown chunk size */ if (maxsize && chunk->size > maxsize) { g_critical (_("Invalid INFO chunk size")); return (FALSE); } /* alloc for info string */ s = g_malloc (chunk->size); if (!ipatch_file_read (riff->handle, s, chunk->size, err)) { g_free (s); return (FALSE); } s[chunk->size - 1] = '\0'; /* force terminate info string */ ipatch_sf2_set_info (reader->sf, chunk->id, s); g_free (s); } } /* chunk->type == IPATCH_RIFF_CHUNK_SUB */ if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); } /* while () */ return (ipatch_riff_get_error (riff, NULL)); } /* preset header reader */ static gboolean sfload_phdrs (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchSF2Preset *preset = NULL, *prev = NULL; /* current & previous preset item */ IpatchIter preset_iter, zone_iter; IpatchItem *zone; IpatchRiffChunk *chunk; IpatchSF2Phdr phdr; guint16 zndx = 0, pzndx = 0; int i, i2; if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_PHDR, err)) return (FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size == 0) return (TRUE); /* no preset headers? */ if (chunk->size % IPATCH_SFONT_PHDR_SIZE) /* verify chunk size */ { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } /* initialize iterator to SoundFont preset list */ ipatch_container_init_iter (IPATCH_CONTAINER (reader->sf), &preset_iter, IPATCH_TYPE_SF2_PRESET); /* loop over all preset headers (including dummy terminal record) */ i = chunk->size / IPATCH_SFONT_PHDR_SIZE; for (; i > 0; i--) { if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_PHDR_SIZE, err)) return (FALSE); ipatch_sf2_load_phdr (riff->handle, &phdr); zndx = phdr.bag_index; if (i != 1) /* don't add terminal record */ { preset = ipatch_sf2_preset_new (); /* ++ ref new preset */ preset->name = g_strndup (phdr.name, 20); preset->program = phdr.program; preset->bank = phdr.bank; preset->library = phdr.library; preset->genre = phdr.genre; preset->morphology = phdr.morphology; /* by default insert_iter keeps appending */ ipatch_container_insert_iter ((IpatchContainer *)(reader->sf), (IpatchItem *)preset, &preset_iter); g_object_unref (preset); /* -- unref new preset */ } if (prev) /* not first preset? */ { if (zndx < pzndx) /* make sure zone index isn't decreasing */ { g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_INVALID_DATA, "Invalid preset zone index"); return (FALSE); } /* init iterator to list of zones */ ipatch_container_init_iter ((IpatchContainer *)prev, &zone_iter, IPATCH_TYPE_SF2_PZONE); i2 = zndx - pzndx; /* # of zones in last preset */ while (i2--) /* create zones for last preset */ { /* ++ ref new zone and insert it */ zone = g_object_new (IPATCH_TYPE_SF2_PZONE, NULL); ipatch_container_insert_iter ((IpatchContainer *)prev, zone, &zone_iter); g_object_unref (zone); /* -- unref new zone */ } } else if (zndx > 0) /* 1st preset, warn if ofs > 0 */ g_warning (_("%d preset zones not referenced, discarding"), zndx); prev = preset; /* update previous preset ptr */ pzndx = zndx; } reader->pbag_count = zndx; /* total number of preset zones */ if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /* preset bag reader */ static gboolean sfload_pbags (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; guint16 *bag_table; guint16 genndx, modndx; guint16 pgenndx, pmodndx; int i; if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_PBAG, err)) return (FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size % IPATCH_SFONT_BAG_SIZE || chunk->size / IPATCH_SFONT_BAG_SIZE != reader->pbag_count + 1) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } bag_table = reader->pbag_table = g_malloc (chunk->size); if (!ipatch_file_read (riff->handle, bag_table, chunk->size, err)) return (FALSE); /* bag_table will be freed by finalize() */ pgenndx = IPATCH_FILE_SWAP16 (riff->handle, &bag_table[0]); pmodndx = IPATCH_FILE_SWAP16 (riff->handle, &bag_table[1]); for (i=0; i < reader->pbag_count; i++) { genndx = IPATCH_FILE_SWAP16 (riff->handle, &bag_table[(i+1)*2]); modndx = IPATCH_FILE_SWAP16 (riff->handle, &bag_table[(i+1)*2+1]); if (genndx < pgenndx) { g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_INVALID_DATA, "Invalid preset gen index"); return (FALSE); } if (modndx < pmodndx) { g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_INVALID_DATA, "Invalid preset mod index"); return (FALSE); } bag_table[i*2] = genndx - pgenndx; bag_table[i*2+1] = modndx - pmodndx; pgenndx = genndx; /* update previous zone gen index */ pmodndx = modndx; /* update previous zone mod index */ } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /* preset modulator reader */ static gboolean sfload_pmods (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchSF2Zone *zone; IpatchSF2Mod mod; GSList *p, *p2; guint bagmod_index = 1; int i; if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_PMOD, err)) return (FALSE); p = reader->sf->presets; while (p) /* traverse through all presets */ { p2 = IPATCH_SF2_PRESET (p->data)->zones; while (p2) /* traverse this preset's zones */ { zone = IPATCH_SF2_ZONE (p2->data); /* get stored modulator count for zone bag table */ i = reader->pbag_table[bagmod_index]; bagmod_index += 2; while (i-- > 0) /* load modulators */ { if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_MOD_SIZE, err)) return (FALSE); ipatch_sf2_load_mod (riff->handle, &mod); ipatch_sf2_mod_item_add ((IpatchSF2ModItem *)zone, &mod); } p2 = g_slist_next (p2); } p = g_slist_next (p); } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /* preset generator reader */ static gboolean sfload_pgens (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchSF2Preset *preset; IpatchSF2Zone *zone; IpatchSF2GenAmount amount; int genid; GSList *p, *p2; guint pbag_index = 0; guint index; int level, discarded; int i; if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_PGEN, err)) return (FALSE); p = reader->sf->presets; while (p) /* traverse through all presets */ { discarded = FALSE; preset = IPATCH_SF2_PRESET (p->data); p2 = preset->zones; while (p2) /* traverse preset's zones */ { level = 0; zone = IPATCH_SF2_ZONE (p2->data); /* retrieve our stored gen count (from load_pbag) */ i = reader->pbag_table[pbag_index]; pbag_index += 2; while (i-- > 0) /* load zone's generators */ { if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_GEN_SIZE, err)) return (FALSE); ipatch_sf2_load_gen (riff->handle, &genid, &amount); /* check validity of generator */ if ((genid != IPATCH_SF2_GEN_INSTRUMENT_ID && !ipatch_sf2_gen_is_valid (genid, TRUE)) || (genid == IPATCH_SF2_GEN_NOTE_RANGE && level != 0) || (genid == IPATCH_SF2_GEN_VELOCITY_RANGE && level > 1)) { discarded = TRUE; continue; } /* IPATCH_SF2_GEN_NOTE_RANGE first (if any) followed by IPATCH_SF2_GEN_VELOCITY_RANGE (if any), IPATCH_SF2_GEN_INSTRUMENT_ID is last */ if (genid == IPATCH_SF2_GEN_NOTE_RANGE) level = 1; else if (genid == IPATCH_SF2_GEN_VELOCITY_RANGE) level = 2; else if (genid == IPATCH_SF2_GEN_INSTRUMENT_ID) { index = amount.uword; if (index >= reader->inst_count) g_warning (_("Invalid reference in preset '%s'"), preset->name); /* will get discarded below */ else ipatch_sf2_zone_set_link_item (zone, (IpatchItem *) reader->inst_table[index]); level = 3; break; /* break out of gen loop */ } else level = 2; /* set the generator */ zone->genarray.values[genid] = amount; IPATCH_SF2_GEN_ARRAY_SET_FLAG (&zone->genarray, genid); } /* generator loop */ /* ignore (skip) any generators following an instrument ID */ while (i-- > 0) { discarded = TRUE; if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_GEN_SIZE, err)) return (FALSE); } /* if level != 3 (no instrument ID) and not first zone, discard */ if (level != 3 && p2 != preset->zones) { /* discard invalid global zone */ IpatchItem *item = IPATCH_ITEM (p2->data); p2 = g_slist_next (p2); ipatch_container_remove (IPATCH_CONTAINER (preset), item); g_warning (_("Preset \"%s\": Discarding invalid global zone"), preset->name); continue; } p2 = g_slist_next (p2); /* next zone */ } /* global zone? Migrate gens/mods to preset and remove zone. */ if (preset->zones && !((IpatchSF2Zone *)(preset->zones->data))->item) { IpatchSF2Zone *zone = (IpatchSF2Zone *)(preset->zones->data); preset->genarray = zone->genarray; preset->mods = zone->mods; /* snatch modulator list */ zone->mods = NULL; ipatch_container_remove (IPATCH_CONTAINER (preset), (IpatchItem *)zone); } if (discarded) g_warning (_("Preset \"%s\": Some invalid generators were discarded"), preset->name); p = g_slist_next (p); } /* free some no longer needed tables */ g_free (reader->pbag_table); reader->pbag_table = NULL; g_free (reader->inst_table); reader->inst_table = NULL; if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /* instrument header reader */ static gboolean sfload_ihdrs (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchSF2Inst *inst = NULL, *prev = NULL; /* current & previous instrument */ IpatchIter inst_iter, zone_iter; IpatchItem *zone; IpatchRiffChunk *chunk; IpatchSF2Inst **iptr; IpatchSF2Ihdr ihdr; guint16 zndx=0, pzndx=0; int i, i2; if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_INST, err)) return (FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size == 0) return (TRUE); /* no instrument headers? */ if (chunk->size % IPATCH_SFONT_INST_SIZE) /* verify chunk size */ { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } /* initialize iterator to instrument list */ ipatch_container_init_iter (IPATCH_CONTAINER (reader->sf), &inst_iter, IPATCH_TYPE_SF2_INST); i = chunk->size / IPATCH_SFONT_INST_SIZE; /* instrument count + 1 EOI */ reader->inst_count = i - 1; /* allocate instrument table (used for PresetZone fixups) */ iptr = reader->inst_table = g_malloc ((i - 1) * sizeof (IpatchSF2Inst *)); /* loop over all instrument headers (including dummy terminal record) */ for (; i > 0; i--) { if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_INST_SIZE, err)) return (FALSE); ipatch_sf2_load_ihdr (riff->handle, &ihdr); zndx = ihdr.bag_index; if (i != 1) /* don't add terminal record, free instead */ { /* ++ ref new inst and add to instrument fixup table */ *(iptr++) = inst = ipatch_sf2_inst_new (); inst->name = g_strndup (ihdr.name, 20); /* insert the instrument (default is to keep appending) */ ipatch_container_insert_iter ((IpatchContainer *)(reader->sf), (IpatchItem *)inst, &inst_iter); g_object_unref (inst); /* -- unref new instrument */ } if (prev) /* not first instrument? */ { if (zndx < pzndx) /* make sure zone index isn't decreasing */ { g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_INVALID_DATA, "Invalid instrument zone index"); return (FALSE); } /* initialize iterator to instrument zone list */ ipatch_container_init_iter ((IpatchContainer *)prev, &zone_iter, IPATCH_TYPE_SF2_IZONE); i2 = zndx - pzndx; /* # of zones in last instrument */ while (i2--) /* create zones for last instrument */ { /* ++ ref new zone and insert it */ zone = g_object_new (IPATCH_TYPE_SF2_IZONE, NULL); ipatch_container_insert_iter ((IpatchContainer *)prev, zone, &zone_iter); g_object_unref (zone); /* -- unref new zone */ } } else if (zndx > 0) /* 1st instrument, warn if ofs > 0 */ g_warning (_("Discarding %d unreferenced instrument zones"), zndx); prev = inst; /* update previous instrument ptr */ pzndx = zndx; } reader->ibag_count = zndx; /* total number of instrument zones */ if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /* instrument bag reader */ static gboolean sfload_ibags (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; guint16 *bag_table; guint16 genndx, modndx; guint16 pgenndx, pmodndx; int i; if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_IBAG, err)) return (FALSE); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size % IPATCH_SFONT_BAG_SIZE || chunk->size / IPATCH_SFONT_BAG_SIZE != reader->ibag_count + 1) { SET_SIZE_ERROR (riff, -1, err); return (FALSE); } bag_table = reader->ibag_table = g_malloc (chunk->size); if (!ipatch_file_read (riff->handle, bag_table, chunk->size, err)) return (FALSE); /* bag_table will be freed by finalize() */ pgenndx = IPATCH_FILE_SWAP16 (riff->handle, &bag_table[0]); pmodndx = IPATCH_FILE_SWAP16 (riff->handle, &bag_table[1]); for (i=0; i < reader->ibag_count; i++) { genndx = IPATCH_FILE_SWAP16 (riff->handle, &bag_table[(i+1)*2]); modndx = IPATCH_FILE_SWAP16 (riff->handle, &bag_table[(i+1)*2+1]); if (genndx < pgenndx) { g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_INVALID_DATA, "Invalid instrument gen index"); return (FALSE); } if (modndx < pmodndx) { g_set_error (err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_INVALID_DATA, "Invalid instrument mod index"); return (FALSE); } bag_table[i*2] = genndx - pgenndx; bag_table[i*2+1] = modndx - pmodndx; pgenndx = genndx; /* update previous zone gen index */ pmodndx = modndx; /* update previous zone mod index */ } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /* instrument modulator reader */ static gboolean sfload_imods (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchSF2Zone *zone; IpatchSF2Mod mod; guint bagmod_index = 1; GSList *p, *p2; int i; if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_IMOD, err)) return (FALSE); p = reader->sf->insts; while (p) /* traverse through all instruments */ { p2 = IPATCH_SF2_INST (p->data)->zones; while (p2) /* traverse this instrument's zones */ { zone = IPATCH_SF2_ZONE (p2->data); /* stored modulator count */ i = reader->ibag_table[bagmod_index]; bagmod_index += 2; while (i-- > 0) /* load zone's modulators */ { if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_MOD_SIZE, err)) return (FALSE); ipatch_sf2_load_mod (riff->handle, &mod); ipatch_sf2_mod_item_add ((IpatchSF2ModItem *)zone, &mod); } p2 = g_slist_next (p2); } p = g_slist_next (p); } if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /* instrument generator reader */ static gboolean sfload_igens (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchSF2Inst *inst; IpatchSF2Zone *zone; IpatchSF2GenAmount amount; int genid; GSList *p, *p2; guint ibag_index = 0; guint index; int level, discarded; int i; if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_IGEN, err)) return (FALSE); p = reader->sf->insts; while (p) /* traverse through all instruments */ { discarded = FALSE; inst = IPATCH_SF2_INST (p->data); p2 = inst->zones; while (p2) /* traverse instruments's zones */ { level = 0; zone = IPATCH_SF2_ZONE (p2->data); /* retrieve our stored gen count (from load_ibag) */ i = reader->ibag_table[ibag_index]; ibag_index += 2; while (i--) /* load zone's generators */ { if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_GEN_SIZE, err)) return (FALSE); ipatch_sf2_load_gen (riff->handle, &genid, &amount); /* check validity of generator */ if ((genid != IPATCH_SF2_GEN_SAMPLE_ID && !ipatch_sf2_gen_is_valid (genid, FALSE)) || (genid == IPATCH_SF2_GEN_NOTE_RANGE && level != 0) || (genid == IPATCH_SF2_GEN_VELOCITY_RANGE && level > 1)) { discarded = TRUE; continue; } /* IPATCH_SF2_GEN_NOTE_RANGE first (if any) followed by IPATCH_SF2_GEN_VELOCITY_RANGE (if any), IPATCH_SF2_GEN_SAMPLE_ID is last */ if (genid == IPATCH_SF2_GEN_NOTE_RANGE) level = 1; else if (genid == IPATCH_SF2_GEN_VELOCITY_RANGE) level = 2; else if (genid == IPATCH_SF2_GEN_SAMPLE_ID) { index = amount.uword; if (index >= reader->sample_count) g_warning (_("Invalid reference in instrument '%s'"), inst->name); /* will get discarded below */ else ipatch_sf2_zone_set_link_item (zone, (IpatchItem *) reader->sample_table[index]); level = 3; break; /* break out of gen loop */ } else level = 2; /* set the generator */ zone->genarray.values[genid] = amount; IPATCH_SF2_GEN_ARRAY_SET_FLAG (&zone->genarray, genid); } /* generator loop */ /* ignore (skip) any generators following a sample ID */ while (i-- > 0) { discarded = TRUE; if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_GEN_SIZE, err)) return (FALSE); } /* if level !=3 (no sample ID) and not first zone, discard */ if (level != 3 && p2 != inst->zones) { /* discard invalid global zone */ IpatchItem *item = IPATCH_ITEM (p2->data); p2 = g_slist_next (p2); ipatch_container_remove (IPATCH_CONTAINER (inst), item); g_warning (_("Instrument \"%s\": Discarding invalid" " global zone"), inst->name); continue; } p2 = g_slist_next (p2); /* next zone */ } /* global zone? Migrate gens/mods to instrument and remove zone. */ if (inst->zones && !((IpatchSF2Zone *)(inst->zones->data))->item) { IpatchSF2Zone *zone = (IpatchSF2Zone *)(inst->zones->data); inst->genarray = zone->genarray; inst->mods = zone->mods; /* snatch modulator list */ zone->mods = NULL; ipatch_container_remove (IPATCH_CONTAINER (inst), (IpatchItem *)zone); } if (discarded) g_warning (_("Instrument \"%s\": Some invalid generators" " were discarded"), inst->name); p = g_slist_next (p); /* next instrument */ } /* free some no longer needed tables */ g_free (reader->ibag_table); reader->ibag_table = NULL; g_free (reader->sample_table); reader->sample_table = NULL; if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } /* sample header reader */ static gboolean sfload_shdrs (IpatchSF2Reader *reader, GError **err) { IpatchRiff *riff = IPATCH_RIFF (reader); IpatchRiffChunk *chunk; IpatchSF2Sample *sample, *link_sample, **sptr; IpatchSampleData *sampledata; IpatchSample *store; IpatchIter iter; IpatchSF2Shdr shdr; guint samchunk_pos, samchunk_size, sam24chunk_pos; guint openlink_count = 0; char *filename; int i, count; if (!ipatch_riff_read_chunk_verify (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_SHDR, err)) return (FALSE); g_object_get (IPATCH_BASE (reader->sf)->file, "file-name", &filename, /* ++ alloc filename */ "sample-pos", &samchunk_pos, "sample-size", &samchunk_size, "sample24-pos", &sam24chunk_pos, NULL); chunk = ipatch_riff_get_chunk (riff, -1); if (chunk->size <= IPATCH_SFONT_SHDR_SIZE) return (TRUE); /* no samples? */ if (chunk->size % IPATCH_SFONT_SHDR_SIZE) /* verify chunk size */ { SET_SIZE_ERROR (riff, -1, err); g_free (filename); /* -- free filename */ return (FALSE); } /* initialize iterator to sample list */ ipatch_container_init_iter (IPATCH_CONTAINER (reader->sf), &iter, IPATCH_TYPE_SF2_SAMPLE); /* get number of sample headers */ count = chunk->size / IPATCH_SFONT_SHDR_SIZE - 1; reader->sample_count = count; /* allocate sample fixup table (to fixup instrument zone references) */ sptr = reader->sample_table = g_malloc (count * sizeof (IpatchSF2Sample *)); /* load all sample headers (not including terminal record) */ for (i = 0; i < count; i++) { if (!ipatch_file_buf_load (riff->handle, IPATCH_SFONT_SHDR_SIZE, err)) { g_free (filename); /* -- free filename */ return (FALSE); } ipatch_sf2_load_shdr (riff->handle, &shdr); /* ++ ref new sample and add to sample fixup table */ *(sptr++) = sample = g_object_new (IPATCH_TYPE_SF2_SAMPLE, NULL); sample->name = g_strndup (shdr.name, 20); /* sample NOT totally screwed? (ROM or within sample chunk, ROM or sample chunk actually exists, at least 4 samples in length) */ if (((shdr.type & IPATCH_SF2_FILE_SAMPLE_TYPE_ROM) || shdr.end <= samchunk_size) && ((shdr.type & IPATCH_SF2_FILE_SAMPLE_TYPE_ROM) || samchunk_pos > 0) && (shdr.start < shdr.end && shdr.end - shdr.start > 4)) { /* loop is okay? */ if (shdr.loop_end <= shdr.end && shdr.loop_start < shdr.loop_end && shdr.start <= shdr.loop_start) { sample->loop_start = shdr.loop_start - shdr.start; sample->loop_end = shdr.loop_end - shdr.start; } else /* loop is on krak */ { int size = shdr.end - shdr.start; g_warning (_("Invalid loop for sample '%s'"), sample->name); if (size >= 48) { sample->loop_start = 8; sample->loop_end = size - 8; } else /* sample is rather small */ { sample->loop_start = 1; sample->loop_end = size - 1; } } sample->rate = shdr.rate; sample->root_note = shdr.root_note; sample->fine_tune = shdr.fine_tune; if (shdr.type & IPATCH_SF2_FILE_SAMPLE_TYPE_RIGHT) sample->channel = IPATCH_SF2_SAMPLE_CHANNEL_RIGHT; else if (shdr.type & IPATCH_SF2_FILE_SAMPLE_TYPE_LEFT) sample->channel = IPATCH_SF2_SAMPLE_CHANNEL_LEFT; else sample->channel = IPATCH_SF2_SAMPLE_CHANNEL_MONO; /* check for stereo linked sample */ if ((shdr.type & IPATCH_SF2_FILE_SAMPLE_TYPE_RIGHT || shdr.type & IPATCH_SF2_FILE_SAMPLE_TYPE_LEFT)) { if (shdr.link_index < i) /* can we fixup link? */ { link_sample = reader->sample_table[shdr.link_index]; if (!link_sample->linked) /* sample not already linked? */ { /* FIXME - Ensure same size samples */ ipatch_sf2_sample_set_linked (sample, link_sample); ipatch_sf2_sample_set_linked (link_sample, sample); if (ipatch_item_get_flags (link_sample) & (1 << 31)) { openlink_count--; ipatch_item_clear_flags (link_sample, 1 << 31); } } else /* sample is already linked */ g_warning (_("Duplicate stereo link to sample '%s'" " from '%s'"), link_sample->name, sample->name); } else /* could not fixup stereo link, do later (below) */ { openlink_count++; ipatch_item_set_flags (sample, 1 << 31); } } /* sample is not a ROM sample? */ if (!(shdr.type & IPATCH_SF2_FILE_SAMPLE_TYPE_ROM)) { /* SoundFont contains 24 bit audio? */ if (sam24chunk_pos > 0) { /* ++ ref new split 24 bit sample store */ store = ipatch_sample_store_split24_new (riff->handle->file, samchunk_pos + shdr.start * 2, sam24chunk_pos + shdr.start); /* use host endian, Split24 stores will transform as necessary */ ipatch_sample_set_format (store, IPATCH_SAMPLE_24BIT | IPATCH_SAMPLE_MONO | IPATCH_SAMPLE_SIGNED | IPATCH_SAMPLE_ENDIAN_HOST); } else /* 16 bit samples */ { /* ++ ref new file sample store */ store = ipatch_sample_store_file_new (riff->handle->file, samchunk_pos + shdr.start * 2); ipatch_sample_set_format (store, IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_MONO | IPATCH_SAMPLE_SIGNED | IPATCH_SAMPLE_LENDIAN); } } else /* ROM sample, create ROM sample store */ { /* Set ROM flag */ ipatch_item_set_flags (sample, IPATCH_SF2_SAMPLE_FLAG_ROM); /* ++ ref new ROM sample store */ store = ipatch_sample_store_rom_new (shdr.start * 2); ipatch_sample_set_format (store, IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_MONO | IPATCH_SAMPLE_SIGNED | IPATCH_SAMPLE_LENDIAN); } ipatch_sample_set_size (store, shdr.end - shdr.start); sampledata = ipatch_sample_data_new (); /* ++ ref */ ipatch_sample_data_add (sampledata, (IpatchSampleStore *)store); ipatch_sf2_sample_set_data (sample, sampledata); g_object_unref (store); /* -- unref sample store */ g_object_unref (sampledata); /* -- unref sampledata */ } else /* sample is messed, set to blank data */ { g_warning (_("Invalid sample '%s'"), sample->name); ipatch_sf2_sample_set_blank (sample); } /* insert sample into SoundFont */ ipatch_container_insert_iter ((IpatchContainer *)(reader->sf), (IpatchItem *)sample, &iter); g_object_unref (sample); /* -- unref new sample */ } if (openlink_count > 0) /* any unresolved linked stereo samples? */ { count = reader->sample_count; for (i = 0; i < reader->sample_count; i++) { sample = reader->sample_table[i]; if ((ipatch_item_get_flags (sample) & (1 << 31)) && !sample->linked) { g_warning (_("Invalid stereo link for sample '%s'"), sample->name); sample->channel = IPATCH_SF2_SAMPLE_CHANNEL_MONO; } } } g_free (filename); /* -- free filename */ if (!ipatch_riff_end_chunk (riff, err)) return (FALSE); return (TRUE); } libinstpatch-1.0.0/libinstpatch/IpatchSndFile.h0000644000175000017500000000707111461332142016431 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSndFile * @short_description: libsndfile file object * @see_also: * @stability: Stable * * Object type for libsndfile audio file identification. */ #ifndef __IPATCH_SND_FILE_H__ #define __IPATCH_SND_FILE_H__ #include #include #include #include typedef struct _IpatchSndFile IpatchSndFile; typedef struct _IpatchSndFileClass IpatchSndFileClass; #define IPATCH_TYPE_SND_FILE (ipatch_snd_file_get_type ()) #define IPATCH_SND_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SND_FILE, IpatchSndFile)) #define IPATCH_SND_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SND_FILE, \ IpatchSndFileClass)) #define IPATCH_IS_SND_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SND_FILE)) #define IPATCH_IS_SND_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SND_FILE)) #define IPATCH_SND_FILE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SND_FILE, \ IpatchSndFileClass)) #define IPATCH_TYPE_SND_FILE_FORMAT \ (ipatch_snd_file_format_get_type()) #define IPATCH_TYPE_SND_FILE_SUB_FORMAT \ (ipatch_snd_file_sub_format_get_type()) /** * IpatchSndFileEndian: * @IPATCH_SND_FILE_ENDIAN_FILE: Use the default endian for the file format * @IPATCH_SND_FILE_ENDIAN_LITTLE: Little endian byte order * @IPATCH_SND_FILE_ENDIAN_BIG: Big endian byte order * @IPATCH_SND_FILE_ENDIAN_CPU: Native CPU byte order * * Endian byte order libsndfile enum. */ typedef enum { IPATCH_SND_FILE_ENDIAN_FILE, IPATCH_SND_FILE_ENDIAN_LITTLE, IPATCH_SND_FILE_ENDIAN_BIG, IPATCH_SND_FILE_ENDIAN_CPU } IpatchSndFileEndian; /** * IPATCH_SND_FILE_DEFAULT_FORMAT: * * Default file format enum for #IPATCH_TYPE_SND_FILE_FORMAT. */ #define IPATCH_SND_FILE_DEFAULT_FORMAT SF_FORMAT_WAV /** * IPATCH_SND_FILE_DEFAULT_SUB_FORMAT: * * Default file sub format enum for #IPATCH_TYPE_SND_FILE_SUB_FORMAT. */ #define IPATCH_SND_FILE_DEFAULT_SUB_FORMAT SF_FORMAT_PCM_16 /** * IPATCH_SND_FILE_DEFAULT_ENDIAN: * * Default endian byte order from enum #IPATCH_TYPE_SND_FILE_ENDIAN. */ #define IPATCH_SND_FILE_DEFAULT_ENDIAN IPATCH_SND_FILE_ENDIAN_FILE /* DLS file object (derived from IpatchFile) */ struct _IpatchSndFile { IpatchFile parent_instance; }; /* DLS file class (derived from IpatchFile) */ struct _IpatchSndFileClass { IpatchFileClass parent_class; }; GType ipatch_snd_file_get_type (void); IpatchSndFile *ipatch_snd_file_new (void); GType ipatch_snd_file_format_get_type (void); GType ipatch_snd_file_sub_format_get_type (void); int *ipatch_snd_file_format_get_sub_formats (int format, guint *size); int ipatch_snd_file_sample_format_to_sub_format (int sample_format, int file_format); #endif libinstpatch-1.0.0/libinstpatch/Makefile.in0000644000175000017500000010623111461360570015654 00000000000000# Makefile.in generated by automake 1.11 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 = libinstpatch DIST_COMMON = $(ipatchinc_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/libinstpatch.h.in \ $(srcdir)/version.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/python.m4 \ $(top_srcdir)/acinclude.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)/config.h CONFIG_CLEAN_FILES = libinstpatch.h version.h 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)$(libdir)" "$(DESTDIR)$(ipatchincdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libinstpatch_1_0_la_DEPENDENCIES = am__objects_1 = am__objects_2 = builtin_enums.lo marshals.lo am__objects_3 = $(am__objects_2) IpatchBase.lo IpatchContainer.lo \ IpatchContainer_notify.lo IpatchConverter.lo \ IpatchConverterSF2VoiceCache.lo IpatchConvert_DLS2.lo \ IpatchConvert_Gig.lo IpatchConvert_SF2.lo IpatchDLS2.lo \ IpatchDLS2Conn.lo IpatchDLS2Info.lo IpatchDLS2Inst.lo \ IpatchDLS2Param_tables.lo IpatchDLS2Region.lo \ IpatchDLS2Sample.lo IpatchDLSFile.lo IpatchDLSReader.lo \ IpatchDLSWriter.lo IpatchFile.lo IpatchFileBuf.lo IpatchGig.lo \ IpatchGigDimension.lo IpatchGigEffects.lo IpatchGigFile.lo \ IpatchGigInst.lo IpatchGigRegion.lo IpatchGigSample.lo \ IpatchGigSubRegion.lo IpatchItem.lo IpatchItemProp.lo \ IpatchIter.lo IpatchList.lo IpatchParamProp.lo IpatchPaste.lo \ IpatchRange.lo IpatchRiff.lo IpatchSample.lo \ IpatchSampleData.lo IpatchSampleList.lo IpatchSampleStore.lo \ IpatchSampleStoreCache.lo IpatchSampleStoreFile.lo \ IpatchSampleStoreRam.lo IpatchSampleStoreRom.lo \ IpatchSampleStoreSndFile.lo IpatchSampleStoreSplit24.lo \ IpatchSampleStoreSwap.lo IpatchSampleStoreVirtual.lo \ IpatchSampleTransform.lo IpatchSF2.lo IpatchSF2File.lo \ IpatchSF2Gen.lo IpatchSF2GenItem.lo IpatchSF2Gen_tables.lo \ IpatchSF2Inst.lo IpatchSF2IZone.lo IpatchSF2Mod.lo \ IpatchSF2ModItem.lo IpatchSF2Preset.lo IpatchSF2PZone.lo \ IpatchSF2Reader.lo IpatchSF2Sample.lo IpatchSF2VoiceCache.lo \ IpatchSF2VoiceCache_DLS.lo IpatchSF2VoiceCache_SF2.lo \ IpatchSF2VoiceCache_Gig.lo IpatchSF2VoiceCache_VBank.lo \ IpatchSF2Writer.lo IpatchSF2Zone.lo IpatchSndFile.lo \ IpatchTypeProp.lo IpatchUnit.lo IpatchUnit_generic.lo \ IpatchUnit_DLS.lo IpatchUnit_SF2.lo IpatchVBank.lo \ IpatchVBankInst.lo IpatchVBankRegion.lo \ IpatchVirtualContainer.lo IpatchVirtualContainer_types.lo \ IpatchXml.lo IpatchXmlObject.lo md5.lo misc.lo sample.lo \ util.lo am_libinstpatch_1_0_la_OBJECTS = $(am__objects_1) $(am__objects_3) libinstpatch_1_0_la_OBJECTS = $(am_libinstpatch_1_0_la_OBJECTS) libinstpatch_1_0_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libinstpatch_1_0_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) 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 = $(libinstpatch_1_0_la_SOURCES) DIST_SOURCES = $(libinstpatch_1_0_la_SOURCES) HEADERS = $(ipatchinc_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ IPATCH_BINARY_AGE = @IPATCH_BINARY_AGE@ IPATCH_INTERFACE_AGE = @IPATCH_INTERFACE_AGE@ IPATCH_VERSION = @IPATCH_VERSION@ IPATCH_VERSION_MAJOR = @IPATCH_VERSION_MAJOR@ IPATCH_VERSION_MICRO = @IPATCH_VERSION_MICRO@ IPATCH_VERSION_MINOR = @IPATCH_VERSION_MINOR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ 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@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ PYGTK_CODEGEN_DIR = @PYGTK_CODEGEN_DIR@ PYGTK_LIBS = @PYGTK_LIBS@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ SNDFILE_LIBS = @SNDFILE_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ 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@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ 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@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ lib_LTLIBRARIES = libinstpatch-1.0.la @PLATFORM_WIN32_TRUE@no_undefined = -no-undefined -export-symbols @PLATFORM_WIN32_TRUE@libinstpatch_la_def = libinstpatch.def BUILT_SOURCES = \ builtin_enums.c \ builtin_enums.h \ marshals.c \ marshals.h # correctly clean the generated source files CLEANFILES = $(BUILT_SOURCES) # extra files and optional sources EXTRA_DIST = \ marshals.list \ version.h.in \ libinstpatch.def ipatch_public_h_sources = \ IpatchBase.h \ IpatchContainer.h \ IpatchConverter.h \ IpatchConverterSF2VoiceCache.h \ IpatchConvert_DLS2.h \ IpatchConvert_Gig.h \ IpatchConvert_SF2.h \ IpatchDLS2Conn.h \ IpatchDLS2.h \ IpatchDLS2Info.h \ IpatchDLS2Inst.h \ IpatchDLS2Region.h \ IpatchDLS2Sample.h \ IpatchDLSFile.h \ IpatchDLSReader.h \ IpatchDLSWriter.h \ IpatchFile.h \ IpatchGig.h \ IpatchGigDimension.h \ IpatchGigEffects.h \ IpatchGigFile.h \ IpatchGigInst.h \ IpatchGigRegion.h \ IpatchGigSample.h \ IpatchGigSubRegion.h \ IpatchItem.h \ IpatchIter.h \ IpatchList.h \ IpatchParamProp.h \ IpatchPaste.h \ IpatchRange.h \ IpatchRiff.h \ IpatchSample.h \ IpatchSampleData.h \ IpatchSampleList.h \ IpatchSampleStore.h \ IpatchSampleStoreCache.h \ IpatchSampleStoreFile.h \ IpatchSampleStoreRam.h \ IpatchSampleStoreRom.h \ IpatchSampleStoreSndFile.h \ IpatchSampleStoreSplit24.h \ IpatchSampleStoreSwap.h \ IpatchSampleStoreVirtual.h \ IpatchSampleTransform.h \ IpatchSF2.h \ IpatchSF2File.h \ IpatchSF2Gen.h \ IpatchSF2GenItem.h \ IpatchSF2Inst.h \ IpatchSF2IZone.h \ IpatchSF2Mod.h \ IpatchSF2ModItem.h \ IpatchSF2Preset.h \ IpatchSF2PZone.h \ IpatchSF2Reader.h \ IpatchSF2Sample.h \ IpatchSF2VoiceCache.h \ IpatchSF2VoiceCache_DLS.h \ IpatchSF2VoiceCache_SF2.h \ IpatchSF2VoiceCache_Gig.h \ IpatchSF2VoiceCache_VBank.h \ IpatchSF2Writer.h \ IpatchSF2Zone.h \ IpatchSndFile.h \ IpatchTypeProp.h \ IpatchUnit.h \ IpatchUnit_generic.h \ IpatchUnit_DLS.h \ IpatchUnit_SF2.h \ IpatchVBank.h \ IpatchVBankInst.h \ IpatchVBankRegion.h \ IpatchVirtualContainer.h \ IpatchVirtualContainer_types.h \ IpatchXml.h \ IpatchXmlObject.h \ misc.h \ sample.h \ util.h \ version.h ipatch_sources = \ $(BUILT_SOURCES) \ IpatchBase.c \ IpatchContainer.c \ IpatchContainer_notify.c \ IpatchConverter.c \ IpatchConverterSF2VoiceCache.c \ IpatchConverter_priv.h \ IpatchConvert_DLS2.c \ IpatchConvert_Gig.c \ IpatchConvert_SF2.c \ IpatchDLS2.c \ IpatchDLS2Conn.c \ IpatchDLS2Info.c \ IpatchDLS2Inst.c \ IpatchDLS2Param_tables.c \ IpatchDLS2Region.c \ IpatchDLS2Sample.c \ IpatchDLSFile.c \ IpatchDLSReader.c \ IpatchDLSWriter.c \ IpatchFile.c \ IpatchFileBuf.c \ IpatchGig.c \ IpatchGigDimension.c \ IpatchGigEffects.c \ IpatchGigFile.c \ IpatchGigInst.c \ IpatchGigRegion.c \ IpatchGigSample.c \ IpatchGigSubRegion.c \ IpatchItem.c \ IpatchItemProp.c \ IpatchIter.c \ IpatchList.c \ IpatchParamProp.c \ IpatchPaste.c \ IpatchRange.c \ IpatchRiff.c \ IpatchSample.c \ IpatchSampleData.c \ IpatchSampleList.c \ IpatchSampleStore.c \ IpatchSampleStoreCache.c \ IpatchSampleStoreFile.c \ IpatchSampleStoreRam.c \ IpatchSampleStoreRom.c \ IpatchSampleStoreSndFile.c \ IpatchSampleStoreSplit24.c \ IpatchSampleStoreSwap.c \ IpatchSampleStoreVirtual.c \ IpatchSampleTransform.c \ IpatchSF2.c \ IpatchSF2File.c \ IpatchSF2Gen.c \ IpatchSF2GenItem.c \ IpatchSF2Gen_tables.c \ IpatchSF2Inst.c \ IpatchSF2IZone.c \ IpatchSF2Mod.c \ IpatchSF2ModItem.c \ IpatchSF2Preset.c \ IpatchSF2PZone.c \ IpatchSF2Reader.c \ IpatchSF2Sample.c \ IpatchSF2VoiceCache.c \ IpatchSF2VoiceCache_DLS.c \ IpatchSF2VoiceCache_SF2.c \ IpatchSF2VoiceCache_Gig.c \ IpatchSF2VoiceCache_VBank.c \ IpatchSF2Writer.c \ IpatchSF2Zone.c \ IpatchSndFile.c \ IpatchTypeProp.c \ IpatchUnit.c \ IpatchUnit_generic.c \ IpatchUnit_DLS.c \ IpatchUnit_SF2.c \ IpatchVBank.c \ IpatchVBankInst.c \ IpatchVBankRegion.c \ IpatchVirtualContainer.c \ IpatchVirtualContainer_types.c \ IpatchXml.c \ IpatchXmlObject.c \ i18n.h \ ipatch_priv.h \ md5.c \ md5.h \ misc.c \ sample.c \ util.c libinstpatch_1_0_la_SOURCES = $(ipatch_public_h_sources) $(ipatch_sources) libinstpatch_1_0_la_LDFLAGS = $(no_undefined) $(libinstpatch_la_def) \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -export-dynamic libinstpatch_1_0_la_LIBADD = @SNDFILE_LIBS@ @GOBJECT_LIBS@ ipatchincdir = $(includedir)/libinstpatch-1.0/libinstpatch ipatchinc_HEADERS = $(ipatch_public_h_sources) builtin_enums.h libinstpatch.h INCLUDES = @GOBJECT_CFLAGS@ @SNDFILE_CFLAGS@ -I.. -DLIBINSTPATCH_COMPILATION \ -DG_LOG_DOMAIN=\"libInstPatch\" -DLOCALEDIR=\"$(datadir)/locale\" all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(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 libinstpatch/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu libinstpatch/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): libinstpatch.h: $(top_builddir)/config.status $(srcdir)/libinstpatch.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ version.h: $(top_builddir)/config.status $(srcdir)/version.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || 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)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libinstpatch-1.0.la: $(libinstpatch_1_0_la_OBJECTS) $(libinstpatch_1_0_la_DEPENDENCIES) $(libinstpatch_1_0_la_LINK) -rpath $(libdir) $(libinstpatch_1_0_la_OBJECTS) $(libinstpatch_1_0_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchBase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchContainer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchContainer_notify.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchConvert_DLS2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchConvert_Gig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchConvert_SF2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchConverter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchConverterSF2VoiceCache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchDLS2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchDLS2Conn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchDLS2Info.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchDLS2Inst.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchDLS2Param_tables.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchDLS2Region.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchDLS2Sample.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchDLSFile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchDLSReader.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchDLSWriter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchFile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchFileBuf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchGig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchGigDimension.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchGigEffects.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchGigFile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchGigInst.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchGigRegion.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchGigSample.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchGigSubRegion.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchItem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchItemProp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchIter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchList.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchParamProp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchPaste.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchRange.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchRiff.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2File.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2Gen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2GenItem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2Gen_tables.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2IZone.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2Inst.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2Mod.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2ModItem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2PZone.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2Preset.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2Reader.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2Sample.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2VoiceCache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2VoiceCache_DLS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2VoiceCache_Gig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2VoiceCache_SF2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2VoiceCache_VBank.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2Writer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSF2Zone.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSample.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleData.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleList.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleStore.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleStoreCache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleStoreFile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleStoreRam.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleStoreRom.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleStoreSndFile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleStoreSplit24.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleStoreSwap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleStoreVirtual.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSampleTransform.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchSndFile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchTypeProp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchUnit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchUnit_DLS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchUnit_SF2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchUnit_generic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchVBank.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchVBankInst.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchVBankRegion.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchVirtualContainer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchVirtualContainer_types.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchXml.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpatchXmlObject.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/builtin_enums.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/marshals.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.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 install-ipatchincHEADERS: $(ipatchinc_HEADERS) @$(NORMAL_INSTALL) test -z "$(ipatchincdir)" || $(MKDIR_P) "$(DESTDIR)$(ipatchincdir)" @list='$(ipatchinc_HEADERS)'; test -n "$(ipatchincdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(ipatchincdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(ipatchincdir)" || exit $$?; \ done uninstall-ipatchincHEADERS: @$(NORMAL_UNINSTALL) @list='$(ipatchinc_HEADERS)'; test -n "$(ipatchincdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(ipatchincdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(ipatchincdir)" && rm -f $$files 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 distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(ipatchincdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ 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-data-local install-ipatchincHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES 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-ipatchincHEADERS uninstall-libLTLIBRARIES \ uninstall-local .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-local install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-ipatchincHEADERS \ install-libLTLIBRARIES install-man 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-ipatchincHEADERS \ uninstall-libLTLIBRARIES uninstall-local @OS_WIN32_TRUE@install-libtool-import-lib: @OS_WIN32_TRUE@ $(INSTALL) .libs/libinstpatch-1.0.dll.a $(DESTDIR)$(libdir) @OS_WIN32_TRUE@uninstall-libtool-import-lib: @OS_WIN32_TRUE@ -rm $(DESTDIR)$(libdir)/libinstpatch-1.0.dll.a @OS_WIN32_FALSE@install-libtool-import-lib: @OS_WIN32_FALSE@uninstall-libtool-import-lib: marshals.c: marshals.list echo "/* Autogenerated file (add to marshals.list and 'make update-marshals') */" >marshals.c glib-genmarshal --body --prefix=ipatch_marshal \ marshals.list >>marshals.c marshals.h: marshals.list echo "/* Autogenerated file (add to marshals.list and 'make update-marshals') */" >marshals.h glib-genmarshal --header --prefix=ipatch_marshal \ marshals.list >>marshals.h builtin_enums.c: s-builtin-enums-c @true s-builtin-enums-c: $(ipatch_public_h_sources) Makefile ( cd $(srcdir) && glib-mkenums \ --fhead "#include \"libinstpatch.h\"\n#include \"ipatch_priv.h\"" \ --fprod "\n/* enumerations from \"@filename@\" */" \ --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \ $(ipatch_public_h_sources) ) \ | sed 's/dl_s2/dls2/g;s/DL_S2/DLS2/g' \ > xgen-enumc && cp xgen-enumc $(srcdir)/builtin_enums.c \ && rm -f xgen-enumc builtin_enums.h: s-builtin-enums-h @true s-builtin-enums-h: $(ipatch_public_h_sources) Makefile ( cd $(srcdir) && glib-mkenums \ --fhead "#ifndef __IPATCH_BUILTIN_ENUMS_H__\n#define __IPATCH_BUILTIN_ENUMS_H__\n\n#include \n\nG_BEGIN_DECLS\n" \ --fprod "/* enumerations from \"@filename@\" */\n" \ --vhead "GType @enum_name@_get_type (void);\n#define IPATCH_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \ --ftail "G_END_DECLS\n\n#endif /* __IPATCH_BUILTIN_ENUMS_H__ */" \ $(ipatch_public_h_sources) ) \ | sed 's/dl_s2/dls2/g;s/DL_S2/DLS2/g' \ > xgen-enumh && (cmp -s xgen-enumh $(srcdir)/builtin_enums.h \ || cp xgen-enumh $(srcdir)/builtin_enums.h ) \ && rm -f xgen-enumh install-data-local: install-libtool-import-lib uninstall-local: uninstall-libtool-import-lib # 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: libinstpatch-1.0.0/libinstpatch/IpatchSF2Writer.h0000644000175000017500000000652611461332142016700 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2Writer * @short_description: SoundFont writer object * @see_also: * @stability: Stable * * Object for writing a tree of SoundFont objects (#IpatchSF2) to a SoundFont * file. */ #ifndef __IPATCH_SF2_WRITER_H__ #define __IPATCH_SF2_WRITER_H__ #include #include #include #include #include #include typedef struct _IpatchSF2Writer IpatchSF2Writer; /* private structure */ typedef struct _IpatchSF2WriterClass IpatchSF2WriterClass; #define IPATCH_TYPE_SF2_WRITER (ipatch_sf2_writer_get_type ()) #define IPATCH_SF2_WRITER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_WRITER, \ IpatchSF2Writer)) #define IPATCH_SF2_WRITER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_WRITER, \ IpatchSF2WriterClass)) #define IPATCH_IS_SF2_WRITER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_WRITER)) #define IPATCH_IS_SF2_WRITER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2_WRITER)) /* SF2 writer object */ struct _IpatchSF2Writer { IpatchRiff parent_instance; /* derived from IpatchRiff */ IpatchSF2 *orig_sf; /* original SF2 object */ IpatchSF2 *sf; /* duplicated SF2 object to save */ gboolean migrate_samples; /* set to TRUE to migrate samples to new file */ GHashTable *inst_hash; /* instrument => index hash */ GHashTable *sample_hash; /* sample => SampleHashValue hash */ }; /* SF2 writer class */ struct _IpatchSF2WriterClass { IpatchRiffClass parent_class; }; GType ipatch_sf2_writer_get_type (void); IpatchSF2Writer *ipatch_sf2_writer_new (IpatchFileHandle *handle, IpatchSF2 *sfont); void ipatch_sf2_writer_set_patch (IpatchSF2Writer *writer, IpatchSF2 *sfont); void ipatch_sf2_writer_set_file_handle (IpatchSF2Writer *writer, IpatchFileHandle *handle); gboolean ipatch_sf2_writer_save (IpatchSF2Writer *writer, GError **err); void ipatch_sf2_write_phdr (IpatchFileHandle *handle, const IpatchSF2Phdr *phdr); void ipatch_sf2_write_ihdr (IpatchFileHandle *handle, const IpatchSF2Ihdr *ihdr); void ipatch_sf2_write_shdr (IpatchFileHandle *handle, const IpatchSF2Shdr *shdr); void ipatch_sf2_write_bag (IpatchFileHandle *handle, const IpatchSF2Bag *bag); void ipatch_sf2_write_mod (IpatchFileHandle *handle, const IpatchSF2Mod *mod); void ipatch_sf2_write_gen (IpatchFileHandle *handle, int genid, const IpatchSF2GenAmount *amount); #endif libinstpatch-1.0.0/libinstpatch/IpatchFileBuf.c0000644000175000017500000006102311461332142016411 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /* * IpatchFile.c - File buffer and integer read/write funcs */ #include #include #include #include #include "IpatchFile.h" /* Defined in IpatchFile.c */ extern gboolean _ipatch_file_read_no_pos_update (IpatchFileHandle *handle, gpointer buf, guint size, GError **err); extern gboolean _ipatch_file_write_no_pos_update (IpatchFileHandle *handle, gconstpointer buf, guint size, GError **err); /** * ipatch_file_read_u8: * @file: File to read from * @val: Location to store value * @err: Location to store error info or %NULL * * Read an unsigned 8 bit integer from a file. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_read_u8 (IpatchFileHandle *handle, guint8 *val, GError **err) { return (ipatch_file_read (handle, val, sizeof (guint8), err)); } /** * ipatch_file_read_u16: * @handle: File handle * @val: Location to store value * @err: Location to store error info or %NULL * * Read an unsigned 16 bit integer from a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_read_u16 (IpatchFileHandle *handle, guint16 *val, GError **err) { if (!ipatch_file_read (handle, val, sizeof (guint16), err)) return (FALSE); *val = IPATCH_FILE_SWAP16 (handle->file, val); return (TRUE); } /** * ipatch_file_read_u32: * @handle: File handle * @val: Location to store value * @err: Location to store error info or %NULL * * Read an unsigned 32 bit integer from a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_read_u32 (IpatchFileHandle *handle, guint32 *val, GError **err) { if (!ipatch_file_read (handle, val, sizeof (guint32), err)) return (FALSE); *val = IPATCH_FILE_SWAP32 (handle->file, val); return (TRUE); } /** * ipatch_file_read_u64: * @handle: File handle * @val: Location to store value * @err: Location to store error info or %NULL * * Read an unsigned 64 bit integer from a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_read_u64 (IpatchFileHandle *handle, guint64 *val, GError **err) { if (!ipatch_file_read (handle, val, sizeof (guint64), err)) return (FALSE); *val = IPATCH_FILE_SWAP64 (handle->file, val); return (TRUE); } /** * ipatch_file_read_s8: * @handle: File handle * @val: Location to store value * @err: Location to store error info or %NULL * * Read a signed 8 bit integer from a file. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_read_s8 (IpatchFileHandle *handle, gint8 *val, GError **err) { return (ipatch_file_read (handle, val, sizeof (gint8), err)); } /** * ipatch_file_read_s16: * @handle: File handle * @val: Location to store value * @err: Location to store error info or %NULL * * Read a signed 16 bit integer from a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_read_s16 (IpatchFileHandle *handle, gint16 *val, GError **err) { if (!ipatch_file_read (handle, val, sizeof (gint16), err)) return (FALSE); *val = IPATCH_FILE_SWAP16 (handle->file, val); return (TRUE); } /** * ipatch_file_read_s32: * @handle: File handle * @val: Location to store value * @err: Location to store error info or %NULL * * Read a signed 32 bit integer from a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_read_s32 (IpatchFileHandle *handle, gint32 *val, GError **err) { if (!ipatch_file_read (handle, val, sizeof (gint32), err)) return (FALSE); *val = IPATCH_FILE_SWAP32 (handle->file, val); return (TRUE); } /** * ipatch_file_read_s64: * @handle: File handle * @val: Location to store value * @err: Location to store error info or %NULL * * Read a signed 64 bit integer from a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_read_s64 (IpatchFileHandle *handle, gint64 *val, GError **err) { if (!ipatch_file_read (handle, val, sizeof (gint64), err)) return (FALSE); *val = IPATCH_FILE_SWAP64 (handle->file, val); return (TRUE); } /** * ipatch_file_write_u8: * @handle: File handle * @val: Value to store * @err: Location to store error info or %NULL * * Write an unsigned 8 bit integer to a file. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_write_u8 (IpatchFileHandle *handle, guint8 val, GError **err) { return (ipatch_file_write (handle, &val, sizeof (guint8), err)); } /** * ipatch_file_write_u16: * @handle: File handle * @val: Value to store * @err: Location to store error info or %NULL * * Write an unsigned 16 bit integer to a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_write_u16 (IpatchFileHandle *handle, guint16 val, GError **err) { g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (IPATCH_IS_FILE (handle->file), FALSE); val = IPATCH_FILE_SWAP16 (handle->file, &val); if (!ipatch_file_write (handle, &val, sizeof (guint16), err)) return (FALSE); return (TRUE); } /** * ipatch_file_write_u32: * @handle: File handle * @val: Value to store * @err: Location to store error info or %NULL * * Write an unsigned 32 bit integer to a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_write_u32 (IpatchFileHandle *handle, guint32 val, GError **err) { g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (IPATCH_IS_FILE (handle->file), FALSE); val = IPATCH_FILE_SWAP32 (handle->file, &val); if (!ipatch_file_write (handle, &val, sizeof (guint32), err)) return (FALSE); return (TRUE); } /** * ipatch_file_write_u64: * @handle: File handle * @val: Value to store * @err: Location to store error info or %NULL * * Write an unsigned 64 bit integer to a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_write_u64 (IpatchFileHandle *handle, guint64 val, GError **err) { g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (IPATCH_IS_FILE (handle->file), FALSE); val = IPATCH_FILE_SWAP64 (handle->file, &val); if (!ipatch_file_write (handle, &val, sizeof (guint64), err)) return (FALSE); return (TRUE); } /** * ipatch_file_write_s8: * @handle: File handle * @val: Value to store * @err: Location to store error info or %NULL * * Write a signed 8 bit integer to a file. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_write_s8 (IpatchFileHandle *handle, gint8 val, GError **err) { return (ipatch_file_write (handle, &val, sizeof (gint8), err)); } /** * ipatch_file_write_s16: * @handle: File handle * @val: Value to store * @err: Location to store error info or %NULL * * Write a signed 16 bit integer to a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_write_s16 (IpatchFileHandle *handle, gint16 val, GError **err) { g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (IPATCH_IS_FILE (handle->file), FALSE); val = IPATCH_FILE_SWAP16 (handle->file, &val); if (!ipatch_file_write (handle, &val, sizeof (gint16), err)) return (FALSE); return (TRUE); } /** * ipatch_file_write_s32: * @handle: File handle * @val: Value to store * @err: Location to store error info or %NULL * * Write a signed 32 bit integer to a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_write_s32 (IpatchFileHandle *handle, gint32 val, GError **err) { g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (IPATCH_IS_FILE (handle->file), FALSE); val = IPATCH_FILE_SWAP32 (handle->file, &val); if (!ipatch_file_write (handle, &val, sizeof (gint32), err)) return (FALSE); return (TRUE); } /** * ipatch_file_write_s64: * @handle: File handle * @val: Value to store * @err: Location to store error info or %NULL * * Write a signed 64 bit integer to a file and performs endian * byte swapping if necessary. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_file_write_s64 (IpatchFileHandle *handle, gint64 val, GError **err) { g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (IPATCH_IS_FILE (handle->file), FALSE); val = IPATCH_FILE_SWAP64 (handle->file, &val); if (!ipatch_file_write (handle, &val, sizeof (gint64), err)) return (FALSE); return (TRUE); } /** * ipatch_file_buf_load: * @filebuf: Initialized file buffer structure * @size: Size of data to load * @err: Location to store error info or %NULL * * Load data from a file into a buffer for error checking convenience. * I/O errors need only be checked on this function and not on the subsequent * buffered read function calls. It is an error if an end of file is * encountered before all the requested data is read. * * Returns: %TRUE on success, %FALSE on error. */ gboolean ipatch_file_buf_load (IpatchFileHandle *handle, guint size, GError **err) { g_return_val_if_fail (handle != NULL, FALSE); g_return_val_if_fail (size != 0, FALSE); /* If there is still buffered data, flush it (add to file position) */ if (handle->buf_position < handle->buf->len) handle->position += handle->buf->len - handle->buf_position; g_byte_array_set_size (handle->buf, size); handle->buf_position = 0; if (!_ipatch_file_read_no_pos_update (handle, handle->buf->data, size, err)) return (FALSE); return (TRUE); } /** * ipatch_file_buf_read: * @handle: File handle with loaded data to read from * @buf: Buffer to copy data to * @size: Amount of data to copy in bytes * * Read data from a file handle's buffer and advance the buffer's current * position. A call to ipatch_file_buf_load() must have been previously * executed and there must be enough remaining data in the buffer for the read. */ void ipatch_file_buf_read (IpatchFileHandle *handle, gpointer buf, guint size) { g_return_if_fail (handle != NULL); g_return_if_fail (handle->buf_position + size <= handle->buf->len); memcpy (buf, handle->buf->data + handle->buf_position, size); handle->buf_position += size; handle->position += size; } /** * ipatch_file_buf_write: * @handle: File handle to append buffered data to * @buf: Buffer to copy data from * @size: Amount of data to copy in bytes * * Write data to a file handle's buffer and advance the buffer's current position. * Data will not actually be written to file till ipatch_file_buf_commit() is * called. */ void ipatch_file_buf_write (IpatchFileHandle *handle, gconstpointer buf, guint size) { g_return_if_fail (handle != NULL); g_byte_array_append (handle->buf, buf, size); handle->buf_position = handle->buf->len; handle->position += size; } /** * ipatch_file_buf_memset: * @handle: File handle to append buffered data to * @c: Character to write * @size: Size of data to set * * Sets the given @size in bytes to the character @c and advances the * current position. Buffer is expanded if necessary. */ void ipatch_file_buf_memset (IpatchFileHandle *handle, char c, guint size) { g_return_if_fail (handle != NULL); if (size == 0) return; if (handle->buf_position + size > handle->buf->len) g_byte_array_set_size (handle->buf, handle->buf_position + size); memset (handle->buf->data + handle->buf_position, c, size); handle->buf_position += size; handle->position += size; } /** * ipatch_file_buf_commit: * @handle: File handle with buffered data to write * @err: Location to store error info or %NULL * * Writes all data in a file handle's buffer to the file and resets the * buffer to empty. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_file_buf_commit (IpatchFileHandle *handle, GError **err) { g_return_val_if_fail (handle != NULL, FALSE); if (handle->buf->len == 0) return (TRUE); /* no data? */ if (!_ipatch_file_write_no_pos_update (handle, handle->buf->data, handle->buf->len, err)) return (FALSE); g_byte_array_set_size (handle->buf, 0); handle->buf_position = 0; return (TRUE); } /** * ipatch_file_buf_seek: * @handle: File handle * @offset: Offset to seek * @type: Seek type * * Seeks the current position in a file handle's buffer specified by an @offset * and seek @type. It is an error to seek outside of the current size of * buffered data (loaded or written). The @offset is relative to the buffer, * not the file position. */ void ipatch_file_buf_seek (IpatchFileHandle *handle, int offset, GSeekType type) { g_return_if_fail (handle != NULL); if (type == G_SEEK_CUR) { g_return_if_fail (handle->buf_position + offset >= 0); g_return_if_fail (handle->buf_position + offset < handle->buf->len); handle->buf_position += offset; handle->position += offset; } else if (type == G_SEEK_SET) { g_return_if_fail (offset >= 0 && offset < handle->buf->len); handle->position += offset - handle->buf_position; handle->buf_position = offset; } else if (type == G_SEEK_END) { g_return_if_fail (handle->buf->len + offset >= 0); g_return_if_fail (handle->buf->len + offset < handle->buf->len); handle->position = (handle->buf->len + offset) - handle->buf_position; handle->buf_position = handle->buf->len + offset; } } /** * ipatch_file_buf_read_u8: * @handle: File handle with loaded data * * Reads an unsigned byte from a file buffer and advances the buffer's * current position. * * Returns: The value. */ guint8 ipatch_file_buf_read_u8 (IpatchFileHandle *handle) { guint8 *val; g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (handle->buf_position + 1 <= handle->buf->len, 0); val = (guint8 *)(handle->buf->data + handle->buf_position); handle->buf_position++; handle->position++; return (*val); } /** * ipatch_file_buf_read_u16: * @handle: File handle with loaded data * * Reads an unsigned 16 bit word from a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * * Returns: The value. */ guint16 ipatch_file_buf_read_u16 (IpatchFileHandle *handle) { guint16 *val; g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (handle->buf_position + 2 <= handle->buf->len, 0); val = (guint16 *)(handle->buf->data + handle->buf_position); handle->buf_position += 2; handle->position += 2; return (IPATCH_FILE_SWAP16 (handle->file, val)); } /** * ipatch_file_buf_read_u32: * @handle: File handle with loaded data * * Reads an unsigned 32 bit word from a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * * Returns: The value. */ guint32 ipatch_file_buf_read_u32 (IpatchFileHandle *handle) { guint32 *val; g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (handle->buf_position + 4 <= handle->buf->len, 0); val = (guint32 *)(handle->buf->data + handle->buf_position); handle->buf_position += 4; handle->position += 4; return (IPATCH_FILE_SWAP32 (handle->file, val)); } /** * ipatch_file_buf_read_u64: * @handle: File handle with loaded data * * Reads an unsigned 64 bit word from a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * * Returns: The value. */ guint64 ipatch_file_buf_read_u64 (IpatchFileHandle *handle) { guint64 *val; g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (handle->buf_position + 8 <= handle->buf->len, 0); val = (guint64 *)(handle->buf->data + handle->buf_position); handle->buf_position += 8; handle->position += 8; return (IPATCH_FILE_SWAP64 (handle->file, val)); } /** * ipatch_file_buf_read_s8: * @handle: File handle with loaded data * * Reads a signed byte from a file buffer and advances the buffer's * current position. * * Returns: The value. */ gint8 ipatch_file_buf_read_s8 (IpatchFileHandle *handle) { gint8 *val; g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (handle->buf_position + 1 <= handle->buf->len, 0); val = (gint8 *)(handle->buf->data + handle->buf_position); handle->buf_position++; handle->position++; return (*val); } /** * ipatch_file_buf_read_s16: * @handle: File handle with loaded data * * Reads a signed 16 bit word from a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * * Returns: The value. */ gint16 ipatch_file_buf_read_s16 (IpatchFileHandle *handle) { gint16 *val; g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (handle->buf_position + 2 <= handle->buf->len, 0); val = (gint16 *)(handle->buf->data + handle->buf_position); handle->buf_position += 2; handle->position += 2; return (IPATCH_FILE_SWAP16 (handle->file, val)); } /** * ipatch_file_buf_read_s32: * @handle: File handle with loaded data * * Reads a signed 32 bit word from a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * * Returns: The value. */ gint32 ipatch_file_buf_read_s32 (IpatchFileHandle *handle) { gint32 *val; g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (handle->buf_position + 4 <= handle->buf->len, 0); val = (gint32 *)(handle->buf->data + handle->buf_position); handle->buf_position += 4; handle->position += 4; return (IPATCH_FILE_SWAP32 (handle->file, val)); } /** * ipatch_file_buf_read_s64: * @handle: File handle with loaded data * * Reads a signed 64 bit word from a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * * Returns: The value. */ gint64 ipatch_file_buf_read_s64 (IpatchFileHandle *handle) { gint64 *val; g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (handle->buf_position + 8 <= handle->buf->len, 0); val = (gint64 *)(handle->buf->data + handle->buf_position); handle->buf_position += 8; handle->position += 8; return (IPATCH_FILE_SWAP64 (handle->file, val)); } /** * ipatch_file_buf_write_u8: * @handle: File handle * @val: Value to write into file buffer * * Writes an unsigned byte to a file buffer and advances the buffer's * current position. The file buffer is expanded if needed. */ void ipatch_file_buf_write_u8 (IpatchFileHandle *handle, guint8 val) { g_return_if_fail (handle != NULL); if (handle->buf_position + 1 > handle->buf->len) g_byte_array_set_size (handle->buf, handle->buf_position + 1); *(guint8 *)(handle->buf->data + handle->buf_position) = val; handle->buf_position++; handle->position++; } /** * ipatch_file_buf_write_u16: * @handle: File handle * @val: Value to write into file buffer * * Writes an unsigned 16 bit word to a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * The file buffer is expanded if needed. */ void ipatch_file_buf_write_u16 (IpatchFileHandle *handle, guint16 val) { g_return_if_fail (handle != NULL); if (handle->buf_position + 2 > handle->buf->len) g_byte_array_set_size (handle->buf, handle->buf_position + 2); *(guint16 *)(handle->buf->data + handle->buf_position) = IPATCH_FILE_SWAP16 (handle->file, &val); handle->buf_position += 2; handle->position += 2; } /** * ipatch_file_buf_write_u32: * @handle: File handle * @val: Value to write into file buffer * * Writes an unsigned 32 bit word to a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * The file buffer is expanded if needed. */ void ipatch_file_buf_write_u32 (IpatchFileHandle *handle, guint32 val) { g_return_if_fail (handle != NULL); if (handle->buf_position + 4 > handle->buf->len) g_byte_array_set_size (handle->buf, handle->buf_position + 4); *(guint32 *)(handle->buf->data + handle->buf_position) = IPATCH_FILE_SWAP32 (handle->file, &val); handle->buf_position += 4; handle->position += 4; } /** * ipatch_file_buf_write_u64: * @handle: File handle * @val: Value to write into file buffer * * Writes an unsigned 64 bit word to a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * The file buffer is expanded if needed. */ void ipatch_file_buf_write_u64 (IpatchFileHandle *handle, guint64 val) { g_return_if_fail (handle != NULL); if (handle->buf_position + 8 > handle->buf->len) g_byte_array_set_size (handle->buf, handle->buf_position + 8); *(guint64 *)(handle->buf->data + handle->buf_position) = IPATCH_FILE_SWAP64 (handle->file, &val); handle->buf_position += 8; handle->position += 8; } /** * ipatch_file_buf_write_s8: * @handle: File handle * @val: Value to write into file buffer * * Writes a signed byte to a file buffer and advances the buffer's * current position. The file buffer is expanded if needed. */ void ipatch_file_buf_write_s8 (IpatchFileHandle *handle, gint8 val) { g_return_if_fail (handle != NULL); if (handle->buf_position + 1 > handle->buf->len) g_byte_array_set_size (handle->buf, handle->buf_position + 1); *(gint8 *)(handle->buf->data + handle->buf_position) = val; handle->buf_position++; handle->position++; } /** * ipatch_file_buf_write_s16: * @handle: File handle * @val: Value to write into file buffer * * Writes a signed 16 bit word to a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * The file buffer is expanded if needed. */ void ipatch_file_buf_write_s16 (IpatchFileHandle *handle, gint16 val) { g_return_if_fail (handle != NULL); if (handle->buf_position + 2 > handle->buf->len) g_byte_array_set_size (handle->buf, handle->buf_position + 2); *(gint16 *)(handle->buf->data + handle->buf_position) = IPATCH_FILE_SWAP16 (handle->file, &val); handle->buf_position += 2; handle->position += 2; } /** * ipatch_file_buf_write_s32: * @handle: File handle * @val: Value to write into file buffer * * Writes a signed 32 bit word to a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * The file buffer is expanded if needed. */ void ipatch_file_buf_write_s32 (IpatchFileHandle *handle, gint32 val) { g_return_if_fail (handle != NULL); if (handle->buf_position + 4 > handle->buf->len) g_byte_array_set_size (handle->buf, handle->buf_position + 4); *(gint32 *)(handle->buf->data + handle->buf_position) = IPATCH_FILE_SWAP32 (handle->file, &val); handle->buf_position += 4; handle->position += 4; } /** * ipatch_file_buf_write_s64: * @handle: File handle * @val: Value to write into file buffer * * Writes a signed 64 bit word to a file buffer and advances the buffer's * current position. Performs endian byte swapping if necessary. * The file buffer is expanded if needed. */ void ipatch_file_buf_write_s64 (IpatchFileHandle *handle, gint64 val) { g_return_if_fail (handle != NULL); if (handle->buf_position + 8 > handle->buf->len) g_byte_array_set_size (handle->buf, handle->buf_position + 8); *(gint64 *)(handle->buf->data + handle->buf_position) = IPATCH_FILE_SWAP64 (handle->file, &val); handle->buf_position += 8; handle->position += 8; } libinstpatch-1.0.0/libinstpatch/IpatchGigSample.h0000644000175000017500000000472711461332142016762 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchGigSample * @short_description: GigaSampler sample object * @see_also: #IpatchGig * @stability: Stable * * Object defining a GigaSampler sample object. Child of #IpatchGig objects * and referenced by #IpatchGigSubRegion objects. */ #ifndef __IPATCH_GIG_SAMPLE_H__ #define __IPATCH_GIG_SAMPLE_H__ #include #include /* forward type declarations */ typedef struct _IpatchGigSample IpatchGigSample; typedef struct _IpatchGigSampleClass IpatchGigSampleClass; #include #define IPATCH_TYPE_GIG_SAMPLE (ipatch_gig_sample_get_type ()) #define IPATCH_GIG_SAMPLE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_GIG_SAMPLE, \ IpatchGigSample)) #define IPATCH_GIG_SAMPLE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_GIG_SAMPLE, \ IpatchGigSampleClass)) #define IPATCH_IS_GIG_SAMPLE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_GIG_SAMPLE)) #define IPATCH_IS_GIG_SAMPLE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_GIG_SAMPLE)) #define IPATCH_GIG_SAMPLE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_GIG_SAMPLE, \ IpatchGigSampleClass)) /* GigaSampler sample object */ struct _IpatchGigSample { IpatchDLS2Sample parent_instance; guint32 group_number; /* sample group number - FIXME - what exactly is it? */ }; struct _IpatchGigSampleClass { IpatchDLS2SampleClass parent_class; }; GType ipatch_gig_sample_get_type (void); IpatchGigSample *ipatch_gig_sample_new (void); IpatchGigSample *ipatch_gig_sample_first (IpatchIter *iter); IpatchGigSample *ipatch_gig_sample_next (IpatchIter *iter); #endif libinstpatch-1.0.0/libinstpatch/IpatchSndFile.c0000644000175000017500000001731411461332142016425 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSndFile.h" #include "sample.h" #include "ipatch_priv.h" #include "i18n.h" #include "misc.h" static gboolean ipatch_snd_file_identify (IpatchFile *file, IpatchFileHandle *handle, GError **err); G_DEFINE_TYPE (IpatchSndFile, ipatch_snd_file, IPATCH_TYPE_FILE); /* Get type of dynamic libsndfile file format enum (register it as needed) */ GType ipatch_snd_file_format_get_type (void) { static GType type = 0; if (!type) { GEnumValue *values; SF_FORMAT_INFO finfo; int major_count; int value_index = 0; int i; sf_command (NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof (int)); values = g_new (GEnumValue, major_count + 1); for (i = 0; i < major_count; i++) { finfo.format = i; sf_command (NULL, SFC_GET_FORMAT_MAJOR, &finfo, sizeof (finfo)); /* Skip RAW format since we use IpatchSampleStoreFile instead, for more flexibility */ if (finfo.format == SF_FORMAT_RAW) continue; values[value_index].value = finfo.format; values[value_index].value_name = finfo.extension; values[value_index].value_nick = finfo.name; value_index++; } values[value_index].value = 0; values[value_index].value_name = NULL; values[value_index].value_nick = NULL; type = g_enum_register_static ("IpatchSndFileFormat", values); } return (type); } /* Get type of dynamic libsndfile file sub format enum (register it as needed) */ GType ipatch_snd_file_sub_format_get_type (void) { static GType type = 0; if (!type) { GEnumValue *values; SF_FORMAT_INFO sinfo; int subtype_count; int value_index = 0; int i; sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof (int)); values = g_new (GEnumValue, subtype_count + 1); for (i = 0; i < subtype_count; i++) { sinfo.format = i; sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &sinfo, sizeof (sinfo)); values[value_index].value = sinfo.format; values[value_index].value_name = sinfo.name; values[value_index].value_nick = NULL; value_index++; } values[value_index].value = 0; values[value_index].value_name = NULL; values[value_index].value_nick = NULL; type = g_enum_register_static ("IpatchSndFileSubFormat", values); } return (type); } static void ipatch_snd_file_class_init (IpatchSndFileClass *klass) { IpatchFileClass *file_class = IPATCH_FILE_CLASS (klass); file_class->identify = ipatch_snd_file_identify; /* Set to last execution (subtract another 100, since we really want to be last) */ file_class->identify_order = IPATCH_FILE_IDENTIFY_ORDER_LAST - 100; } static void ipatch_snd_file_init (IpatchSndFile *file) { } /* Identify if this file format is known by libsndfile */ static gboolean ipatch_snd_file_identify (IpatchFile *file, IpatchFileHandle *handle, GError **err) { SNDFILE *sfhandle; SF_INFO info = { 0 }; char *filename; filename = ipatch_file_get_name (file); /* ++ alloc file name */ if (!filename) return (FALSE); sfhandle = sf_open (filename, SFM_READ, &info); if (sfhandle) sf_close (sfhandle); g_free (filename); /* -- free file name */ return (sfhandle != NULL); } /** * ipatch_snd_file_new: * * Create a new libsndfile file object. * * Returns: New libsndfile file object (derived from IpatchFile) with a * reference count of 1. Caller owns the reference and removing it will * destroy the item. */ IpatchSndFile * ipatch_snd_file_new (void) { return (IPATCH_SND_FILE (g_object_new (IPATCH_TYPE_SND_FILE, NULL))); } /** * ipatch_snd_file_format_get_sub_formats: * @format: "IpatchSndFileFormat" GEnum to get sub formats of * @size: Location to store size of returned sub formats array * * Get supported sub formats of a given libsndfile format. * * Returns: Newly allocated list of sub format enum values or %NULL if @format * is invalid */ int * ipatch_snd_file_format_get_sub_formats (int format, guint *size) { SF_FORMAT_INFO info; SF_INFO sfinfo; GArray *array; int subtype_count, s; if (size) *size = 0; /* In case of error */ g_return_val_if_fail (size != NULL, NULL); format &= SF_FORMAT_TYPEMASK; /* Mask out everything but file type */ array = g_array_new (FALSE, FALSE, sizeof (int)); /* ++ alloc array */ memset (&sfinfo, 0, sizeof (sfinfo)); sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof (int)); sfinfo.channels = 1; for (s = 0; s < subtype_count; s++) { info.format = s; sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &info, sizeof (info)); sfinfo.format = format | info.format; if (sf_format_check (&sfinfo)) g_array_append_val (array, info.format); } *size = array->len; return ((int *)g_array_free (array, FALSE)); /* !! caller takes over alloc */ } /** * ipatch_snd_file_sample_format_to_sub_format: * @sample_format: libinstpatch sample format (see #sample) * @file_format: libsndfile format GEnum "IpatchSndFileFormat" value or -1 to * not limit sub formats to a given file format. * * Get the optimal libsndfile sub format for a libinstpatch sample format. The * returned value may not be an exact equivalent, in the case of unsigned * sample data with bit widths greater than 8, but will return the optimal * format in those cases. If @file_format is not -1 then the resulting sub * format is guaranteed to be valid for it. * * Returns: Optimal libsndfile sub format enum value or -1 on error (invalid * @sample_format). */ int ipatch_snd_file_sample_format_to_sub_format (int sample_format, int file_format) { int sub_format, i; int *formats; guint size; g_return_val_if_fail (ipatch_sample_format_verify (sample_format), -1); switch (IPATCH_SAMPLE_FORMAT_GET_WIDTH (sample_format)) { case IPATCH_SAMPLE_8BIT: sub_format = SF_FORMAT_PCM_S8; break; case IPATCH_SAMPLE_16BIT: sub_format = SF_FORMAT_PCM_16; break; case IPATCH_SAMPLE_24BIT: case IPATCH_SAMPLE_REAL24BIT: sub_format = SF_FORMAT_PCM_24; break; case IPATCH_SAMPLE_32BIT: sub_format = SF_FORMAT_PCM_32; break; case IPATCH_SAMPLE_FLOAT: sub_format = SF_FORMAT_FLOAT; break; case IPATCH_SAMPLE_DOUBLE: sub_format = SF_FORMAT_DOUBLE; break; default: sub_format = SF_FORMAT_PCM_16; break; } if (file_format) { /* ++ alloc array of valid sub formats for this file format */ formats = ipatch_snd_file_format_get_sub_formats (file_format, &size); if (!formats) return (-1); /* Invalid file_format value */ for (i = 0; i < size; i++) if (formats[i] == sub_format) break; if (i == size) sub_format = formats[0]; /* sub format not found? Just use first one. FIXME? */ g_free (formats); /* -- free formats array */ } return (sub_format); } libinstpatch-1.0.0/libinstpatch/IpatchConverter.h0000644000175000017500000002372111461332142017054 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchConverter * @short_description: Base class for object conversion handlers * @see_also: * @stability: Stable * * A base abstract type for object conversion handlers. */ #ifndef __IPATCH_CONVERTER_H__ #define __IPATCH_CONVERTER_H__ #include #include #include #include /* forward type declarations */ typedef struct _IpatchConverter IpatchConverter; typedef struct _IpatchConverterClass IpatchConverterClass; #define IPATCH_TYPE_CONVERTER (ipatch_converter_get_type ()) #define IPATCH_CONVERTER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_CONVERTER, IpatchConverter)) #define IPATCH_CONVERTER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_CONVERTER, \ IpatchConverterClass)) #define IPATCH_IS_CONVERTER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_CONVERTER)) #define IPATCH_IS_CONVERTER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_CONVERTER)) #define IPATCH_CONVERTER_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_CONVERTER, \ IpatchConverterClass)) /** * IpatchConverterLinkLookupFunc: * @converter: Converter instance * @item: Converted item which has the link property that will be assigned to * @link: Original object being linked (before conversion) * @newtype: New type that link needs to be converted to * @user_data: User defined data supplied to the converter instance * * This function type allows for object link interception by the user of * an #IpatchConverter instance. It is called by conversion processes which * create objects linking other external objects which need to be converted * also. If this function returns %NULL then the @link will be converted * by the converter process and the user notified with the * #IpatchConverterLinkNotifyFunc. An example usage of this feature is * the #IpatchPaste system, which does object conversions and substitutes * already converted objects (a conversion pool). * * Returns: Existing converted item satisfying @link and @newtype, or %NULL * otherwise. */ typedef GObject * (*IpatchConverterLinkLookupFunc) (IpatchConverter *converter, GObject *item, GObject *link, GType newtype, gpointer user_data); /** * IpatchConverterLinkNotifyFunc: * @converter: Converter instance * @orig: Original link item which was converted * @conv: New converted link item * @newtype: New type that link was converted to (same as passed to * #IpatchConverterLinkLookupFunc). * @user_data: User defined data supplied to the converter instance * * This function type allows for object link interception by the user of * an #IpatchConverter instance. It is called by conversion processes which * create objects linking other external objects which need to be converted * also. For each link object which needs to be converted * #IpatchConverterLinkLookupFunc is called first, if it returns %NULL then * this function will be called with the newly converted link object. */ typedef void (*IpatchConverterLinkNotifyFunc) (IpatchConverter *converter, GObject *orig, GObject *conv, GType newtype, gpointer user_data); /* conversion instance */ struct _IpatchConverter { GObject parent_instance; /* derived from GObject */ int flags; /* IpatchConverterFlags */ GList *inputs; /* list of input GObjects to convert */ GList *outputs; /* list of new converted output GObjects */ /* callbacks for object link interception */ IpatchConverterLinkLookupFunc *link_lookup; IpatchConverterLinkNotifyFunc *link_notify; float progress; /* 0.0 - 1.0 progress property */ /* conversion ratings (0.0 - 1.0 = worst - best). For container objects ratings can be done individually on the children, then min_rate/max_rate will be useful */ float min_rate; /* minimum rating amongst all items */ float max_rate; /* maximum rating amongst all items */ float avg_rate; /* average rating for all items */ float sum_rate; /* sum of all ratings (to calculate avg) */ int item_count; /* count of children items being rated */ gboolean rate_items; /* set to TRUE to log a rating for each child item */ /* conversion log */ GList *log; /* LogEntry list (defined in IpatchConverter.c, prepended) */ }; /* conversion class */ struct _IpatchConverterClass { GObjectClass parent_class; /* methods */ gboolean (*verify)(IpatchConverter *converter, char **failmsg); void (*init)(IpatchConverter *converter); gboolean (*convert)(IpatchConverter *converter, GError **err); char * (*notes)(IpatchConverter *converter); }; /* type for log entries */ typedef enum { IPATCH_CONVERTER_LOG_RATING, /* log a rating update */ IPATCH_CONVERTER_LOG_INFO, /* informational only */ IPATCH_CONVERTER_LOG_WARN, /* warning */ IPATCH_CONVERTER_LOG_CRITICAL, /* critical (but non fatal) message */ IPATCH_CONVERTER_LOG_FATAL /* fatal error */ } IpatchConverterLogType; /* mask for type field (IpatchConverterLogType) */ #define IPATCH_CONVERTER_LOG_TYPE_MASK 0x0F /* flag for IpatchConverterLog->type to indicate allocated message string */ #define IPATCH_CONVERTER_LOG_MSG_ALLOC 0x80 #define IPATCH_CONVERTER_INPUT(converter) \ (converter->inputs ? G_OBJECT (converter->inputs->data) : (GObject *)NULL) #define IPATCH_CONVERTER_OUTPUT(converter) \ (converter->outputs ? G_OBJECT (converter->outputs->data) : (GObject *)NULL) /* enum used for src_count and dest_count fields in class */ typedef enum { IPATCH_CONVERTER_COUNT_ONE_OR_MORE = -1, /* 1 or more objects */ IPATCH_CONVERTER_COUNT_ZERO_OR_MORE = -2 /* 0 or more objects */ } IpatchConverterCount; /* flags for ipatch_register_converter_map() */ typedef enum { IPATCH_CONVERTER_FLAG_SRC_DERIVED = 1 << 8 /* match source derived types */ } IpatchConverterFlags; /* priority levels for converter mappings */ typedef enum { /* 0 value is an alias for IPATCH_CONVERTER_PRIORITY_DEFAULT */ IPATCH_CONVERTER_PRIORITY_LOWEST = 1, IPATCH_CONVERTER_PRIORITY_LOW = 25, IPATCH_CONVERTER_PRIORITY_DEFAULT = 50, IPATCH_CONVERTER_PRIORITY_HIGH = 75, IPATCH_CONVERTER_PRIORITY_HIGHEST = 100 } IpatchConverterPriority; /* converter info structure */ typedef struct { GType conv_type; /* conversion handler type */ GType src_type; /* source type of conversion handler */ GType src_match; /* furthest source parent type to match (0 = exact match) */ GType dest_type; /* destination type of conversion handler */ GType dest_match; /* furthest dest parent type to match (0 = exact match) */ guint8 flags; /* IpatchConverterFlags */ gint8 priority; /* priority (1-100) */ gint8 src_count; /* required source item count or IpatchConverterCount */ gint8 dest_count; /* required destination item count or IpatchConverterCount */ } IpatchConverterInfo; gboolean ipatch_convert_objects (GObject *input, GObject *output, GError **err); GObject *ipatch_convert_object_to_type (GObject *object, GType type, GError **err); IpatchList *ipatch_convert_object_to_type_multi (GObject *object, GType type, GError **err); IpatchList *ipatch_convert_object_to_type_multi_set (GObject *object, GType type, GError **err, const char *first_property_name, ...); IpatchConverter *ipatch_create_converter (GType src_type, GType dest_type); void ipatch_register_converter_map (GType conv_type, guint flags, GType src_type, GType src_match, gint8 src_count, GType dest_type, GType dest_match, gint8 dest_count); GType ipatch_find_converter (GType src_type, GType dest_type); IpatchConverterInfo * ipatch_lookup_converter_info (GType conv_type, GType src_type, GType dest_type); GType ipatch_converter_get_type (void); void ipatch_converter_add_input (IpatchConverter *converter, GObject *object); void ipatch_converter_add_output (IpatchConverter *converter, GObject *object); void ipatch_converter_add_inputs (IpatchConverter *converter, GList *objects); void ipatch_converter_add_outputs (IpatchConverter *converter, GList *objects); GObject *ipatch_converter_get_input (IpatchConverter *converter); GObject *ipatch_converter_get_output (IpatchConverter *converter); IpatchList *ipatch_converter_get_inputs (IpatchConverter *converter); IpatchList *ipatch_converter_get_outputs (IpatchConverter *converter); gboolean ipatch_converter_verify (IpatchConverter *converter, char **failmsg); void ipatch_converter_init (IpatchConverter *converter); gboolean ipatch_converter_convert (IpatchConverter *converter, GError **err); void ipatch_converter_reset (IpatchConverter *converter); char *ipatch_converter_get_notes (IpatchConverter *converter); void ipatch_converter_log (IpatchConverter *converter, GObject *item, int type, char *msg); void ipatch_converter_log_printf (IpatchConverter *converter, GObject *item, int type, const char *fmt, ...); gboolean ipatch_converter_log_next (IpatchConverter *converter, gpointer *pos, GObject **item, int *type, char **msg); void ipatch_converter_set_link_funcs (IpatchConverter *converter, IpatchConverterLinkLookupFunc *link_lookup, IpatchConverterLinkNotifyFunc *link_notify); #endif libinstpatch-1.0.0/libinstpatch/IpatchContainer_notify.c0000644000175000017500000005740211461332142020415 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /* * IpatchContainer_notify.c - Container add/remove callback notify system */ #include #include "IpatchContainer.h" #include "ipatch_priv.h" /* hash value used for IpatchContainer callbacks */ typedef struct { IpatchContainerCallback callback; /* callback function */ IpatchContainerDisconnect disconnect; /* called when callback is disconnected */ gpointer user_data; /* user data to pass to function */ guint handler_id; /* unique handler ID */ } ContainerCallback; static void ipatch_container_real_disconnect (guint handler_id, IpatchContainer *container, IpatchItem *child, IpatchContainerCallback callback, gpointer user_data, gboolean isadd); static gboolean callback_hash_GHRFunc (gpointer key, gpointer value, gpointer user_data); /* lock for add_callback_next_id, add_callback_hash, and add_wild_callback_list */ G_LOCK_DEFINE_STATIC (add_callbacks); static guint add_callback_next_id = 1; /* next container add handler ID */ /* hash of container add callbacks (IpatchContainer -> GSList) */ static GHashTable *add_callback_hash; static GSList *add_wild_callback_list = NULL; /* container add wildcard cbs */ /* lock for remove_callback_next_id, remove_callback_hash and remove_wild_callback_list */ G_LOCK_DEFINE_STATIC (remove_callbacks); static guint remove_callback_next_id = 1; /* next container remove handler ID */ /* container remove callbacks */ static GHashTable *remove_container_callback_hash; /* IpatchContainer -> GSList */ static GHashTable *remove_child_callback_hash; /* IpatchItem -> GSList */ static GSList *remove_wild_callback_list = NULL; /* container add wildcard cbs */ void _ipatch_container_notify_init (void) { /* one time hash init for container callbacks */ add_callback_hash = g_hash_table_new (NULL, NULL); remove_container_callback_hash = g_hash_table_new (NULL, NULL); remove_child_callback_hash = g_hash_table_new (NULL, NULL); } /** * ipatch_container_add_notify: * @container: Container item for which an item add occurred * @child: Child which was added * * Notify that a child add has occurred to an #IpatchContainer object. * Should be called after the add has occurred. This function is normally * not needed except when using ipatch_container_insert_iter(). */ void ipatch_container_add_notify (IpatchContainer *container, IpatchItem *child) { /* dynamically adjustable max callbacks to allocate cbarray for */ static guint max_callbacks = 64; ContainerCallback *cbarray; /* stack allocated callback array */ ContainerCallback *cb; ContainerCallback *old_cbarray; guint old_max_callbacks; GSList *match_container, *wild_list; guint cbindex = 0, i; g_return_if_fail (IPATCH_IS_CONTAINER (container)); g_return_if_fail (IPATCH_IS_ITEM (child)); /* Container has changed */ ipatch_item_changed ((IpatchItem *)container); /* if hooks not active for container, just return */ if (!(ipatch_item_get_flags (container) & IPATCH_ITEM_HOOKS_ACTIVE)) return; /* allocate callback array on stack (for performance) */ cbarray = g_alloca (max_callbacks * sizeof (ContainerCallback)); G_LOCK (add_callbacks); /* lookup callback list for this container */ match_container = g_hash_table_lookup (add_callback_hash, container); wild_list = add_wild_callback_list; /* duplicate lists into array (since we will call them outside of lock) */ for (; match_container && cbindex < max_callbacks; match_container = match_container->next, cbindex++) { cb = (ContainerCallback *)(match_container->data); cbarray[cbindex].callback = cb->callback; cbarray[cbindex].user_data = cb->user_data; } for (; wild_list && cbindex < max_callbacks; wild_list = wild_list->next, cbindex++) { cb = (ContainerCallback *)(wild_list->data); cbarray[cbindex].callback = cb->callback; cbarray[cbindex].user_data = cb->user_data; } if (match_container || wild_list) { /* We exceeded max_callbacks (Bender just shit a brick) */ old_cbarray = cbarray; old_max_callbacks = max_callbacks; cbindex += g_slist_length (match_container); cbindex += g_slist_length (wild_list); max_callbacks = cbindex + 16; /* plus some for kicks */ cbarray = g_alloca (max_callbacks * sizeof (ContainerCallback)); memcpy (cbarray, old_cbarray, old_max_callbacks * sizeof (ContainerCallback)); cbindex = old_max_callbacks; /* duplicate rest of the lists */ for (; match_container && cbindex < max_callbacks; match_container = match_container->next, cbindex++) { cb = (ContainerCallback *)(match_container->data); cbarray[cbindex].callback = cb->callback; cbarray[cbindex].user_data = cb->user_data; } for (; wild_list && cbindex < max_callbacks; wild_list = wild_list->next, cbindex++) { cb = (ContainerCallback *)(wild_list->data); cbarray[cbindex].callback = cb->callback; cbarray[cbindex].user_data = cb->user_data; } } G_UNLOCK (add_callbacks); /* call the callbacks */ for (i = 0; i < cbindex; i++) { cb = &cbarray[i]; cb->callback (container, child, cb->user_data); } } /** * ipatch_container_remove_notify: * @container: Container item for which a remove will occur * @child: Child which will be removed * * Notify that a container remove will occur to an #IpatchContainer object. * Should be called before the remove occurs. This function is normally not * needed, except when using ipatch_container_remove_iter(). */ void ipatch_container_remove_notify (IpatchContainer *container, IpatchItem *child) { /* dynamically adjustable max callbacks to allocate cbarray for */ static guint max_callbacks = 64; ContainerCallback *cbarray; /* stack allocated callback array */ ContainerCallback *cb; ContainerCallback *old_cbarray; guint old_max_callbacks; GSList *match_container, *match_child, *wild_list; guint cbindex = 0, i; g_return_if_fail (IPATCH_IS_CONTAINER (container)); g_return_if_fail (IPATCH_IS_ITEM (child)); /* Container has changed */ ipatch_item_changed ((IpatchItem *)container); /* if hooks not active for container, just return */ if (!(ipatch_item_get_flags (container) & IPATCH_ITEM_HOOKS_ACTIVE)) return; /* allocate callback array on stack (for performance) */ cbarray = g_alloca (max_callbacks * sizeof (ContainerCallback)); G_LOCK (remove_callbacks); /* lookup callback list for container */ match_container = g_hash_table_lookup (remove_container_callback_hash, container); /* lookup callback list for child */ match_child = g_hash_table_lookup (remove_child_callback_hash, child); wild_list = remove_wild_callback_list; /* duplicate lists into array (since we will call them outside of lock) */ for (; match_container && cbindex < max_callbacks; match_container = match_container->next, cbindex++) { cb = (ContainerCallback *)(match_container->data); cbarray[cbindex].callback = cb->callback; cbarray[cbindex].user_data = cb->user_data; } for (; match_child && cbindex < max_callbacks; match_child = match_child->next, cbindex++) { cb = (ContainerCallback *)(match_child->data); cbarray[cbindex].callback = cb->callback; cbarray[cbindex].user_data = cb->user_data; } for (; wild_list && cbindex < max_callbacks; wild_list = wild_list->next, cbindex++) { cb = (ContainerCallback *)(wild_list->data); cbarray[cbindex].callback = cb->callback; cbarray[cbindex].user_data = cb->user_data; } if (match_container || match_child || wild_list) { /* We exceeded max_callbacks (Bender just shit a brick) */ old_cbarray = cbarray; old_max_callbacks = max_callbacks; cbindex += g_slist_length (match_container); cbindex += g_slist_length (match_child); cbindex += g_slist_length (wild_list); max_callbacks = cbindex + 16; /* plus some for kicks */ cbarray = g_alloca (max_callbacks * sizeof (ContainerCallback)); memcpy (cbarray, old_cbarray, old_max_callbacks * sizeof (ContainerCallback)); cbindex = old_max_callbacks; /* duplicate rest of the lists */ for (; match_container && cbindex < max_callbacks; match_container = match_container->next, cbindex++) { cb = (ContainerCallback *)(match_container->data); cbarray[cbindex].callback = cb->callback; cbarray[cbindex].user_data = cb->user_data; } for (; match_child && cbindex < max_callbacks; match_child = match_child->next, cbindex++) { cb = (ContainerCallback *)(match_child->data); cbarray[cbindex].callback = cb->callback; cbarray[cbindex].user_data = cb->user_data; } for (; wild_list && cbindex < max_callbacks; wild_list = wild_list->next, cbindex++) { cb = (ContainerCallback *)(wild_list->data); cbarray[cbindex].callback = cb->callback; cbarray[cbindex].user_data = cb->user_data; } } G_UNLOCK (remove_callbacks); /* call the callbacks */ for (i = 0; i < cbindex; i++) { cb = &cbarray[i]; cb->callback (container, child, cb->user_data); } } /** * ipatch_container_add_connect: * @container: Container to match (%NULL for wildcard) * @callback: Callback function to call on match * @disconnect: Function to call when callback is disconnected or %NULL * @user_data: User defined data pointer to pass to @callback and @disconnect * * Adds a callback which gets called when a container item add operation occurs * and the container matches @container. When @container is %NULL, @callback * will be called for every container add operation. * * Returns: Handler ID which can be used to disconnect the callback or * 0 on error (only occurs on invalid function parameters). */ guint ipatch_container_add_connect (IpatchContainer *container, IpatchContainerCallback callback, IpatchContainerDisconnect disconnect, gpointer user_data) { ContainerCallback *cb; GSList *cblist; guint handler_id; g_return_val_if_fail (!container || IPATCH_IS_CONTAINER (container), 0); g_return_val_if_fail (callback != NULL, 0); cb = g_slice_new (ContainerCallback); cb->callback = callback; cb->disconnect = disconnect; cb->user_data = user_data; G_LOCK (add_callbacks); handler_id = add_callback_next_id++; cb->handler_id = handler_id; if (container) { /* get existing list for Container (if any) */ cblist = g_hash_table_lookup (add_callback_hash, container); /* update the list in the hash table */ g_hash_table_insert (add_callback_hash, container, g_slist_prepend (cblist, cb)); } else /* callback is wildcard, just add to the wildcard list */ add_wild_callback_list = g_slist_prepend (add_wild_callback_list, cb); G_UNLOCK (add_callbacks); return (handler_id); } /** * ipatch_container_remove_connect: * @container: Container to match (%NULL for wildcard) * @child: Child item to match (%NULL for wildcard) * @callback: Callback function to call on match * @disconnect: Function to call when callback is disconnected or %NULL * @user_data: User defined data pointer to pass to @callback and @disconnect * * Adds a callback which gets called when a container item remove operation * occurs and the container matches @container and child item matches @child. * The @container and/or @child parameters can be %NULL in which case they are * wildcard. If both are %NULL then @callback will be called for every * container remove operation. Note that specifying only @child or both * @container and @child is the same, since a child belongs to only one container. * * Returns: Handler ID which can be used to disconnect the callback or * 0 on error (only occurs on invalid function parameters). */ guint ipatch_container_remove_connect (IpatchContainer *container, IpatchItem *child, IpatchContainerCallback callback, IpatchContainerDisconnect disconnect, gpointer user_data) { ContainerCallback *cb; GSList *cblist; guint handler_id; g_return_val_if_fail (!container || IPATCH_IS_CONTAINER (container), 0); g_return_val_if_fail (!child || IPATCH_IS_ITEM (child), 0); g_return_val_if_fail (callback != NULL, 0); cb = g_slice_new (ContainerCallback); cb->callback = callback; cb->disconnect = disconnect; cb->user_data = user_data; G_LOCK (remove_callbacks); handler_id = remove_callback_next_id++; cb->handler_id = handler_id; if (child) /* child and container:child are equivalent (child has only 1 parent) */ { /* get existing list for child (if any) */ cblist = g_hash_table_lookup (remove_child_callback_hash, child); /* update new list head */ g_hash_table_insert (remove_child_callback_hash, child, g_slist_prepend (cblist, cb)); } else if (container) { /* get existing list for container (if any) */ cblist = g_hash_table_lookup (remove_container_callback_hash, container); /* update new list head */ g_hash_table_insert (remove_container_callback_hash, container, g_slist_prepend (cblist, cb)); } else /* callback is completely wildcard, just add to the wildcard list */ remove_wild_callback_list = g_slist_prepend (remove_wild_callback_list, cb); G_UNLOCK (remove_callbacks); return (handler_id); } /** * ipatch_container_add_disconnect: * @handler_id: ID of callback handler * * Disconnects a container add callback previously connected with * ipatch_container_add_connect() by handler ID. The * ipatch_container_add_disconnect_matched() function can be used instead to * disconnect by original callback criteria and is actually faster. */ void ipatch_container_add_disconnect (guint handler_id) { g_return_if_fail (handler_id != 0); ipatch_container_real_disconnect (handler_id, NULL, NULL, NULL, NULL, TRUE); } /** * ipatch_container_add_disconnect_matched: * @container: Container to match * @callback: Callback function to match * @user_data: User data to match * * Disconnects a container add callback previously connected with * ipatch_container_add_connect() by match criteria. */ void ipatch_container_add_disconnect_matched (IpatchContainer *container, IpatchContainerCallback callback, gpointer user_data) { g_return_if_fail (callback != NULL); ipatch_container_real_disconnect (0, container, NULL, callback, user_data, TRUE); } /** * ipatch_container_remove_disconnect: * @handler_id: ID of callback handler * * Disconnects a container remove callback previously connected with * ipatch_container_remove_connect() by handler ID. The * ipatch_container_remove_disconnect_matched() function can be used instead to * disconnect by original callback criteria and is actually faster. */ void ipatch_container_remove_disconnect (guint handler_id) { g_return_if_fail (handler_id != 0); ipatch_container_real_disconnect (handler_id, NULL, NULL, NULL, NULL, FALSE); } /** * ipatch_container_remove_disconnect_matched: * @container: Container to match * @child: Child item to match * @callback: Callback function to match * @user_data: User data to match * * Disconnects a handler previously connected with * ipatch_container_remove_connect() by match criteria. */ void ipatch_container_remove_disconnect_matched (IpatchContainer *container, IpatchItem *child, IpatchContainerCallback callback, gpointer user_data) { g_return_if_fail (callback != NULL); ipatch_container_real_disconnect (0, container, child, callback, user_data, FALSE); } /* a bag used in ipatch_container_real_disconnect */ typedef struct { gboolean found; /* Set to TRUE if handler found */ IpatchItem *match; /* container or child - in: (match only), out */ ContainerCallback cb; /* in: handler_id, out: disconnect, user_data */ gpointer update_key; /* out: key of list root requiring update */ GSList *update_list; /* out: new root of list to update */ gboolean update_needed; /* out: set when a list root needs updating */ gboolean isadd; /* same value as function parameter */ } DisconnectBag; /* function for removing a callback using match criteria (hash table lookup). * Faster than iterating over the hash (required when searching by ID). */ static void disconnect_matched (GHashTable *hash, DisconnectBag *bag) { ContainerCallback *cb; GSList *list, *newroot, *p; list = g_hash_table_lookup (hash, bag->match); if (!list) return; for (p = list; p; p = p->next) /* loop over callbacks in list */ { cb = (ContainerCallback *)(p->data); /* matches criteria? */ if (cb->callback == bag->cb.callback && cb->user_data == bag->cb.user_data) { /* return callback's disconnect func */ bag->found = TRUE; bag->cb.disconnect = cb->disconnect; g_slice_free (ContainerCallback, cb); newroot = g_slist_delete_link (list, p); if (!newroot) /* no more list? - remove hash entry */ g_hash_table_remove (hash, bag->match); else if (newroot != list) /* root of list changed? - update hash entry */ g_hash_table_insert (hash, bag->match, newroot); break; } } } /* Used by disconnect functions. * Either handler_id should be set to a non-zero value or the other * parameters should be assigned but not both. * isadd specifies if the handler is an add callback (TRUE) or remove * callback (FALSE). */ static void ipatch_container_real_disconnect (guint handler_id, IpatchContainer *container, IpatchItem *child, IpatchContainerCallback callback, gpointer user_data, gboolean isadd) { ContainerCallback *cb; DisconnectBag bag = { 0 }; gboolean isfoundchild = FALSE; GSList *p; g_return_if_fail (handler_id != 0 || callback != 0); g_return_if_fail (handler_id == 0 || callback == 0); if (!handler_id) /* find by match criteria? */ { bag.match = child ? child : (IpatchItem *)container; bag.cb.callback = callback; bag.cb.user_data = user_data; } else bag.cb.handler_id = handler_id; /* find by handler ID */ bag.isadd = isadd; if (isadd) /* add callback search? */ { G_LOCK (add_callbacks); if (handler_id) /* search by ID? */ { /* scan every list in add callback hash and remove if found */ g_hash_table_foreach_remove (add_callback_hash, callback_hash_GHRFunc, &bag); if (bag.update_needed) /* update root of list if needed (can't do that in GHRFunc) */ g_hash_table_insert (add_callback_hash, bag.update_key, bag.update_list); } else disconnect_matched (add_callback_hash, &bag); /* lookup by match and remove if found */ /* if not found, check wildcard list (if search by handler ID * or NULL container) */ if (!bag.found && (handler_id || !container)) { for (p = add_wild_callback_list; p; p = p->next) { cb = (ContainerCallback *)(p->data); if ((handler_id && cb->handler_id == handler_id) || (!handler_id && cb->callback == callback && cb->user_data == user_data)) { bag.found = TRUE; bag.cb.disconnect = cb->disconnect; bag.cb.user_data = cb->user_data; g_slice_free (ContainerCallback, cb); add_wild_callback_list = g_slist_delete_link (add_wild_callback_list, p); break; } } } G_UNLOCK (add_callbacks); } else /* remove callback search */ { G_LOCK (remove_callbacks); /* check child remove callback list if search by ID or child is set */ if (handler_id) /* search by ID? */ { g_hash_table_foreach_remove (remove_child_callback_hash, callback_hash_GHRFunc, &bag); if (bag.update_needed) /* update root of list if needed (can't do that in GHRFunc) */ g_hash_table_insert (remove_child_callback_hash, bag.update_key, bag.update_list); } else if (child) /* match by child? */ disconnect_matched (remove_child_callback_hash, &bag); if (bag.found) isfoundchild = TRUE; /* indicate it is a child callback */ if (!bag.found) /* not yet found? */ { /* check container remove callback list if search by ID or container is set */ if (handler_id) /* search by ID? */ { g_hash_table_foreach_remove (remove_container_callback_hash, callback_hash_GHRFunc, &bag); if (bag.update_needed) /* update root of list if needed (can't do that in GHRFunc) */ g_hash_table_insert (remove_container_callback_hash, bag.update_key, bag.update_list); } else if (container) /* match by container? */ disconnect_matched (remove_container_callback_hash, &bag); } /* if not yet found, check wildcard list (if search by handler ID * or NULL container and child) */ if (!bag.found && (handler_id || (!container && !child))) { for (p = remove_wild_callback_list; p; p = p->next) { cb = (ContainerCallback *)(p->data); if ((handler_id && cb->handler_id == handler_id) || (!handler_id && cb->callback == callback && cb->user_data == user_data)) { bag.found = TRUE; bag.cb.disconnect = cb->disconnect; bag.cb.user_data = cb->user_data; g_slice_free (ContainerCallback, cb); remove_wild_callback_list = g_slist_delete_link (remove_wild_callback_list, p); break; } } } G_UNLOCK (remove_callbacks); } if (!bag.found) { if (handler_id) g_critical (G_STRLOC ": Failed to find %s container handler with ID '%d'", isadd ? "add" : "remove", handler_id); else g_critical (G_STRLOC ": Failed to find %s container handler with criteria %p:%p:%p:%p", isadd ? "add" : "remove", container, child, callback, user_data); } /* see if callback found and it had a disconnect func */ if (bag.cb.disconnect) { if (isfoundchild) bag.cb.disconnect (NULL, bag.match, bag.cb.user_data); else bag.cb.disconnect ((IpatchContainer *)bag.match, NULL, bag.cb.user_data); } } /* finds a container add or remove handler by ID and removes it */ static gboolean callback_hash_GHRFunc (gpointer key, gpointer value, gpointer user_data) { DisconnectBag *bag = (DisconnectBag *)user_data; GSList *cblist = (GSList *)value, *p, *newroot; ContainerCallback *cb; p = cblist; while (p) /* loop over callbacks in callback list */ { cb = (ContainerCallback *)(p->data); /* matches criteria? (by ID or by match) */ if ((bag->cb.handler_id && cb->handler_id == bag->cb.handler_id) || (!bag->cb.handler_id && key == bag->match && cb->callback == bag->cb.callback && cb->user_data == bag->cb.user_data)) { /* return callback's item, pspec, disconnect func and user_data */ bag->found = TRUE; bag->cb.disconnect = cb->disconnect; bag->cb.user_data = cb->user_data; bag->match = key; g_slice_free (ContainerCallback, cb); newroot = g_slist_delete_link (cblist, p); if (!newroot) return (TRUE); /* no more list? Remove hash entry */ /* if root not the same, return update information (can't be done in GHRFunc) */ if (newroot != cblist) { bag->update_key = key; bag->update_list = newroot; } return (FALSE); /* don't remove entry (callback list not empty) */ } p = g_slist_next (p); } return (FALSE); /* don't remove entry (item not found) */ } libinstpatch-1.0.0/libinstpatch/IpatchSF2File.h0000644000175000017500000001650011461332142016274 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2File * @short_description: SoundFont file object * @see_also: * @stability: Stable * * A #IpatchFile object type specifically for SoundFont files. */ #ifndef __IPATCH_SF2_FILE_H__ #define __IPATCH_SF2_FILE_H__ #include #include #include #include /* forward type declarations */ typedef struct _IpatchSF2File IpatchSF2File; typedef struct _IpatchSF2FileClass IpatchSF2FileClass; typedef struct _IpatchSF2Phdr IpatchSF2Phdr; typedef struct _IpatchSF2Ihdr IpatchSF2Ihdr; typedef struct _IpatchSF2Shdr IpatchSF2Shdr; typedef struct _IpatchSF2Bag IpatchSF2Bag; #define IPATCH_TYPE_SF2_FILE (ipatch_sf2_file_get_type ()) #define IPATCH_SF2_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_FILE, IpatchSF2File)) #define IPATCH_SF2_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_FILE, \ IpatchSF2FileClass)) #define IPATCH_IS_SF2_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_FILE)) #define IPATCH_IS_SF2_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2_FILE)) #define IPATCH_SF2_FILE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SF2_FILE, \ IpatchSF2FileClass)) /* SoundFont file object (derived from IpatchFile) */ struct _IpatchSF2File { IpatchFile parent_instance; guint32 sample_pos; /* position in file of the sample data */ guint32 sample_size; /* sample data chunk size (in samples) */ guint32 sample24_pos; /* position in file of LS bytes of 24 bit samples or 0 */ }; /* SoundFont file class (derived from IpatchFile) */ struct _IpatchSF2FileClass { IpatchFileClass parent_class; }; /* SoundFont file preset header */ struct _IpatchSF2Phdr { char name[20]; /* preset name */ guint16 program; /* MIDI program number */ guint16 bank; /* MIDI bank number */ guint16 bag_index; /* index into preset bag (#IPFileBag) */ guint32 library; /* Not used (preserved) */ guint32 genre; /* Not used (preserved) */ guint32 morphology; /* Not used (preserved) */ }; /* SoundFont file instrument header */ struct _IpatchSF2Ihdr { char name[20]; /* name of instrument */ guint16 bag_index; /* instrument bag index (#IPFileBag) */ }; /* SoundFont file sample header */ struct _IpatchSF2Shdr { char name[20]; /* sample name */ guint32 start; /* offset to start of sample */ guint32 end; /* offset to end of sample */ guint32 loop_start; /* offset to start of loop */ guint32 loop_end; /* offset to end of loop */ guint32 rate; /* sample rate recorded at */ guint8 root_note; /* root midi note number */ gint8 fine_tune; /* pitch correction in cents */ guint16 link_index; /* linked sample index for stereo samples */ guint16 type; /* type of sample (see IpatchSF2SampleFlags) */ }; /* SoundFont file bag (zone), indexes for zone's generators and modulators */ struct _IpatchSF2Bag { guint16 mod_index; /* index into modulator list */ guint16 gen_index; /* index into generator list */ }; /* RIFF chunk FOURCC guint32 integers */ #define IPATCH_SFONT_FOURCC_SFBK IPATCH_FOURCC ('s','f','b','k') #define IPATCH_SFONT_FOURCC_INFO IPATCH_FOURCC ('I','N','F','O') #define IPATCH_SFONT_FOURCC_SDTA IPATCH_FOURCC ('s','d','t','a') #define IPATCH_SFONT_FOURCC_PDTA IPATCH_FOURCC ('p','d','t','a') #define IPATCH_SFONT_FOURCC_SMPL IPATCH_FOURCC ('s','m','p','l') #define IPATCH_SFONT_FOURCC_SM24 IPATCH_FOURCC ('s','m','2','4') #define IPATCH_SFONT_FOURCC_PHDR IPATCH_FOURCC ('p','h','d','r') #define IPATCH_SFONT_FOURCC_PBAG IPATCH_FOURCC ('p','b','a','g') #define IPATCH_SFONT_FOURCC_PMOD IPATCH_FOURCC ('p','m','o','d') #define IPATCH_SFONT_FOURCC_PGEN IPATCH_FOURCC ('p','g','e','n') #define IPATCH_SFONT_FOURCC_INST IPATCH_FOURCC ('i','n','s','t') #define IPATCH_SFONT_FOURCC_IBAG IPATCH_FOURCC ('i','b','a','g') #define IPATCH_SFONT_FOURCC_IMOD IPATCH_FOURCC ('i','m','o','d') #define IPATCH_SFONT_FOURCC_IGEN IPATCH_FOURCC ('i','g','e','n') #define IPATCH_SFONT_FOURCC_SHDR IPATCH_FOURCC ('s','h','d','r') /* SoundFont info IDs */ #define IPATCH_SFONT_FOURCC_IFIL IPATCH_FOURCC ('i','f','i','l') #define IPATCH_SFONT_FOURCC_ISNG IPATCH_FOURCC ('i','s','n','g') #define IPATCH_SFONT_FOURCC_INAM IPATCH_FOURCC ('I','N','A','M') #define IPATCH_SFONT_FOURCC_IROM IPATCH_FOURCC ('i','r','o','m') #define IPATCH_SFONT_FOURCC_IVER IPATCH_FOURCC ('i','v','e','r') #define IPATCH_SFONT_FOURCC_ICRD IPATCH_FOURCC ('I','C','R','D') #define IPATCH_SFONT_FOURCC_IENG IPATCH_FOURCC ('I','E','N','G') #define IPATCH_SFONT_FOURCC_IPRD IPATCH_FOURCC ('I','P','R','D') #define IPATCH_SFONT_FOURCC_ICOP IPATCH_FOURCC ('I','C','O','P') #define IPATCH_SFONT_FOURCC_ICMT IPATCH_FOURCC ('I','C','M','T') #define IPATCH_SFONT_FOURCC_ISFT IPATCH_FOURCC ('I','S','F','T') /* SoundFont file chunk sizes */ #define IPATCH_SFONT_VERSION_SIZE 4 /* file version info size */ #define IPATCH_SFONT_PHDR_SIZE 38 /* file preset header size */ #define IPATCH_SFONT_INST_SIZE 22 /* file instrument header size */ #define IPATCH_SFONT_SHDR_SIZE 46 /* file sample header size */ #define IPATCH_SFONT_BAG_SIZE 4 /* file bag (zone) size */ #define IPATCH_SFONT_MOD_SIZE 10 /* file modulator size */ #define IPATCH_SFONT_GEN_SIZE 4 /* file generator size */ #define IPATCH_SFONT_NAME_SIZE 20 /* name string size (Preset/Inst/Sample) */ /** * IpatchSF2FileSampleType: * @IPATCH_SF2_FILE_SAMPLE_TYPE_MONO: Mono channel * @IPATCH_SF2_FILE_SAMPLE_TYPE_RIGHT: Right channel of a stereo pair * @IPATCH_SF2_FILE_SAMPLE_TYPE_LEFT: Left channel of a stereo pair * @IPATCH_SF2_FILE_SAMPLE_TYPE_LINKED: Linked list of samples (not yet used) * @IPATCH_SF2_FILE_SAMPLE_TYPE_ROM: A ROM sample * * SoundFont file sample channel mode */ typedef enum { IPATCH_SF2_FILE_SAMPLE_TYPE_MONO = 1 << 0, IPATCH_SF2_FILE_SAMPLE_TYPE_RIGHT = 1 << 1, IPATCH_SF2_FILE_SAMPLE_TYPE_LEFT = 1 << 2, IPATCH_SF2_FILE_SAMPLE_TYPE_LINKED = 1 << 3, IPATCH_SF2_FILE_SAMPLE_TYPE_ROM = 1 << 15 } IpatchSF2FileSampleType; GType ipatch_sf2_file_get_type (void); IpatchSF2File *ipatch_sf2_file_new (void); void ipatch_sf2_file_set_sample_pos (IpatchSF2File *file, guint sample_pos); guint ipatch_sf2_file_get_sample_pos (IpatchSF2File *file); void ipatch_sf2_file_set_sample_size (IpatchSF2File *file, guint sample_size); guint ipatch_sf2_file_get_sample_size (IpatchSF2File *file); void ipatch_sf2_file_set_sample24_pos (IpatchSF2File *file, guint sample24_pos); guint ipatch_sf2_file_get_sample24_pos (IpatchSF2File *file); #endif libinstpatch-1.0.0/libinstpatch/IpatchGigSubRegion.h0000644000175000017500000000647111461332142017434 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchGigSubRegion * @short_description: GigaSampler sub region object * @see_also: #IpatchGigRegion * @stability: Stable * * Defines a GigaSampler sub region object which are children of * #IpatchGigRegion objects and define how a referenced #IpatchGigSample * is synthesized in a #IpatchGigInst. */ #ifndef __IPATCH_GIG_SUB_REGION_H__ #define __IPATCH_GIG_SUB_REGION_H__ #include #include /* forward type declarations */ typedef struct _IpatchGigSubRegion IpatchGigSubRegion; typedef struct _IpatchGigSubRegionClass IpatchGigSubRegionClass; #include #include #include #define IPATCH_TYPE_GIG_SUB_REGION (ipatch_gig_sub_region_get_type ()) #define IPATCH_GIG_SUB_REGION(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_GIG_SUB_REGION, \ IpatchGigSubRegion)) #define IPATCH_GIG_SUB_REGION_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_GIG_SUB_REGION, \ IpatchGigSubRegionClass)) #define IPATCH_IS_GIG_SUB_REGION(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_GIG_SUB_REGION)) #define IPATCH_IS_GIG_SUB_REGION_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_GIG_SUB_REGION)) #define IPATCH_GIG_SUB_REGION_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_GIG_SUB_REGION, \ IpatchGigSubRegionClass)) /* a GigaSampler sub region */ struct _IpatchGigSubRegion { IpatchItem parent_instance; IpatchGigEffects effects; /* effects for this sub region */ IpatchGigSample *sample; /* sample for this sub region */ IpatchDLS2SampleInfo *sample_info; /* sample info override or NULL */ }; /* GigaSampler sub region class */ struct _IpatchGigSubRegionClass { IpatchItemClass parent_class; }; /* Flags crammed into IpatchItem flags */ typedef enum { IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE = 1 << IPATCH_ITEM_UNUSED_FLAG_SHIFT } IpatchGigSubRegionFlags; /* 1 flag + 3 for expansion */ #define IPATCH_GIG_SUB_REGION_UNUSED_FLAG_SHIFT \ (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 4) GType ipatch_gig_sub_region_get_type (void); IpatchGigSubRegion *ipatch_gig_sub_region_new (void); IpatchGigSubRegion *ipatch_gig_sub_region_first (IpatchIter *iter); IpatchGigSubRegion *ipatch_gig_sub_region_next (IpatchIter *iter); IpatchGigSample *ipatch_gig_sub_region_get_sample (IpatchGigSubRegion *subregion); void ipatch_gig_sub_region_set_sample (IpatchGigSubRegion *subregion, IpatchGigSample *sample); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2Sample.h0000644000175000017500000001130011461332142016627 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2Sample * @short_description: SoundFont audio sample * @see_also: #IpatchSF2, #IpatchSF2IZone * @stability: Stable * * SoundFont samples are children of #IpatchSF2 objects and are referenced * by #IpatchSF2IZone objects. They define the audio which is synthesized. */ #ifndef __IPATCH_SF2_SAMPLE_H__ #define __IPATCH_SF2_SAMPLE_H__ #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchSF2Sample IpatchSF2Sample; typedef struct _IpatchSF2SampleClass IpatchSF2SampleClass; #define IPATCH_TYPE_SF2_SAMPLE (ipatch_sf2_sample_get_type ()) #define IPATCH_SF2_SAMPLE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_SAMPLE, \ IpatchSF2Sample)) #define IPATCH_SF2_SAMPLE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_SAMPLE, \ IpatchSF2SampleClass)) #define IPATCH_IS_SF2_SAMPLE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_SAMPLE)) #define IPATCH_IS_SF2_SAMPLE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2_SAMPLE)) #define IPATCH_SF2_SAMPLE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SF2_SAMPLE, \ IpatchSF2SampleClass)) /* SoundFont sample item */ struct _IpatchSF2Sample { IpatchItem parent_instance; IpatchSampleData *sample_data; /* sample data object */ char *name; /* name of sample */ int rate; /* sample rate */ guint32 loop_start; /* loop start offset (in samples) */ guint32 loop_end; /* loop end offset (in samples, first sample AFTER loop actually) */ guint8 root_note; /* root midi note number */ gint8 fine_tune; /* fine tuning in cents */ guint8 channel; /* IpatchSF2SampleChannel */ IpatchSF2Sample *linked; /* linked sample pointer or NULL */ }; struct _IpatchSF2SampleClass { IpatchItemClass parent_class; }; /* sampletype flag defines */ /** * IpatchSF2SampleChannel: * @IPATCH_SF2_SAMPLE_CHANNEL_MONO: Mono sample * @IPATCH_SF2_SAMPLE_CHANNEL_LEFT: Left channel of a stereo pair * (#IpatchSF2Sample::linked-sample will be set to the right channel) * @IPATCH_SF2_SAMPLE_CHANNEL_RIGHT: Right channel of a stereo pair * (#IpatchSF2Sample::linked-sample will be set to the left channel) * * Sample channel orientation. */ typedef enum { IPATCH_SF2_SAMPLE_CHANNEL_MONO, IPATCH_SF2_SAMPLE_CHANNEL_LEFT, IPATCH_SF2_SAMPLE_CHANNEL_RIGHT } IpatchSF2SampleChannel; /* sample rate and length constraints */ #define IPATCH_SF2_SAMPLE_RATE_MIN 400 /* min sample rate (by standard) */ #define IPATCH_SF2_SAMPLE_RATE_MAX 50000 /* max rate (by the standard) */ #define IPATCH_SF2_SAMPLE_LENGTH_MIN 32 /* min length (by the standard) */ /* IpatchItem flag for indicating ROM sample */ #define IPATCH_SF2_SAMPLE_FLAG_ROM (1 << IPATCH_ITEM_UNUSED_FLAG_SHIFT) /* we reserve flags for ROM flag and 3 for expansion */ #define IPATCH_SAMPLE_UNUSED_FLAG_SHIFT \ (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 4) GType ipatch_sf2_sample_get_type (void); IpatchSF2Sample *ipatch_sf2_sample_new (void); IpatchSF2Sample *ipatch_sf2_sample_first (IpatchIter *iter); IpatchSF2Sample *ipatch_sf2_sample_next (IpatchIter *iter); void ipatch_sf2_sample_set_name (IpatchSF2Sample *sample, const char *name); char *ipatch_sf2_sample_get_name (IpatchSF2Sample *sample); void ipatch_sf2_sample_set_data (IpatchSF2Sample *sample, IpatchSampleData *sampledata); IpatchSampleData *ipatch_sf2_sample_get_data (IpatchSF2Sample *sample); IpatchSampleData *ipatch_sf2_sample_peek_data (IpatchSF2Sample *sample); void ipatch_sf2_sample_set_linked (IpatchSF2Sample *sample, IpatchSF2Sample *linked); IpatchSF2Sample *ipatch_sf2_sample_get_linked (IpatchSF2Sample *sample); IpatchSF2Sample *ipatch_sf2_sample_peek_linked (IpatchSF2Sample *sample); void ipatch_sf2_sample_set_blank (IpatchSF2Sample *sample); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2Reader.h0000644000175000017500000000625111461332142016621 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2Reader * @short_description: SoundFont file reader * @see_also: * @stability: Stable * * Reads a SoundFont file and loads it into a object tree (#IpatchSF2). */ #ifndef __IPATCH_SF2_READER_H__ #define __IPATCH_SF2_READER_H__ #include #include #include #include #include #include typedef struct _IpatchSF2Reader IpatchSF2Reader; /* private structure */ typedef struct _IpatchSF2ReaderClass IpatchSF2ReaderClass; #define IPATCH_TYPE_SF2_READER (ipatch_sf2_reader_get_type ()) #define IPATCH_SF2_READER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_READER, \ IpatchSF2Reader)) #define IPATCH_SF2_READER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_READER, \ IpatchSF2ReaderClass)) #define IPATCH_IS_SF2_READER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_READER)) #define IPATCH_IS_SF2_READER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2_READER)) /* SoundFont parser object */ struct _IpatchSF2Reader { IpatchRiff parent_instance; /* derived from IpatchRiff */ IpatchSF2 *sf; /* SoundFont object to load file into */ /*< private >*/ guint16 *pbag_table; guint pbag_count; guint16 *ibag_table; guint ibag_count; IpatchSF2Inst **inst_table; guint inst_count; IpatchSF2Sample **sample_table; guint sample_count; }; /* RIFF parser class */ struct _IpatchSF2ReaderClass { IpatchRiffClass parent_class; }; GType ipatch_sf2_reader_get_type (void); IpatchSF2Reader *ipatch_sf2_reader_new (IpatchFileHandle *handle); void ipatch_sf2_reader_set_file_handle (IpatchSF2Reader *reader, IpatchFileHandle *handle); IpatchSF2 *ipatch_sf2_reader_load (IpatchSF2Reader *reader, GError **err); void ipatch_sf2_load_phdr (IpatchFileHandle *handle, IpatchSF2Phdr *phdr); void ipatch_sf2_load_ihdr (IpatchFileHandle *handle, IpatchSF2Ihdr *ihdr); void ipatch_sf2_load_shdr (IpatchFileHandle *handle, IpatchSF2Shdr *shdr); void ipatch_sf2_load_bag (IpatchFileHandle *handle, IpatchSF2Bag *bag); void ipatch_sf2_load_mod (IpatchFileHandle *handle, IpatchSF2Mod *mod); void ipatch_sf2_load_gen (IpatchFileHandle *handle, int *genid, IpatchSF2GenAmount *amount); #endif libinstpatch-1.0.0/libinstpatch/IpatchConvert_Gig.h0000644000175000017500000000371411461332142017313 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchConvert_Gig * @short_description: GigaSampler conversion handlers * @see_also: #IpatchConverter * @stability: Stable * * Conversion handlers for GigaSampler objects. */ #ifndef __IPATCH_CONVERT_GIG_H__ #define __IPATCH_CONVERT_GIG_H__ #include #include #include typedef IpatchConverter IpatchConverterGigToFile; typedef IpatchConverterClass IpatchConverterGigToFileClass; typedef IpatchConverter IpatchConverterFileToGig; typedef IpatchConverterClass IpatchConverterFileToGigClass; typedef IpatchConverter IpatchConverterFileToGigSample; typedef IpatchConverterClass IpatchConverterFileToGigSampleClass; #define IPATCH_TYPE_CONVERTER_GIG_TO_FILE \ (ipatch_converter_gig_to_file_get_type ()) #define IPATCH_TYPE_CONVERTER_FILE_TO_GIG \ (ipatch_converter_file_to_gig_get_type ()) #define IPATCH_TYPE_CONVERTER_FILE_TO_GIG_SAMPLE \ (ipatch_converter_file_to_gig_sample_get_type ()) GType ipatch_converter_gig_to_file_get_type (void); GType ipatch_converter_file_to_gig_get_type (void); GType ipatch_converter_file_to_gig_sample_get_type (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchItemProp.c0000644000175000017500000004627411461332142016647 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /* * IpatchItemProp.c - IpatchItem property change callback system */ #include #include #include #include "IpatchItem.h" #include "IpatchParamProp.h" #include "ipatch_priv.h" /* hash key for IpatchItem property matching */ typedef struct { IpatchItem *item; /* IpatchItem to match for callback */ GParamSpec *pspec; /* GParamSpec to match for callback */ } PropMatchKey; /* hash value used for IpatchItem property callbacks */ typedef struct { IpatchItemPropCallback callback; /* callback function */ IpatchItemPropDisconnect disconnect; /* called when callback is disconnected */ gpointer user_data; /* user data to pass to function */ guint handler_id; /* unique handler ID */ } PropCallback; static void prop_match_key_free (gpointer data); static guint prop_callback_hash_func (gconstpointer key); static gboolean prop_callback_equal_func (gconstpointer a, gconstpointer b); static void ipatch_item_prop_real_disconnect (guint handler_id, IpatchItem *item, GParamSpec *pspec, IpatchItemPropCallback callback, gpointer user_data); static gboolean prop_callback_hash_GHRFunc (gpointer key, gpointer value, gpointer user_data); /* lock for prop_callback_next_id, prop_callback_hash and wild_prop_callback_list */ G_LOCK_DEFINE_STATIC (prop_callbacks); static guint prop_callback_next_id = 1; /* next handler ID */ /* hash of IpatchItem prop callbacks (PropMatchKey -> GSList) */ static GHashTable *prop_callback_hash; /* wildcard callbacks (item and property are wildcard) */ static GSList *wild_prop_callback_list = NULL; /* called by ipatch_init() */ void _ipatch_item_prop_init (void) { /* create IpatchItem property callback hash */ prop_callback_hash = g_hash_table_new_full (prop_callback_hash_func, prop_callback_equal_func, prop_match_key_free, NULL); } /* GDestroyNotify function to free prop_callback_hash keys */ static void prop_match_key_free (gpointer data) { g_slice_free (PropMatchKey, data); } /* hash function for IpatchItem property notify callback hash */ static guint prop_callback_hash_func (gconstpointer key) { const PropMatchKey *propkey = (const PropMatchKey *)key; return (GPOINTER_TO_UINT (propkey->item) + GPOINTER_TO_UINT (propkey->pspec)); } /* hash equal function for IpatchItem property notify callback hash */ static gboolean prop_callback_equal_func (gconstpointer a, gconstpointer b) { const PropMatchKey *akey = (const PropMatchKey *)a; const PropMatchKey *bkey = (const PropMatchKey *)b; return (akey->item == bkey->item && akey->pspec == bkey->pspec); } /** * ipatch_item_prop_notify: * @item: Item whose property changed * @pspec: Parameter specification for @item of parameter that changed * @new_value: The new value that was assigned * @old_value: Old value that property had (can be %NULL for read only props) * * Usually only used by #IpatchItem object implementations, rather * than explicitly called by the user. It should be called AFTER item * property changes that occur outside of the #IpatchItem * item_set_property method. */ void ipatch_item_prop_notify (IpatchItem *item, GParamSpec *pspec, const GValue *new_value, const GValue *old_value) { /* dynamically adjustable max callbacks to allocate cbarray for */ static guint max_callbacks = 64; PropMatchKey cbkey; PropCallback *cbarray; /* NULL terminated array */ PropCallback *cb; PropCallback *old_cbarray; guint old_max_callbacks; GSList *match_both, *match_item, *match_prop, *wild_list; guint cbindex = 0, i; g_return_if_fail (IPATCH_IS_ITEM (item)); g_return_if_fail (G_IS_PARAM_SPEC (pspec)); g_return_if_fail (G_IS_VALUE (new_value)); g_return_if_fail (!old_value || G_IS_VALUE (old_value)); /* should save-able state change be indicated (set #IpatchBase dirty flag) */ if (!(pspec->flags & IPATCH_PARAM_NO_SAVE_CHANGE)) ipatch_item_changed (item); /* if hooks not active for item, just return */ if (!(ipatch_item_get_flags (item) & IPATCH_ITEM_HOOKS_ACTIVE)) return; /* key for IpatchItem property callback hash */ cbkey.item = item; cbkey.pspec = pspec; /* allocate callback array on stack (for performance) */ cbarray = g_alloca (max_callbacks * sizeof (PropCallback)); G_LOCK (prop_callbacks); /* lookup callback list for this IpatchItem:Property */ match_both = g_hash_table_lookup (prop_callback_hash, &cbkey); /* lookup callback list for IpatchItem:* */ cbkey.pspec = NULL; match_item = g_hash_table_lookup (prop_callback_hash, &cbkey); /* lookup callback list for *:Property */ cbkey.pspec = pspec; cbkey.item = NULL; match_prop = g_hash_table_lookup (prop_callback_hash, &cbkey); wild_list = wild_prop_callback_list; /* duplicate lists into array (since we will call them outside of lock) */ for (; match_both && cbindex < max_callbacks; match_both = match_both->next) cbarray[cbindex++] = *(PropCallback *)(match_both->data); for (; match_item && cbindex < max_callbacks; match_item = match_item->next) cbarray[cbindex++] = *(PropCallback *)(match_item->data); for (; match_prop && cbindex < max_callbacks; match_prop = match_prop->next) cbarray[cbindex++] = *(PropCallback *)(match_prop->data); for (; wild_list && cbindex < max_callbacks; wild_list = wild_list->next) cbarray[cbindex++] = *(PropCallback *)(wild_list->data); if (match_both || match_item || match_prop || wild_list) { /* We exceeded max_callbacks (Bender just shit a brick) */ old_cbarray = cbarray; old_max_callbacks = max_callbacks; cbindex += g_slist_length (match_both); cbindex += g_slist_length (match_item); cbindex += g_slist_length (match_prop); cbindex += g_slist_length (wild_list); max_callbacks = cbindex + 16; /* plus some for kicks */ cbarray = g_alloca (max_callbacks * sizeof (PropCallback)); memcpy (cbarray, old_cbarray, old_max_callbacks * sizeof (PropCallback)); cbindex = old_max_callbacks; /* duplicate rest of the lists */ for (; match_both && cbindex < max_callbacks; match_both = match_both->next) cbarray[cbindex++] = *(PropCallback *)(match_both->data); for (; match_item && cbindex < max_callbacks; match_item = match_item->next) cbarray[cbindex++] = *(PropCallback *)(match_item->data); for (; match_prop && cbindex < max_callbacks; match_prop = match_prop->next) cbarray[cbindex++] = *(PropCallback *)(match_prop->data); for (; wild_list && cbindex < max_callbacks; wild_list = wild_list->next) cbarray[cbindex++] = *(PropCallback *)(wild_list->data); } G_UNLOCK (prop_callbacks); if (cbindex) { IpatchItemPropNotify info = { 0 }; info.item = item; info.pspec = pspec; info.new_value = new_value; info.old_value = old_value; /* call the callbacks */ for (i = 0; i < cbindex; i++) { cb = &cbarray[i]; info.user_data = cb->user_data; cb->callback (&info); } /* call event data destroy functions if any have been set */ if (info.eventdata[0].destroy) info.eventdata[0].destroy (info.eventdata[0].data); if (info.eventdata[1].destroy) info.eventdata[1].destroy (info.eventdata[1].data); if (info.eventdata[2].destroy) info.eventdata[2].destroy (info.eventdata[2].data); if (info.eventdata[3].destroy) info.eventdata[3].destroy (info.eventdata[3].data); } } /** * ipatch_item_prop_notify_by_name: * @item: Item whose property changed * @prop_name: Name of property that changed * @new_value: The new value that was assigned * @old_value: Old value that property had (can be %NULL for read only * properties) * * Usually only used by #IpatchItem object implementations, rather * than explicitly called by the user. Like ipatch_item_prop_notify() * except takes a property name instead of a parameter spec, for * added convenience. */ void ipatch_item_prop_notify_by_name (IpatchItem *item, const char *prop_name, const GValue *new_value, const GValue *old_value) { GObjectClass *klass; GParamSpec *pspec, *redirect; g_return_if_fail (IPATCH_IS_ITEM (item)); g_return_if_fail (prop_name != NULL); g_return_if_fail (G_IS_VALUE (new_value)); g_return_if_fail (!old_value || G_IS_VALUE (old_value)); /* get the item's class and lookup the property */ klass = G_OBJECT_GET_CLASS (item); pspec = g_object_class_find_property (klass, prop_name); g_return_if_fail (pspec != NULL); /* use overridden param spec if its an override param spec */ redirect = g_param_spec_get_redirect_target (pspec); if (redirect) pspec = redirect; ipatch_item_prop_notify (item, pspec, new_value, old_value); } /** * ipatch_item_prop_connect: * @item: IpatchItem to match (or %NULL for wildcard) * @pspec: Property parameter specification to match (or %NULL for wildcard) * @callback: Callback function * @disconnect: Callback disconnect function (called when the callback is * disconnected) can be NULL. * @user_data: User defined data to pass to @callback and @disconnect function. * * Connect a callback for a specific #IpatchItem and property. If a property * change occurs for the given @item and @pspec then the callback is * invoked. The parameters @item and/or @pspec may be %NULL for wild card * matching (if both are %NULL then callback will be called for all #IpatchItem * property changes). * * Returns: Unique handler ID which can be used to remove the handler or 0 on * error (only when function params are incorrect). */ guint ipatch_item_prop_connect (IpatchItem *item, GParamSpec *pspec, IpatchItemPropCallback callback, IpatchItemPropDisconnect disconnect, gpointer user_data) { PropMatchKey *cbkey = NULL; PropCallback *cb; GSList *cblist; guint handler_id; g_return_val_if_fail (!item || IPATCH_IS_ITEM (item), 0); g_return_val_if_fail (!pspec || G_IS_PARAM_SPEC (pspec), 0); g_return_val_if_fail (callback != NULL, 0); if (item || pspec) { cbkey = g_slice_new (PropMatchKey); cbkey->item = item; cbkey->pspec = pspec; } cb = g_slice_new (PropCallback); cb->callback = callback; cb->disconnect = disconnect; cb->user_data = user_data; G_LOCK (prop_callbacks); handler_id = prop_callback_next_id++; cb->handler_id = handler_id; if (cbkey) { /* get existing list for IpatchItem:Property (if any) */ cblist = g_hash_table_lookup (prop_callback_hash, cbkey); /* if IpatchItem:Property already exists then cbkey gets freed here */ g_hash_table_insert (prop_callback_hash, cbkey, g_slist_prepend (cblist, cb)); } else /* callback is completely wildcard, just add to the wildcard list */ wild_prop_callback_list = g_slist_prepend (wild_prop_callback_list, cb); G_UNLOCK (prop_callbacks); return (handler_id); } /** * ipatch_item_prop_connect_by_name: * @item: IpatchItem to match (or %NULL for wildcard) * @prop_name: Name of property of @item to match * @callback: Callback function * @disconnect: Callback disconnect function (called when the callback is * disconnect) can be NULL. * @user_data: User defined data to pass to @callback and @disconnect function. * * Like ipatch_item_prop_add_callback() but takes the name of a property\ * instead of the parameter spec, for added convenience. * * Returns: Unique handler ID which can be used to remove the handler or 0 on * error (only when function params are incorrect). */ guint ipatch_item_prop_connect_by_name (IpatchItem *item, const char *prop_name, IpatchItemPropCallback callback, IpatchItemPropDisconnect disconnect, gpointer user_data) { GParamSpec *pspec; g_return_val_if_fail (IPATCH_IS_ITEM (item), 0); g_return_val_if_fail (prop_name != NULL, 0); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (item), prop_name); g_return_val_if_fail (pspec != NULL, 0); return (ipatch_item_prop_connect (item, pspec, callback, disconnect, user_data)); } /* a bag used in next 2 removal functions */ typedef struct { gboolean found; /* Set to TRUE if handler found */ PropMatchKey key; /* out: (remove_callback func), in: (matched func) */ PropCallback cb; /* in: handler_id, out: disconnect, user_data */ PropMatchKey update_key; /* out: key of list root requiring update */ GSList *update_list; /* out: new root of list to update */ gboolean update_needed; /* out: set if root of list needs update */ } PropRemoveBag; /** * ipatch_item_prop_disconnect: * @handler_id: Handler ID as returned from ipatch_item_prop_connect(). * * Disconnects an #IpatchItem property change callback handler by its ID. */ void ipatch_item_prop_disconnect (guint handler_id) { g_return_if_fail (handler_id != 0); ipatch_item_prop_real_disconnect (handler_id, NULL, NULL, NULL, NULL); } /** * ipatch_item_prop_disconnect_matched: * @item: #IpatchItem of handler to match (does not need to be valid) * @pspec: GParamSpec of handler to match (does not need to be valid) * @callback: Callback function to match * @user_data: User data to match * * Disconnects first #IpatchItem property change callback matching all the * function parameters. * Note: Only the pointer values of @item and @pspec are used so they don't * actually need to be valid anymore. */ void ipatch_item_prop_disconnect_matched (IpatchItem *item, GParamSpec *pspec, IpatchItemPropCallback callback, gpointer user_data) { g_return_if_fail (callback != NULL); ipatch_item_prop_real_disconnect (0, item, pspec, callback, user_data); } /** * ipatch_item_prop_disconnect_by_name: * @item: #IpatchItem of handler to match (NOTE: Must be a valid object!) * @prop_name: Name of property of @item to match * @callback: Callback function to match * @user_data: User data to match * * Like ipatch_item_prop_disconnect_matched() but takes a name of the * property to match instead of a parameter spec, for added convenience. * Note: @item must still be valid (to look up the property), contrary to * ipatch_item_prop_disconnect_matched(). */ void ipatch_item_prop_disconnect_by_name (IpatchItem *item, const char *prop_name, IpatchItemPropCallback callback, gpointer user_data) { GParamSpec *pspec; g_return_if_fail (IPATCH_IS_ITEM (item)); g_return_if_fail (prop_name != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (item), prop_name); g_return_if_fail (pspec != NULL); ipatch_item_prop_disconnect_matched (item, pspec, callback, user_data); } /* used by ipatch_item_prop_disconnect and ipatch_item_prop_disconnect_matched. * Either handler_id should be set to a non-zero value or the other * parameters should be assigned but not both. */ static void ipatch_item_prop_real_disconnect (guint handler_id, IpatchItem *item, GParamSpec *pspec, IpatchItemPropCallback callback, gpointer user_data) { PropMatchKey *update_key; PropRemoveBag bag = { 0 }; PropCallback *cb; GSList *p; g_return_if_fail (handler_id != 0 || callback != NULL); g_return_if_fail (handler_id == 0 || callback == NULL); if (!handler_id) /* find by match criteria? */ { bag.key.item = item; bag.key.pspec = pspec; bag.cb.callback = callback; bag.cb.user_data = user_data; } else bag.cb.handler_id = handler_id; /* find by handler ID */ G_LOCK (prop_callbacks); /* only look in hash if ID search or item or pspec specified (not wildcard) */ if (handler_id || (item || pspec)) g_hash_table_foreach_remove (prop_callback_hash, prop_callback_hash_GHRFunc, &bag); /* hash entry did not get removed and requires list root to be updated, this can't be done in the GHRFunc */ if (bag.update_needed) { /* allocate and copy key for insert (gets freed) */ update_key = g_slice_new (PropMatchKey); *update_key = bag.update_key; g_hash_table_insert (prop_callback_hash, update_key, bag.update_list); } /* if not found and find ID or !item and !pspec (wildcard), check wildcard list */ if (!bag.found && (handler_id || (!item && !pspec))) { for (p = wild_prop_callback_list; p; p = p->next) { cb = (PropCallback *)(p->data); /* callback matches criteria? (handler_id or callback:user_data) */ if ((handler_id && cb->handler_id == handler_id) || (!handler_id && cb->callback == callback && cb->user_data == user_data)) { bag.found = TRUE; bag.cb.disconnect = cb->disconnect; bag.cb.user_data = cb->user_data; g_slice_free (PropCallback, cb); wild_prop_callback_list = g_slist_delete_link (wild_prop_callback_list, p); break; } } } G_UNLOCK (prop_callbacks); if (!bag.found) { if (handler_id) g_critical (G_STRLOC ": Failed to find handler with ID '%d'", handler_id); else g_critical (G_STRLOC ": Failed to find handler matching criteria %p:%p:%p:%p", item, pspec, callback, user_data); } /* see if callback found and it had a disconnect func */ if (bag.cb.disconnect) bag.cb.disconnect (bag.key.item, bag.key.pspec, bag.cb.user_data); } /* finds a handler by ID or item/property/callback/user_data and removes it */ static gboolean prop_callback_hash_GHRFunc (gpointer key, gpointer value, gpointer user_data) { PropRemoveBag *bag = (PropRemoveBag *)user_data; PropMatchKey *propkey = (PropMatchKey *)key; GSList *cblist = (GSList *)value, *p, *newroot; PropCallback *cb; p = cblist; while (p) /* loop over callbacks in callback list */ { cb = (PropCallback *)(p->data); /* criteria matches? (by ID or by match) */ if ((bag->cb.handler_id && cb->handler_id == bag->cb.handler_id) || (!bag->cb.handler_id && propkey->item == bag->key.item && propkey->pspec == bag->key.pspec && cb->callback == bag->cb.callback && cb->user_data == bag->cb.user_data)) { /* return callback's item, pspec, disconnect func and user_data */ bag->found = TRUE; bag->cb.disconnect = cb->disconnect; bag->cb.user_data = cb->user_data; bag->key.item = propkey->item; bag->key.pspec = propkey->pspec; g_slice_free (PropCallback, cb); newroot = g_slist_delete_link (cblist, p); if (!newroot) return (TRUE); /* no more list? Remove hash entry */ /* if root not the same, return update information (can't be done in GHRFunc) */ if (newroot != cblist) { bag->update_needed = TRUE; bag->update_key = *(PropMatchKey *)key; bag->update_list = newroot; } return (FALSE); } p = g_slist_next (p); } return (FALSE); } libinstpatch-1.0.0/libinstpatch/libinstpatch.def0000644000175000017500000005656011456655761017001 00000000000000EXPORTS _ipatch_code_error _ipatch_code_errorv _ipatch_convert_DLS2_init _ipatch_convert_SF2_init _ipatch_convert_gig_init _ipatch_cram_decoder_class_install_properties _ipatch_cram_encoder_class_install_properties _ipatch_cram_init _ipatch_dls2_conn_init _ipatch_dls2_info_init _ipatch_dls2_sample_init _ipatch_iface_prop_init _ipatch_param_init _ipatch_paste_init _ipatch_sf2_gen_init _ipatch_sf2_mod_init _ipatch_sf2_voice_cache_init_DLS _ipatch_sf2_voice_cache_init_SF2 _ipatch_sf2_voice_cache_init_gig _ipatch_type_prop_init _ipatch_unit_dls_init _ipatch_unit_generic_init _ipatch_unit_init _ipatch_unit_sf2_init ipatch_application_name DATA ipatch_audio_file_get_type ipatch_base_find_item_by_midi_locale_ref ipatch_base_find_unused_midi_locale ipatch_base_flags_get_type ipatch_base_get_file_name ipatch_base_get_type ipatch_base_ref_file ipatch_base_set_file ipatch_base_set_file_name ipatch_container_add_unique ipatch_container_count ipatch_container_get_child_types ipatch_container_get_children ipatch_container_get_type ipatch_container_get_virtual_types ipatch_container_init_iter ipatch_container_insert ipatch_container_insert_iter ipatch_container_make_unique ipatch_container_remove ipatch_container_remove_all ipatch_container_remove_iter ipatch_container_set_add_hook ipatch_container_set_remove_hook ipatch_container_type_get_child_types ipatch_converter_add_input ipatch_converter_add_inputs ipatch_converter_add_output ipatch_converter_add_outputs ipatch_converter_convert ipatch_converter_dls2_inst_to_sf2_voice_cache_get_type ipatch_converter_dls2_region_to_sf2_voice_cache_get_type ipatch_converter_dls2_sample_to_sf2_voice_cache_get_type ipatch_converter_dls2_to_file_get_type ipatch_converter_file_to_dls2_get_type ipatch_converter_file_to_gig_get_type ipatch_converter_file_to_sf2_get_type ipatch_converter_find_flags_get_type ipatch_converter_flags_get_type ipatch_converter_get_notes ipatch_converter_get_type ipatch_converter_gig_inst_to_sf2_voice_cache_get_type ipatch_converter_gig_sample_to_sf2_voice_cache_get_type ipatch_converter_gig_to_file_get_type ipatch_converter_init ipatch_converter_log ipatch_converter_log_next ipatch_converter_log_type_get_type ipatch_converter_ref_input ipatch_converter_ref_inputs ipatch_converter_ref_output ipatch_converter_ref_outputs ipatch_converter_reset ipatch_converter_sample_file_to_dls2_sample_get_type ipatch_converter_sample_file_to_sf2_sample_get_type ipatch_converter_sf2_inst_to_sf2_voice_cache_get_type ipatch_converter_sf2_izone_to_sf2_voice_cache_get_type ipatch_converter_sf2_preset_to_sf2_voice_cache_get_type ipatch_converter_sf2_pzone_to_sf2_voice_cache_get_type ipatch_converter_sf2_sample_to_sf2_voice_cache_get_type ipatch_converter_sf2_to_file_get_type ipatch_converter_verify ipatch_cram_close_ebml_chunk ipatch_cram_decoder_converter_get_type ipatch_cram_decoder_converter_new ipatch_cram_decoder_decode_all ipatch_cram_decoder_decode_file ipatch_cram_decoder_get_type ipatch_cram_decoder_new ipatch_cram_decoder_next_file ipatch_cram_decoder_set_cram_file ipatch_cram_decoder_set_dest_file ipatch_cram_decoder_start ipatch_cram_dls_file_encode ipatch_cram_encoder_converter_get_type ipatch_cram_encoder_converter_new ipatch_cram_encoder_declare_binary ipatch_cram_encoder_declare_file ipatch_cram_encoder_declare_flac_audio ipatch_cram_encoder_end ipatch_cram_encoder_flags_get_type ipatch_cram_encoder_get_type ipatch_cram_encoder_new ipatch_cram_encoder_set_audio_endian ipatch_cram_encoder_set_file ipatch_cram_encoder_start ipatch_cram_encoder_store_audio ipatch_cram_encoder_store_audio_interleaved ipatch_cram_encoder_store_binary ipatch_cram_file_get_type ipatch_cram_file_new ipatch_cram_fixup_ebml_size ipatch_cram_get_ebml_enum ipatch_cram_get_ebml_id ipatch_cram_read_ebml_chunk ipatch_cram_read_varlength ipatch_cram_sf2_file_encode ipatch_cram_store_ebml_chunk ipatch_cram_varlength_decode ipatch_cram_varlength_encode ipatch_cram_varlength_min_size ipatch_cram_varlength_size ipatch_cram_write_ebml_chunk ipatch_cram_write_ebml_chunk_buf ipatch_create_converter ipatch_create_path ipatch_dls2_conn_dest_type_get_type ipatch_dls2_conn_duplicate ipatch_dls2_conn_free ipatch_dls2_conn_get_type ipatch_dls2_conn_list_duplicate ipatch_dls2_conn_list_duplicate_fast ipatch_dls2_conn_list_free ipatch_dls2_conn_list_set ipatch_dls2_conn_list_unset ipatch_dls2_conn_new ipatch_dls2_conn_polarity_type_get_type ipatch_dls2_conn_src_type_get_type ipatch_dls2_conn_transform_masks_get_type ipatch_dls2_conn_transform_shifts_get_type ipatch_dls2_conn_transform_type_get_type ipatch_dls2_find_inst_ref ipatch_dls2_find_sample_ref ipatch_dls2_flags_get_type ipatch_dls2_get_info ipatch_dls2_get_type ipatch_dls2_info_bag_free ipatch_dls2_info_bag_new ipatch_dls2_info_duplicate ipatch_dls2_info_free ipatch_dls2_info_get ipatch_dls2_info_get_property ipatch_dls2_info_install_class_properties ipatch_dls2_info_is_defined ipatch_dls2_info_notify ipatch_dls2_info_peek ipatch_dls2_info_set ipatch_dls2_info_set_property ipatch_dls2_info_type_get_type ipatch_dls2_inst_compare ipatch_dls2_inst_conn_count ipatch_dls2_inst_first ipatch_dls2_inst_flags_get_type ipatch_dls2_inst_get_conns ipatch_dls2_inst_get_info ipatch_dls2_inst_get_midi_locale ipatch_dls2_inst_get_type ipatch_dls2_inst_new ipatch_dls2_inst_next ipatch_dls2_inst_set_conn ipatch_dls2_inst_set_info ipatch_dls2_inst_set_midi_locale ipatch_dls2_inst_unset_all_conns ipatch_dls2_inst_unset_conn ipatch_dls2_make_unique_name ipatch_dls2_new ipatch_dls2_ref_file ipatch_dls2_ref_region_references ipatch_dls2_region_channel_map_stereo ipatch_dls2_region_channel_type_get_type ipatch_dls2_region_clear_sample_override_flags ipatch_dls2_region_conn_count ipatch_dls2_region_first ipatch_dls2_region_flags_get_type ipatch_dls2_region_get_conns ipatch_dls2_region_get_info ipatch_dls2_region_get_sample_override ipatch_dls2_region_get_type ipatch_dls2_region_in_range ipatch_dls2_region_new ipatch_dls2_region_next ipatch_dls2_region_peek_sample ipatch_dls2_region_ref_sample ipatch_dls2_region_sample_override_get_type ipatch_dls2_region_set_conn ipatch_dls2_region_set_info ipatch_dls2_region_set_key_range ipatch_dls2_region_set_sample ipatch_dls2_region_set_sample_override ipatch_dls2_region_set_sample_override_flags ipatch_dls2_region_set_velocity_range ipatch_dls2_region_unset_all_conns ipatch_dls2_region_unset_conn ipatch_dls2_sample_find_store_ref ipatch_dls2_sample_first ipatch_dls2_sample_flags_get_type ipatch_dls2_sample_get_size ipatch_dls2_sample_get_type ipatch_dls2_sample_info_duplicate ipatch_dls2_sample_info_free ipatch_dls2_sample_info_get_property ipatch_dls2_sample_info_install_class_properties ipatch_dls2_sample_info_new ipatch_dls2_sample_info_set_property ipatch_dls2_sample_new ipatch_dls2_sample_next ipatch_dls2_sample_peek_data ipatch_dls2_sample_ref_data ipatch_dls2_sample_set_blank ipatch_dls2_sample_set_data ipatch_dls2_set_file ipatch_dls2_set_info ipatch_dls_file_get_type ipatch_dls_file_new ipatch_dls_load_connection ipatch_dls_load_dlid ipatch_dls_load_info ipatch_dls_load_pool_table ipatch_dls_load_region_header ipatch_dls_load_sample_format ipatch_dls_load_sample_info ipatch_dls_load_wave_link ipatch_dls_reader_error_get_type ipatch_dls_reader_error_quark ipatch_dls_reader_fixup ipatch_dls_reader_get_type ipatch_dls_reader_load ipatch_dls_reader_load_art_list ipatch_dls_reader_load_inst_list ipatch_dls_reader_load_level_0 ipatch_dls_reader_load_region_list ipatch_dls_reader_load_wave_pool ipatch_dls_reader_new ipatch_dls_reader_set_file ipatch_dls_reader_set_pool_table ipatch_dls_reader_start ipatch_dls_writer_get_type ipatch_dls_writer_new ipatch_dls_writer_save ipatch_dls_writer_set_file ipatch_dls_writer_set_patch ipatch_dump_object ipatch_error_get_type ipatch_error_quark ipatch_file_buf_commit ipatch_file_buf_free ipatch_file_buf_init ipatch_file_buf_load ipatch_file_buf_memset ipatch_file_buf_read ipatch_file_buf_read_s16 ipatch_file_buf_read_s32 ipatch_file_buf_read_s64 ipatch_file_buf_read_s8 ipatch_file_buf_read_u16 ipatch_file_buf_read_u32 ipatch_file_buf_read_u64 ipatch_file_buf_read_u8 ipatch_file_buf_seek ipatch_file_buf_write ipatch_file_buf_write_s16 ipatch_file_buf_write_s32 ipatch_file_buf_write_s64 ipatch_file_buf_write_s8 ipatch_file_buf_write_u16 ipatch_file_buf_write_u32 ipatch_file_buf_write_u64 ipatch_file_buf_write_u8 ipatch_file_close ipatch_file_convert_type ipatch_file_default_close_method ipatch_file_default_get_size_method ipatch_file_default_getfd_method ipatch_file_default_open_method ipatch_file_default_read_method ipatch_file_default_seek_method ipatch_file_default_write_method ipatch_file_get_fd ipatch_file_get_iofuncs ipatch_file_get_name ipatch_file_get_position ipatch_file_get_size ipatch_file_get_type ipatch_file_identify ipatch_file_identify_open ipatch_file_is_open ipatch_file_new ipatch_file_open ipatch_file_open_with_fd ipatch_file_open_with_io_channel ipatch_file_read ipatch_file_read_eof ipatch_file_read_s16 ipatch_file_read_s32 ipatch_file_read_s64 ipatch_file_read_s8 ipatch_file_read_u16 ipatch_file_read_u32 ipatch_file_read_u64 ipatch_file_read_u8 ipatch_file_ref_io_channel ipatch_file_seek ipatch_file_seek_eof ipatch_file_set_big_endian ipatch_file_set_iofuncs ipatch_file_set_iofuncs_null ipatch_file_set_iofuncs_static ipatch_file_set_little_endian ipatch_file_set_name ipatch_file_update_position ipatch_file_write ipatch_file_write_s16 ipatch_file_write_s32 ipatch_file_write_s64 ipatch_file_write_s8 ipatch_file_write_u16 ipatch_file_write_u32 ipatch_file_write_u64 ipatch_file_write_u8 ipatch_find_converter ipatch_find_paste_handler ipatch_gerror_message ipatch_get_conversion_dest_types ipatch_get_conversion_src_types ipatch_get_conversion_table ipatch_get_paste_dest_types ipatch_get_paste_src_types ipatch_gig_control_type_get_type ipatch_gig_dimension_first ipatch_gig_dimension_get_type ipatch_gig_dimension_new ipatch_gig_dimension_next ipatch_gig_dimension_type_get_type ipatch_gig_effects_init ipatch_gig_effects_to_gen_array ipatch_gig_file_get_type ipatch_gig_file_new ipatch_gig_filter_type_get_type ipatch_gig_get_type ipatch_gig_inst_first ipatch_gig_inst_get_type ipatch_gig_inst_new ipatch_gig_inst_next ipatch_gig_load_dimension_info ipatch_gig_load_dimension_names ipatch_gig_load_group_names ipatch_gig_load_region_header ipatch_gig_load_sample_info ipatch_gig_new ipatch_gig_parse_effects ipatch_gig_reader_load_inst_lart ipatch_gig_reader_load_region_list ipatch_gig_reader_load_sub_regions ipatch_gig_region_first ipatch_gig_region_flags_get_type ipatch_gig_region_get_type ipatch_gig_region_new ipatch_gig_region_new_dimension ipatch_gig_region_next ipatch_gig_region_remove_dimension ipatch_gig_region_set_key_range ipatch_gig_region_set_velocity_range ipatch_gig_sample_first ipatch_gig_sample_get_type ipatch_gig_sample_new ipatch_gig_sample_next ipatch_gig_store_effects ipatch_gig_sub_region_first ipatch_gig_sub_region_flags_get_type ipatch_gig_sub_region_get_type ipatch_gig_sub_region_new ipatch_gig_sub_region_next ipatch_gig_sub_region_ref_sample ipatch_gig_sub_region_set_sample ipatch_gig_sub_region_set_sample_info_override ipatch_gig_to_sf2_timecents ipatch_gig_volsust_to_sf2_centibels ipatch_iface_find_property ipatch_iface_get ipatch_iface_get_property ipatch_iface_get_valist ipatch_iface_install_property ipatch_iface_install_property_handlers ipatch_iface_list_properties ipatch_iface_set ipatch_iface_set_property ipatch_iface_set_valist ipatch_init ipatch_item_changed ipatch_item_clear_flags ipatch_item_copy ipatch_item_describe ipatch_item_duplicate ipatch_item_first ipatch_item_flags_get_type ipatch_item_get_atomic ipatch_item_get_flags ipatch_item_get_type ipatch_item_next ipatch_item_peek_ancestor_type ipatch_item_peek_base ipatch_item_peek_parent ipatch_item_prop_notify ipatch_item_prop_notify_by_name ipatch_item_ref_ancestor_type ipatch_item_ref_base ipatch_item_ref_parent ipatch_item_remove ipatch_item_set_atomic ipatch_item_set_flags ipatch_item_set_parent ipatch_item_set_prop_notify_hook ipatch_item_unparent ipatch_iter_GList_count ipatch_iter_GList_first ipatch_iter_GList_get ipatch_iter_GList_index ipatch_iter_GList_init ipatch_iter_GList_insert ipatch_iter_GList_last ipatch_iter_GList_methods DATA ipatch_iter_GList_next ipatch_iter_GList_remove ipatch_iter_GSList_count ipatch_iter_GSList_first ipatch_iter_GSList_get ipatch_iter_GSList_index ipatch_iter_GSList_init ipatch_iter_GSList_insert ipatch_iter_GSList_last ipatch_iter_GSList_methods DATA ipatch_iter_GSList_next ipatch_iter_GSList_remove ipatch_iter_alloc ipatch_iter_array_count ipatch_iter_array_first ipatch_iter_array_get ipatch_iter_array_index ipatch_iter_array_init ipatch_iter_array_insert ipatch_iter_array_last ipatch_iter_array_methods DATA ipatch_iter_array_next ipatch_iter_array_remove ipatch_iter_duplicate ipatch_iter_free ipatch_iter_get_type ipatch_list_duplicate ipatch_list_get_type ipatch_list_init_iter ipatch_list_new ipatch_lookup_converter_info ipatch_marshal_ENUM__FLAGS ipatch_md5_final ipatch_md5_init ipatch_md5_update ipatch_param_find_property ipatch_param_get ipatch_param_get_property ipatch_param_get_valist ipatch_param_install_property ipatch_param_list_properties ipatch_param_set ipatch_param_set_property ipatch_param_set_valist ipatch_param_spec_range ipatch_param_spec_range_get_type ipatch_paste_choice_flags_get_type ipatch_paste_choice_get_type ipatch_paste_default_handler ipatch_paste_execute ipatch_paste_find_flags_get_type ipatch_paste_get_choice ipatch_paste_get_type ipatch_paste_is_possible ipatch_paste_new ipatch_paste_objects ipatch_paste_set_objects ipatch_range_copy ipatch_range_free ipatch_range_get_type ipatch_range_new ipatch_register_converter ipatch_register_paste_handler ipatch_riff_chunk_type_get_type ipatch_riff_close_chunk ipatch_riff_get_chunk ipatch_riff_get_chunk_array ipatch_riff_get_chunk_level ipatch_riff_get_error ipatch_riff_get_file ipatch_riff_get_position ipatch_riff_get_total_size ipatch_riff_message_detail ipatch_riff_mode_get_type ipatch_riff_parser_error_get_type ipatch_riff_parser_error_quark ipatch_riff_parser_get_type ipatch_riff_parser_new ipatch_riff_pop_state ipatch_riff_push_state ipatch_riff_read_chunk ipatch_riff_read_chunk_verify ipatch_riff_set_file ipatch_riff_skip_chunks ipatch_riff_start_read ipatch_riff_start_read_chunk ipatch_riff_status_get_type ipatch_riff_write_chunk ipatch_sample_channel_get_type ipatch_sample_channel_route_get_type ipatch_sample_data_find_flags_get_type ipatch_sample_data_find_store_ref ipatch_sample_data_first ipatch_sample_data_get_list ipatch_sample_data_get_primary_channels ipatch_sample_data_get_primary_format ipatch_sample_data_get_primary_frame_size ipatch_sample_data_get_size ipatch_sample_data_get_type ipatch_sample_data_new ipatch_sample_data_next ipatch_sample_data_ref_blank ipatch_sample_data_ref_primary_store ipatch_sample_data_set_size ipatch_sample_endian_get_type ipatch_sample_file_get_save_types ipatch_sample_file_get_type ipatch_sample_find_flags_get_type ipatch_sample_find_source ipatch_sample_format_verify ipatch_sample_get_type ipatch_sample_install_property ipatch_sample_install_property_readonly ipatch_sample_loop_type_get_type ipatch_sample_new_property_param_spec ipatch_sample_new_transform_func_array ipatch_sample_sign_get_type ipatch_sample_source_close ipatch_sample_source_get_format ipatch_sample_source_get_frame_size ipatch_sample_source_get_native_format ipatch_sample_source_get_transform ipatch_sample_source_read ipatch_sample_source_set_format ipatch_sample_speed_get_type ipatch_sample_store_FALSE ipatch_sample_store_RAM_get_location ipatch_sample_store_RAM_get_type ipatch_sample_store_RAM_new ipatch_sample_store_RAM_set_location ipatch_sample_store_ROM_get_location ipatch_sample_store_ROM_get_type ipatch_sample_store_ROM_new ipatch_sample_store_ROM_set_location ipatch_sample_store_TRUE ipatch_sample_store_activate ipatch_sample_store_alloc ipatch_sample_store_copy ipatch_sample_store_duplicate ipatch_sample_store_file_get_location ipatch_sample_store_file_get_type ipatch_sample_store_file_new ipatch_sample_store_file_peek_file ipatch_sample_store_file_ref_file ipatch_sample_store_file_set_file ipatch_sample_store_file_set_location ipatch_sample_store_first ipatch_sample_store_flags_get_type ipatch_sample_store_get_active ipatch_sample_store_get_format ipatch_sample_store_get_frame_size ipatch_sample_store_get_size ipatch_sample_store_get_speed ipatch_sample_store_get_type ipatch_sample_store_is_readable ipatch_sample_store_is_writable ipatch_sample_store_next ipatch_sample_store_read ipatch_sample_store_set_format ipatch_sample_store_swap_get_type ipatch_sample_store_swap_new ipatch_sample_store_transform_init ipatch_sample_store_transform_init_size ipatch_sample_store_transform_new ipatch_sample_store_transform_new_size ipatch_sample_store_transform_read ipatch_sample_store_transform_write ipatch_sample_store_write ipatch_sample_transform_alloc ipatch_sample_transform_alloc_size ipatch_sample_transform_convert ipatch_sample_transform_free_buffers ipatch_sample_transform_get_buffers ipatch_sample_transform_get_frame_sizes ipatch_sample_transform_get_max_frames ipatch_sample_transform_get_type ipatch_sample_transform_new ipatch_sample_transform_set_buffers ipatch_sample_transform_set_formats ipatch_sample_width_get_type ipatch_sample_width_sizes DATA ipatch_set_application_name ipatch_sf2_file_get_sample_pos ipatch_sf2_file_get_sample_size ipatch_sf2_file_get_type ipatch_sf2_file_new ipatch_sf2_file_set_sample_pos ipatch_sf2_file_set_sample_size ipatch_sf2_find_inst_ref ipatch_sf2_find_preset_ref ipatch_sf2_find_sample_ref ipatch_sf2_free_info_array ipatch_sf2_gen_abs_array DATA ipatch_sf2_gen_abs_valid_mask DATA ipatch_sf2_gen_add_mask DATA ipatch_sf2_gen_amount_to_value ipatch_sf2_gen_array_duplicate ipatch_sf2_gen_array_free ipatch_sf2_gen_array_get_type ipatch_sf2_gen_array_init ipatch_sf2_gen_array_new ipatch_sf2_gen_array_offset ipatch_sf2_gen_info DATA ipatch_sf2_gen_ofs_array DATA ipatch_sf2_gen_ofs_valid_mask DATA ipatch_sf2_gen_sample_modes_get_type ipatch_sf2_gen_type_get_type ipatch_sf2_genid_default_value ipatch_sf2_genid_offset ipatch_sf2_genid_unit_str ipatch_sf2_get_info ipatch_sf2_get_info_array ipatch_sf2_get_info_max_size ipatch_sf2_get_type ipatch_sf2_info_id_is_valid ipatch_sf2_info_type_get_type ipatch_sf2_inst_first ipatch_sf2_inst_get_name ipatch_sf2_inst_get_type ipatch_sf2_inst_has_global_zone ipatch_sf2_inst_new ipatch_sf2_inst_new_zone ipatch_sf2_inst_next ipatch_sf2_inst_set_name ipatch_sf2_izone_first ipatch_sf2_izone_get_type ipatch_sf2_izone_new ipatch_sf2_izone_next ipatch_sf2_izone_ref_sample ipatch_sf2_izone_set_sample ipatch_sf2_load_bag ipatch_sf2_load_gen ipatch_sf2_load_ihdr ipatch_sf2_load_mod ipatch_sf2_load_phdr ipatch_sf2_load_shdr ipatch_sf2_make_unique_name ipatch_sf2_mod_control_get_type ipatch_sf2_mod_control_palette_get_type ipatch_sf2_mod_direction_get_type ipatch_sf2_mod_duplicate ipatch_sf2_mod_field_masks_get_type ipatch_sf2_mod_field_shifts_get_type ipatch_sf2_mod_free ipatch_sf2_mod_get_type ipatch_sf2_mod_list_duplicate ipatch_sf2_mod_list_free ipatch_sf2_mod_list_get_default ipatch_sf2_mod_list_offset ipatch_sf2_mod_list_override ipatch_sf2_mod_new ipatch_sf2_mod_polarity_get_type ipatch_sf2_mod_transform_get_type ipatch_sf2_mod_type_get_type ipatch_sf2_new ipatch_sf2_preset_compare ipatch_sf2_preset_first ipatch_sf2_preset_get_midi_locale ipatch_sf2_preset_get_name ipatch_sf2_preset_get_type ipatch_sf2_preset_has_global_zone ipatch_sf2_preset_new ipatch_sf2_preset_new_zone ipatch_sf2_preset_next ipatch_sf2_preset_set_midi_locale ipatch_sf2_preset_set_name ipatch_sf2_pzone_first ipatch_sf2_pzone_get_type ipatch_sf2_pzone_new ipatch_sf2_pzone_next ipatch_sf2_pzone_ref_inst ipatch_sf2_pzone_set_inst ipatch_sf2_reader_get_type ipatch_sf2_reader_load ipatch_sf2_reader_new ipatch_sf2_reader_set_file ipatch_sf2_ref_file ipatch_sf2_ref_zone_references ipatch_sf2_sample_find_store_ref ipatch_sf2_sample_first ipatch_sf2_sample_flags_get_type ipatch_sf2_sample_get_name ipatch_sf2_sample_get_size ipatch_sf2_sample_get_type ipatch_sf2_sample_new ipatch_sf2_sample_next ipatch_sf2_sample_peek_data ipatch_sf2_sample_peek_linked ipatch_sf2_sample_ref_data ipatch_sf2_sample_ref_linked ipatch_sf2_sample_set_blank ipatch_sf2_sample_set_data ipatch_sf2_sample_set_linked ipatch_sf2_sample_set_name ipatch_sf2_set_file ipatch_sf2_set_info ipatch_sf2_units_clamp ipatch_sf2_units_range_intersect ipatch_sf2_units_sfont_to_user ipatch_sf2_units_sfont_to_user_str ipatch_sf2_units_user_to_sfont ipatch_sf2_voice_cache_add_voice ipatch_sf2_voice_cache_get_type ipatch_sf2_voice_cache_new ipatch_sf2_voice_cache_optimize ipatch_sf2_voice_cache_select ipatch_sf2_voice_cache_set_voice_range ipatch_sf2_voice_convert_sample_data ipatch_sf2_voice_sel_type_get_type ipatch_sf2_write_bag ipatch_sf2_write_gen ipatch_sf2_write_ihdr ipatch_sf2_write_mod ipatch_sf2_write_phdr ipatch_sf2_write_shdr ipatch_sf2_writer_get_type ipatch_sf2_writer_new ipatch_sf2_writer_save ipatch_sf2_writer_set_file ipatch_sf2_writer_set_patch ipatch_sf2_zone_class_install_gen_properties ipatch_sf2_zone_copy_gen_array ipatch_sf2_zone_fill_gen_array ipatch_sf2_zone_first ipatch_sf2_zone_gen_count ipatch_sf2_zone_genid_get_prop_name ipatch_sf2_zone_genid_get_pspec ipatch_sf2_zone_get_gen ipatch_sf2_zone_get_gen_property ipatch_sf2_zone_get_mods ipatch_sf2_zone_get_type ipatch_sf2_zone_in_range ipatch_sf2_zone_insert_mod ipatch_sf2_zone_mod_count ipatch_sf2_zone_next ipatch_sf2_zone_peek_item ipatch_sf2_zone_ref_item ipatch_sf2_zone_remove_mod ipatch_sf2_zone_set_gen ipatch_sf2_zone_set_gen_property ipatch_sf2_zone_set_item ipatch_sf2_zone_set_key_range ipatch_sf2_zone_set_mod ipatch_sf2_zone_set_velocity_range ipatch_sf2_zone_unset_gen ipatch_strconcat_num ipatch_type_find_property ipatch_type_get ipatch_type_get_property ipatch_type_get_valist ipatch_type_install_property ipatch_type_list_properties ipatch_type_object_get ipatch_type_object_get_property ipatch_type_object_get_valist ipatch_type_register_func ipatch_type_set ipatch_type_set_property ipatch_type_set_valist ipatch_unit_centibel_to_decibel ipatch_unit_centibel_to_dls_gain ipatch_unit_cents_to_hertz ipatch_unit_class_lookup_map ipatch_unit_class_register_map ipatch_unit_class_type_get_type ipatch_unit_conversion_lookup ipatch_unit_conversion_register ipatch_unit_convert ipatch_unit_decibel_to_centibel ipatch_unit_decibel_to_dls_gain ipatch_unit_dls_abs_pitch_to_hertz ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch ipatch_unit_dls_abs_time_to_seconds ipatch_unit_dls_abs_time_to_sf2_abs_time ipatch_unit_dls_class_convert ipatch_unit_dls_gain_to_centibel ipatch_unit_dls_gain_to_decibel ipatch_unit_flags_get_type ipatch_unit_hertz_to_cents ipatch_unit_hertz_to_dls_abs_pitch ipatch_unit_hertz_to_sf2_abs_pitch ipatch_unit_info_alloc ipatch_unit_info_free ipatch_unit_lookup_by_id ipatch_unit_lookup_by_name ipatch_unit_percent_to_tenth_percent ipatch_unit_register ipatch_unit_seconds_to_dls_abs_time ipatch_unit_seconds_to_sf2_abs_time ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch ipatch_unit_sf2_abs_pitch_to_hertz ipatch_unit_sf2_abs_time_to_dls_abs_time ipatch_unit_sf2_abs_time_to_seconds ipatch_unit_tenth_percent_to_percent ipatch_unit_type_get_type ipatch_unit_user_class_convert ipatch_value_get_range ipatch_value_set_range ipatch_value_set_static_range ipatch_version ipatch_virtual_container_get_type ipatch_virtual_dls2_melodic_get_type ipatch_virtual_dls2_percussion_get_type ipatch_virtual_dls2_samples_get_type ipatch_virtual_gig_melodic_get_type ipatch_virtual_gig_percussion_get_type ipatch_virtual_gig_samples_get_type ipatch_virtual_sf2_inst_get_type ipatch_virtual_sf2_melodic_get_type ipatch_virtual_sf2_percussion_get_type ipatch_virtual_sf2_rom_get_type ipatch_virtual_sf2_samples_get_type libinstpatch-1.0.0/libinstpatch/IpatchSampleTransform.h0000644000175000017500000001051511461332142020217 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleTransform * @short_description: Audio format conversion instance * @see_also: * @stability: Stable * * A structure for converting between audio formats (for example the bit width * or number of channels). This structure is initialized with the source and * destination audio formats, multi-channel mapping and conversion buffers. */ #ifndef __IPATCH_SAMPLE_TRANSFORM_H__ #define __IPATCH_SAMPLE_TRANSFORM_H__ #include #include typedef struct _IpatchSampleTransform IpatchSampleTransform; /** * IpatchSampleTransformFunc: * @transform: Sample transform object * * Audio conversion handler prototype. Handler will modify * samples of @transform if number of samples * changes (a change in the number of channels occurs). */ typedef void (*IpatchSampleTransformFunc)(IpatchSampleTransform *transform); #include /* sample transform object */ struct _IpatchSampleTransform { guint16 src_format; /* source sample format */ guint16 dest_format; /* destination sample format */ guint8 channel_map[8]; /* channel mapping for multi-channel audio */ guint8 buf1_max_frame; /* max bytes per frame for buf1 */ guint8 buf2_max_frame; /* max bytes per frame for buf2 */ guint8 func_count; /* number of functions in funcs array */ guint8 free_buffers; /* set to TRUE if buffers need to be freed */ guint max_frames; /* max frames that can be converted in batch */ guint frames; /* number of frames to transform */ guint samples; /* # of samples for current transform func (not frames!)*/ gpointer buf1; /* buffer 1 (first input) */ gpointer buf2; /* buffer 2 */ guint combined_size; /* size in bytes of both buffers (if combined) */ gpointer reserved1; /* Reserved field */ gpointer reserved2; /* Reserved field */ /* array of transform funcs */ IpatchSampleTransformFunc funcs[IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS]; }; IpatchSampleTransform *ipatch_sample_transform_new (int src_format, int dest_format, guint32 channel_map); void ipatch_sample_transform_free (IpatchSampleTransform *transform); void ipatch_sample_transform_init (IpatchSampleTransform *transform); IpatchSampleTransform *ipatch_sample_transform_pool_acquire (int src_format, int dest_format, guint32 channel_map); void ipatch_sample_transform_pool_release (IpatchSampleTransform *transform); void ipatch_sample_transform_set_formats (IpatchSampleTransform *transform, int src_format, int dest_format, guint32 channel_map); void ipatch_sample_transform_alloc (IpatchSampleTransform *transform, guint frames); int ipatch_sample_transform_alloc_size (IpatchSampleTransform *transform, guint size); void ipatch_sample_transform_free_buffers (IpatchSampleTransform *transform); guint ipatch_sample_transform_set_buffers_size (IpatchSampleTransform *transform, gpointer buf, guint size); void ipatch_sample_transform_get_buffers (IpatchSampleTransform *transform, gpointer *buf1, gpointer *buf2); void ipatch_sample_transform_get_frame_sizes (IpatchSampleTransform *transform, guint *buf1_size, guint *buf2_size); guint ipatch_sample_transform_get_max_frames (IpatchSampleTransform *transform); gpointer ipatch_sample_transform_convert (IpatchSampleTransform *transform, gconstpointer src, gpointer dest, guint frames); gpointer ipatch_sample_transform_convert_single (IpatchSampleTransform *transform, guint frames); #endif libinstpatch-1.0.0/libinstpatch/IpatchDLS2Inst.c0000644000175000017500000004167311461332142016450 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchDLS2Inst.h" #include "IpatchDLS2Conn.h" #include "IpatchDLS2Region.h" #include "IpatchDLSFile.h" #include "IpatchParamProp.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" enum { PROP_0, PROP_TITLE, PROP_BANK, PROP_PROGRAM, PROP_PERCUSSION }; static void ipatch_dls2_inst_class_init (IpatchDLS2InstClass *klass); static void ipatch_dls2_inst_finalize (GObject *gobject); static void get_title (IpatchDLS2Inst *inst, GValue *value); static void ipatch_dls2_inst_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_dls2_inst_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_dls2_inst_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static const GType *ipatch_dls2_inst_container_child_types (void); static gboolean ipatch_dls2_inst_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type); static gpointer parent_class = NULL; static GType inst_child_types[2] = { 0 }; GType ipatch_dls2_inst_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchDLS2InstClass), NULL, NULL, (GClassInitFunc)ipatch_dls2_inst_class_init, NULL, NULL, sizeof (IpatchDLS2Inst), 0, (GInstanceInitFunc) NULL, }; item_type = g_type_register_static (IPATCH_TYPE_CONTAINER, "IpatchDLS2Inst", &item_info, 0); } return (item_type); } static void ipatch_dls2_inst_class_init (IpatchDLS2InstClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS (klass); GParamSpec *pspec; parent_class = g_type_class_peek_parent (klass); obj_class->finalize = ipatch_dls2_inst_finalize; obj_class->get_property = ipatch_dls2_inst_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_dls2_inst_set_property; item_class->copy = ipatch_dls2_inst_item_copy; container_class->child_types = ipatch_dls2_inst_container_child_types; container_class->init_iter = ipatch_dls2_inst_container_init_iter; g_object_class_override_property (obj_class, PROP_TITLE, "title"); /* bank and program numbers are flagged as UNIQUE properties and are grouped together (i.e., siblings with same bank/preset are considered conflicting) */ pspec = g_param_spec_int ("bank", _("Bank"), _("MIDI bank number"), 0, IPATCH_DLS2_INST_BANK_MAX, 0, G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE); ipatch_param_set (pspec, "unique-group-id", 1, NULL); g_object_class_install_property (obj_class, PROP_BANK, pspec); pspec = g_param_spec_int ("program", _("Program"), _("MIDI program number"), 0, 127, 0, G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE); ipatch_param_set (pspec, "unique-group-id", 1, NULL); g_object_class_install_property (obj_class, PROP_PROGRAM, pspec); g_object_class_install_property (obj_class, PROP_PERCUSSION, g_param_spec_boolean ("percussion", _("Percussion"), _("Percussion instrument?"), FALSE, G_PARAM_READWRITE)); ipatch_dls2_info_install_class_properties (obj_class); inst_child_types[0] = IPATCH_TYPE_DLS2_REGION; } static void ipatch_dls2_inst_finalize (GObject *gobject) { IpatchDLS2Inst *inst = IPATCH_DLS2_INST (gobject); GSList *p; IPATCH_ITEM_WLOCK (inst); ipatch_dls2_info_free (inst->info); inst->info = NULL; p = inst->conns; while (p) { ipatch_dls2_conn_free ((IpatchDLS2Conn *)(p->data)); p = g_slist_delete_link (p, p); } inst->conns = NULL; g_free (inst->dlid); inst->dlid = NULL; IPATCH_ITEM_WUNLOCK (inst); if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (gobject); } static void get_title (IpatchDLS2Inst *inst, GValue *value) { char *name; char *s; g_object_get (inst, "name", &name, NULL); if (name) { s = g_strdup_printf ("%05d-%03d %s", inst->bank, inst->program, name); g_free (name); } else s = g_strdup_printf ("%05d-%03d %s", inst->bank, inst->program, IPATCH_UNTITLED); g_value_take_string (value, s); } static void ipatch_dls2_inst_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchDLS2Inst *inst = IPATCH_DLS2_INST (object); gboolean retval; switch (property_id) { case PROP_BANK: IPATCH_ITEM_WLOCK (inst); /* locked to ensure bank/program atomicity */ inst->bank = g_value_get_int (value); IPATCH_ITEM_WUNLOCK (inst); break; case PROP_PROGRAM: IPATCH_ITEM_WLOCK (inst); /* locked to ensure bank/program atomicity */ inst->program = g_value_get_int (value); IPATCH_ITEM_WUNLOCK (inst); break; case PROP_PERCUSSION: if (g_value_get_boolean (value)) ipatch_item_set_flags ((IpatchItem *)inst, IPATCH_DLS2_INST_PERCUSSION); else ipatch_item_clear_flags ((IpatchItem *)inst, IPATCH_DLS2_INST_PERCUSSION); break; default: IPATCH_ITEM_WLOCK (inst); retval = ipatch_dls2_info_set_property (&inst->info, property_id, value); IPATCH_ITEM_WUNLOCK (inst); if (!retval) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } break; } /* does title property need to be notified? */ if (property_id == PROP_BANK || property_id == PROP_PROGRAM || property_id == IPATCH_DLS2_NAME) { GValue newval = { 0 }; g_value_init (&newval, G_TYPE_STRING); get_title (inst, &newval); ipatch_item_prop_notify ((IpatchItem *)inst, ipatch_item_pspec_title, &newval, NULL); g_value_unset (&newval); } } static void ipatch_dls2_inst_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchDLS2Inst *inst = IPATCH_DLS2_INST (object); gboolean retval; switch (property_id) { case PROP_TITLE: get_title (inst, value); break; case PROP_BANK: g_value_set_int (value, inst->bank); break; case PROP_PROGRAM: g_value_set_int (value, inst->program); break; case PROP_PERCUSSION: g_value_set_boolean (value, (ipatch_item_get_flags ((IpatchItem *)inst) & IPATCH_DLS2_INST_PERCUSSION) != 0); break; default: IPATCH_ITEM_RLOCK (inst); retval = ipatch_dls2_info_get_property (inst->info, property_id, value); IPATCH_ITEM_RUNLOCK (inst); if (!retval) G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_dls2_inst_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchDLS2Inst *src_inst, *dest_inst; IpatchItem *ritem; GSList *p; src_inst = IPATCH_DLS2_INST (src); dest_inst = IPATCH_DLS2_INST (dest); IPATCH_ITEM_RLOCK (src_inst); /* set the percussion flag if set in src */ if (ipatch_item_get_flags (src_inst) & IPATCH_DLS2_INST_PERCUSSION) ipatch_item_set_flags (dest_inst, IPATCH_DLS2_INST_PERCUSSION); dest_inst->bank = src_inst->bank; dest_inst->program = src_inst->program; dest_inst->info = ipatch_dls2_info_duplicate (src_inst->info); if (src_inst->dlid) dest_inst->dlid = g_memdup (src_inst->dlid, IPATCH_DLS_DLID_SIZE); p = src_inst->regions; while (p) /* duplicate regions */ { /* ++ ref new duplicate item */ ritem = ipatch_item_duplicate_link_func (IPATCH_ITEM (p->data), link_func, user_data); g_return_if_fail (ritem != NULL); /* !! take over duplicate item reference */ dest_inst->regions = g_slist_prepend (dest_inst->regions, ritem); ipatch_item_set_parent (ritem, IPATCH_ITEM (dest_inst)); p = g_slist_next (p); } dest_inst->conns = ipatch_dls2_conn_list_duplicate (src_inst->conns); IPATCH_ITEM_RUNLOCK (src_inst); dest_inst->regions = g_slist_reverse (dest_inst->regions); } static const GType * ipatch_dls2_inst_container_child_types (void) { return (inst_child_types); } /* container is locked by caller */ static gboolean ipatch_dls2_inst_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type) { IpatchDLS2Inst *inst = IPATCH_DLS2_INST (container); if (!g_type_is_a (type, IPATCH_TYPE_DLS2_REGION)) { g_critical ("Invalid child type '%s' for parent of type '%s'", g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); return (FALSE); } ipatch_iter_GSList_init (iter, &inst->regions); return (TRUE); } /** * ipatch_dls2_inst_new: * * Create a new DLS instrument object. * * Returns: New DLS instrument with a reference count of 1. Caller * owns the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchDLS2Inst * ipatch_dls2_inst_new (void) { return (IPATCH_DLS2_INST (g_object_new (IPATCH_TYPE_DLS2_INST, NULL))); } /** * ipatch_dls2_inst_first: * @iter: Patch item iterator containing #IpatchDLS2Inst items * * Gets the first item in an instrument iterator. A convenience wrapper for * ipatch_iter_first(). * * Returns: The first instrument in @iter or %NULL if empty. */ IpatchDLS2Inst * ipatch_dls2_inst_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_DLS2_INST (obj)); else return (NULL); } /** * ipatch_dls2_inst_next: * @iter: Patch item iterator containing #IpatchDLS2Inst items * * Gets the next item in an instrument iterator. A convenience wrapper for * ipatch_iter_next(). * * Returns: The next instrument in @iter or %NULL if at the end of the list. */ IpatchDLS2Inst * ipatch_dls2_inst_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_DLS2_INST (obj)); else return (NULL); } /** * ipatch_dls2_inst_get_info: * @inst: DLS instrument to get info from * @fourcc: FOURCC integer id of INFO to get * * Get a DLS instrument info string by FOURCC integer ID (integer * representation of a 4 character RIFF chunk ID, see * #IpatchRiff). * * Returns: New allocated info string value or %NULL if no info with the * given @fourcc ID. String should be freed when finished with it. */ char * ipatch_dls2_inst_get_info (IpatchDLS2Inst *inst, guint32 fourcc) { char *val; g_return_val_if_fail (IPATCH_IS_DLS2_INST (inst), NULL); IPATCH_ITEM_RLOCK (inst); val = ipatch_dls2_info_get (inst->info, fourcc); IPATCH_ITEM_RUNLOCK (inst); return (val); } /** * ipatch_dls2_inst_set_info: * @inst: DLS instrument to set info of * @fourcc: FOURCC integer ID of INFO to set * @val: Value to set info to or %NULL to unset (clear) info. * * Sets an INFO value in a DLS instrument object. * Emits changed signal. */ void ipatch_dls2_inst_set_info (IpatchDLS2Inst *inst, guint32 fourcc, const char *val) { GValue newval = { 0 }, oldval = { 0 }; g_return_if_fail (IPATCH_IS_DLS2_INST (inst)); g_value_init (&newval, G_TYPE_STRING); g_value_set_static_string (&newval, val); g_value_init (&oldval, G_TYPE_STRING); g_value_take_string (&oldval, ipatch_dls2_inst_get_info (inst, fourcc)); IPATCH_ITEM_WLOCK (inst); ipatch_dls2_info_set (&inst->info, fourcc, val); IPATCH_ITEM_WUNLOCK (inst); ipatch_dls2_info_notify ((IpatchItem *)inst, fourcc, &newval, &oldval); /* does title property need to be notified? */ if (fourcc == IPATCH_DLS2_NAME) ipatch_item_prop_notify ((IpatchItem *)inst, ipatch_item_pspec_title, &newval, &oldval); g_value_unset (&oldval); g_value_unset (&newval); } /** * ipatch_dls2_inst_set_midi_locale: * @inst: DLS instrument to set MIDI locale of * @bank: MIDI bank number to assign to instrument * @program: MIDI program number to assign to instrument * * Sets the MIDI locale of a DLS instrument (bank and program numbers). */ void ipatch_dls2_inst_set_midi_locale (IpatchDLS2Inst *inst, int bank, int program) { g_object_set (inst, "bank", bank, "program", program, NULL); } /** * ipatch_dls2_inst_get_midi_locale: * @inst: Instrument to get MIDI locale from * @bank: Location to store instrument's MIDI bank number or %NULL * @program: Location to store instrument's MIDI program number or %NULL * * Gets the MIDI locale of a DLS instrument (bank and program numbers). */ void ipatch_dls2_inst_get_midi_locale (IpatchDLS2Inst *inst, int *bank, int *program) { g_return_if_fail (IPATCH_IS_DLS2_INST (inst)); IPATCH_ITEM_RLOCK (inst); if (bank) *bank = inst->bank; if (program) *program = inst->program; IPATCH_ITEM_RUNLOCK (inst); } /** * ipatch_dls2_inst_compare: * @p1: First instrument in comparison * @p2: Second instrument in comparison * * Instrument comparison function for sorting. Compare two instruments by their * MIDI bank:program numbers. Note that this function is compatible with * GCompareFunc and can therefore be used with g_list_sort, etc. * * FIXME: Also note that percussion instruments are sorted after regular ones. * * Returns: Comparison result that is less than, equal to, or greater than zero * if @p1 is found, respectively, to be less than, to match, or be greater * than @p2. */ int ipatch_dls2_inst_compare (const IpatchDLS2Inst *p1, const IpatchDLS2Inst *p2) { gint32 aval, bval; guint32 aperc, bperc; aperc = (ipatch_item_get_flags ((IpatchItem *)p1) & IPATCH_DLS2_INST_PERCUSSION) ? 1 << 31 : 0; bperc = (ipatch_item_get_flags ((IpatchItem *)p2) & IPATCH_DLS2_INST_PERCUSSION) ? 1 << 31 : 0; aval = aperc | ((gint32)(p1->bank) << 16) | p1->program; bval = bperc | ((gint32)(p2->bank) << 16) | p2->program; return (aval - bval); } /** * ipatch_dls2_inst_get_conns: * @inst: Instrument to get connections from * * Gets a list of connections from a DLS instrument. List should be freed with * ipatch_dls2_conn_list_free() (free_conns set to %TRUE) when finished * with it. * * Returns: New list of connections (#IpatchDLS2Conn) in @inst or * %NULL if no connections. Remember to free it when finished. */ GSList * ipatch_dls2_inst_get_conns (IpatchDLS2Inst *inst) { GSList *newlist; g_return_val_if_fail (IPATCH_IS_DLS2_INST (inst), NULL); IPATCH_ITEM_RLOCK (inst); newlist = ipatch_dls2_conn_list_duplicate (inst->conns); IPATCH_ITEM_RUNLOCK (inst); return (newlist); } /** * ipatch_dls2_inst_set_conn: * @inst: DLS instrument * @conn: Connection * * Set a global DLS connection in an instrument. See * ipatch_dls2_conn_list_set() for more details. */ void ipatch_dls2_inst_set_conn (IpatchDLS2Inst *inst, const IpatchDLS2Conn *conn) { g_return_if_fail (IPATCH_IS_DLS2_INST (inst)); g_return_if_fail (conn != NULL); IPATCH_ITEM_WLOCK (inst); ipatch_dls2_conn_list_set (&inst->conns, conn); IPATCH_ITEM_WUNLOCK (inst); } /** * ipatch_dls2_inst_unset_conn: * @inst: DLS instrument * @conn: Connection * * Remove a global DLS connection from an instrument. See * ipatch_dls2_conn_list_unset() for more details. */ void ipatch_dls2_inst_unset_conn (IpatchDLS2Inst *inst, const IpatchDLS2Conn *conn) { g_return_if_fail (IPATCH_IS_DLS2_INST (inst)); g_return_if_fail (conn != NULL); IPATCH_ITEM_WLOCK (inst); ipatch_dls2_conn_list_unset (&inst->conns, conn); IPATCH_ITEM_WUNLOCK (inst); } /** * ipatch_dls2_inst_unset_all_conns: * @inst: DLS instrument * * Remove all global connections in an instrument. */ void ipatch_dls2_inst_unset_all_conns (IpatchDLS2Inst *inst) { g_return_if_fail (IPATCH_IS_DLS2_INST (inst)); IPATCH_ITEM_WLOCK (inst); ipatch_dls2_conn_list_free (inst->conns, TRUE); inst->conns = NULL; IPATCH_ITEM_WUNLOCK (inst); } /** * ipatch_dls2_inst_conn_count: * @inst: Instrument to count connections in * * Count number of connections in a instrument * * Returns: Count of connections */ guint ipatch_dls2_inst_conn_count (IpatchDLS2Inst *inst) { guint i; IPATCH_ITEM_RLOCK (inst); i = g_slist_length (inst->conns); IPATCH_ITEM_RUNLOCK (inst); return (i); } libinstpatch-1.0.0/libinstpatch/IpatchDLS2.c0000644000175000017500000006064111461332142015606 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchDLS2.h" #include "IpatchDLSFile.h" #include "IpatchDLS2Info.h" #include "IpatchDLS2Region.h" #include "IpatchTypeProp.h" #include "IpatchVirtualContainer_types.h" #include "version.h" #include "ipatch_priv.h" /* non-INFO properties (INFO properties use their FOURCC int values) */ enum { PROP_0, PROP_VERSION }; static void ipatch_dls2_class_init (IpatchDLS2Class *klass); static void ipatch_dls2_init (IpatchDLS2 *dls); static void ipatch_dls2_finalize (GObject *gobject); static void ipatch_dls2_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_dls2_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_dls2_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static const GType *ipatch_dls2_container_child_types (void); static const GType *ipatch_dls2_container_virtual_types (void); static gboolean ipatch_dls2_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type); static void ipatch_dls2_container_make_unique (IpatchContainer *container, IpatchItem *item); static void ipatch_dls2_base_find_unused_locale (IpatchBase *base, int *bank, int *program, const IpatchItem *exclude, gboolean percussion); static int locale_gcompare_func (gconstpointer a, gconstpointer b); static IpatchItem * ipatch_dls2_base_find_item_by_locale (IpatchBase *base, int bank, int program); static gpointer parent_class = NULL; static GType dls2_child_types[3] = { 0 }; static GType dls2_virt_types[4] = { 0 }; /* for chaining to original file-name property */ static IpatchItemClass *base_item_class; /* SoundFont item type creation function */ GType ipatch_dls2_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchDLS2Class), NULL, NULL, (GClassInitFunc)ipatch_dls2_class_init, NULL, NULL, sizeof (IpatchDLS2), 0, (GInstanceInitFunc)ipatch_dls2_init, }; item_type = g_type_register_static (IPATCH_TYPE_BASE, "IpatchDLS2", &item_info, 0); } return (item_type); } static void ipatch_dls2_class_init (IpatchDLS2Class *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS (klass); IpatchBaseClass *base_class = IPATCH_BASE_CLASS (klass); /* save original base class for chaining file-name property */ base_item_class = IPATCH_ITEM_CLASS (g_type_class_ref (IPATCH_TYPE_BASE)); parent_class = g_type_class_peek_parent (klass); obj_class->finalize = ipatch_dls2_finalize; obj_class->get_property = ipatch_dls2_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_dls2_set_property; item_class->copy = ipatch_dls2_item_copy; container_class->child_types = ipatch_dls2_container_child_types; container_class->virtual_types = ipatch_dls2_container_virtual_types; container_class->init_iter = ipatch_dls2_container_init_iter; container_class->make_unique = ipatch_dls2_container_make_unique; base_class->find_unused_locale = ipatch_dls2_base_find_unused_locale; base_class->find_item_by_locale = ipatch_dls2_base_find_item_by_locale; /* non INFO properties */ g_object_class_override_property (obj_class, IPATCH_DLS2_NAME, "title"); g_object_class_install_property (obj_class, PROP_VERSION, g_param_spec_string ("version", _("Version"), _("File version \"n.n.n.n\""), NULL, G_PARAM_READWRITE)); ipatch_dls2_info_install_class_properties (obj_class); dls2_child_types[0] = IPATCH_TYPE_DLS2_INST; dls2_child_types[1] = IPATCH_TYPE_DLS2_SAMPLE; dls2_virt_types[0] = IPATCH_TYPE_VIRTUAL_DLS2_MELODIC; dls2_virt_types[1] = IPATCH_TYPE_VIRTUAL_DLS2_PERCUSSION; dls2_virt_types[2] = IPATCH_TYPE_VIRTUAL_DLS2_SAMPLES; } static void ipatch_dls2_init (IpatchDLS2 *dls) { g_object_set (dls, "name", _(IPATCH_BASE_DEFAULT_NAME), "software", "libInstPatch v" IPATCH_VERSION, NULL); ipatch_item_clear_flags (IPATCH_ITEM (dls), IPATCH_BASE_CHANGED); } /* function called when SoundFont is being destroyed */ static void ipatch_dls2_finalize (GObject *gobject) { IpatchDLS2 *dls = IPATCH_DLS2 (gobject); IPATCH_ITEM_WLOCK (dls); ipatch_dls2_info_free (dls->info); dls->info = NULL; g_free (dls->dlid); dls->dlid = NULL; IPATCH_ITEM_WUNLOCK (dls); if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (gobject); } static void ipatch_dls2_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchDLS2 *dls = IPATCH_DLS2 (object); gboolean retval; if (property_id == PROP_VERSION) { const char *verstr; guint16 msu, msl, lsu, lsl; verstr = g_value_get_string (value); if (verstr && sscanf (verstr, "%hu.%hu.%hu.%hu", &msu, &msl, &lsu, &lsl) != 4) { g_warning ("Version property parse error"); return; } IPATCH_ITEM_WLOCK (dls); if (verstr) { ipatch_item_set_flags (dls, IPATCH_DLS2_VERSION_SET); dls->ms_version = (guint32)msu << 16 || msl; dls->ls_version = (guint32)lsu << 16 || lsl; } else ipatch_item_clear_flags (dls, IPATCH_DLS2_VERSION_SET); IPATCH_ITEM_WUNLOCK (dls); } else { IPATCH_ITEM_WLOCK (dls); retval = ipatch_dls2_info_set_property (&dls->info, property_id, value); IPATCH_ITEM_WUNLOCK (dls); /* check of "title" property needs to be notified, values do not need to be sent, since its a read only property */ if (property_id == IPATCH_DLS2_NAME) ipatch_item_prop_notify ((IpatchItem *)dls, ipatch_item_pspec_title, value, NULL); if (!retval) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } } static void ipatch_dls2_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchDLS2 *dls; gboolean retval; char *s; g_return_if_fail (IPATCH_IS_DLS2 (object)); dls = IPATCH_DLS2 (object); if (property_id == PROP_VERSION) { gboolean version_set; guint32 ms, ls; IPATCH_ITEM_RLOCK (dls); version_set = (ipatch_item_get_flags (dls) & IPATCH_DLS2_VERSION_SET) > 0; ms = dls->ms_version; ls = dls->ls_version; IPATCH_ITEM_RUNLOCK (dls); if (version_set) { s = g_strdup_printf ("%u.%u.%u.%u", ms >> 16, ms & 0xFFFF, ls >> 16, ls & 0xFFFF); g_value_take_string (value, s); } else g_value_set_string (value, NULL); } else /* INFO property or invalid */ { IPATCH_ITEM_RLOCK (dls); retval = ipatch_dls2_info_get_property (dls->info, property_id, value); IPATCH_ITEM_RUNLOCK (dls); if (!retval) G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_dls2_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchDLS2 *src_dls, *dest_dls; IpatchItem *newitem; GHashTable *repl_samples; GSList *p; src_dls = IPATCH_DLS2 (src); dest_dls = IPATCH_DLS2 (dest); /* create item replacement hash */ repl_samples = g_hash_table_new (NULL, NULL); IPATCH_ITEM_RLOCK (src_dls); dest_dls->ms_version = src_dls->ms_version; dest_dls->ls_version = src_dls->ls_version; if (ipatch_item_get_flags (src_dls) & IPATCH_DLS2_VERSION_SET) ipatch_item_set_flags (dest_dls, IPATCH_DLS2_VERSION_SET); if (IPATCH_BASE (src_dls)->file) ipatch_base_set_file (IPATCH_BASE (dest_dls), IPATCH_BASE (src_dls)->file); dest_dls->info = ipatch_dls2_info_duplicate (src_dls->info); if (src_dls->dlid) dest_dls->dlid = g_memdup (src_dls->dlid, IPATCH_DLS_DLID_SIZE); p = src_dls->samples; while (p) /* duplicate samples */ { newitem = ipatch_item_duplicate ((IpatchItem *)(p->data)); g_return_if_fail (newitem != NULL); dest_dls->samples = g_slist_prepend (dest_dls->samples, newitem); ipatch_item_set_parent (newitem, IPATCH_ITEM (src_dls)); /* add to sample pointer replacement hash */ g_hash_table_insert (repl_samples, p->data, newitem); /* FIXME - phase linked groups? */ p = g_slist_next (p); } p = src_dls->insts; while (p) /* duplicate instruments */ { newitem = ipatch_item_duplicate_replace ((IpatchItem *)(p->data), repl_samples); g_return_if_fail (newitem != NULL); dest_dls->insts = g_slist_prepend (dest_dls->insts, newitem); ipatch_item_set_parent (newitem, IPATCH_ITEM (src_dls)); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (src_dls); dest_dls->insts = g_slist_reverse (dest_dls->insts); dest_dls->samples = g_slist_reverse (dest_dls->samples); g_hash_table_destroy (repl_samples); } static const GType * ipatch_dls2_container_child_types (void) { return (dls2_child_types); } static const GType * ipatch_dls2_container_virtual_types (void) { return (dls2_virt_types); } /* container is locked by caller */ static gboolean ipatch_dls2_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type) { IpatchDLS2 *dls = IPATCH_DLS2 (container); if (g_type_is_a (type, IPATCH_TYPE_DLS2_INST)) ipatch_iter_GSList_init (iter, &dls->insts); else if (g_type_is_a (type, IPATCH_TYPE_DLS2_SAMPLE)) ipatch_iter_GSList_init (iter, &dls->samples); else { g_critical ("Invalid child type '%s' for parent of type '%s'", g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); return (FALSE); } return (TRUE); } static void ipatch_dls2_container_make_unique (IpatchContainer *container, IpatchItem *item) { IpatchDLS2 *dls = IPATCH_DLS2 (container); gboolean perc; char *name, *newname; IPATCH_ITEM_WLOCK (dls); if (IPATCH_IS_DLS2_INST (item)) { int bank, newbank, program, newprogram; ipatch_dls2_inst_get_midi_locale (IPATCH_DLS2_INST (item), &bank, &program); newbank = bank; newprogram = program; perc = (ipatch_item_get_flags (item) & IPATCH_DLS2_INST_PERCUSSION) != 0; ipatch_base_find_unused_midi_locale (IPATCH_BASE (dls), &newbank, &newprogram, item, perc); if (bank != newbank || program != newprogram) ipatch_dls2_inst_set_midi_locale (IPATCH_DLS2_INST (item), newbank, newprogram); } else if (!IPATCH_IS_DLS2_SAMPLE (item)) { g_critical ("Invalid child type '%s' for IpatchDLS2 object", g_type_name (G_TYPE_FROM_INSTANCE (item))); return; } g_object_get (item, "name", &name, NULL); newname = ipatch_dls2_make_unique_name (dls, G_TYPE_FROM_INSTANCE (item), name, NULL); if (!name || strcmp (name, newname) != 0) g_object_set (item, "name", newname, NULL); IPATCH_ITEM_WUNLOCK (dls); g_free (name); g_free (newname); } /* base method to find an unused MIDI bank:program locale */ static void ipatch_dls2_base_find_unused_locale (IpatchBase *base, int *bank, int *program, const IpatchItem *exclude, gboolean percussion) { IpatchDLS2 *dls = IPATCH_DLS2 (base); GSList *locale_list = NULL; IpatchDLS2Inst *inst; GSList *p; int b, n; /* Stores current bank and preset number */ guint32 lbank, lprogram; /* fill array with bank and preset numbers */ IPATCH_ITEM_RLOCK (dls); p = dls->insts; while (p) { inst = (IpatchDLS2Inst *)(p->data); /* only add to locale list if not the exclude item */ if ((gpointer)inst != (gpointer)exclude) locale_list = g_slist_prepend (locale_list, GUINT_TO_POINTER ((inst->bank << 16) | inst->program)); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (dls); if (!locale_list) { *program = 0; return; } locale_list = g_slist_sort (locale_list, (GCompareFunc)locale_gcompare_func); b = *bank; n = *program; /* loop through sorted list of bank:programs */ p = locale_list; while (p) { lprogram = GPOINTER_TO_UINT (p->data); lbank = lprogram >> 16; lprogram &= 0xFFFF; if (lbank > b || (lbank == b && lprogram > n)) break; if (lbank >= b) { if (++n > 127) { n = 0; b++; } } p = g_slist_delete_link (p, p); /* delete and advance */ } *bank = b; *program = n; if (p) g_slist_free (p); /* free remainder of list */ } /* function used to do a temporary sort on preset list for ipatch_dls2_base_find_unused_locale */ static int locale_gcompare_func (gconstpointer a, gconstpointer b) { return (GPOINTER_TO_UINT (a) - GPOINTER_TO_UINT (b)); } static IpatchItem * ipatch_dls2_base_find_item_by_locale (IpatchBase *base, int bank, int program) { IpatchDLS2Inst *inst; inst = ipatch_dls2_find_inst (IPATCH_DLS2 (base), NULL, bank, program, NULL); return ((IpatchItem *)inst); } /** * ipatch_dls2_new: * * Create a new DLS base object. * * Returns: New DLS base object with a reference count of 1. Caller * owns the reference and removing it will destroy the item. */ IpatchDLS2 * ipatch_dls2_new (void) { return (IPATCH_DLS2 (g_object_new (IPATCH_TYPE_DLS2, NULL))); } /** * ipatch_dls2_set_file: * @dls: DLS to set file object of * @file: File object to use with the DLS object * * Sets the file object of a DLS object. DLS files are kept open * for sample data that references the file. This function sets a * DLS object's authoritive file. A convenience function, as * ipatch_base_set_file() does the same thing (albeit without more specific * type casting). */ void ipatch_dls2_set_file (IpatchDLS2 *dls, IpatchDLSFile *file) { g_return_if_fail (IPATCH_IS_DLS2 (dls)); g_return_if_fail (IPATCH_IS_DLS_FILE (file)); ipatch_base_set_file (IPATCH_BASE (dls), IPATCH_FILE (file)); } /** * ipatch_dls2_get_file: * @dls: DLS object to get file object of * * Gets the file object of a DLS. The returned DLS file object's * reference count has been incremented. The caller owns the reference and is * responsible for removing it with g_object_unref. * A convenience function as ipatch_base_get_file() does the same thing * (albeit without more specific type casting). * * Returns: The DLS file object or %NULL if @dls is not open. Remember * to unref the file object with g_object_unref() when done with it. */ IpatchDLSFile * ipatch_dls2_get_file (IpatchDLS2 *dls) { IpatchFile *file; g_return_val_if_fail (IPATCH_IS_DLS2 (dls), NULL); file = ipatch_base_get_file (IPATCH_BASE (dls)); if (file) return (IPATCH_DLS_FILE (file)); else return (NULL); } /** * ipatch_dls2_get_info: * @dls: DLS to get info from * @fourcc: FOURCC integer id of INFO to get * * Get a DLS info string by FOURCC integer ID (integer representation of * a 4 character RIFF chunk ID, see #IpatchRiff). * * Returns: New allocated info string value or %NULL if no info with the * given @fourcc ID. String should be freed when finished with it. */ char * ipatch_dls2_get_info (IpatchDLS2 *dls, guint32 fourcc) { char *val; g_return_val_if_fail (IPATCH_IS_DLS2 (dls), NULL); IPATCH_ITEM_RLOCK (dls); val = ipatch_dls2_info_get (dls->info, fourcc); IPATCH_ITEM_RUNLOCK (dls); return (val); } /** * ipatch_dls2_set_info: * @dls: DLS to set info of * @fourcc: FOURCC integer ID of INFO to set * @val: Value to set info to or %NULL to unset (clear) info. * * Sets an INFO value in a DLS object. * * Emits changed signal on DLS object. */ void ipatch_dls2_set_info (IpatchDLS2 *dls, guint32 fourcc, const char *val) { GValue newval = { 0 }, oldval = { 0 }; g_return_if_fail (IPATCH_IS_DLS2 (dls)); g_value_init (&newval, G_TYPE_STRING); g_value_set_static_string (&newval, val); g_value_init (&oldval, G_TYPE_STRING); g_value_take_string (&oldval, ipatch_dls2_get_info (dls, fourcc)); IPATCH_ITEM_WLOCK (dls); ipatch_dls2_info_set (&dls->info, fourcc, val); IPATCH_ITEM_WUNLOCK (dls); ipatch_dls2_info_notify ((IpatchItem *)dls, fourcc, &newval, &oldval); /* need to do title notify? */ if (fourcc == IPATCH_DLS2_NAME) ipatch_item_prop_notify ((IpatchItem *)dls, ipatch_item_pspec_title, &newval, &oldval); g_value_unset (&oldval); g_value_unset (&newval); } /** * ipatch_dls2_make_unique_name: * @dls: DLS object * @child_type: A child type of @dls to search for a unique name in * @name: An initial name to use or NULL * @exclude: An item to exclude from search or NULL * * Generates a unique name for the given @child_type in @dls. The @name * parameter is used as a base and is modified, by appending a number, to * make it unique (if necessary). The @exclude parameter is used to exclude * an existing @dls child item from the search. * * MT-Note: To ensure that an item is actually unique before being * added to a DLS object, ipatch_container_add_unique() should be * used. * * Returns: A new unique name which should be freed when finished with it. */ char * ipatch_dls2_make_unique_name (IpatchDLS2 *dls, GType child_type, const char *name, const IpatchItem *exclude) { GSList **list, *p; char *curname, *numptr; const char *temp; guint count = 2, info_ofs, len; g_return_val_if_fail (IPATCH_IS_DLS2 (dls), NULL); if (g_type_is_a (child_type, IPATCH_TYPE_DLS2_INST)) { list = &dls->insts; info_ofs = G_STRUCT_OFFSET (IpatchDLS2Inst, info); if (!name || !*name) name = _("New Instrument"); } else if (g_type_is_a (child_type, IPATCH_TYPE_DLS2_SAMPLE)) { list = &dls->samples; info_ofs = G_STRUCT_OFFSET (IpatchDLS2Sample, info); if (!name || !*name) name = _("New Sample"); } else { g_critical ("Invalid child type '%s' of parent type '%s'", g_type_name (child_type), g_type_name (G_OBJECT_TYPE (dls))); return (NULL); } len = strlen (name); /* allocate string size + 10 chars for number + zero termination */ curname = g_malloc0 (len + 10 + 1); strcpy (curname, name); /* copy name */ numptr = curname + len; /* pointer to end of name to concat number */ IPATCH_ITEM_RLOCK (dls); p = *list; while (p) /* check for duplicate */ { IPATCH_ITEM_RLOCK (p->data); /* MT - Recursive LOCK */ if (p->data != exclude) { temp = ipatch_dls2_info_peek (G_STRUCT_MEMBER (IpatchDLS2Info *, p->data, info_ofs), IPATCH_DLS2_NAME); if (temp && strcmp (temp, curname) == 0) { /* duplicate name */ IPATCH_ITEM_RUNLOCK (p->data); sprintf (numptr, "%u", count++); p = *list; /* start over */ continue; } } IPATCH_ITEM_RUNLOCK (p->data); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (dls); curname = g_realloc (curname, strlen (curname) + 1); return (curname); } /** * ipatch_dls2_find_inst: * @dls: DLS object to search in * @name: Name of instrument to find or %NULL to match any name * @bank: MIDI bank number of instrument to search for or -1 to not search by * MIDI bank:program numbers * @program: MIDI program number of instrument to search for, only used * if @bank is 0-128 * @exclude: A instrument to exclude from the search or %NULL * * Find a instrument by name or bank:program MIDI numbers. If instrument @name * and @bank:@program are specified then match for either condition. * If a instrument is found its reference count is incremented before it * is returned. The caller is responsible for removing the reference * with g_object_unref() when finished with it. * * Returns: The matching instrument or %NULL if not found. Remember to unref * the item when finished with it. */ IpatchDLS2Inst * ipatch_dls2_find_inst (IpatchDLS2 *dls, const char *name, int bank, int program, const IpatchDLS2Inst *exclude) { IpatchDLS2Inst *inst; gboolean bynum = FALSE; const char *temp = NULL; GSList *p; g_return_val_if_fail (IPATCH_IS_DLS2 (dls), NULL); /* if bank and program are valid, then search by number */ if (bank >= 0 && program >= 0 && program < 128) bynum = TRUE; IPATCH_ITEM_RLOCK (dls); p = dls->insts; while (p) { inst = (IpatchDLS2Inst *)(p->data); IPATCH_ITEM_RLOCK (inst); /* MT - Recursive LOCK */ if (inst != exclude && ((bynum && inst->bank == bank && inst->program == program) || (name && (temp = ipatch_dls2_info_peek (inst->info, IPATCH_DLS2_NAME)) && strcmp (temp, name) == 0))) { g_object_ref (inst); IPATCH_ITEM_RUNLOCK (inst); IPATCH_ITEM_RUNLOCK (dls); return (inst); } IPATCH_ITEM_RUNLOCK (inst); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (dls); return (NULL); } /** * ipatch_dls2_find_sample: * @dls: SoundFont to search in * @name: Name of sample to find * @exclude: A sample to exclude from the search or %NULL * * Find a sample by @name in a SoundFont. If a sample is found its * reference count is incremented before it is returned. The caller * is responsible for removing the reference with g_object_unref() * when finished with it. * * Returns: The matching sample or %NULL if not found. Remember to unref * the item when finished with it. */ IpatchDLS2Sample * ipatch_dls2_find_sample (IpatchDLS2 *dls, const char *name, const IpatchDLS2Sample *exclude) { IpatchDLS2Sample *sample; const char *temp = NULL; GSList *p; g_return_val_if_fail (IPATCH_IS_DLS2 (dls), NULL); g_return_val_if_fail (name != NULL, NULL); IPATCH_ITEM_RLOCK (dls); p = dls->samples; while (p) { sample = (IpatchDLS2Sample *)(p->data); IPATCH_ITEM_RLOCK (sample); /* MT - Recursive LOCK */ if (sample != exclude && (temp = ipatch_dls2_info_peek (sample->info, IPATCH_DLS2_NAME)) && strcmp (temp, name) == 0) { g_object_ref (sample); IPATCH_ITEM_RUNLOCK (sample); IPATCH_ITEM_RUNLOCK (dls); return (sample); } IPATCH_ITEM_RUNLOCK (sample); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (dls); return (NULL); } /** * ipatch_dls2_get_region_references: * @sample: Sample to locate referencing regions of. * * Get list of regions referencing an #IpatchDLS2Sample. * * Returns: New item list containing #IpatchDLS2Region objects * that refer to @sample. The returned list has a reference count of 1 which * the caller owns, unreference it when done. */ IpatchList * ipatch_dls2_get_region_references (IpatchDLS2Sample *sample) { IpatchDLS2 *dls; IpatchDLS2Region *region; IpatchList *refitems; IpatchIter iter, region_iter; IpatchDLS2Inst *inst; IpatchItem *pitem; gboolean success; g_return_val_if_fail (IPATCH_IS_DLS2_SAMPLE (sample), NULL); pitem = ipatch_item_get_parent (IPATCH_ITEM (sample)); g_return_val_if_fail (IPATCH_IS_DLS2 (pitem), NULL); dls = IPATCH_DLS2 (pitem); refitems = ipatch_list_new (); IPATCH_ITEM_RLOCK (dls); success = ipatch_container_init_iter ((IpatchContainer *)dls, &iter, IPATCH_TYPE_DLS2_INST); g_return_val_if_fail (success != FALSE, NULL); inst = ipatch_dls2_inst_first (&iter); while (inst) /* loop over instruments */ { IPATCH_ITEM_RLOCK (inst); /* ## embedded lock */ success = ipatch_container_init_iter ((IpatchContainer *)dls, ®ion_iter, IPATCH_TYPE_DLS2_INST); g_return_val_if_fail (success != FALSE, NULL); region = ipatch_dls2_region_first (®ion_iter); while (region) /* loop over regions */ { if (ipatch_dls2_region_peek_sample (region) == sample) { g_object_ref (region); /* ++ ref region for new iterator */ refitems->items = g_list_prepend (refitems->items, region); } region = ipatch_dls2_region_next (®ion_iter); } IPATCH_ITEM_RUNLOCK (inst); inst = ipatch_dls2_inst_next (&iter); } IPATCH_ITEM_RUNLOCK (dls); return (refitems); } libinstpatch-1.0.0/libinstpatch/IpatchSF2IZone.h0000644000175000017500000000541611461332142016445 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2IZone * @short_description: SoundFont instrument zone object * @see_also: #IpatchSF2Inst, #IpatchSF2Sample * @stability: Stable * * Instrument zones are children to #IpatchSF2Inst objects and define how * their referenced #IpatchSF2Sample is synthesized. */ #ifndef __IPATCH_SF2_IZONE_H__ #define __IPATCH_SF2_IZONE_H__ #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchSF2IZone IpatchSF2IZone; typedef struct _IpatchSF2IZoneClass IpatchSF2IZoneClass; #define IPATCH_TYPE_SF2_IZONE (ipatch_sf2_izone_get_type ()) #define IPATCH_SF2_IZONE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_IZONE, \ IpatchSF2IZone)) #define IPATCH_SF2_IZONE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_IZONE, \ IpatchSF2IZoneClass)) #define IPATCH_IS_SF2_IZONE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_IZONE)) #define IPATCH_IS_SF2_IZONE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2_IZONE)) #define IPATCH_SF2_IZONE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SF2_IZONE, \ IpatchSF2IZoneClass)) /* SoundFont izone item */ struct _IpatchSF2IZone { IpatchSF2Zone parent_instance; }; struct _IpatchSF2IZoneClass { IpatchSF2ZoneClass parent_class; }; /* reserve 2 flags */ #define IPATCH_SF2_IZONE_UNUSED_FLAG_SHIFT \ (IPATCH_SF2_ZONE_UNUSED_FLAG_SHIFT + 2) GType ipatch_sf2_izone_get_type (void); IpatchSF2IZone *ipatch_sf2_izone_new (void); IpatchSF2IZone *ipatch_sf2_izone_first (IpatchIter *iter); IpatchSF2IZone *ipatch_sf2_izone_next (IpatchIter *iter); void ipatch_sf2_izone_set_sample (IpatchSF2IZone *izone, IpatchSF2Sample *sample); IpatchSF2Sample *ipatch_sf2_izone_get_sample (IpatchSF2IZone *izone); IpatchSF2IZone *ipatch_sf2_izone_get_stereo_link (IpatchSF2IZone *izone); #endif libinstpatch-1.0.0/libinstpatch/IpatchSampleStore.c0000644000175000017500000001533211461332142017335 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchSampleStore.h" #include "builtin_enums.h" #include "ipatch_priv.h" enum { PROP_0, PROP_SAMPLE_SIZE, /* size of sample (in frames) */ PROP_SAMPLE_FORMAT, /* Sample format (Width | Channels | Signed | Endian) */ PROP_SAMPLE_RATE, /* sample rate hint */ PROP_SAMPLE_DATA, /* sample data pointer (not supported, just returns NULL) */ /* read only dummy properties to conform to IpatchSample interface */ PROP_LOOP_TYPE, PROP_LOOP_START, PROP_LOOP_END, PROP_ROOT_NOTE, PROP_FINE_TUNE }; static void ipatch_sample_store_sample_iface_init (IpatchSampleIface *iface); static void ipatch_sample_store_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sample_store_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); G_DEFINE_ABSTRACT_TYPE_WITH_CODE (IpatchSampleStore, ipatch_sample_store, IPATCH_TYPE_ITEM, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sample_store_sample_iface_init)) static void ipatch_sample_store_sample_iface_init (IpatchSampleIface *iface) { } static void ipatch_sample_store_class_init (IpatchSampleStoreClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->get_property = ipatch_sample_store_get_property; item_class->item_set_property = ipatch_sample_store_set_property; ipatch_sample_install_property (obj_class, PROP_SAMPLE_SIZE, "sample-size"); ipatch_sample_install_property (obj_class, PROP_SAMPLE_FORMAT, "sample-format"); ipatch_sample_install_property (obj_class, PROP_SAMPLE_RATE, "sample-rate"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_DATA, "sample-data"); /* these are read only properties and just return the default value */ ipatch_sample_install_property_readonly (obj_class, PROP_LOOP_TYPE, "loop-type"); ipatch_sample_install_property_readonly (obj_class, PROP_LOOP_START, "loop-start"); ipatch_sample_install_property_readonly (obj_class, PROP_LOOP_END, "loop-end"); ipatch_sample_install_property_readonly (obj_class, PROP_ROOT_NOTE, "root-note"); ipatch_sample_install_property_readonly (obj_class, PROP_FINE_TUNE, "fine-tune"); } static void ipatch_sample_store_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSampleStore *store = IPATCH_SAMPLE_STORE (object); int format; switch (property_id) { case PROP_SAMPLE_SIZE: /* Lock not required, only set once during creation, prior to MT use */ store->size = g_value_get_uint (value); break; case PROP_SAMPLE_FORMAT: format = g_value_get_int (value) << IPATCH_SAMPLE_STORE_FORMAT_SHIFT; /* Lock not required since this should only be done once, prior to MT use */ ipatch_item_clear_flags (store, IPATCH_SAMPLE_FORMAT_MASK << IPATCH_SAMPLE_STORE_FORMAT_SHIFT); ipatch_item_set_flags (store, format); break; case PROP_SAMPLE_RATE: store->rate = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_sample_store_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSampleStore *store = IPATCH_SAMPLE_STORE (object); switch (property_id) { case PROP_SAMPLE_SIZE: /* Lock not required since it should not change, once used in MT context */ g_value_set_uint (value, store->size); break; case PROP_SAMPLE_FORMAT: /* Lock not required since format should never change, once used in MT context */ g_value_set_int (value, ipatch_sample_store_get_format (store)); break; case PROP_SAMPLE_RATE: g_value_set_int (value, store->rate); break; case PROP_SAMPLE_DATA: g_value_set_object (value, NULL); break; case PROP_LOOP_TYPE: g_value_set_enum (value, IPATCH_SAMPLE_LOOP_NONE); break; case PROP_LOOP_START: g_value_set_uint (value, 0); break; case PROP_LOOP_END: g_value_set_uint (value, 0); break; case PROP_ROOT_NOTE: g_value_set_int (value, IPATCH_SAMPLE_ROOT_NOTE_DEFAULT); break; case PROP_FINE_TUNE: g_value_set_int (value, 0); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_sample_store_init (IpatchSampleStore *store) { /* initialize format to default - signed 16 bit mono little endian data */ ipatch_item_set_flags (store, IPATCH_SAMPLE_FORMAT_DEFAULT << IPATCH_SAMPLE_STORE_FORMAT_SHIFT); store->rate = IPATCH_SAMPLE_RATE_DEFAULT; } /** * ipatch_sample_store_first: * @iter: Patch item iterator containing #IpatchSampleStore items * * Gets the first item in a sample store iterator. A convenience wrapper for * ipatch_iter_first(). * * Returns: The first sample store in @iter or %NULL if empty. */ IpatchSampleStore * ipatch_sample_store_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_SAMPLE_STORE (obj)); else return (NULL); } /** * ipatch_sample_store_next: * @iter: Patch item iterator containing #IpatchSampleStore items * * Gets the next item in a sample store iterator. A convenience wrapper for * ipatch_iter_next(). * * Returns: The next sample store in @iter or %NULL if at the end of the list. */ IpatchSampleStore * ipatch_sample_store_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_SAMPLE_STORE (obj)); else return (NULL); } libinstpatch-1.0.0/libinstpatch/IpatchDLS2Param_tables.c0000644000175000017500000002531711461332142020122 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /* * IpatchDLS2Param_tables.c - DLS2 effect parameter tables */ #include #include "IpatchDLS2Region.h" #include "IpatchUnit.h" #include "IpatchUnit_DLS.h" #include "ipatch_priv.h" #include "i18n.h" /* abs pitch constants: int ((1200 * (log2 (hz / 440.0)) + 6900.0) * 65536.0 + 0.5) */ #define ABSP_TENTH_HZ -499642883L /* 0.1 Hz */ #define ABSP_5HZ -55791972L /* 5 Hz */ #define ABSP_20HZ 101494427L /* 20 Hz */ #define ABSP_5535CENTS 362741760L /* 5535 cents */ #define ABSP_11921CENTS 781254656L /* 11921 cents */ /* relative pitch constants: cents * 65536 */ #define RELP_N12800CENTS -838860800L /* -12800 cents */ #define RELP_N1200CENTS -78643200L /* -1200 cents */ #define RELP_0CENTS 0 /* 0 cents */ #define RELP_100CENTS 6553600L /* 100 cents */ #define RELP_1200CENTS 78643200L /* 1200 cents */ #define RELP_6400CENTS 419430400L /* 6400 cents */ #define RELP_12800CENTS 838860800L /* 12800 cents */ /* abs time constants: int (1200.0 * (log2 (secs)) * 65536.0 + 0.5) */ #define ABST_0SECS IPATCH_UNIT_DLS_ABS_TIME_0SECS /* 0 secs degenerate case */ #define ABST_10MSECS -522494110L /* 10 msecs */ #define ABST_15MSECS -476490787L /* 15 msecs */ #define ABST_10SECS 261247056L /* 10 secs */ #define ABST_40SECS 418533456L /* 40 secs */ /* relative time cents constants: cents * 65536 */ #define RELT_0TCENTS 0 /* 0 time cents */ #define RELT_6000TCENTS 393216000L /* 6000 time cents */ /* DLS gain constants: gain_db * 655360 */ #define GAIN_0DB 0 /* 0 dB */ #define GAIN_12DB 7864320L /* 12 dB */ #define GAIN_22P5DB 14745600L /* 22.5 dB */ /* DLS percent constants: percent * 655360 */ #define PERCENT_N50P8 -33292288L /* -50.8% */ #define PERCENT_N50 -32768000L /* -50% */ #define PERCENT_0 0 /* 0% */ #define PERCENT_50 32768000L /* 50% */ #define PERCENT_50P8 33292288L /* 50.8% */ #define PERCENT_100 65536000L /* 100% */ /* Info for DLS2 parameters: min, max, default, unit_type, label */ const IpatchDLS2ParamInfo ipatch_dls2_param_info[] = { /* IPATCH_DLS2_PARAM_MOD_LFO_FREQ */ { ABSP_TENTH_HZ, ABSP_20HZ, ABSP_5HZ, IPATCH_UNIT_TYPE_DLS_ABS_PITCH, N_("Mod LFO Freq") }, /* IPATCH_DLS2_PARAM_MOD_LFO_DELAY */ { ABST_10MSECS, ABST_10SECS, ABST_10MSECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Mod LFO Delay") }, /* IPATCH_DLS2_PARAM_VIB_LFO_FREQ */ { ABSP_TENTH_HZ, ABSP_20HZ, ABSP_5HZ, IPATCH_UNIT_TYPE_DLS_ABS_PITCH, N_("Vib LFO Freq") }, /* IPATCH_DLS2_PARAM_VIB_LFO_DELAY */ { ABST_10MSECS, ABST_10SECS, ABST_10MSECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Vib LFO Delay") }, /* IPATCH_DLS2_PARAM_VOL_EG_DELAY */ { ABST_0SECS, ABST_40SECS, ABST_0SECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Vol Env Delay") }, /* IPATCH_DLS2_PARAM_VOL_EG_ATTACK */ { ABST_0SECS, ABST_40SECS, ABST_0SECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Vol Env Attack") }, /* IPATCH_DLS2_PARAM_VOL_EG_HOLD */ { ABST_0SECS, ABST_40SECS, ABST_0SECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Vol Env Hold") }, /* IPATCH_DLS2_PARAM_VOL_EG_DECAY */ { ABST_0SECS, ABST_40SECS, ABST_0SECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Vol Env Decay") }, /* IPATCH_DLS2_PARAM_VOL_EG_SUSTAIN */ { PERCENT_0, PERCENT_100, PERCENT_100, IPATCH_UNIT_TYPE_DLS_PERCENT, N_("Vol Env Sustain") }, /* IPATCH_DLS2_PARAM_VOL_EG_RELEASE */ { ABST_0SECS, ABST_40SECS, ABST_0SECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Vol Env Release") }, /* IPATCH_DLS2_PARAM_VOL_EG_SHUTDOWN */ { ABST_0SECS, ABST_40SECS, ABST_15MSECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Vol Env Shutdown") }, /* IPATCH_DLS2_PARAM_VOL_EG_VELOCITY_TO_ATTACK */ { RELT_0TCENTS, RELT_6000TCENTS, RELT_0TCENTS, IPATCH_UNIT_TYPE_DLS_REL_TIME, N_("Vol Env Velocity to Attack") }, /* IPATCH_DLS2_PARAM_VOL_EG_NOTE_TO_DECAY */ { RELT_0TCENTS, RELT_6000TCENTS, RELT_0TCENTS, IPATCH_UNIT_TYPE_DLS_REL_TIME, N_("Vol Env Note to Decay") }, /* IPATCH_DLS2_PARAM_VOL_EG_NOTE_TO_HOLD */ { RELT_0TCENTS, RELT_6000TCENTS, RELT_0TCENTS, IPATCH_UNIT_TYPE_DLS_REL_TIME, N_("Vol Env Note to Hold") }, /* IPATCH_DLS2_PARAM_MOD_EG_DELAY */ { ABST_0SECS, ABST_40SECS, ABST_0SECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Mod Env Delay") }, /* IPATCH_DLS2_PARAM_MOD_EG_ATTACK */ { ABST_0SECS, ABST_40SECS, ABST_0SECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Mod Env Attack") }, /* IPATCH_DLS2_PARAM_MOD_EG_HOLD */ { ABST_0SECS, ABST_40SECS, ABST_0SECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Mod Env Hold") }, /* IPATCH_DLS2_PARAM_MOD_EG_DECAY */ { ABST_0SECS, ABST_40SECS, ABST_0SECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Mod Env Decay") }, /* IPATCH_DLS2_PARAM_MOD_EG_SUSTAIN */ { PERCENT_0, PERCENT_100, PERCENT_100, IPATCH_UNIT_TYPE_DLS_PERCENT, N_("Mod Env Sustain") }, /* IPATCH_DLS2_PARAM_MOD_EG_RELEASE */ { ABST_0SECS, ABST_40SECS, ABST_0SECS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Mod Env Release") }, /* IPATCH_DLS2_PARAM_MOD_EG_VELOCITY_TO_ATTACK */ { RELT_0TCENTS, RELT_6000TCENTS, RELT_0TCENTS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Mod Env Velocity to Attack") }, /* IPATCH_DLS2_PARAM_MOD_EG_NOTE_TO_DECAY */ { RELT_0TCENTS, RELT_6000TCENTS, RELT_0TCENTS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Mod Env Note to Decay") }, /* IPATCH_DLS2_PARAM_MOD_EG_NOTE_TO_HOLD */ { RELT_0TCENTS, RELT_6000TCENTS, RELT_0TCENTS, IPATCH_UNIT_TYPE_DLS_ABS_TIME, N_("Mod Env Note to Hold") }, /* IPATCH_DLS2_PARAM_SCALE_TUNE */ { RELP_0CENTS, RELP_12800CENTS, RELP_12800CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Scale Tuning") }, /* IPATCH_DLS2_PARAM_RPN2_TO_NOTE */ { RELP_0CENTS, RELP_6400CENTS, RELP_6400CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("RPN2 to note") }, /* IPATCH_DLS2_PARAM_FILTER_CUTOFF */ { ABSP_5535CENTS, ABSP_11921CENTS, 0x7FFFFFFF, IPATCH_UNIT_TYPE_DLS_ABS_PITCH, N_("Filter Cutoff") }, /* IPATCH_DLS2_PARAM_FILTER_Q */ { GAIN_0DB, GAIN_22P5DB, GAIN_0DB, IPATCH_UNIT_TYPE_DLS_GAIN, N_("Filter Q") }, /* IPATCH_DLS2_PARAM_MOD_LFO_TO_FILTER_CUTOFF */ { RELP_N12800CENTS, RELP_12800CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Mod LFO to Cutoff") }, /* IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_FILTER_CUTOFF */ { RELP_N12800CENTS, RELP_12800CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Mod LFO CC1 to Cutoff") }, /* IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_FILTER_CUTOFF */ { RELP_N12800CENTS, RELP_12800CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Mod LFO Channel Press. to Cutoff") }, /* IPATCH_DLS2_PARAM_MOD_EG_TO_FILTER_CUTOFF */ { RELP_N12800CENTS, RELP_12800CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Mod Env to Cutoff") }, /* IPATCH_DLS2_PARAM_VELOCITY_TO_FILTER_CUTOFF */ { RELP_N12800CENTS, RELP_12800CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Velocity to Cutoff") }, /* IPATCH_DLS2_PARAM_NOTE_TO_FILTER_CUTOFF */ { RELP_N12800CENTS, RELP_12800CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Note number to Cutoff") }, /* IPATCH_DLS2_PARAM_MOD_LFO_TO_GAIN */ { GAIN_0DB, GAIN_12DB, GAIN_0DB, IPATCH_UNIT_TYPE_DLS_GAIN, N_("Mod LFO to Gain") }, /* IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_GAIN */ { GAIN_0DB, GAIN_12DB, GAIN_0DB, IPATCH_UNIT_TYPE_DLS_GAIN, N_("Mod LFO CC1 to Gain") }, /* IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_GAIN */ { GAIN_0DB, GAIN_12DB, GAIN_0DB, IPATCH_UNIT_TYPE_DLS_GAIN, N_("Mod LFO Channel Press. to Gain") }, /* IPATCH_DLS2_PARAM_VELOCITY_TO_GAIN */ { GAIN_0DB, GAIN_12DB, GAIN_0DB, IPATCH_UNIT_TYPE_DLS_GAIN, N_("Velocity to Gain") }, /* IPATCH_DLS2_PARAM_CC7_TO_GAIN */ { GAIN_0DB, GAIN_12DB, GAIN_0DB, IPATCH_UNIT_TYPE_DLS_GAIN, N_("CC7 to Gain") }, /* IPATCH_DLS2_PARAM_CC11_TO_GAIN */ { GAIN_0DB, GAIN_12DB, GAIN_0DB, IPATCH_UNIT_TYPE_DLS_GAIN, N_("CC11 to Gain") }, /* IPATCH_DLS2_PARAM_TUNE */ { RELP_N1200CENTS, RELP_1200CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Tune") }, /* IPATCH_DLS2_PARAM_PITCH_WHEEL_RPN0_TO_PITCH */ { RELP_12800CENTS, RELP_12800CENTS, RELP_12800CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Pitch Wheel RPN0 to Pitch") }, /* IPATCH_DLS2_PARAM_NOTE_TO_PITCH */ { RELP_0CENTS, RELP_12800CENTS, RELP_12800CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Note to Pitch") }, /* IPATCH_DLS2_PARAM_RPN1_TO_PITCH */ { RELP_0CENTS, RELP_100CENTS, RELP_100CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("RPN1 to Pitch") }, /* IPATCH_DLS2_PARAM_VIB_LFO_TO_PITCH */ { RELP_N1200CENTS, RELP_1200CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Vib LFO to Pitch") }, /* IPATCH_DLS2_PARAM_VIB_LFO_CC1_TO_PITCH */ { RELP_N1200CENTS, RELP_1200CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Vib LFO CC1 to Pitch") }, /* IPATCH_DLS2_PARAM_VIB_LFO_CHANNEL_PRESS_TO_PITCH */ { RELP_N1200CENTS, RELP_1200CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Vib LFO Channel Press. to Pitch") }, /* IPATCH_DLS2_PARAM_MOD_LFO_TO_PITCH */ { RELP_N1200CENTS, RELP_1200CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Mod LFO to Pitch") }, /* IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_PITCH */ { RELP_N1200CENTS, RELP_1200CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Mod LFO CC1 to Pitch") }, /* IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_PITCH */ { RELP_N1200CENTS, RELP_1200CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Mod LFO Channel Press. to Pitch") }, /* IPATCH_DLS2_PARAM_MOD_EG_TO_PITCH */ { RELP_N1200CENTS, RELP_1200CENTS, RELP_0CENTS, IPATCH_UNIT_TYPE_DLS_REL_PITCH, N_("Mod Envelope to Pitch") }, /* IPATCH_DLS2_PARAM_PAN */ { PERCENT_N50, PERCENT_50, PERCENT_0, IPATCH_UNIT_TYPE_DLS_PERCENT, N_("Pan") }, /* IPATCH_DLS2_PARAM_CC10_TO_PAN */ { PERCENT_N50P8, PERCENT_50P8, PERCENT_50P8, IPATCH_UNIT_TYPE_DLS_PERCENT, N_("CC10 to Pan") }, /* IPATCH_DLS2_PARAM_CC91_TO_REVERB_SEND */ { PERCENT_0, PERCENT_100, PERCENT_100, IPATCH_UNIT_TYPE_DLS_PERCENT, N_("CC91 to Reverb") }, /* IPATCH_DLS2_PARAM_REVERB_SEND */ { PERCENT_0, PERCENT_100, PERCENT_0, IPATCH_UNIT_TYPE_DLS_PERCENT, N_("Reverb") }, /* IPATCH_DLS2_PARAM_CC93_TO_CHORUS_SEND */ { PERCENT_0, PERCENT_100, PERCENT_100, IPATCH_UNIT_TYPE_DLS_PERCENT, N_("CC93 to Chorus") }, /* IPATCH_DLS2_PARAM_CHORUS_SEND */ { PERCENT_0, PERCENT_100, PERCENT_0, IPATCH_UNIT_TYPE_DLS_PERCENT, N_("Chorus") }, }; libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreCache.h0000644000175000017500000000755311461332142020274 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleStoreCache * @short_description: Sample store object for cached samples in RAM * @see_also: #IpatchSampleData * @stability: Stable * * This sample store type is tightly integrated with #IpatchSampleData to provide * managed cached samples in RAM. */ #ifndef __IPATCH_SAMPLE_STORE_CACHE_H__ #define __IPATCH_SAMPLE_STORE_CACHE_H__ #include #include #include /* forward type declarations */ typedef struct _IpatchSampleStoreCache IpatchSampleStoreCache; typedef struct _IpatchSampleStoreCacheClass IpatchSampleStoreCacheClass; #define IPATCH_TYPE_SAMPLE_STORE_CACHE (ipatch_sample_store_cache_get_type ()) #define IPATCH_SAMPLE_STORE_CACHE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_STORE_CACHE, \ IpatchSampleStoreCache)) #define IPATCH_SAMPLE_STORE_CACHE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_STORE_CACHE, \ IpatchSampleStoreCacheClass)) #define IPATCH_IS_SAMPLE_STORE_CACHE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_STORE_CACHE)) #define IPATCH_IS_SAMPLE_STORE_CACHE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_STORE_CACHE)) /* RAM sample store instance */ struct _IpatchSampleStoreCache { IpatchSampleStore parent_instance; gpointer location; /* Pointer to the sample data in memory */ guint32 channel_map; /* Channel map of cached sample in reference to native sample */ glong last_open; /* Unix time of last open or 0 if currently open */ int open_count; /* Current number of opens (atomic int) */ }; /* RAM sample store class */ struct _IpatchSampleStoreCacheClass { IpatchSampleStoreClass parent_class; }; /** * ipatch_sample_store_cache_get_location: * @store: Sample store to get sample data location from * * Macro to quickly fetch a cache sample store's data location pointer. * * Returns: Sample data pointer. */ #define ipatch_sample_store_cache_get_location(store) \ ((store)->location) /* No lock needed, set only once during creation */ /** * ipatch_sample_store_cache_get_channel_map: * @store: Sample store to get channel map from * * Macro to quickly fetch a cache sample store's channel map value. Cached * samples store a channel map in reference to the native sample of their * parent #IpatchSampleData. * * Returns: Channel map value. */ #define ipatch_sample_store_cache_get_channel_map(store) \ ((store)->channel_map) /* No lock needed, set only once during creation */ /* Used by #IpatchSampleData */ #define ipatch_sample_store_cache_get_open_count(store) \ g_atomic_int_get (&((store)->open_count)) /* we reserve 4 bits for future expansion */ #define IPATCH_SAMPLE_STORE_CACHE_UNUSED_FLAG_SHIFT \ (IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT + 4) GType ipatch_sample_store_cache_get_type (void); IpatchSample *ipatch_sample_store_cache_new (gpointer location); void ipatch_sample_store_cache_open (IpatchSampleStoreCache *store); void ipatch_sample_store_cache_close (IpatchSampleStoreCache *store); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2Zone.c0000644000175000017500000002702711461332142016331 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include #include "IpatchSF2Zone.h" #include "IpatchSF2PZone.h" #include "IpatchSF2.h" #include "IpatchSF2Gen.h" #include "IpatchSF2Mod.h" #include "IpatchSF2ModItem.h" #include "IpatchParamProp.h" #include "IpatchRange.h" #include "IpatchUnit.h" #include "builtin_enums.h" #include "ipatch_priv.h" static void ipatch_sf2_zone_mod_item_iface_init (IpatchSF2ModItemIface *moditem_iface); static void ipatch_sf2_zone_class_init (IpatchSF2ZoneClass *klass); static void ipatch_sf2_zone_finalize (GObject *gobject); static void ipatch_sf2_zone_get_title (IpatchSF2Zone *zone, GValue *value); static void ipatch_sf2_zone_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sf2_zone_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sf2_zone_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static void ipatch_sf2_zone_link_item_title_notify (IpatchItemPropNotify *info); /* generator property IDs go before these */ enum { PROP_0, PROP_TITLE, PROP_MODULATORS }; /* For passing between class init and mod item interface init */ static GParamSpec *modulators_spec = NULL; G_DEFINE_ABSTRACT_TYPE_WITH_CODE (IpatchSF2Zone, ipatch_sf2_zone, IPATCH_TYPE_ITEM, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SF2_MOD_ITEM, ipatch_sf2_zone_mod_item_iface_init)) static void ipatch_sf2_zone_class_init (IpatchSF2ZoneClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->finalize = ipatch_sf2_zone_finalize; obj_class->get_property = ipatch_sf2_zone_get_property; item_class->copy = ipatch_sf2_zone_item_copy; item_class->item_set_property = ipatch_sf2_zone_set_property; g_object_class_override_property (obj_class, PROP_TITLE, "title"); g_object_class_override_property (obj_class, PROP_MODULATORS, "modulators"); modulators_spec = g_object_class_find_property (obj_class, "modulators"); } /* mod item interface initialization */ static void ipatch_sf2_zone_mod_item_iface_init (IpatchSF2ModItemIface *moditem_iface) { moditem_iface->modlist_ofs = G_STRUCT_OFFSET (IpatchSF2Zone, mods); /* cache the modulators property for fast notifications */ moditem_iface->mod_pspec = modulators_spec; } static void ipatch_sf2_zone_init (IpatchSF2Zone *zone) { } static void ipatch_sf2_zone_finalize (GObject *gobject) { IpatchSF2Zone *zone = IPATCH_SF2_ZONE (gobject); IpatchItem *link = NULL; GSList *p; IPATCH_ITEM_WLOCK (zone); if (zone->item) { link = zone->item; g_object_unref (zone->item); zone->item = NULL; } p = zone->mods; while (p) { ipatch_sf2_mod_free ((IpatchSF2Mod *)(p->data)); p = g_slist_next (p); } g_slist_free (zone->mods); zone->mods = NULL; IPATCH_ITEM_WUNLOCK (zone); if (link) ipatch_item_prop_disconnect_matched (link, ipatch_item_pspec_title, ipatch_sf2_zone_link_item_title_notify, zone); if (G_OBJECT_CLASS (ipatch_sf2_zone_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sf2_zone_parent_class)->finalize (gobject); } static void ipatch_sf2_zone_get_title (IpatchSF2Zone *zone, GValue *value) { IpatchItem *ref; char *s = NULL; g_object_get (zone, "link-item", &ref, NULL); /* ++ ref zone linked item */ if (ref) { g_object_get (ref, "name", &s, NULL); g_object_unref (ref); /* -- unref zone linked item */ } g_value_take_string (value, s); } static void ipatch_sf2_zone_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSF2Zone *zone = IPATCH_SF2_ZONE (object); IpatchSF2ModList *list; if (property_id == PROP_MODULATORS) { list = (IpatchSF2ModList *)g_value_get_boxed (value); ipatch_sf2_mod_item_set_mods (IPATCH_SF2_MOD_ITEM (zone), list, IPATCH_SF2_MOD_NO_NOTIFY); } else { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_sf2_zone_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSF2Zone *zone = IPATCH_SF2_ZONE (object); IpatchSF2ModList *list; if (property_id == PROP_TITLE) ipatch_sf2_zone_get_title (zone, value); else if (property_id == PROP_MODULATORS) { list = ipatch_sf2_mod_item_get_mods (IPATCH_SF2_MOD_ITEM (zone)); g_value_take_boxed (value, list); } else { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_sf2_zone_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchSF2Zone *src_zone, *dest_zone; IpatchItem *refitem; IpatchSF2Mod *mod; GSList *p; src_zone = IPATCH_SF2_ZONE (src); dest_zone = IPATCH_SF2_ZONE (dest); IPATCH_ITEM_RLOCK (src_zone); refitem = IPATCH_ITEM_COPY_LINK_FUNC (dest, src_zone->item, link_func, user_data); if (refitem) ipatch_sf2_zone_set_link_item (dest_zone, refitem); p = src_zone->mods; while (p) /* duplicate modulators */ { mod = ipatch_sf2_mod_duplicate ((IpatchSF2Mod *)(p->data)); dest_zone->mods = g_slist_prepend (dest_zone->mods, mod); p = g_slist_next (p); } /* duplicate generator array */ memcpy (&dest_zone->genarray, &src_zone->genarray, sizeof (IpatchSF2GenArray)); IPATCH_ITEM_RUNLOCK (src_zone); dest_zone->mods = g_slist_reverse (dest_zone->mods); } /** * ipatch_sf2_zone_first: * @iter: Patch item iterator containing #IpatchSF2Zone items * * Gets the first item in a zone iterator. A convenience * wrapper for ipatch_iter_first(). * * Returns: The first zone in @iter or %NULL if empty. */ IpatchSF2Zone * ipatch_sf2_zone_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_SF2_ZONE (obj)); else return (NULL); } /** * ipatch_sf2_zone_next: * @iter: Patch item iterator containing #IpatchSF2Zone items * * Gets the next item in a zone iterator. A convenience wrapper * for ipatch_iter_next(). * * Returns: The next zone in @iter or %NULL if at the end of * the list. */ IpatchSF2Zone * ipatch_sf2_zone_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_SF2_ZONE (obj)); else return (NULL); } /** * ipatch_sf2_zone_set_link_item: * @zone: Zone to set zone item of * @item: New item for zone to use * * Sets the referenced item of a zone (a #IpatchSF2Inst for preset zones, * #IpatchSF2Sample for instrument zones). The type specific item set routines * for each zone type may be preferred, as this one doesn't do strict type * checking. */ void ipatch_sf2_zone_set_link_item (IpatchSF2Zone *zone, IpatchItem *item) { GValue oldval = { 0 }, newval = { 0 }; IpatchItem *olditem; if (!ipatch_sf2_zone_set_link_item_no_notify (zone, item, &olditem)) return; g_value_init (&oldval, G_TYPE_OBJECT); g_value_take_object (&oldval, olditem); /* !! take over reference */ g_value_init (&newval, G_TYPE_OBJECT); g_value_set_object (&newval, (GObject *)item); ipatch_item_prop_notify_by_name ((IpatchItem *)zone, "link-item", &newval, &oldval); g_value_unset (&oldval); g_value_unset (&newval); } /** * ipatch_sf2_zone_set_link_item_no_notify: * @zone: Zone to set zone item of * @item: New item for zone to use * @olditem: Pointer to store old item pointer or %NULL to ignore. Caller owns * reference if specified. * * Like ipatch_sf2_zone_set_link_item() but performs no property or item * change notifications (shouldn't normally be used outside of derived types), * and the old value can be retrieved with the @olditem parameter. * * Returns: TRUE if property was changed, FALSE otherwise (invalid inputs) */ gboolean ipatch_sf2_zone_set_link_item_no_notify (IpatchSF2Zone *zone, IpatchItem *item, IpatchItem **olditem) { IpatchItem *oldie; if (olditem) *olditem = NULL; /* in case of failure */ g_return_val_if_fail (IPATCH_IS_SF2_ZONE (zone), FALSE); g_return_val_if_fail (IPATCH_IS_ITEM (item), FALSE); if (item) g_object_ref (item); /* ref for zone */ IPATCH_ITEM_WLOCK (zone); oldie = zone->item; zone->item = item; IPATCH_ITEM_WUNLOCK (zone); /* remove "title" notify on old item */ if (oldie) ipatch_item_prop_disconnect_matched (oldie, ipatch_item_pspec_title, ipatch_sf2_zone_link_item_title_notify, zone); /* add a prop notify on link-item "title" so zone can notify it's title also */ ipatch_item_prop_connect (item, ipatch_item_pspec_title, ipatch_sf2_zone_link_item_title_notify, NULL, zone); /* either caller takes reference to old item or we unref it, unref outside of lock */ if (olditem) *olditem = oldie; else if (oldie) g_object_unref (oldie); return (TRUE); } /* property notify for when link-item "title" property changes */ static void ipatch_sf2_zone_link_item_title_notify (IpatchItemPropNotify *info) { /* notify that zone's title changed */ IpatchItem *zone = (IpatchItem *)(info->user_data); ipatch_item_prop_notify_by_name (zone, "title", info->new_value, info->old_value); } /** * ipatch_sf2_zone_get_link_item: * @zone: Zone to get referenced item of * * Gets the referenced item from a zone (a #IpatchSF2Inst for preset zones, * #IpatchSF2Sample for instrument zones). The type specific item set routines * for each zone type may be preferred, as this one doesn't do strict type * checking. The returned item's reference count is incremented and the caller * is responsible for unrefing it with g_object_unref(). * * Returns: Zone's referenced item or %NULL if global zone. Remember to * unreference the item with g_object_unref() when done with it. */ IpatchItem * ipatch_sf2_zone_get_link_item (IpatchSF2Zone *zone) { IpatchItem *item; g_return_val_if_fail (IPATCH_IS_SF2_ZONE (zone), NULL); IPATCH_ITEM_RLOCK (zone); item = zone->item; if (item) g_object_ref (item); IPATCH_ITEM_RUNLOCK (zone); return (item); } /** * ipatch_sf2_zone_peek_link_item: * @zone: Zone to get referenced item of * * Like ipatch_sf2_zone_get_link_item() but does not add a reference to * the returned item. This function should only be used if a reference * of the returned item is ensured or only the pointer value is of * interest. * * Returns: Zone's linked item. Remember that the item has NOT been referenced. */ IpatchItem * ipatch_sf2_zone_peek_link_item (IpatchSF2Zone *zone) { g_return_val_if_fail (IPATCH_IS_SF2_ZONE (zone), NULL); return (zone->item); /* atomic read */ } libinstpatch-1.0.0/libinstpatch/IpatchUnit.h0000644000175000017500000001132711461332142016023 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchUnit * @short_description: Unit conversion system * @see_also: * @stability: Stable * * System for registering unit types and conversion functions. */ #ifndef __IPATCH_UNIT_H__ #define __IPATCH_UNIT_H__ #include #include typedef struct _IpatchUnitInfo IpatchUnitInfo; /* structure defining a unit type */ struct _IpatchUnitInfo { guint16 id; /* unit type ID */ guint8 digits; /* significant digits to display to user */ guint8 flags; /* IpatchUnitFlags */ GType value_type; /* unit value type */ char *name; /* name identifier (constant) */ char *label; /* unit label (translated) */ char *descr; /* unit description (translated) */ }; typedef enum { IPATCH_UNIT_LOGARITHMIC = 1 << 0, /* unit is logarithmic */ IPATCH_UNIT_USER = 1 << 1 /* a user friendly unit type */ } IpatchUnitFlags; /** * IpatchValueTransform: * @src: Source value to transform from * @dest: Destination value to transform to * * Transform from one value to another. The @src and @dest values have * already been initialized to specific types and the transform function * should convert/process them as necessary. */ typedef void (*IpatchValueTransform)(const GValue *src, GValue *dest); /* built-in unit types */ typedef enum { IPATCH_UNIT_TYPE_NONE = 0, /* a NULL value */ IPATCH_UNIT_TYPE_INT = 1, IPATCH_UNIT_TYPE_UINT = 2, IPATCH_UNIT_TYPE_RANGE = 3, IPATCH_UNIT_TYPE_DECIBELS = 4, IPATCH_UNIT_TYPE_PERCENT = 5, IPATCH_UNIT_TYPE_SEMITONES = 6, IPATCH_UNIT_TYPE_CENTS = 7, IPATCH_UNIT_TYPE_TIME_CENTS = 8, IPATCH_UNIT_TYPE_SAMPLE_RATE = 9, IPATCH_UNIT_TYPE_SAMPLES = 10, IPATCH_UNIT_TYPE_HERTZ = 11, IPATCH_UNIT_TYPE_SECONDS = 12, IPATCH_UNIT_TYPE_MULTIPLIER = 13, /* 128 - 159 reserved for IpatchUnit_DLS.h */ IPATCH_UNIT_TYPE_DLS_GAIN = 128, IPATCH_UNIT_TYPE_DLS_ABS_TIME = 129, IPATCH_UNIT_TYPE_DLS_REL_TIME = 130, IPATCH_UNIT_TYPE_DLS_ABS_PITCH = 131, IPATCH_UNIT_TYPE_DLS_REL_PITCH = 132, IPATCH_UNIT_TYPE_DLS_PERCENT = 133, /* 160 - 169 reserved for IpatchUnit_SF2.h */ IPATCH_UNIT_TYPE_SF2_ABS_PITCH = 160, IPATCH_UNIT_TYPE_SF2_OFS_PITCH = 161, IPATCH_UNIT_TYPE_SF2_ABS_TIME = 162, IPATCH_UNIT_TYPE_SF2_OFS_TIME = 163, IPATCH_UNIT_TYPE_CENTIBELS = 164, IPATCH_UNIT_TYPE_32K_SAMPLES = 165, IPATCH_UNIT_TYPE_TENTH_PERCENT = 166 } IpatchUnitType; /* first dynamic unit type ID */ #define IPATCH_UNIT_TYPE_FIRST_DYNAMIC_ID 1024 /* * Unit class types define domains of conversion, an example is the "user" * unit class which is used to convert values to units digestable by a human. * A conversion class is essentially a mapping between unit types, which can * then be used to lookup conversion functions. */ typedef enum { IPATCH_UNIT_CLASS_NONE, /* a NULL value */ IPATCH_UNIT_CLASS_USER, /* "user" conversion class (for humans) */ IPATCH_UNIT_CLASS_DLS, /* DLS (native patch type) class */ IPATCH_UNIT_CLASS_COUNT /* NOT A VALID CLASS - count of classes */ } IpatchUnitClassType; IpatchUnitInfo *ipatch_unit_info_new (void); void ipatch_unit_info_free (IpatchUnitInfo *info); guint16 ipatch_unit_register (const IpatchUnitInfo *info); IpatchUnitInfo *ipatch_unit_lookup (guint16 id); IpatchUnitInfo *ipatch_unit_lookup_by_name (const char *name); void ipatch_unit_class_register_map (guint16 class_type, guint16 src_units, guint16 dest_units); IpatchUnitInfo *ipatch_unit_class_lookup_map (guint16 class_type, guint16 src_units); void ipatch_unit_conversion_register (guint16 src_units, guint16 dest_units, IpatchValueTransform func); IpatchValueTransform ipatch_unit_conversion_lookup (guint16 src_units, guint16 dest_units, gboolean *set); gboolean ipatch_unit_convert (guint16 src_units, guint16 dest_units, const GValue *src_val, GValue *dest_val); double ipatch_unit_user_class_convert (guint16 src_units, const GValue *src_val); #endif libinstpatch-1.0.0/libinstpatch/IpatchXml.h0000644000175000017500000001140511461332142015641 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. * */ /** * SECTION: IpatchXml * @short_description: XML tree functions * @see_also: IpatchXmlObject * @stability: Stable * * Functions for manipulating XML node trees and saving/loading to/from * XML content in strings or files. XML node trees use the glib GNode N-ary * tree data type for added flexibility. */ #ifndef __IPATCH_XML_H__ #define __IPATCH_XML_H__ #include typedef struct _IpatchXmlNode IpatchXmlNode; typedef struct _IpatchXmlAttr IpatchXmlAttr; /** * IpatchXmlAttr: * @name: Attribute name * @value: Attribute value * * Structure for storing an XML attribute. */ struct _IpatchXmlAttr { char *name; char *value; }; /** * IpatchXmlNode: * @name: XML element name * @value: XML text value or %NULL * @attributes: Linked list of #IpatchXmlAttr structures * * An XML element node. Note that a given node can contain only one text value. */ struct _IpatchXmlNode { char *name; /* XML element name */ char *value; /* Text content of element */ GData *qdata; /* To associate arbitrary data with XML nodes */ GList *attributes; /* List of IpatchXmlAttr structures */ }; GNode *ipatch_xml_new_node (GNode *parent, const char *name, const char *value, const char *attr_name, ...); GNode *ipatch_xml_new_node_strv (GNode *parent, const char *name, const char *value, const char **attr_names, const char **attr_values); gpointer ipatch_xml_get_data (GNode *node, const char *key); void ipatch_xml_set_data (GNode *node, const char *key, gpointer data); void ipatch_xml_set_data_full (GNode *node, const char *key, gpointer data, GDestroyNotify destroy_func); gpointer ipatch_xml_steal_data (GNode *node, const char *key); gpointer ipatch_xml_get_qdata (GNode *node, GQuark quark); void ipatch_xml_set_qdata (GNode *node, GQuark quark, gpointer data); void ipatch_xml_set_qdata_full (GNode *node, GQuark quark, gpointer data, GDestroyNotify destroy_func); gpointer ipatch_xml_steal_qdata (GNode *node, GQuark quark); void ipatch_xml_destroy (GNode *node); GNode *ipatch_xml_copy (GNode *node); void ipatch_xml_set_name (GNode *node, const char *name); void ipatch_xml_set_value (GNode *node, const char *value); void ipatch_xml_set_value_printf (GNode *node, const char *format, ...); void ipatch_xml_take_name (GNode *node, char *name); void ipatch_xml_take_value (GNode *node, char *value); G_CONST_RETURN char *ipatch_xml_get_name (GNode *node); gboolean ipatch_xml_test_name (GNode *node, const char *cmpname); G_CONST_RETURN char *ipatch_xml_get_value (GNode *node); char *ipatch_xml_dup_value (GNode *node); gboolean ipatch_xml_test_value (GNode *node, const char *cmpvalue); void ipatch_xml_set_attribute (GNode *node, const char *attr_name, const char *attr_value); void ipatch_xml_set_attributes (GNode *node, const char *attr_name, const char *attr_value, const char *attr2_name, ...); G_CONST_RETURN char *ipatch_xml_get_attribute (GNode *node, const char *name); gboolean ipatch_xml_test_attribute (GNode *node, const char *attr_name, const char *cmpval); GNode *ipatch_xml_find_child (GNode *node, const char *name); GNode *ipatch_xml_find_by_path (GNode *node, const char *path); char *ipatch_xml_to_str (GNode *node, guint indent); gboolean ipatch_xml_save_to_file (GNode *node, guint indent, const char *filename, GError **err); GNode *ipatch_xml_from_str (const char *str, GError **err); GNode *ipatch_xml_load_from_file (const char *filename, GError **err); IpatchXmlNode *ipatch_xml_node_new (void); void ipatch_xml_node_free (IpatchXmlNode *node); IpatchXmlNode *ipatch_xml_node_duplicate (const IpatchXmlNode *xmlnode); IpatchXmlAttr *ipatch_xml_attr_new (void); void ipatch_xml_attr_free (IpatchXmlAttr *attr); IpatchXmlAttr *ipatch_xml_attr_duplicate (const IpatchXmlAttr *attr); #endif libinstpatch-1.0.0/libinstpatch/IpatchDLS2Sample.c0000644000175000017500000006035111461332142016746 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchDLS2Sample.h" #include "IpatchDLS2.h" #include "IpatchDLSFile.h" #include "IpatchSample.h" #include "IpatchSampleStoreRam.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" #include "builtin_enums.h" /* properties */ enum { PROP_0, PROP_SAMPLE_SIZE, /* read only convenience property */ PROP_SAMPLE_FORMAT, PROP_SAMPLE_RATE, PROP_SAMPLE_DATA }; /* sample info property enums, used by regions as well, so we define these in a non-conflicting range !! Keep order synchronized with IPATCH_DLS2_SAMPLE_INFO_PROPERTY_COUNT */ enum { PROP_FLAGS = IPATCH_DLS2_SAMPLE_INFO_FIRST_PROPERTY_ID, PROP_LOOP_TYPE, PROP_ROOT_NOTE, PROP_FINE_TUNE, PROP_GAIN, PROP_LOOP_START, PROP_LOOP_END }; /* for caching sample info GParamSpec objects for an object class */ typedef struct { GObjectClass *klass; /* object class owning these properties */ GParamSpec *pspecs[IPATCH_DLS2_SAMPLE_INFO_PROPERTY_COUNT]; } ClassPropBag; static void ipatch_dls2_sample_iface_init (IpatchSampleIface *sample_iface); static gboolean ipatch_dls2_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_dls2_sample_finalize (GObject *gobject); static void ipatch_dls2_sample_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_dls2_sample_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_dls2_sample_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static void ipatch_dls2_sample_item_remove (IpatchItem *item); static gboolean ipatch_dls2_sample_real_set_data (IpatchDLS2Sample *sample, IpatchSampleData *sampledata); /* list of ClassPropBag to speed up info property notifies */ static GSList *info_pspec_list = NULL; G_DEFINE_TYPE_WITH_CODE (IpatchDLS2Sample, ipatch_dls2_sample, IPATCH_TYPE_ITEM, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_dls2_sample_iface_init)) /* sample interface initialization */ static void ipatch_dls2_sample_iface_init (IpatchSampleIface *sample_iface) { sample_iface->open = ipatch_dls2_sample_iface_open; sample_iface->loop_types = ipatch_sample_loop_types_standard_release; } static gboolean ipatch_dls2_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchDLS2Sample *sample = IPATCH_DLS2_SAMPLE (handle->sample); g_return_val_if_fail (sample->sample_data != NULL, FALSE); return (ipatch_sample_handle_cascade_open (handle, (IpatchSample *)(sample->sample_data), err)); } static void ipatch_dls2_sample_class_init (IpatchDLS2SampleClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->finalize = ipatch_dls2_sample_finalize; obj_class->get_property = ipatch_dls2_sample_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_dls2_sample_set_property; item_class->copy = ipatch_dls2_sample_item_copy; item_class->remove = ipatch_dls2_sample_item_remove; g_object_class_override_property (obj_class, IPATCH_DLS2_NAME, "title"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_SIZE, "sample-size"); ipatch_sample_install_property_readonly (obj_class, PROP_SAMPLE_FORMAT, "sample-format"); ipatch_sample_install_property (obj_class, PROP_SAMPLE_RATE, "sample-rate"); ipatch_sample_install_property (obj_class, PROP_SAMPLE_DATA, "sample-data"); ipatch_dls2_sample_info_install_class_properties (obj_class); ipatch_dls2_info_install_class_properties (obj_class); } static void ipatch_dls2_sample_init (IpatchDLS2Sample *sample) { ipatch_dls2_sample_set_blank (sample); sample->rate = IPATCH_SAMPLE_RATE_DEFAULT; } static void ipatch_dls2_sample_finalize (GObject *gobject) { IpatchDLS2Sample *sample = IPATCH_DLS2_SAMPLE (gobject); /* nothing should reference the sample after this, but we set pointers to NULL to help catch invalid references. Locking of sample is required since in reality all its children do still hold references */ IPATCH_ITEM_WLOCK (sample); if (sample->sample_info) ipatch_dls2_sample_info_free (sample->sample_info); ipatch_dls2_info_free (sample->info); if (sample->sample_data) g_object_unref (sample->sample_data); g_free (sample->dlid); IPATCH_ITEM_WUNLOCK (sample); if (G_OBJECT_CLASS (ipatch_dls2_sample_parent_class)->finalize) G_OBJECT_CLASS (ipatch_dls2_sample_parent_class)->finalize (gobject); } static void ipatch_dls2_sample_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchDLS2Sample *sample = IPATCH_DLS2_SAMPLE (object); gboolean retval; switch (property_id) { case PROP_SAMPLE_RATE: IPATCH_ITEM_WLOCK (sample); sample->rate = g_value_get_int (value); IPATCH_ITEM_WUNLOCK (sample); break; case PROP_SAMPLE_DATA: ipatch_dls2_sample_real_set_data (sample, (IpatchSampleData *) (g_value_get_object (value))); break; default: IPATCH_ITEM_WLOCK (sample); retval = ipatch_dls2_sample_info_set_property (&sample->sample_info, property_id, value); if (!retval) retval = ipatch_dls2_info_set_property (&sample->info, property_id, value); IPATCH_ITEM_WUNLOCK (sample); /* check if "title" property needs to be notified */ if (property_id == IPATCH_DLS2_NAME) ipatch_item_prop_notify ((IpatchItem *)sample, ipatch_item_pspec_title, value, NULL); if (!retval) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } break; } } static void ipatch_dls2_sample_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchDLS2Sample *sample = IPATCH_DLS2_SAMPLE (object); gboolean retval; switch (property_id) { case PROP_SAMPLE_SIZE: g_return_if_fail (sample->sample_data != NULL); g_object_get_property ((GObject *)(sample->sample_data), "sample-size", value); break; case PROP_SAMPLE_FORMAT: g_return_if_fail (sample->sample_data != NULL); g_object_get_property ((GObject *)(sample->sample_data), "sample-format", value); break; case PROP_SAMPLE_RATE: IPATCH_ITEM_RLOCK (sample); g_value_set_int (value, sample->rate); IPATCH_ITEM_RUNLOCK (sample); break; case PROP_SAMPLE_DATA: g_value_take_object (value, ipatch_dls2_sample_get_data (sample)); break; default: IPATCH_ITEM_RLOCK (sample); retval = ipatch_dls2_sample_info_get_property (sample->sample_info, property_id, value); if (!retval) retval = ipatch_dls2_info_get_property (sample->info, property_id, value); IPATCH_ITEM_RUNLOCK (sample); if (!retval) G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_dls2_sample_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchDLS2Sample *src_sam, *dest_sam; src_sam = IPATCH_DLS2_SAMPLE (src); dest_sam = IPATCH_DLS2_SAMPLE (dest); IPATCH_ITEM_RLOCK (src_sam); dest_sam->sample_info = src_sam->sample_info ? ipatch_dls2_sample_info_duplicate (src_sam->sample_info) : NULL; dest_sam->info = ipatch_dls2_info_duplicate (src_sam->info); ipatch_dls2_sample_set_data (dest_sam, src_sam->sample_data); if (src_sam->dlid) dest_sam->dlid = g_memdup (src_sam->dlid, IPATCH_DLS_DLID_SIZE); IPATCH_ITEM_RUNLOCK (src_sam); } static void ipatch_dls2_sample_item_remove (IpatchItem *item) { IpatchList *list; IpatchItem *parent; IpatchIter iter; /* ++ ref new list */ list = ipatch_dls2_get_region_references (IPATCH_DLS2_SAMPLE (item)); ipatch_list_init_iter (list, &iter); item = ipatch_item_first (&iter); while (item) { ipatch_item_remove (item); item = ipatch_item_next (&iter); } g_object_unref (list); /* -- unref list */ parent = ipatch_item_get_parent (item); /* ++ ref parent */ if (parent) { ipatch_container_remove (IPATCH_CONTAINER (parent), item); g_object_unref (parent); /* -- unref parent */ } } /** * ipatch_dls2_sample_new: * * Create a new DLS sample object. * * Returns: New DLS sample with a reference count of 1. Caller * owns the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchDLS2Sample * ipatch_dls2_sample_new (void) { return (IPATCH_DLS2_SAMPLE (g_object_new (IPATCH_TYPE_DLS2_SAMPLE, NULL))); } /** * ipatch_dls2_sample_first: * @iter: Patch item iterator containing #IpatchDLS2Sample items * * Gets the first item in a sample iterator. A convenience wrapper for * ipatch_iter_first(). * * Returns: The first sample in @iter or %NULL if empty. */ IpatchDLS2Sample * ipatch_dls2_sample_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_DLS2_SAMPLE (obj)); else return (NULL); } /** * ipatch_dls2_sample_next: * @iter: Patch item iterator containing #IpatchDLS2Sample items * * Gets the next item in a sample iterator. A convenience wrapper for * ipatch_iter_next(). * * Returns: The next sample in @iter or %NULL if at the end of the list. */ IpatchDLS2Sample * ipatch_dls2_sample_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_DLS2_SAMPLE (obj)); else return (NULL); } /** * ipatch_dls2_sample_set_data: * @sample: Sample to set sample data of * @sampledata: Sample data to set sample to * * Set a sample's sample data object. */ void ipatch_dls2_sample_set_data (IpatchDLS2Sample *sample, IpatchSampleData *sampledata) { if (ipatch_dls2_sample_real_set_data (sample, sampledata)) g_object_notify (G_OBJECT (sample), "sample-data"); } /* the actual setting of sample data, user routine does a g_object_notify */ static gboolean ipatch_dls2_sample_real_set_data (IpatchDLS2Sample *sample, IpatchSampleData *sampledata) { g_return_val_if_fail (IPATCH_IS_DLS2_SAMPLE (sample), FALSE); g_return_val_if_fail (IPATCH_IS_SAMPLE_DATA (sampledata), FALSE); g_object_ref (sampledata); /* ++ ref for sample */ IPATCH_ITEM_WLOCK (sample); if (sample->sample_data) g_object_unref (sample->sample_data); sample->sample_data = sampledata; /* !! takes over ref */ IPATCH_ITEM_WUNLOCK (sample); return (TRUE); } /** * ipatch_dls2_sample_get_data: * @sample: Sample to get sample data from * * Get the #IpatchSampleData item of a sample. Sample data item is referenced * before returning and caller is responsible for unreferencing it with * g_object_unref() when finished with it. * * Returns: Sample data object of sample or %NULL if none. Remember to * unreference with g_object_unref() when finished with it. */ IpatchSampleData * ipatch_dls2_sample_get_data (IpatchDLS2Sample *sample) { IpatchSampleData *sampledata; g_return_val_if_fail (IPATCH_IS_DLS2_SAMPLE (sample), NULL); IPATCH_ITEM_RLOCK (sample); sampledata = sample->sample_data; if (sampledata) g_object_ref (sampledata); /* ++ ref */ IPATCH_ITEM_RUNLOCK (sample); return (sampledata); /* !! caller takes over ref */ } /** * ipatch_dls2_sample_peek_data: * @sample: Sample to get sample data from * * Get the #IpatchSampleData item of a sample. Like * ipatch_dls2_sample_get_data() but sample data object is not referenced. * This function should only be used if a reference of the sample data object * is ensured or only the pointer value is of importance. * * Returns: Sample data object of sample or %NULL if none. Remember that a * reference is NOT added. */ IpatchSampleData * ipatch_dls2_sample_peek_data (IpatchDLS2Sample *sample) { IpatchSampleData *sampledata; g_return_val_if_fail (IPATCH_IS_DLS2_SAMPLE (sample), NULL); IPATCH_ITEM_RLOCK (sample); sampledata = sample->sample_data; IPATCH_ITEM_RUNLOCK (sample); return (sampledata); } /** * ipatch_dls2_sample_set_blank: * @sample: Sample to set to blank sample data * * Set the sample data of a sample item to blank data. */ void ipatch_dls2_sample_set_blank (IpatchDLS2Sample *sample) { IpatchSampleData *sampledata; g_return_if_fail (IPATCH_IS_DLS2_SAMPLE (sample)); sampledata = ipatch_sample_data_get_blank (); IPATCH_ITEM_WLOCK (sample); if (sample->sample_info) /* reset sample info to defaults */ { ipatch_dls2_sample_info_free (sample->sample_info); sample->sample_info = NULL; } g_object_set (sample, "sample-data", sampledata, "sample-rate", 44100, NULL); IPATCH_ITEM_WUNLOCK (sample); g_object_unref (sampledata); } /** * ipatch_dls2_sample_info_new: * * Allocates a new sample info structure. * * Returns: New sample info structure, free it with * ipatch_dls2_sample_info_free() when finished. */ IpatchDLS2SampleInfo * ipatch_dls2_sample_info_new (void) { IpatchDLS2SampleInfo *sample_info; sample_info = g_slice_new0 (IpatchDLS2SampleInfo); sample_info->root_note = 60; return (sample_info); } /** * ipatch_dls2_sample_info_free: * @sample_info: Sample info structure * * Free a sample info structure allocated with ipatch_dls2_sample_info_new(). */ void ipatch_dls2_sample_info_free (IpatchDLS2SampleInfo *sample_info) { g_slice_free (IpatchDLS2SampleInfo, sample_info); } /** * ipatch_dls2_sample_info_duplicate: * @sample_info: Sample info structure to duplicate * * Duplicate a sample info structure. * * Returns: Newly allocated sample info structure which should be freed * with ipatch_dls2_sample_info_free() when done with it. */ IpatchDLS2SampleInfo * ipatch_dls2_sample_info_duplicate (IpatchDLS2SampleInfo *sample_info) { IpatchDLS2SampleInfo *newinfo; g_return_val_if_fail (sample_info != NULL, NULL); newinfo = ipatch_dls2_sample_info_new (); *newinfo = *sample_info; return (newinfo); } /** * ipatch_dls2_sample_info_init: * @sample_info: Sample info structure to initialize * * Initialize a sample info structure to defaults. */ void ipatch_dls2_sample_info_init (IpatchDLS2SampleInfo *sample_info) { g_return_if_fail (sample_info != NULL); memset (sample_info, 0, sizeof (IpatchDLS2SampleInfo)); sample_info->root_note = 60; } /** * ipatch_dls2_sample_info_install_class_properties: * @obj_class: GObjectClass to install properties for * * Installs sample info properties for the given @obj_class. Useful for * objects that implement #IpatchDLS2SampleInfo properties. */ void ipatch_dls2_sample_info_install_class_properties (GObjectClass *obj_class) { ClassPropBag *bag; /* add new bag to cache pspecs for this class */ bag = g_new (ClassPropBag, 1); bag->klass = obj_class; info_pspec_list = g_slist_append (info_pspec_list, bag); /* properties defined by IpatchSample interface */ bag->pspecs[0] = ipatch_sample_install_property (obj_class, PROP_LOOP_TYPE, "loop-type"); bag->pspecs[1] = ipatch_sample_install_property (obj_class, PROP_LOOP_START, "loop-start"); bag->pspecs[2] = ipatch_sample_install_property (obj_class, PROP_LOOP_END, "loop-end"); bag->pspecs[3] = ipatch_sample_install_property (obj_class, PROP_ROOT_NOTE, "root-note"); bag->pspecs[4] = ipatch_sample_install_property (obj_class, PROP_FINE_TUNE, "fine-tune"); bag->pspecs[5] = g_param_spec_flags ("flags", _("Sample flags"), _("Sample flags"), IPATCH_TYPE_DLS2_SAMPLE_FLAGS, 0, G_PARAM_READWRITE); g_object_class_install_property (obj_class, PROP_FLAGS, bag->pspecs[5]); bag->pspecs[6] = g_param_spec_int ("gain", _("Gain"), _("Gain in DLS relative gain units"), G_MININT, G_MAXINT, 0, G_PARAM_READWRITE); g_object_class_install_property (obj_class, PROP_GAIN, bag->pspecs[6]); } /** * ipatch_dls2_sample_info_is_property_id_valid: * @property_id: Property ID to test * * Check if a property ID is a valid sample info property ID. * * Returns: %TRUE if property_id is a sample info property ID, %FALSE otherwise. */ gboolean ipatch_dls2_sample_info_is_property_id_valid (guint property_id) { return (property_id == PROP_FLAGS || property_id == PROP_LOOP_TYPE || property_id == PROP_ROOT_NOTE || property_id == PROP_FINE_TUNE || property_id == PROP_GAIN || property_id == PROP_LOOP_START || property_id == PROP_LOOP_END); } /** * ipatch_dls2_sample_info_set_property: * @sample_info: Pointer to pointer to sample info * @property_id: Property ID * @value: Value for property * * A function used by set_property methods that implement #IpatchDLS2SampleInfo * properties. * * Returns: %TRUE if property_id was handled, %FALSE otherwise */ gboolean ipatch_dls2_sample_info_set_property (IpatchDLS2SampleInfo **sample_info, guint property_id, const GValue *value) { IpatchDLS2SampleInfo *saminfo; if (!*sample_info) { if (property_id != PROP_FLAGS && property_id != PROP_LOOP_TYPE && property_id != PROP_ROOT_NOTE && property_id != PROP_FINE_TUNE && property_id != PROP_GAIN && property_id != PROP_LOOP_START && property_id != PROP_LOOP_END) return (FALSE); *sample_info = ipatch_dls2_sample_info_new (); } saminfo = *sample_info; switch (property_id) { case PROP_FLAGS: saminfo->options &= ~IPATCH_DLS2_SAMPLE_FLAGS_MASK; saminfo->options |= g_value_get_flags (value) & IPATCH_DLS2_SAMPLE_FLAGS_MASK; break; case PROP_LOOP_TYPE: saminfo->options &= ~IPATCH_DLS2_SAMPLE_LOOP_MASK; saminfo->options |= g_value_get_enum (value) & IPATCH_DLS2_SAMPLE_LOOP_MASK; break; case PROP_ROOT_NOTE: saminfo->root_note = g_value_get_int (value); break; case PROP_FINE_TUNE: saminfo->fine_tune = g_value_get_int (value); break; case PROP_GAIN: saminfo->gain = g_value_get_int (value); break; case PROP_LOOP_START: saminfo->loop_start = g_value_get_uint (value); break; case PROP_LOOP_END: saminfo->loop_end = g_value_get_uint (value); break; default: return (FALSE); } return (TRUE); } /** * ipatch_dls2_sample_info_get_property: * @sample_info: Pointer to sample info * @property_id: Property ID * @value: Value to set * * A function used by get_property methods that implement #IpatchDLS2SampleInfo * properties. * * Returns: %TRUE if property_id was handled, %FALSE otherwise */ gboolean ipatch_dls2_sample_info_get_property (IpatchDLS2SampleInfo *sample_info, guint property_id, GValue *value) { switch (property_id) { case PROP_FLAGS: g_value_set_flags (value, sample_info ? (sample_info->options & IPATCH_DLS2_SAMPLE_FLAGS_MASK) : 0); break; case PROP_LOOP_TYPE: g_value_set_enum (value, sample_info ? (sample_info->options & IPATCH_DLS2_SAMPLE_LOOP_MASK) : IPATCH_SAMPLE_LOOP_NONE); break; case PROP_ROOT_NOTE: g_value_set_int (value, sample_info ? sample_info->root_note : 60); break; case PROP_FINE_TUNE: g_value_set_int (value, sample_info ? sample_info->fine_tune : 0); break; case PROP_GAIN: g_value_set_int (value, sample_info ? sample_info->gain : 0); break; case PROP_LOOP_START: g_value_set_uint (value, sample_info ? sample_info->loop_start : 0); break; case PROP_LOOP_END: g_value_set_uint (value, sample_info ? sample_info->loop_end : 0); break; default: return (FALSE); } return (TRUE); } /** * ipatch_dls2_sample_info_notify_changes: * @item: Item to send #IpatchItem property notifies on * @newinfo: New sample info values * @oldinfo: Old sample info values * * Sends #IpatchItem property notifies for changed sample info parameters. */ void ipatch_dls2_sample_info_notify_changes (IpatchItem *item, IpatchDLS2SampleInfo *newinfo, IpatchDLS2SampleInfo *oldinfo) { GParamSpec **found_pspec_cache = NULL; GObjectClass *klass; GValue newval = { 0 }, oldval = { 0 }; GSList *p; g_return_if_fail (IPATCH_IS_ITEM (item)); klass = G_OBJECT_GET_CLASS (item); /* search for param spec cache for object's class */ for (p = info_pspec_list; p; p = p->next) { if (((ClassPropBag *)(p->data))->klass == klass) { found_pspec_cache = ((ClassPropBag *)(p->data))->pspecs; break; } } g_return_if_fail (found_pspec_cache); if ((oldinfo->options & IPATCH_DLS2_SAMPLE_LOOP_MASK) != (newinfo->options & IPATCH_DLS2_SAMPLE_LOOP_MASK)) { g_value_init (&newval, IPATCH_TYPE_SAMPLE_LOOP_TYPE); g_value_init (&oldval, IPATCH_TYPE_SAMPLE_LOOP_TYPE); g_value_set_flags (&newval, newinfo->options & IPATCH_DLS2_SAMPLE_LOOP_MASK); g_value_set_flags (&oldval, oldinfo->options & IPATCH_DLS2_SAMPLE_LOOP_MASK); ipatch_item_prop_notify (item, found_pspec_cache[0], &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } if ((oldinfo->options & IPATCH_DLS2_SAMPLE_FLAGS_MASK) != (newinfo->options & IPATCH_DLS2_SAMPLE_FLAGS_MASK)) { g_value_init (&newval, IPATCH_TYPE_DLS2_SAMPLE_FLAGS); g_value_init (&oldval, IPATCH_TYPE_DLS2_SAMPLE_FLAGS); g_value_set_flags (&newval, newinfo->options & IPATCH_DLS2_SAMPLE_FLAGS_MASK); g_value_set_flags (&oldval, oldinfo->options & IPATCH_DLS2_SAMPLE_FLAGS_MASK); ipatch_item_prop_notify (item, found_pspec_cache[1], &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } if (oldinfo->root_note != newinfo->root_note) { g_value_init (&newval, G_TYPE_INT); g_value_init (&oldval, G_TYPE_INT); g_value_set_flags (&newval, newinfo->root_note); g_value_set_flags (&oldval, oldinfo->root_note); ipatch_item_prop_notify (item, found_pspec_cache[2], &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } if (oldinfo->fine_tune != newinfo->fine_tune) { g_value_init (&newval, G_TYPE_INT); g_value_init (&oldval, G_TYPE_INT); g_value_set_flags (&newval, newinfo->fine_tune); g_value_set_flags (&oldval, oldinfo->fine_tune); ipatch_item_prop_notify (item, found_pspec_cache[3], &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } if (oldinfo->gain != newinfo->gain) { g_value_init (&newval, G_TYPE_INT); g_value_init (&oldval, G_TYPE_INT); g_value_set_flags (&newval, newinfo->gain); g_value_set_flags (&oldval, oldinfo->gain); ipatch_item_prop_notify (item, found_pspec_cache[4], &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } if (oldinfo->loop_start != newinfo->loop_start) { g_value_init (&newval, G_TYPE_UINT); g_value_init (&oldval, G_TYPE_UINT); g_value_set_flags (&newval, newinfo->loop_start); g_value_set_flags (&oldval, oldinfo->loop_start); ipatch_item_prop_notify (item, found_pspec_cache[5], &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } if (oldinfo->loop_end != newinfo->loop_end) { g_value_init (&newval, G_TYPE_UINT); g_value_init (&oldval, G_TYPE_UINT); g_value_set_flags (&newval, newinfo->loop_end); g_value_set_flags (&oldval, oldinfo->loop_end); ipatch_item_prop_notify (item, found_pspec_cache[6], &newval, &oldval); g_value_unset (&newval); g_value_unset (&oldval); } } libinstpatch-1.0.0/libinstpatch/IpatchParamProp.c0000644000175000017500000003345611461363564017023 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include #include "IpatchParamProp.h" #include "i18n.h" static void param_list_properties_GHFunc (gpointer key, gpointer value, gpointer user_data); static void param_set_property (GParamSpec *spec, GParamSpec *prop_spec, const GValue *value); static void param_value_destroy_notify (gpointer user_data); static gboolean param_get_property (GParamSpec *spec, GParamSpec *prop_spec, GValue *value); G_LOCK_DEFINE_STATIC (param_prop_hash); /* GParamSpec GValue property hash */ static GHashTable *param_prop_hash = NULL; /* initialize parameter/unit system */ void _ipatch_param_init (void) { param_prop_hash = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_param_spec_unref); /* install string length property */ ipatch_param_install_property (g_param_spec_uint ("string-max-length", _("Max Length"), _("Max string length (0=no limit)"), 0, G_MAXUINT, 0, G_PARAM_READWRITE)); /* install floating point digits property */ ipatch_param_install_property (g_param_spec_uint ("float-digits", _("Float Digits"), _("Significant decimal digits"), 0, 64, 2, G_PARAM_READWRITE)); /* install unique group ID property */ ipatch_param_install_property (g_param_spec_uint ("unique-group-id", _("Unique group ID"), _("For grouping multiple unique properties"), 0, G_MAXUINT, 0, G_PARAM_READWRITE)); /* install unit type property */ ipatch_param_install_property (g_param_spec_uint ("unit-type", _("Units"), _("Type of units used"), 0, G_MAXUINT, 0, G_PARAM_READWRITE)); } /** * ipatch_param_install_property: * @prop_spec: Specification for the new #GParamSpec property. Ownership * of the GParamSpec is taken over by this function. The name field of * the GParamSpec should be a static string and is used as the property's * ID. * * Install a new #GParamSpec property which can be used to extend existing * #GParamSpec types or define common parameters shared by all types. An * example property is the "string-max-length" property which defines a * max length for use with #GParamSpecString properties. */ void ipatch_param_install_property (GParamSpec *prop_spec) { GQuark quark; g_return_if_fail (G_IS_PARAM_SPEC (prop_spec)); g_return_if_fail (prop_spec->name != NULL); /* take ownership of the parameter spec */ g_param_spec_ref (prop_spec); g_param_spec_sink (prop_spec); quark = g_quark_from_static_string (prop_spec->name); G_LOCK (param_prop_hash); g_hash_table_insert (param_prop_hash, GUINT_TO_POINTER (quark), prop_spec); G_UNLOCK (param_prop_hash); } /** * ipatch_param_find_property: * @name: Name of GParamSpec property * * Lookup a GParamSpec property by name. * * Returns: The matching GParamSpec or %NULL if not found. The GParamSpec is * internal and should NOT be modified or freed. */ GParamSpec * ipatch_param_find_property (const char *name) { GParamSpec *spec; GQuark quark; g_return_val_if_fail (name != NULL, NULL); quark = g_quark_try_string (name); if (!quark) return (NULL); G_LOCK (param_prop_hash); spec = g_hash_table_lookup (param_prop_hash, GUINT_TO_POINTER (quark)); G_UNLOCK (param_prop_hash); return (spec); } /** * ipatch_param_list_properties: * @n_properties: Output: Length of returned array * * Get a list of all registered GParamSpec properties. * * Returns: An array of GParamSpecs which should be freed when finished. */ GParamSpec ** ipatch_param_list_properties (guint *n_properties) { GParamSpec **specs, **specp; g_return_val_if_fail (n_properties != NULL, NULL); G_LOCK (param_prop_hash); specs = g_new (GParamSpec *, g_hash_table_size (param_prop_hash)); specp = specs; g_hash_table_foreach (param_prop_hash, param_list_properties_GHFunc, &specp); G_UNLOCK (param_prop_hash); return (specs); } static void param_list_properties_GHFunc (gpointer key, gpointer value, gpointer user_data) { GParamSpec ***specs = user_data; **specs = (GParamSpec *)value; *specs = *specs + 1; } /** * ipatch_param_set: * @spec: Parameter spec to set extended properties of * @first_property_name: Name of first property to set * @Varargs: Value of first property to set and optionally followed by more * property name/value pairs, terminated with %NULL name. * * Set extended parameter properties. Parameter properties are used to * extend existing #GParamSpec types. "string-max-length" is an example of * an extended property, which is used for #GParamSpecString parameters to * define the max allowed length. * * Returns: The @spec pointer for convenience, makes it easy to create/install * a parameter spec and set its properties at the same time. */ GParamSpec * ipatch_param_set (GParamSpec *spec, const char *first_property_name, ...) { va_list args; va_start (args, first_property_name); ipatch_param_set_valist (spec, first_property_name, args); va_end (args); return (spec); } /** * ipatch_param_set_valist: * @spec: Parameter spec to set extended properties of * @first_property_name: Name of first property to set * @args: Value of first property to set and optionally followed by more * property name/value pairs, terminated with %NULL name. * * Like ipatch_param_set() but uses a va_list. */ void ipatch_param_set_valist (GParamSpec *spec, const char *first_property_name, va_list args) { const char *name; GValue value = { 0, }; gchar *error = NULL; GParamSpec *prop_spec; g_return_if_fail (G_IS_PARAM_SPEC (spec)); g_return_if_fail (first_property_name != NULL); name = first_property_name; while (name) { prop_spec = ipatch_param_find_property (name); if (!prop_spec) { g_warning ("%s: no parameter property named `%s'", G_STRLOC, name); break; } if (!(prop_spec->flags & G_PARAM_WRITABLE)) { g_warning ("%s: parameter property `%s' is not writable", G_STRLOC, prop_spec->name); break; } g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop_spec)); G_VALUE_COLLECT (&value, args, 0, &error); if (error) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); /* we purposely leak the value here, it might not be * in a sane state if an error condition occured */ break; } param_set_property (spec, prop_spec, &value); g_value_unset (&value); name = va_arg (args, char *); } } /** * ipatch_param_set_property: * @spec: Parameter spec to set an extended property of * @property_name: Name of property to set * @value: Value to set the the property to. The value's * type must be the same as the parameter property's type. * * Set a single extended parameter property of a #GParamSpec. */ void ipatch_param_set_property (GParamSpec *spec, const char *property_name, const GValue *value) { GParamSpec *prop_spec; g_return_if_fail (G_IS_PARAM_SPEC (spec)); g_return_if_fail (property_name != NULL); g_return_if_fail (G_IS_VALUE (value)); prop_spec = ipatch_param_find_property (property_name); if (!prop_spec) { g_warning ("%s: no parameter property named `%s'", G_STRLOC, property_name); return; } if (!(prop_spec->flags & G_PARAM_WRITABLE)) { g_warning ("%s: parameter property `%s' is not writable", G_STRLOC, property_name); return; } if (G_VALUE_TYPE (value) != G_PARAM_SPEC_VALUE_TYPE (prop_spec)) { g_warning ("%s: value type should be '%s' but is '%s'", G_STRLOC, g_type_name (G_PARAM_SPEC_VALUE_TYPE (prop_spec)), G_VALUE_TYPE_NAME (value)); return; } param_set_property (spec, prop_spec, value); } /* does the actual setting of a GParamSpec GValue property */ static void param_set_property (GParamSpec *spec, GParamSpec *prop_spec, const GValue *value) { GQuark quark; GValue *newval; quark = g_quark_try_string (prop_spec->name); g_return_if_fail (quark != 0); /* duplicate the GValue */ newval = g_new0 (GValue, 1); g_value_init (newval, G_VALUE_TYPE (value)); g_value_copy (value, newval); /* set the GParamSpec property with a destroy notify to free the value if the property gets set again */ g_param_spec_set_qdata_full (spec, quark, newval, (GDestroyNotify)param_value_destroy_notify); } /* destroy notify for GParamSpec extended GValue properties */ static void param_value_destroy_notify (gpointer user_data) { GValue *value = (GValue *)user_data; g_value_unset (value); g_free (value); } /** * ipatch_param_get: * @spec: Parameter spec to get extended properties from * @first_property_name: Name of first property to get * @Varargs: Pointer to store first property value and optionally followed * by more property name/value pairs, terminated with %NULL name. * * Get extended parameter properties. Parameter properties are used to * extend existing #GParamSpec types. "string-max-length" is an example of * an extended property, which is used for #GParamSpecString parameters to * define the max allowed length. */ void ipatch_param_get (GParamSpec *spec, const char *first_property_name, ...) { va_list args; va_start (args, first_property_name); ipatch_param_get_valist (spec, first_property_name, args); va_end (args); } /** * ipatch_param_get_valist: * @spec: Parameter spec to get extended properties from * @first_property_name: Name of first property to get * @args: Pointer to store first property value and optionally followed * by more property name/value pairs, terminated with %NULL name. * * Like ipatch_param_get() but uses a va_list. */ void ipatch_param_get_valist (GParamSpec *spec, const char *first_property_name, va_list args) { const char *name; g_return_if_fail (G_IS_PARAM_SPEC (spec)); g_return_if_fail (first_property_name != NULL); name = first_property_name; while (name) { GValue value = { 0, }; GParamSpec *prop_spec; char *error; prop_spec = ipatch_param_find_property (name); if (!prop_spec) { g_warning ("%s: no parameter property named `%s'", G_STRLOC, name); break; } if (!(prop_spec->flags & G_PARAM_READABLE)) { g_warning ("%s: parameter property `%s' is not readable", G_STRLOC, prop_spec->name); break; } g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop_spec)); param_get_property (spec, prop_spec, &value); G_VALUE_LCOPY (&value, args, 0, &error); if (error) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); g_value_unset (&value); break; } g_value_unset (&value); name = va_arg (args, char *); } } /** * ipatch_param_get_property: * @spec: Parameter spec to get an extended property from * @property_name: Name of property to get * @value: An initialized value to store the property value in. The value's * type must be a type that the property can be transformed to. * * Get a single extended parameter property from a #GParamSpec. * * Returns: %TRUE if the parameter property is set, %FALSE otherwise (in which * case @value will contain the default value for this property). */ gboolean ipatch_param_get_property (GParamSpec *spec, const char *property_name, GValue *value) { GParamSpec *prop_spec; gboolean retval = FALSE; g_return_val_if_fail (G_IS_PARAM_SPEC (spec), FALSE); g_return_val_if_fail (property_name != NULL, FALSE); g_return_val_if_fail (G_IS_VALUE (value), FALSE); prop_spec = ipatch_param_find_property (property_name); if (!prop_spec) g_warning ("%s: no parameter property named `%s'", G_STRLOC, property_name); else if (!(prop_spec->flags & G_PARAM_READABLE)) g_warning ("%s: parameter property `%s' is not readable", G_STRLOC, prop_spec->name); else { GValue *prop_value, tmp_value = { 0, }; /* auto-conversion of the callers value type */ if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (prop_spec)) { g_value_reset (value); prop_value = value; } else if (!g_value_type_transformable (G_PARAM_SPEC_VALUE_TYPE (prop_spec), G_VALUE_TYPE (value))) { g_warning ("can't retrieve parameter property `%s' of type" " `%s' as value of type `%s'", prop_spec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (prop_spec)), G_VALUE_TYPE_NAME (value)); return (FALSE); } else { g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (prop_spec)); prop_value = &tmp_value; } retval = param_get_property (spec, prop_spec, prop_value); if (prop_value != value) { g_value_transform (prop_value, value); g_value_unset (&tmp_value); } } return (retval); } /* does the actual getting of a GParamSpec GValue property */ static gboolean param_get_property (GParamSpec *spec, GParamSpec *prop_spec, GValue *value) { GQuark quark; GValue *getval; quark = g_quark_try_string (prop_spec->name); g_return_val_if_fail (quark != 0, FALSE); getval = g_param_spec_get_qdata (spec, quark); if (!getval) g_param_value_set_default (prop_spec, value); else g_value_copy (getval, value); return (getval != NULL); } libinstpatch-1.0.0/libinstpatch/IpatchDLSWriter.h0000644000175000017500000000554711461332142016732 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchDLSWriter * @short_description: DLS instrument file writer * @see_also: #IpatchDLS * @stability: Stable * * Writes a DLS instrument object tree (#IpatchDLS) to a DLS file. */ #ifndef __IPATCH_DLS_WRITER_H__ #define __IPATCH_DLS_WRITER_H__ #include #include #include #include typedef struct _IpatchDLSWriter IpatchDLSWriter; /* private structure */ typedef struct _IpatchDLSWriterClass IpatchDLSWriterClass; #define IPATCH_TYPE_DLS_WRITER (ipatch_dls_writer_get_type ()) #define IPATCH_DLS_WRITER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_DLS_WRITER, \ IpatchDLSWriter)) #define IPATCH_DLS_WRITER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_DLS_WRITER, \ IpatchDLSWriterClass)) #define IPATCH_IS_DLS_WRITER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_DLS_WRITER)) #define IPATCH_IS_DLS_WRITER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_DLS_WRITER)) /* DLS writer object */ struct _IpatchDLSWriter { IpatchRiff parent_instance; /* derived from IpatchRiff */ IpatchDLS2 *orig_dls; /* original DLS object */ IpatchDLS2 *dls; /* duplicated DLS object to save */ gboolean is_gig; /* set to TRUE if saving a GigaSampler file */ GHashTable *sample_hash; /* IpatchDLS2Sample -> sample_array index + 1 */ guint32 *sample_ofstbl; /* sample index -> file offset table */ guint sample_count; /* count of samples */ guint32 ptbl_pos; /* pool table position in file - for later fixup */ }; /* DLS writer class */ struct _IpatchDLSWriterClass { IpatchRiffClass parent_class; }; GType ipatch_dls_writer_get_type (void); IpatchDLSWriter *ipatch_dls_writer_new (IpatchFileHandle *handle, IpatchDLS2 *dls); void ipatch_dls_writer_set_patch (IpatchDLSWriter *writer, IpatchDLS2 *dls); void ipatch_dls_writer_set_file_handle (IpatchDLSWriter *writer, IpatchFileHandle *handle); gboolean ipatch_dls_writer_save (IpatchDLSWriter *writer, GError **err); #endif libinstpatch-1.0.0/libinstpatch/builtin_enums.c0000644000175000017500000016622611461404253016637 00000000000000 /* Generated data (by glib-mkenums) */ #include "libinstpatch.h" #include "ipatch_priv.h" /* enumerations from "IpatchBase.h" */ GType ipatch_base_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_BASE_CHANGED, "IPATCH_BASE_CHANGED", "changed" }, { IPATCH_BASE_SAVED, "IPATCH_BASE_SAVED", "saved" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchBaseFlags", values); } return etype; } /* enumerations from "IpatchConverter.h" */ GType ipatch_converter_log_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_CONVERTER_LOG_RATING, "IPATCH_CONVERTER_LOG_RATING", "rating" }, { IPATCH_CONVERTER_LOG_INFO, "IPATCH_CONVERTER_LOG_INFO", "info" }, { IPATCH_CONVERTER_LOG_WARN, "IPATCH_CONVERTER_LOG_WARN", "warn" }, { IPATCH_CONVERTER_LOG_CRITICAL, "IPATCH_CONVERTER_LOG_CRITICAL", "critical" }, { IPATCH_CONVERTER_LOG_FATAL, "IPATCH_CONVERTER_LOG_FATAL", "fatal" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchConverterLogType", values); } return etype; } GType ipatch_converter_count_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_CONVERTER_COUNT_ONE_OR_MORE, "IPATCH_CONVERTER_COUNT_ONE_OR_MORE", "one-or-more" }, { IPATCH_CONVERTER_COUNT_ZERO_OR_MORE, "IPATCH_CONVERTER_COUNT_ZERO_OR_MORE", "zero-or-more" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchConverterCount", values); } return etype; } GType ipatch_converter_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_CONVERTER_FLAG_SRC_DERIVED, "IPATCH_CONVERTER_FLAG_SRC_DERIVED", "derived" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchConverterFlags", values); } return etype; } GType ipatch_converter_priority_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_CONVERTER_PRIORITY_LOWEST, "IPATCH_CONVERTER_PRIORITY_LOWEST", "lowest" }, { IPATCH_CONVERTER_PRIORITY_LOW, "IPATCH_CONVERTER_PRIORITY_LOW", "low" }, { IPATCH_CONVERTER_PRIORITY_DEFAULT, "IPATCH_CONVERTER_PRIORITY_DEFAULT", "default" }, { IPATCH_CONVERTER_PRIORITY_HIGH, "IPATCH_CONVERTER_PRIORITY_HIGH", "high" }, { IPATCH_CONVERTER_PRIORITY_HIGHEST, "IPATCH_CONVERTER_PRIORITY_HIGHEST", "highest" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchConverterPriority", values); } return etype; } /* enumerations from "IpatchDLS2Conn.h" */ GType ipatch_dls2_conn_src_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_DLS2_CONN_SRC_NONE, "IPATCH_DLS2_CONN_SRC_NONE", "none" }, { IPATCH_DLS2_CONN_SRC_LFO, "IPATCH_DLS2_CONN_SRC_LFO", "lfo" }, { IPATCH_DLS2_CONN_SRC_VELOCITY, "IPATCH_DLS2_CONN_SRC_VELOCITY", "velocity" }, { IPATCH_DLS2_CONN_SRC_NOTE, "IPATCH_DLS2_CONN_SRC_NOTE", "note" }, { IPATCH_DLS2_CONN_SRC_EG1, "IPATCH_DLS2_CONN_SRC_EG1", "eg1" }, { IPATCH_DLS2_CONN_SRC_EG2, "IPATCH_DLS2_CONN_SRC_EG2", "eg2" }, { IPATCH_DLS2_CONN_SRC_PITCH_WHEEL, "IPATCH_DLS2_CONN_SRC_PITCH_WHEEL", "pitch-wheel" }, { IPATCH_DLS2_CONN_SRC_POLY_PRESSURE, "IPATCH_DLS2_CONN_SRC_POLY_PRESSURE", "poly-pressure" }, { IPATCH_DLS2_CONN_SRC_CHANNEL_PRESSURE, "IPATCH_DLS2_CONN_SRC_CHANNEL_PRESSURE", "channel-pressure" }, { IPATCH_DLS2_CONN_SRC_VIBRATO, "IPATCH_DLS2_CONN_SRC_VIBRATO", "vibrato" }, { IPATCH_DLS2_CONN_SRC_CC1, "IPATCH_DLS2_CONN_SRC_CC1", "cc1" }, { IPATCH_DLS2_CONN_SRC_CC7, "IPATCH_DLS2_CONN_SRC_CC7", "cc7" }, { IPATCH_DLS2_CONN_SRC_CC10, "IPATCH_DLS2_CONN_SRC_CC10", "cc10" }, { IPATCH_DLS2_CONN_SRC_CC11, "IPATCH_DLS2_CONN_SRC_CC11", "cc11" }, { IPATCH_DLS2_CONN_SRC_CC91, "IPATCH_DLS2_CONN_SRC_CC91", "cc91" }, { IPATCH_DLS2_CONN_SRC_CC93, "IPATCH_DLS2_CONN_SRC_CC93", "cc93" }, { IPATCH_DLS2_CONN_SRC_RPN0, "IPATCH_DLS2_CONN_SRC_RPN0", "rpn0" }, { IPATCH_DLS2_CONN_SRC_RPN1, "IPATCH_DLS2_CONN_SRC_RPN1", "rpn1" }, { IPATCH_DLS2_CONN_SRC_RPN2, "IPATCH_DLS2_CONN_SRC_RPN2", "rpn2" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchDLS2ConnSrcType", values); } return etype; } GType ipatch_dls2_conn_dest_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_DLS2_CONN_DEST_NONE, "IPATCH_DLS2_CONN_DEST_NONE", "none" }, { IPATCH_DLS2_CONN_DEST_GAIN, "IPATCH_DLS2_CONN_DEST_GAIN", "gain" }, { IPATCH_DLS2_CONN_DEST_RESERVED, "IPATCH_DLS2_CONN_DEST_RESERVED", "reserved" }, { IPATCH_DLS2_CONN_DEST_PITCH, "IPATCH_DLS2_CONN_DEST_PITCH", "pitch" }, { IPATCH_DLS2_CONN_DEST_PAN, "IPATCH_DLS2_CONN_DEST_PAN", "pan" }, { IPATCH_DLS2_CONN_DEST_NOTE, "IPATCH_DLS2_CONN_DEST_NOTE", "note" }, { IPATCH_DLS2_CONN_DEST_LEFT, "IPATCH_DLS2_CONN_DEST_LEFT", "left" }, { IPATCH_DLS2_CONN_DEST_RIGHT, "IPATCH_DLS2_CONN_DEST_RIGHT", "right" }, { IPATCH_DLS2_CONN_DEST_CENTER, "IPATCH_DLS2_CONN_DEST_CENTER", "center" }, { IPATCH_DLS2_CONN_DEST_LFE_CHANNEL, "IPATCH_DLS2_CONN_DEST_LFE_CHANNEL", "lfe-channel" }, { IPATCH_DLS2_CONN_DEST_LEFT_REAR, "IPATCH_DLS2_CONN_DEST_LEFT_REAR", "left-rear" }, { IPATCH_DLS2_CONN_DEST_RIGHT_REAR, "IPATCH_DLS2_CONN_DEST_RIGHT_REAR", "right-rear" }, { IPATCH_DLS2_CONN_DEST_CHORUS, "IPATCH_DLS2_CONN_DEST_CHORUS", "chorus" }, { IPATCH_DLS2_CONN_DEST_REVERB, "IPATCH_DLS2_CONN_DEST_REVERB", "reverb" }, { IPATCH_DLS2_CONN_DEST_LFO_FREQ, "IPATCH_DLS2_CONN_DEST_LFO_FREQ", "lfo-freq" }, { IPATCH_DLS2_CONN_DEST_LFO_DELAY, "IPATCH_DLS2_CONN_DEST_LFO_DELAY", "lfo-delay" }, { IPATCH_DLS2_CONN_DEST_VIB_FREQ, "IPATCH_DLS2_CONN_DEST_VIB_FREQ", "vib-freq" }, { IPATCH_DLS2_CONN_DEST_VIB_DELAY, "IPATCH_DLS2_CONN_DEST_VIB_DELAY", "vib-delay" }, { IPATCH_DLS2_CONN_DEST_EG1_ATTACK, "IPATCH_DLS2_CONN_DEST_EG1_ATTACK", "eg1-attack" }, { IPATCH_DLS2_CONN_DEST_EG1_DECAY, "IPATCH_DLS2_CONN_DEST_EG1_DECAY", "eg1-decay" }, { IPATCH_DLS2_CONN_DEST_EG1_RESERVED, "IPATCH_DLS2_CONN_DEST_EG1_RESERVED", "eg1-reserved" }, { IPATCH_DLS2_CONN_DEST_EG1_RELEASE, "IPATCH_DLS2_CONN_DEST_EG1_RELEASE", "eg1-release" }, { IPATCH_DLS2_CONN_DEST_EG1_SUSTAIN, "IPATCH_DLS2_CONN_DEST_EG1_SUSTAIN", "eg1-sustain" }, { IPATCH_DLS2_CONN_DEST_EG1_DELAY, "IPATCH_DLS2_CONN_DEST_EG1_DELAY", "eg1-delay" }, { IPATCH_DLS2_CONN_DEST_EG1_HOLD, "IPATCH_DLS2_CONN_DEST_EG1_HOLD", "eg1-hold" }, { IPATCH_DLS2_CONN_DEST_EG1_SHUTDOWN, "IPATCH_DLS2_CONN_DEST_EG1_SHUTDOWN", "eg1-shutdown" }, { IPATCH_DLS2_CONN_DEST_EG2_ATTACK, "IPATCH_DLS2_CONN_DEST_EG2_ATTACK", "eg2-attack" }, { IPATCH_DLS2_CONN_DEST_EG2_DECAY, "IPATCH_DLS2_CONN_DEST_EG2_DECAY", "eg2-decay" }, { IPATCH_DLS2_CONN_DEST_EG2_RESERVED, "IPATCH_DLS2_CONN_DEST_EG2_RESERVED", "eg2-reserved" }, { IPATCH_DLS2_CONN_DEST_EG2_RELEASE, "IPATCH_DLS2_CONN_DEST_EG2_RELEASE", "eg2-release" }, { IPATCH_DLS2_CONN_DEST_EG2_SUSTAIN, "IPATCH_DLS2_CONN_DEST_EG2_SUSTAIN", "eg2-sustain" }, { IPATCH_DLS2_CONN_DEST_EG2_DELAY, "IPATCH_DLS2_CONN_DEST_EG2_DELAY", "eg2-delay" }, { IPATCH_DLS2_CONN_DEST_EG2_HOLD, "IPATCH_DLS2_CONN_DEST_EG2_HOLD", "eg2-hold" }, { IPATCH_DLS2_CONN_DEST_FILTER_CUTOFF, "IPATCH_DLS2_CONN_DEST_FILTER_CUTOFF", "filter-cutoff" }, { IPATCH_DLS2_CONN_DEST_FILTER_Q, "IPATCH_DLS2_CONN_DEST_FILTER_Q", "filter-q" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchDLS2ConnDestType", values); } return etype; } GType ipatch_dls2_conn_transform_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_DLS2_CONN_TRANS_LINEAR, "IPATCH_DLS2_CONN_TRANS_LINEAR", "linear" }, { IPATCH_DLS2_CONN_TRANS_CONCAVE, "IPATCH_DLS2_CONN_TRANS_CONCAVE", "concave" }, { IPATCH_DLS2_CONN_TRANS_CONVEX, "IPATCH_DLS2_CONN_TRANS_CONVEX", "convex" }, { IPATCH_DLS2_CONN_TRANS_SWITCH, "IPATCH_DLS2_CONN_TRANS_SWITCH", "switch" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchDLS2ConnTransformType", values); } return etype; } GType ipatch_dls2_conn_polarity_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_DLS2_CONN_POLARITY_UNI, "IPATCH_DLS2_CONN_POLARITY_UNI", "uni" }, { IPATCH_DLS2_CONN_POLARITY_BI, "IPATCH_DLS2_CONN_POLARITY_BI", "bi" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchDLS2ConnPolarityType", values); } return etype; } GType ipatch_dls2_conn_transform_masks_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_DLS2_CONN_MASK_OUTPUT_TRANS, "IPATCH_DLS2_CONN_MASK_OUTPUT_TRANS", "output-trans" }, { IPATCH_DLS2_CONN_MASK_CTRLSRC_TRANS, "IPATCH_DLS2_CONN_MASK_CTRLSRC_TRANS", "ctrlsrc-trans" }, { IPATCH_DLS2_CONN_MASK_CTRLSRC_POLARITY, "IPATCH_DLS2_CONN_MASK_CTRLSRC_POLARITY", "ctrlsrc-polarity" }, { IPATCH_DLS2_CONN_MASK_CTRLSRC_INVERT, "IPATCH_DLS2_CONN_MASK_CTRLSRC_INVERT", "ctrlsrc-invert" }, { IPATCH_DLS2_CONN_MASK_SRC_TRANS, "IPATCH_DLS2_CONN_MASK_SRC_TRANS", "src-trans" }, { IPATCH_DLS2_CONN_MASK_SRC_POLARITY, "IPATCH_DLS2_CONN_MASK_SRC_POLARITY", "src-polarity" }, { IPATCH_DLS2_CONN_MASK_SRC_INVERT, "IPATCH_DLS2_CONN_MASK_SRC_INVERT", "src-invert" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchDLS2ConnTransformMasks", values); } return etype; } GType ipatch_dls2_conn_transform_shifts_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_DLS2_CONN_SHIFT_OUTPUT_TRANS, "IPATCH_DLS2_CONN_SHIFT_OUTPUT_TRANS", "output-trans" }, { IPATCH_DLS2_CONN_SHIFT_CTRLSRC_TRANS, "IPATCH_DLS2_CONN_SHIFT_CTRLSRC_TRANS", "ctrlsrc-trans" }, { IPATCH_DLS2_CONN_SHIFT_CTRLSRC_POLARITY, "IPATCH_DLS2_CONN_SHIFT_CTRLSRC_POLARITY", "ctrlsrc-polarity" }, { IPATCH_DLS2_CONN_SHIFT_CTRLSRC_INVERT, "IPATCH_DLS2_CONN_SHIFT_CTRLSRC_INVERT", "ctrlsrc-invert" }, { IPATCH_DLS2_CONN_SHIFT_SRC_TRANS, "IPATCH_DLS2_CONN_SHIFT_SRC_TRANS", "src-trans" }, { IPATCH_DLS2_CONN_SHIFT_SRC_POLARITY, "IPATCH_DLS2_CONN_SHIFT_SRC_POLARITY", "src-polarity" }, { IPATCH_DLS2_CONN_SHIFT_SRC_INVERT, "IPATCH_DLS2_CONN_SHIFT_SRC_INVERT", "src-invert" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchDLS2ConnTransformShifts", values); } return etype; } /* enumerations from "IpatchDLS2.h" */ GType ipatch_dls2_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_DLS2_VERSION_SET, "IPATCH_DLS2_VERSION_SET", "set" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchDLS2Flags", values); } return etype; } /* enumerations from "IpatchDLS2Info.h" */ GType ipatch_dls2_info_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_DLS2_ARCHIVE_LOCATION, "IPATCH_DLS2_ARCHIVE_LOCATION", "archive-location" }, { IPATCH_DLS2_ARTIST, "IPATCH_DLS2_ARTIST", "artist" }, { IPATCH_DLS2_COMMISSIONED, "IPATCH_DLS2_COMMISSIONED", "commissioned" }, { IPATCH_DLS2_COMMENT, "IPATCH_DLS2_COMMENT", "comment" }, { IPATCH_DLS2_COPYRIGHT, "IPATCH_DLS2_COPYRIGHT", "copyright" }, { IPATCH_DLS2_DATE, "IPATCH_DLS2_DATE", "date" }, { IPATCH_DLS2_ENGINEER, "IPATCH_DLS2_ENGINEER", "engineer" }, { IPATCH_DLS2_GENRE, "IPATCH_DLS2_GENRE", "genre" }, { IPATCH_DLS2_KEYWORDS, "IPATCH_DLS2_KEYWORDS", "keywords" }, { IPATCH_DLS2_MEDIUM, "IPATCH_DLS2_MEDIUM", "medium" }, { IPATCH_DLS2_NAME, "IPATCH_DLS2_NAME", "name" }, { IPATCH_DLS2_PRODUCT, "IPATCH_DLS2_PRODUCT", "product" }, { IPATCH_DLS2_SUBJECT, "IPATCH_DLS2_SUBJECT", "subject" }, { IPATCH_DLS2_SOFTWARE, "IPATCH_DLS2_SOFTWARE", "software" }, { IPATCH_DLS2_SOURCE, "IPATCH_DLS2_SOURCE", "source" }, { IPATCH_DLS2_SOURCE_FORM, "IPATCH_DLS2_SOURCE_FORM", "source-form" }, { IPATCH_DLS2_TECHNICIAN, "IPATCH_DLS2_TECHNICIAN", "technician" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchDLS2InfoType", values); } return etype; } /* enumerations from "IpatchDLS2Inst.h" */ GType ipatch_dls2_inst_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_DLS2_INST_PERCUSSION, "IPATCH_DLS2_INST_PERCUSSION", "percussion" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchDLS2InstFlags", values); } return etype; } /* enumerations from "IpatchDLS2Region.h" */ GType ipatch_dls2_param_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_DLS2_PARAM_MOD_LFO_FREQ, "IPATCH_DLS2_PARAM_MOD_LFO_FREQ", "mod-lfo-freq" }, { IPATCH_DLS2_PARAM_MOD_LFO_DELAY, "IPATCH_DLS2_PARAM_MOD_LFO_DELAY", "mod-lfo-delay" }, { IPATCH_DLS2_PARAM_VIB_LFO_FREQ, "IPATCH_DLS2_PARAM_VIB_LFO_FREQ", "vib-lfo-freq" }, { IPATCH_DLS2_PARAM_VIB_LFO_DELAY, "IPATCH_DLS2_PARAM_VIB_LFO_DELAY", "vib-lfo-delay" }, { IPATCH_DLS2_PARAM_VOL_EG_DELAY, "IPATCH_DLS2_PARAM_VOL_EG_DELAY", "vol-eg-delay" }, { IPATCH_DLS2_PARAM_VOL_EG_ATTACK, "IPATCH_DLS2_PARAM_VOL_EG_ATTACK", "vol-eg-attack" }, { IPATCH_DLS2_PARAM_VOL_EG_HOLD, "IPATCH_DLS2_PARAM_VOL_EG_HOLD", "vol-eg-hold" }, { IPATCH_DLS2_PARAM_VOL_EG_DECAY, "IPATCH_DLS2_PARAM_VOL_EG_DECAY", "vol-eg-decay" }, { IPATCH_DLS2_PARAM_VOL_EG_SUSTAIN, "IPATCH_DLS2_PARAM_VOL_EG_SUSTAIN", "vol-eg-sustain" }, { IPATCH_DLS2_PARAM_VOL_EG_RELEASE, "IPATCH_DLS2_PARAM_VOL_EG_RELEASE", "vol-eg-release" }, { IPATCH_DLS2_PARAM_VOL_EG_SHUTDOWN, "IPATCH_DLS2_PARAM_VOL_EG_SHUTDOWN", "vol-eg-shutdown" }, { IPATCH_DLS2_PARAM_VOL_EG_VELOCITY_TO_ATTACK, "IPATCH_DLS2_PARAM_VOL_EG_VELOCITY_TO_ATTACK", "vol-eg-velocity-to-attack" }, { IPATCH_DLS2_PARAM_VOL_EG_NOTE_TO_DECAY, "IPATCH_DLS2_PARAM_VOL_EG_NOTE_TO_DECAY", "vol-eg-note-to-decay" }, { IPATCH_DLS2_PARAM_VOL_EG_NOTE_TO_HOLD, "IPATCH_DLS2_PARAM_VOL_EG_NOTE_TO_HOLD", "vol-eg-note-to-hold" }, { IPATCH_DLS2_PARAM_MOD_EG_DELAY, "IPATCH_DLS2_PARAM_MOD_EG_DELAY", "mod-eg-delay" }, { IPATCH_DLS2_PARAM_MOD_EG_ATTACK, "IPATCH_DLS2_PARAM_MOD_EG_ATTACK", "mod-eg-attack" }, { IPATCH_DLS2_PARAM_MOD_EG_HOLD, "IPATCH_DLS2_PARAM_MOD_EG_HOLD", "mod-eg-hold" }, { IPATCH_DLS2_PARAM_MOD_EG_DECAY, "IPATCH_DLS2_PARAM_MOD_EG_DECAY", "mod-eg-decay" }, { IPATCH_DLS2_PARAM_MOD_EG_SUSTAIN, "IPATCH_DLS2_PARAM_MOD_EG_SUSTAIN", "mod-eg-sustain" }, { IPATCH_DLS2_PARAM_MOD_EG_RELEASE, "IPATCH_DLS2_PARAM_MOD_EG_RELEASE", "mod-eg-release" }, { IPATCH_DLS2_PARAM_MOD_EG_VELOCITY_TO_ATTACK, "IPATCH_DLS2_PARAM_MOD_EG_VELOCITY_TO_ATTACK", "mod-eg-velocity-to-attack" }, { IPATCH_DLS2_PARAM_MOD_EG_NOTE_TO_DECAY, "IPATCH_DLS2_PARAM_MOD_EG_NOTE_TO_DECAY", "mod-eg-note-to-decay" }, { IPATCH_DLS2_PARAM_MOD_EG_NOTE_TO_HOLD, "IPATCH_DLS2_PARAM_MOD_EG_NOTE_TO_HOLD", "mod-eg-note-to-hold" }, { IPATCH_DLS2_PARAM_SCALE_TUNE, "IPATCH_DLS2_PARAM_SCALE_TUNE", "scale-tune" }, { IPATCH_DLS2_PARAM_RPN2_TO_NOTE, "IPATCH_DLS2_PARAM_RPN2_TO_NOTE", "rpn2-to-note" }, { IPATCH_DLS2_PARAM_FILTER_CUTOFF, "IPATCH_DLS2_PARAM_FILTER_CUTOFF", "filter-cutoff" }, { IPATCH_DLS2_PARAM_FILTER_Q, "IPATCH_DLS2_PARAM_FILTER_Q", "filter-q" }, { IPATCH_DLS2_PARAM_MOD_LFO_TO_FILTER_CUTOFF, "IPATCH_DLS2_PARAM_MOD_LFO_TO_FILTER_CUTOFF", "mod-lfo-to-filter-cutoff" }, { IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_FILTER_CUTOFF, "IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_FILTER_CUTOFF", "mod-lfo-cc1-to-filter-cutoff" }, { IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_FILTER_CUTOFF, "IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_FILTER_CUTOFF", "mod-lfo-channel-press-to-filter-cutoff" }, { IPATCH_DLS2_PARAM_MOD_EG_TO_FILTER_CUTOFF, "IPATCH_DLS2_PARAM_MOD_EG_TO_FILTER_CUTOFF", "mod-eg-to-filter-cutoff" }, { IPATCH_DLS2_PARAM_VELOCITY_TO_FILTER_CUTOFF, "IPATCH_DLS2_PARAM_VELOCITY_TO_FILTER_CUTOFF", "velocity-to-filter-cutoff" }, { IPATCH_DLS2_PARAM_NOTE_TO_FILTER_CUTOFF, "IPATCH_DLS2_PARAM_NOTE_TO_FILTER_CUTOFF", "note-to-filter-cutoff" }, { IPATCH_DLS2_PARAM_MOD_LFO_TO_GAIN, "IPATCH_DLS2_PARAM_MOD_LFO_TO_GAIN", "mod-lfo-to-gain" }, { IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_GAIN, "IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_GAIN", "mod-lfo-cc1-to-gain" }, { IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_GAIN, "IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_GAIN", "mod-lfo-channel-press-to-gain" }, { IPATCH_DLS2_PARAM_VELOCITY_TO_GAIN, "IPATCH_DLS2_PARAM_VELOCITY_TO_GAIN", "velocity-to-gain" }, { IPATCH_DLS2_PARAM_CC7_TO_GAIN, "IPATCH_DLS2_PARAM_CC7_TO_GAIN", "cc7-to-gain" }, { IPATCH_DLS2_PARAM_CC11_TO_GAIN, "IPATCH_DLS2_PARAM_CC11_TO_GAIN", "cc11-to-gain" }, { IPATCH_DLS2_PARAM_TUNE, "IPATCH_DLS2_PARAM_TUNE", "tune" }, { IPATCH_DLS2_PARAM_PITCH_WHEEL_RPN0_TO_PITCH, "IPATCH_DLS2_PARAM_PITCH_WHEEL_RPN0_TO_PITCH", "pitch-wheel-rpn0-to-pitch" }, { IPATCH_DLS2_PARAM_NOTE_NUMBER_TO_PITCH, "IPATCH_DLS2_PARAM_NOTE_NUMBER_TO_PITCH", "note-number-to-pitch" }, { IPATCH_DLS2_PARAM_RPN1_TO_PITCH, "IPATCH_DLS2_PARAM_RPN1_TO_PITCH", "rpn1-to-pitch" }, { IPATCH_DLS2_PARAM_VIB_LFO_TO_PITCH, "IPATCH_DLS2_PARAM_VIB_LFO_TO_PITCH", "vib-lfo-to-pitch" }, { IPATCH_DLS2_PARAM_VIB_LFO_CC1_TO_PITCH, "IPATCH_DLS2_PARAM_VIB_LFO_CC1_TO_PITCH", "vib-lfo-cc1-to-pitch" }, { IPATCH_DLS2_PARAM_VIB_LFO_CHANNEL_PRESS_TO_PITCH, "IPATCH_DLS2_PARAM_VIB_LFO_CHANNEL_PRESS_TO_PITCH", "vib-lfo-channel-press-to-pitch" }, { IPATCH_DLS2_PARAM_MOD_LFO_TO_PITCH, "IPATCH_DLS2_PARAM_MOD_LFO_TO_PITCH", "mod-lfo-to-pitch" }, { IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_PITCH, "IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_PITCH", "mod-lfo-cc1-to-pitch" }, { IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_PITCH, "IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_PITCH", "mod-lfo-channel-press-to-pitch" }, { IPATCH_DLS2_PARAM_MOD_EG_TO_PITCH, "IPATCH_DLS2_PARAM_MOD_EG_TO_PITCH", "mod-eg-to-pitch" }, { IPATCH_DLS2_PARAM_PAN, "IPATCH_DLS2_PARAM_PAN", "pan" }, { IPATCH_DLS2_PARAM_CC10_TO_PAN, "IPATCH_DLS2_PARAM_CC10_TO_PAN", "cc10-to-pan" }, { IPATCH_DLS2_PARAM_CC91_TO_REVERB_SEND, "IPATCH_DLS2_PARAM_CC91_TO_REVERB_SEND", "cc91-to-reverb-send" }, { IPATCH_DLS2_PARAM_REVERB_SEND, "IPATCH_DLS2_PARAM_REVERB_SEND", "reverb-send" }, { IPATCH_DLS2_PARAM_CC93_TO_CHORUS_SEND, "IPATCH_DLS2_PARAM_CC93_TO_CHORUS_SEND", "cc93-to-chorus-send" }, { IPATCH_DLS2_PARAM_CHORUS_SEND, "IPATCH_DLS2_PARAM_CHORUS_SEND", "chorus-send" }, { IPATCH_DLS2_PARAM_COUNT, "IPATCH_DLS2_PARAM_COUNT", "count" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchDLS2Param", values); } return etype; } GType ipatch_dls2_region_channel_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_DLS2_REGION_CHANNEL_LEFT, "IPATCH_DLS2_REGION_CHANNEL_LEFT", "left" }, { IPATCH_DLS2_REGION_CHANNEL_RIGHT, "IPATCH_DLS2_REGION_CHANNEL_RIGHT", "right" }, { IPATCH_DLS2_REGION_CHANNEL_CENTER, "IPATCH_DLS2_REGION_CHANNEL_CENTER", "center" }, { IPATCH_DLS2_REGION_CHANNEL_LOW_FREQ, "IPATCH_DLS2_REGION_CHANNEL_LOW_FREQ", "low-freq" }, { IPATCH_DLS2_REGION_CHANNEL_SURROUND_LEFT, "IPATCH_DLS2_REGION_CHANNEL_SURROUND_LEFT", "surround-left" }, { IPATCH_DLS2_REGION_CHANNEL_SURROUND_RIGHT, "IPATCH_DLS2_REGION_CHANNEL_SURROUND_RIGHT", "surround-right" }, { IPATCH_DLS2_REGION_CHANNEL_LEFT_OF_CENTER, "IPATCH_DLS2_REGION_CHANNEL_LEFT_OF_CENTER", "left-of-center" }, { IPATCH_DLS2_REGION_CHANNEL_RIGHT_OF_CENTER, "IPATCH_DLS2_REGION_CHANNEL_RIGHT_OF_CENTER", "right-of-center" }, { IPATCH_DLS2_REGION_CHANNEL_SURROUND_CENTER, "IPATCH_DLS2_REGION_CHANNEL_SURROUND_CENTER", "surround-center" }, { IPATCH_DLS2_REGION_CHANNEL_SIDE_LEFT, "IPATCH_DLS2_REGION_CHANNEL_SIDE_LEFT", "side-left" }, { IPATCH_DLS2_REGION_CHANNEL_SIDE_RIGHT, "IPATCH_DLS2_REGION_CHANNEL_SIDE_RIGHT", "side-right" }, { IPATCH_DLS2_REGION_CHANNEL_TOP, "IPATCH_DLS2_REGION_CHANNEL_TOP", "top" }, { IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_LEFT, "IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_LEFT", "top-front-left" }, { IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_CENTER, "IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_CENTER", "top-front-center" }, { IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_RIGHT, "IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_RIGHT", "top-front-right" }, { IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_LEFT, "IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_LEFT", "top-rear-left" }, { IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_CENTER, "IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_CENTER", "top-rear-center" }, { IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_RIGHT, "IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_RIGHT", "top-rear-right" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchDLS2RegionChannelType", values); } return etype; } GType ipatch_dls2_region_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_DLS2_REGION_SELF_NON_EXCLUSIVE, "IPATCH_DLS2_REGION_SELF_NON_EXCLUSIVE", "self-non-exclusive" }, { IPATCH_DLS2_REGION_PHASE_MASTER, "IPATCH_DLS2_REGION_PHASE_MASTER", "phase-master" }, { IPATCH_DLS2_REGION_MULTI_CHANNEL, "IPATCH_DLS2_REGION_MULTI_CHANNEL", "multi-channel" }, { IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE, "IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE", "sample-info-override" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchDLS2RegionFlags", values); } return etype; } /* enumerations from "IpatchDLS2Sample.h" */ GType ipatch_dls2_sample_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_DLS2_SAMPLE_NO_TRUNCATION, "IPATCH_DLS2_SAMPLE_NO_TRUNCATION", "truncation" }, { IPATCH_DLS2_SAMPLE_NO_COMPRESSION, "IPATCH_DLS2_SAMPLE_NO_COMPRESSION", "compression" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchDLS2SampleFlags", values); } return etype; } /* enumerations from "IpatchDLSReader.h" */ GType ipatch_dls_reader_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_DLS_READER_ERROR_GIG, "IPATCH_DLS_READER_ERROR_GIG", "gig" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchDLSReaderError", values); } return etype; } /* enumerations from "IpatchFile.h" */ GType ipatch_file_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_FILE_FLAG_SWAP, "IPATCH_FILE_FLAG_SWAP", "swap" }, { IPATCH_FILE_FLAG_BIG_ENDIAN, "IPATCH_FILE_FLAG_BIG_ENDIAN", "big-endian" }, { IPATCH_FILE_FLAG_FREE_IOFUNCS, "IPATCH_FILE_FLAG_FREE_IOFUNCS", "free-iofuncs" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchFileFlags", values); } return etype; } GType ipatch_file_identify_order_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_FILE_IDENTIFY_ORDER_LAST, "IPATCH_FILE_IDENTIFY_ORDER_LAST", "last" }, { IPATCH_FILE_IDENTIFY_ORDER_DEFAULT, "IPATCH_FILE_IDENTIFY_ORDER_DEFAULT", "default" }, { IPATCH_FILE_IDENTIFY_ORDER_FIRST, "IPATCH_FILE_IDENTIFY_ORDER_FIRST", "first" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchFileIdentifyOrder", values); } return etype; } /* enumerations from "IpatchGigDimension.h" */ GType ipatch_gig_dimension_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_GIG_DIMENSION_NONE, "IPATCH_GIG_DIMENSION_NONE", "none" }, { IPATCH_GIG_DIMENSION_MOD_WHEEL, "IPATCH_GIG_DIMENSION_MOD_WHEEL", "mod-wheel" }, { IPATCH_GIG_DIMENSION_BREATH, "IPATCH_GIG_DIMENSION_BREATH", "breath" }, { IPATCH_GIG_DIMENSION_FOOT, "IPATCH_GIG_DIMENSION_FOOT", "foot" }, { IPATCH_GIG_DIMENSION_PORTAMENTO_TIME, "IPATCH_GIG_DIMENSION_PORTAMENTO_TIME", "portamento-time" }, { IPATCH_GIG_DIMENSION_EFFECT_1, "IPATCH_GIG_DIMENSION_EFFECT_1", "effect-1" }, { IPATCH_GIG_DIMENSION_EFFECT_2, "IPATCH_GIG_DIMENSION_EFFECT_2", "effect-2" }, { IPATCH_GIG_DIMENSION_GEN_PURPOSE_1, "IPATCH_GIG_DIMENSION_GEN_PURPOSE_1", "gen-purpose-1" }, { IPATCH_GIG_DIMENSION_GEN_PURPOSE_2, "IPATCH_GIG_DIMENSION_GEN_PURPOSE_2", "gen-purpose-2" }, { IPATCH_GIG_DIMENSION_GEN_PURPOSE_3, "IPATCH_GIG_DIMENSION_GEN_PURPOSE_3", "gen-purpose-3" }, { IPATCH_GIG_DIMENSION_GEN_PURPOSE_4, "IPATCH_GIG_DIMENSION_GEN_PURPOSE_4", "gen-purpose-4" }, { IPATCH_GIG_DIMENSION_SUSTAIN_PEDAL, "IPATCH_GIG_DIMENSION_SUSTAIN_PEDAL", "sustain-pedal" }, { IPATCH_GIG_DIMENSION_PORTAMENTO, "IPATCH_GIG_DIMENSION_PORTAMENTO", "portamento" }, { IPATCH_GIG_DIMENSION_SOSTENUTO, "IPATCH_GIG_DIMENSION_SOSTENUTO", "sostenuto" }, { IPATCH_GIG_DIMENSION_SOFT_PEDAL, "IPATCH_GIG_DIMENSION_SOFT_PEDAL", "soft-pedal" }, { IPATCH_GIG_DIMENSION_GEN_PURPOSE_5, "IPATCH_GIG_DIMENSION_GEN_PURPOSE_5", "gen-purpose-5" }, { IPATCH_GIG_DIMENSION_GEN_PURPOSE_6, "IPATCH_GIG_DIMENSION_GEN_PURPOSE_6", "gen-purpose-6" }, { IPATCH_GIG_DIMENSION_GEN_PURPOSE_7, "IPATCH_GIG_DIMENSION_GEN_PURPOSE_7", "gen-purpose-7" }, { IPATCH_GIG_DIMENSION_GEN_PURPOSE_8, "IPATCH_GIG_DIMENSION_GEN_PURPOSE_8", "gen-purpose-8" }, { IPATCH_GIG_DIMENSION_EFFECT_DEPTH_1, "IPATCH_GIG_DIMENSION_EFFECT_DEPTH_1", "effect-depth-1" }, { IPATCH_GIG_DIMENSION_EFFECT_DEPTH_2, "IPATCH_GIG_DIMENSION_EFFECT_DEPTH_2", "effect-depth-2" }, { IPATCH_GIG_DIMENSION_EFFECT_DEPTH_3, "IPATCH_GIG_DIMENSION_EFFECT_DEPTH_3", "effect-depth-3" }, { IPATCH_GIG_DIMENSION_EFFECT_DEPTH_4, "IPATCH_GIG_DIMENSION_EFFECT_DEPTH_4", "effect-depth-4" }, { IPATCH_GIG_DIMENSION_EFFECT_DEPTH_5, "IPATCH_GIG_DIMENSION_EFFECT_DEPTH_5", "effect-depth-5" }, { IPATCH_GIG_DIMENSION_CHANNEL, "IPATCH_GIG_DIMENSION_CHANNEL", "channel" }, { IPATCH_GIG_DIMENSION_LAYER, "IPATCH_GIG_DIMENSION_LAYER", "layer" }, { IPATCH_GIG_DIMENSION_VELOCITY, "IPATCH_GIG_DIMENSION_VELOCITY", "velocity" }, { IPATCH_GIG_DIMENSION_AFTER_TOUCH, "IPATCH_GIG_DIMENSION_AFTER_TOUCH", "after-touch" }, { IPATCH_GIG_DIMENSION_RELEASE_TRIG, "IPATCH_GIG_DIMENSION_RELEASE_TRIG", "release-trig" }, { IPATCH_GIG_DIMENSION_KEYBOARD, "IPATCH_GIG_DIMENSION_KEYBOARD", "keyboard" }, { IPATCH_GIG_DIMENSION_ROUND_ROBIN, "IPATCH_GIG_DIMENSION_ROUND_ROBIN", "round-robin" }, { IPATCH_GIG_DIMENSION_RANDOM, "IPATCH_GIG_DIMENSION_RANDOM", "random" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchGigDimensionType", values); } return etype; } /* enumerations from "IpatchGigEffects.h" */ GType ipatch_gig_filter_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_GIG_FILTER_LOWPASS, "IPATCH_GIG_FILTER_LOWPASS", "lowpass" }, { IPATCH_GIG_FILTER_BANDPASS, "IPATCH_GIG_FILTER_BANDPASS", "bandpass" }, { IPATCH_GIG_FILTER_HIGHPASS, "IPATCH_GIG_FILTER_HIGHPASS", "highpass" }, { IPATCH_GIG_FILTER_BANDREJECT, "IPATCH_GIG_FILTER_BANDREJECT", "bandreject" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchGigFilterType", values); } return etype; } GType ipatch_gig_control_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_GIG_CTRL_MOD_WHEEL, "IPATCH_GIG_CTRL_MOD_WHEEL", "mod-wheel" }, { IPATCH_GIG_CTRL_BREATH, "IPATCH_GIG_CTRL_BREATH", "breath" }, { IPATCH_GIG_CTRL_FOOT, "IPATCH_GIG_CTRL_FOOT", "foot" }, { IPATCH_GIG_CTRL_PORTAMENTO_TIME, "IPATCH_GIG_CTRL_PORTAMENTO_TIME", "portamento-time" }, { IPATCH_GIG_CTRL_EFFECT_1, "IPATCH_GIG_CTRL_EFFECT_1", "effect-1" }, { IPATCH_GIG_CTRL_EFFECT_2, "IPATCH_GIG_CTRL_EFFECT_2", "effect-2" }, { IPATCH_GIG_CTRL_GEN_PURPOSE_1, "IPATCH_GIG_CTRL_GEN_PURPOSE_1", "gen-purpose-1" }, { IPATCH_GIG_CTRL_GEN_PURPOSE_2, "IPATCH_GIG_CTRL_GEN_PURPOSE_2", "gen-purpose-2" }, { IPATCH_GIG_CTRL_GEN_PURPOSE_3, "IPATCH_GIG_CTRL_GEN_PURPOSE_3", "gen-purpose-3" }, { IPATCH_GIG_CTRL_GEN_PURPOSE_4, "IPATCH_GIG_CTRL_GEN_PURPOSE_4", "gen-purpose-4" }, { IPATCH_GIG_CTRL_SUSTAIN_PEDAL, "IPATCH_GIG_CTRL_SUSTAIN_PEDAL", "sustain-pedal" }, { IPATCH_GIG_CTRL_PORTAMENTO, "IPATCH_GIG_CTRL_PORTAMENTO", "portamento" }, { IPATCH_GIG_CTRL_SOSTENUTO, "IPATCH_GIG_CTRL_SOSTENUTO", "sostenuto" }, { IPATCH_GIG_CTRL_SOFT_PEDAL, "IPATCH_GIG_CTRL_SOFT_PEDAL", "soft-pedal" }, { IPATCH_GIG_CTRL_GEN_PURPOSE_5, "IPATCH_GIG_CTRL_GEN_PURPOSE_5", "gen-purpose-5" }, { IPATCH_GIG_CTRL_GEN_PURPOSE_6, "IPATCH_GIG_CTRL_GEN_PURPOSE_6", "gen-purpose-6" }, { IPATCH_GIG_CTRL_GEN_PURPOSE_7, "IPATCH_GIG_CTRL_GEN_PURPOSE_7", "gen-purpose-7" }, { IPATCH_GIG_CTRL_GEN_PURPOSE_8, "IPATCH_GIG_CTRL_GEN_PURPOSE_8", "gen-purpose-8" }, { IPATCH_GIG_CTRL_EFFECT_DEPTH_1, "IPATCH_GIG_CTRL_EFFECT_DEPTH_1", "effect-depth-1" }, { IPATCH_GIG_CTRL_EFFECT_DEPTH_2, "IPATCH_GIG_CTRL_EFFECT_DEPTH_2", "effect-depth-2" }, { IPATCH_GIG_CTRL_EFFECT_DEPTH_3, "IPATCH_GIG_CTRL_EFFECT_DEPTH_3", "effect-depth-3" }, { IPATCH_GIG_CTRL_EFFECT_DEPTH_4, "IPATCH_GIG_CTRL_EFFECT_DEPTH_4", "effect-depth-4" }, { IPATCH_GIG_CTRL_EFFECT_DEPTH_5, "IPATCH_GIG_CTRL_EFFECT_DEPTH_5", "effect-depth-5" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchGigControlType", values); } return etype; } /* enumerations from "IpatchGigRegion.h" */ GType ipatch_gig_region_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE, "IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE", "self-non-exclusive" }, { IPATCH_GIG_REGION_PHASE_MASTER, "IPATCH_GIG_REGION_PHASE_MASTER", "phase-master" }, { IPATCH_GIG_REGION_MULTI_CHANNEL, "IPATCH_GIG_REGION_MULTI_CHANNEL", "multi-channel" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchGigRegionFlags", values); } return etype; } /* enumerations from "IpatchGigSubRegion.h" */ GType ipatch_gig_sub_region_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE, "IPATCH_GIG_SUB_REGION_SAMPLE_INFO_OVERRIDE", "override" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchGigSubRegionFlags", values); } return etype; } /* enumerations from "IpatchItem.h" */ GType ipatch_item_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_ITEM_HOOKS_ACTIVE, "IPATCH_ITEM_HOOKS_ACTIVE", "hooks-active" }, { IPATCH_ITEM_FREE_MUTEX, "IPATCH_ITEM_FREE_MUTEX", "free-mutex" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchItemFlags", values); } return etype; } /* enumerations from "IpatchPaste.h" */ GType ipatch_paste_choice_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_PASTE_CHOICE_IGNORE, "IPATCH_PASTE_CHOICE_IGNORE", "ignore" }, { IPATCH_PASTE_CHOICE_REPLACE, "IPATCH_PASTE_CHOICE_REPLACE", "replace" }, { IPATCH_PASTE_CHOICE_KEEP, "IPATCH_PASTE_CHOICE_KEEP", "keep" }, { IPATCH_PASTE_CHOICE_CANCEL, "IPATCH_PASTE_CHOICE_CANCEL", "cancel" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchPasteChoice", values); } return etype; } GType ipatch_paste_priority_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_PASTE_PRIORITY_LOWEST, "IPATCH_PASTE_PRIORITY_LOWEST", "lowest" }, { IPATCH_PASTE_PRIORITY_LOW, "IPATCH_PASTE_PRIORITY_LOW", "low" }, { IPATCH_PASTE_PRIORITY_DEFAULT, "IPATCH_PASTE_PRIORITY_DEFAULT", "default" }, { IPATCH_PASTE_PRIORITY_HIGH, "IPATCH_PASTE_PRIORITY_HIGH", "high" }, { IPATCH_PASTE_PRIORITY_HIGHEST, "IPATCH_PASTE_PRIORITY_HIGHEST", "highest" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchPastePriority", values); } return etype; } /* enumerations from "IpatchRiff.h" */ GType ipatch_riff_status_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_RIFF_STATUS_FAIL, "IPATCH_RIFF_STATUS_FAIL", "fail" }, { IPATCH_RIFF_STATUS_BEGIN, "IPATCH_RIFF_STATUS_BEGIN", "begin" }, { IPATCH_RIFF_STATUS_FINISHED, "IPATCH_RIFF_STATUS_FINISHED", "finished" }, { IPATCH_RIFF_STATUS_NORMAL, "IPATCH_RIFF_STATUS_NORMAL", "normal" }, { IPATCH_RIFF_STATUS_CHUNK_END, "IPATCH_RIFF_STATUS_CHUNK_END", "chunk-end" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchRiffStatus", values); } return etype; } GType ipatch_riff_mode_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_RIFF_READ, "IPATCH_RIFF_READ", "read" }, { IPATCH_RIFF_WRITE, "IPATCH_RIFF_WRITE", "write" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchRiffMode", values); } return etype; } GType ipatch_riff_chunk_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_RIFF_CHUNK_RIFF, "IPATCH_RIFF_CHUNK_RIFF", "riff" }, { IPATCH_RIFF_CHUNK_LIST, "IPATCH_RIFF_CHUNK_LIST", "list" }, { IPATCH_RIFF_CHUNK_SUB, "IPATCH_RIFF_CHUNK_SUB", "sub" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchRiffChunkType", values); } return etype; } GType ipatch_riff_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_RIFF_ERROR_NOT_RIFF, "IPATCH_RIFF_ERROR_NOT_RIFF", "not-riff" }, { IPATCH_RIFF_ERROR_UNEXPECTED_ID, "IPATCH_RIFF_ERROR_UNEXPECTED_ID", "unexpected-id" }, { IPATCH_RIFF_ERROR_UNEXPECTED_CHUNK_END, "IPATCH_RIFF_ERROR_UNEXPECTED_CHUNK_END", "unexpected-chunk-end" }, { IPATCH_RIFF_ERROR_INVALID_ID, "IPATCH_RIFF_ERROR_INVALID_ID", "invalid-id" }, { IPATCH_RIFF_ERROR_ODD_SIZE, "IPATCH_RIFF_ERROR_ODD_SIZE", "odd-size" }, { IPATCH_RIFF_ERROR_SIZE_EXCEEDED, "IPATCH_RIFF_ERROR_SIZE_EXCEEDED", "size-exceeded" }, { IPATCH_RIFF_ERROR_SIZE_MISMATCH, "IPATCH_RIFF_ERROR_SIZE_MISMATCH", "size-mismatch" }, { IPATCH_RIFF_ERROR_INVALID_DATA, "IPATCH_RIFF_ERROR_INVALID_DATA", "invalid-data" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchRiffError", values); } return etype; } /* enumerations from "IpatchSample.h" */ GType ipatch_sample_loop_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SAMPLE_LOOP_NONE, "IPATCH_SAMPLE_LOOP_NONE", "none" }, { IPATCH_SAMPLE_LOOP_STANDARD, "IPATCH_SAMPLE_LOOP_STANDARD", "standard" }, { IPATCH_SAMPLE_LOOP_RELEASE, "IPATCH_SAMPLE_LOOP_RELEASE", "release" }, { IPATCH_SAMPLE_LOOP_PINGPONG, "IPATCH_SAMPLE_LOOP_PINGPONG", "pingpong" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSampleLoopType", values); } return etype; } /* enumerations from "IpatchSampleStoreRam.h" */ GType ipatch_sample_store_ram_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SAMPLE_STORE_RAM_ALLOCATED, "IPATCH_SAMPLE_STORE_RAM_ALLOCATED", "allocated" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSampleStoreRamFlags", values); } return etype; } /* enumerations from "IpatchSF2.h" */ GType ipatch_sf2_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SF2_SAMPLES_24BIT, "IPATCH_SF2_SAMPLES_24BIT", "24bit" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSF2Flags", values); } return etype; } GType ipatch_sf2_info_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SF2_UNKNOWN, "IPATCH_SF2_UNKNOWN", "unknown" }, { IPATCH_SF2_VERSION, "IPATCH_SF2_VERSION", "version" }, { IPATCH_SF2_ENGINE, "IPATCH_SF2_ENGINE", "engine" }, { IPATCH_SF2_NAME, "IPATCH_SF2_NAME", "name" }, { IPATCH_SF2_ROM_NAME, "IPATCH_SF2_ROM_NAME", "rom-name" }, { IPATCH_SF2_ROM_VERSION, "IPATCH_SF2_ROM_VERSION", "rom-version" }, { IPATCH_SF2_DATE, "IPATCH_SF2_DATE", "date" }, { IPATCH_SF2_AUTHOR, "IPATCH_SF2_AUTHOR", "author" }, { IPATCH_SF2_PRODUCT, "IPATCH_SF2_PRODUCT", "product" }, { IPATCH_SF2_COPYRIGHT, "IPATCH_SF2_COPYRIGHT", "copyright" }, { IPATCH_SF2_COMMENT, "IPATCH_SF2_COMMENT", "comment" }, { IPATCH_SF2_SOFTWARE, "IPATCH_SF2_SOFTWARE", "software" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSF2InfoType", values); } return etype; } /* enumerations from "IpatchSF2File.h" */ GType ipatch_sf2_file_sample_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SF2_FILE_SAMPLE_TYPE_MONO, "IPATCH_SF2_FILE_SAMPLE_TYPE_MONO", "mono" }, { IPATCH_SF2_FILE_SAMPLE_TYPE_RIGHT, "IPATCH_SF2_FILE_SAMPLE_TYPE_RIGHT", "right" }, { IPATCH_SF2_FILE_SAMPLE_TYPE_LEFT, "IPATCH_SF2_FILE_SAMPLE_TYPE_LEFT", "left" }, { IPATCH_SF2_FILE_SAMPLE_TYPE_LINKED, "IPATCH_SF2_FILE_SAMPLE_TYPE_LINKED", "linked" }, { IPATCH_SF2_FILE_SAMPLE_TYPE_ROM, "IPATCH_SF2_FILE_SAMPLE_TYPE_ROM", "rom" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSF2FileSampleType", values); } return etype; } /* enumerations from "IpatchSF2Gen.h" */ GType ipatch_sf2_gen_props_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SF2_GEN_PROPS_INST, "IPATCH_SF2_GEN_PROPS_INST", "inst" }, { IPATCH_SF2_GEN_PROPS_PRESET, "IPATCH_SF2_GEN_PROPS_PRESET", "preset" }, { IPATCH_SF2_GEN_PROPS_INST_GLOBAL, "IPATCH_SF2_GEN_PROPS_INST_GLOBAL", "inst-global" }, { IPATCH_SF2_GEN_PROPS_PRESET_GLOBAL, "IPATCH_SF2_GEN_PROPS_PRESET_GLOBAL", "preset-global" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSF2GenPropsType", values); } return etype; } GType ipatch_sf2_gen_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SF2_GEN_SAMPLE_START, "IPATCH_SF2_GEN_SAMPLE_START", "sample-start" }, { IPATCH_SF2_GEN_SAMPLE_END, "IPATCH_SF2_GEN_SAMPLE_END", "sample-end" }, { IPATCH_SF2_GEN_SAMPLE_LOOP_START, "IPATCH_SF2_GEN_SAMPLE_LOOP_START", "sample-loop-start" }, { IPATCH_SF2_GEN_SAMPLE_LOOP_END, "IPATCH_SF2_GEN_SAMPLE_LOOP_END", "sample-loop-end" }, { IPATCH_SF2_GEN_SAMPLE_COARSE_START, "IPATCH_SF2_GEN_SAMPLE_COARSE_START", "sample-coarse-start" }, { IPATCH_SF2_GEN_MOD_LFO_TO_PITCH, "IPATCH_SF2_GEN_MOD_LFO_TO_PITCH", "mod-lfo-to-pitch" }, { IPATCH_SF2_GEN_VIB_LFO_TO_PITCH, "IPATCH_SF2_GEN_VIB_LFO_TO_PITCH", "vib-lfo-to-pitch" }, { IPATCH_SF2_GEN_MOD_ENV_TO_PITCH, "IPATCH_SF2_GEN_MOD_ENV_TO_PITCH", "mod-env-to-pitch" }, { IPATCH_SF2_GEN_FILTER_CUTOFF, "IPATCH_SF2_GEN_FILTER_CUTOFF", "filter-cutoff" }, { IPATCH_SF2_GEN_FILTER_Q, "IPATCH_SF2_GEN_FILTER_Q", "filter-q" }, { IPATCH_SF2_GEN_MOD_LFO_TO_FILTER_CUTOFF, "IPATCH_SF2_GEN_MOD_LFO_TO_FILTER_CUTOFF", "mod-lfo-to-filter-cutoff" }, { IPATCH_SF2_GEN_MOD_ENV_TO_FILTER_CUTOFF, "IPATCH_SF2_GEN_MOD_ENV_TO_FILTER_CUTOFF", "mod-env-to-filter-cutoff" }, { IPATCH_SF2_GEN_SAMPLE_COARSE_END, "IPATCH_SF2_GEN_SAMPLE_COARSE_END", "sample-coarse-end" }, { IPATCH_SF2_GEN_MOD_LFO_TO_VOLUME, "IPATCH_SF2_GEN_MOD_LFO_TO_VOLUME", "mod-lfo-to-volume" }, { IPATCH_SF2_GEN_UNUSED1, "IPATCH_SF2_GEN_UNUSED1", "unused1" }, { IPATCH_SF2_GEN_CHORUS, "IPATCH_SF2_GEN_CHORUS", "chorus" }, { IPATCH_SF2_GEN_REVERB, "IPATCH_SF2_GEN_REVERB", "reverb" }, { IPATCH_SF2_GEN_PAN, "IPATCH_SF2_GEN_PAN", "pan" }, { IPATCH_SF2_GEN_UNUSED2, "IPATCH_SF2_GEN_UNUSED2", "unused2" }, { IPATCH_SF2_GEN_UNUSED3, "IPATCH_SF2_GEN_UNUSED3", "unused3" }, { IPATCH_SF2_GEN_UNUSED4, "IPATCH_SF2_GEN_UNUSED4", "unused4" }, { IPATCH_SF2_GEN_MOD_LFO_DELAY, "IPATCH_SF2_GEN_MOD_LFO_DELAY", "mod-lfo-delay" }, { IPATCH_SF2_GEN_MOD_LFO_FREQ, "IPATCH_SF2_GEN_MOD_LFO_FREQ", "mod-lfo-freq" }, { IPATCH_SF2_GEN_VIB_LFO_DELAY, "IPATCH_SF2_GEN_VIB_LFO_DELAY", "vib-lfo-delay" }, { IPATCH_SF2_GEN_VIB_LFO_FREQ, "IPATCH_SF2_GEN_VIB_LFO_FREQ", "vib-lfo-freq" }, { IPATCH_SF2_GEN_MOD_ENV_DELAY, "IPATCH_SF2_GEN_MOD_ENV_DELAY", "mod-env-delay" }, { IPATCH_SF2_GEN_MOD_ENV_ATTACK, "IPATCH_SF2_GEN_MOD_ENV_ATTACK", "mod-env-attack" }, { IPATCH_SF2_GEN_MOD_ENV_HOLD, "IPATCH_SF2_GEN_MOD_ENV_HOLD", "mod-env-hold" }, { IPATCH_SF2_GEN_MOD_ENV_DECAY, "IPATCH_SF2_GEN_MOD_ENV_DECAY", "mod-env-decay" }, { IPATCH_SF2_GEN_MOD_ENV_SUSTAIN, "IPATCH_SF2_GEN_MOD_ENV_SUSTAIN", "mod-env-sustain" }, { IPATCH_SF2_GEN_MOD_ENV_RELEASE, "IPATCH_SF2_GEN_MOD_ENV_RELEASE", "mod-env-release" }, { IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_HOLD, "IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_HOLD", "note-to-mod-env-hold" }, { IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_DECAY, "IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_DECAY", "note-to-mod-env-decay" }, { IPATCH_SF2_GEN_VOL_ENV_DELAY, "IPATCH_SF2_GEN_VOL_ENV_DELAY", "vol-env-delay" }, { IPATCH_SF2_GEN_VOL_ENV_ATTACK, "IPATCH_SF2_GEN_VOL_ENV_ATTACK", "vol-env-attack" }, { IPATCH_SF2_GEN_VOL_ENV_HOLD, "IPATCH_SF2_GEN_VOL_ENV_HOLD", "vol-env-hold" }, { IPATCH_SF2_GEN_VOL_ENV_DECAY, "IPATCH_SF2_GEN_VOL_ENV_DECAY", "vol-env-decay" }, { IPATCH_SF2_GEN_VOL_ENV_SUSTAIN, "IPATCH_SF2_GEN_VOL_ENV_SUSTAIN", "vol-env-sustain" }, { IPATCH_SF2_GEN_VOL_ENV_RELEASE, "IPATCH_SF2_GEN_VOL_ENV_RELEASE", "vol-env-release" }, { IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_HOLD, "IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_HOLD", "note-to-vol-env-hold" }, { IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_DECAY, "IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_DECAY", "note-to-vol-env-decay" }, { IPATCH_SF2_GEN_INSTRUMENT_ID, "IPATCH_SF2_GEN_INSTRUMENT_ID", "instrument-id" }, { IPATCH_SF2_GEN_RESERVED1, "IPATCH_SF2_GEN_RESERVED1", "reserved1" }, { IPATCH_SF2_GEN_NOTE_RANGE, "IPATCH_SF2_GEN_NOTE_RANGE", "note-range" }, { IPATCH_SF2_GEN_VELOCITY_RANGE, "IPATCH_SF2_GEN_VELOCITY_RANGE", "velocity-range" }, { IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START, "IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START", "sample-coarse-loop-start" }, { IPATCH_SF2_GEN_FIXED_NOTE, "IPATCH_SF2_GEN_FIXED_NOTE", "fixed-note" }, { IPATCH_SF2_GEN_FIXED_VELOCITY, "IPATCH_SF2_GEN_FIXED_VELOCITY", "fixed-velocity" }, { IPATCH_SF2_GEN_ATTENUATION, "IPATCH_SF2_GEN_ATTENUATION", "attenuation" }, { IPATCH_SF2_GEN_RESERVED2, "IPATCH_SF2_GEN_RESERVED2", "reserved2" }, { IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END, "IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END", "sample-coarse-loop-end" }, { IPATCH_SF2_GEN_COARSE_TUNE, "IPATCH_SF2_GEN_COARSE_TUNE", "coarse-tune" }, { IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE, "IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE", "fine-tune-override" }, { IPATCH_SF2_GEN_SAMPLE_ID, "IPATCH_SF2_GEN_SAMPLE_ID", "sample-id" }, { IPATCH_SF2_GEN_SAMPLE_MODES, "IPATCH_SF2_GEN_SAMPLE_MODES", "sample-modes" }, { IPATCH_SF2_GEN_RESERVED3, "IPATCH_SF2_GEN_RESERVED3", "reserved3" }, { IPATCH_SF2_GEN_SCALE_TUNE, "IPATCH_SF2_GEN_SCALE_TUNE", "scale-tune" }, { IPATCH_SF2_GEN_EXCLUSIVE_CLASS, "IPATCH_SF2_GEN_EXCLUSIVE_CLASS", "exclusive-class" }, { IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE, "IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE", "root-note-override" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSF2GenType", values); } return etype; } GType ipatch_sf2_gen_sample_modes_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP, "IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP", "noloop" }, { IPATCH_SF2_GEN_SAMPLE_MODE_LOOP, "IPATCH_SF2_GEN_SAMPLE_MODE_LOOP", "loop" }, { IPATCH_SF2_GEN_SAMPLE_MODE_LOOP_RELEASE, "IPATCH_SF2_GEN_SAMPLE_MODE_LOOP_RELEASE", "loop-release" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSF2GenSampleModes", values); } return etype; } /* enumerations from "IpatchSF2Mod.h" */ GType ipatch_sf2_mod_field_masks_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SF2_MOD_MASK_CONTROL, "IPATCH_SF2_MOD_MASK_CONTROL", "control" }, { IPATCH_SF2_MOD_MASK_CC, "IPATCH_SF2_MOD_MASK_CC", "cc" }, { IPATCH_SF2_MOD_MASK_DIRECTION, "IPATCH_SF2_MOD_MASK_DIRECTION", "direction" }, { IPATCH_SF2_MOD_MASK_POLARITY, "IPATCH_SF2_MOD_MASK_POLARITY", "polarity" }, { IPATCH_SF2_MOD_MASK_TYPE, "IPATCH_SF2_MOD_MASK_TYPE", "type" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSF2ModFieldMasks", values); } return etype; } GType ipatch_sf2_mod_field_shifts_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SF2_MOD_SHIFT_CONTROL, "IPATCH_SF2_MOD_SHIFT_CONTROL", "control" }, { IPATCH_SF2_MOD_SHIFT_CC, "IPATCH_SF2_MOD_SHIFT_CC", "cc" }, { IPATCH_SF2_MOD_SHIFT_DIRECTION, "IPATCH_SF2_MOD_SHIFT_DIRECTION", "direction" }, { IPATCH_SF2_MOD_SHIFT_POLARITY, "IPATCH_SF2_MOD_SHIFT_POLARITY", "polarity" }, { IPATCH_SF2_MOD_SHIFT_TYPE, "IPATCH_SF2_MOD_SHIFT_TYPE", "type" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSF2ModFieldShifts", values); } return etype; } GType ipatch_sf2_mod_control_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SF2_MOD_CONTROL_NONE, "IPATCH_SF2_MOD_CONTROL_NONE", "none" }, { IPATCH_SF2_MOD_CONTROL_NOTE_ON_VELOCITY, "IPATCH_SF2_MOD_CONTROL_NOTE_ON_VELOCITY", "note-on-velocity" }, { IPATCH_SF2_MOD_CONTROL_NOTE_NUMBER, "IPATCH_SF2_MOD_CONTROL_NOTE_NUMBER", "note-number" }, { IPATCH_SF2_MOD_CONTROL_POLY_PRESSURE, "IPATCH_SF2_MOD_CONTROL_POLY_PRESSURE", "poly-pressure" }, { IPATCH_SF2_MOD_CONTROL_CHAN_PRESSURE, "IPATCH_SF2_MOD_CONTROL_CHAN_PRESSURE", "chan-pressure" }, { IPATCH_SF2_MOD_CONTROL_PITCH_WHEEL, "IPATCH_SF2_MOD_CONTROL_PITCH_WHEEL", "pitch-wheel" }, { IPATCH_SF2_MOD_CONTROL_BEND_RANGE, "IPATCH_SF2_MOD_CONTROL_BEND_RANGE", "bend-range" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSF2ModControl", values); } return etype; } GType ipatch_sf2_mod_control_palette_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SF2_MOD_CC_GENERAL, "IPATCH_SF2_MOD_CC_GENERAL", "general" }, { IPATCH_SF2_MOD_CC_MIDI, "IPATCH_SF2_MOD_CC_MIDI", "midi" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSF2ModControlPalette", values); } return etype; } GType ipatch_sf2_mod_direction_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SF2_MOD_DIRECTION_POSITIVE, "IPATCH_SF2_MOD_DIRECTION_POSITIVE", "positive" }, { IPATCH_SF2_MOD_DIRECTION_NEGATIVE, "IPATCH_SF2_MOD_DIRECTION_NEGATIVE", "negative" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSF2ModDirection", values); } return etype; } GType ipatch_sf2_mod_polarity_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SF2_MOD_POLARITY_UNIPOLAR, "IPATCH_SF2_MOD_POLARITY_UNIPOLAR", "unipolar" }, { IPATCH_SF2_MOD_POLARITY_BIPOLAR, "IPATCH_SF2_MOD_POLARITY_BIPOLAR", "bipolar" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSF2ModPolarity", values); } return etype; } GType ipatch_sf2_mod_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SF2_MOD_TYPE_LINEAR, "IPATCH_SF2_MOD_TYPE_LINEAR", "linear" }, { IPATCH_SF2_MOD_TYPE_CONCAVE, "IPATCH_SF2_MOD_TYPE_CONCAVE", "concave" }, { IPATCH_SF2_MOD_TYPE_CONVEX, "IPATCH_SF2_MOD_TYPE_CONVEX", "convex" }, { IPATCH_SF2_MOD_TYPE_SWITCH, "IPATCH_SF2_MOD_TYPE_SWITCH", "switch" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSF2ModType", values); } return etype; } GType ipatch_sf2_mod_transform_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SF2_MOD_TRANSFORM_LINEAR, "IPATCH_SF2_MOD_TRANSFORM_LINEAR", "linear" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSF2ModTransform", values); } return etype; } GType ipatch_sf2_mod_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SF2_MOD_NO_DUPLICATE, "IPATCH_SF2_MOD_NO_DUPLICATE", "duplicate" }, { IPATCH_SF2_MOD_NO_NOTIFY, "IPATCH_SF2_MOD_NO_NOTIFY", "notify" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSF2ModFlags", values); } return etype; } /* enumerations from "IpatchSF2Sample.h" */ GType ipatch_sf2_sample_channel_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SF2_SAMPLE_CHANNEL_MONO, "IPATCH_SF2_SAMPLE_CHANNEL_MONO", "mono" }, { IPATCH_SF2_SAMPLE_CHANNEL_LEFT, "IPATCH_SF2_SAMPLE_CHANNEL_LEFT", "left" }, { IPATCH_SF2_SAMPLE_CHANNEL_RIGHT, "IPATCH_SF2_SAMPLE_CHANNEL_RIGHT", "right" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSF2SampleChannel", values); } return etype; } /* enumerations from "IpatchSF2VoiceCache.h" */ GType ipatch_sf2_voice_sel_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SF2_VOICE_SEL_NOTE, "IPATCH_SF2_VOICE_SEL_NOTE", "note" }, { IPATCH_SF2_VOICE_SEL_VELOCITY, "IPATCH_SF2_VOICE_SEL_VELOCITY", "velocity" }, { IPATCH_SF2_VOICE_SEL_AFTER_TOUCH, "IPATCH_SF2_VOICE_SEL_AFTER_TOUCH", "after-touch" }, { IPATCH_SF2_VOICE_SEL_MIDI_CC, "IPATCH_SF2_VOICE_SEL_MIDI_CC", "midi-cc" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSF2VoiceSelType", values); } return etype; } /* enumerations from "IpatchSndFile.h" */ GType ipatch_snd_file_endian_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SND_FILE_ENDIAN_FILE, "IPATCH_SND_FILE_ENDIAN_FILE", "file" }, { IPATCH_SND_FILE_ENDIAN_LITTLE, "IPATCH_SND_FILE_ENDIAN_LITTLE", "little" }, { IPATCH_SND_FILE_ENDIAN_BIG, "IPATCH_SND_FILE_ENDIAN_BIG", "big" }, { IPATCH_SND_FILE_ENDIAN_CPU, "IPATCH_SND_FILE_ENDIAN_CPU", "cpu" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSndFileEndian", values); } return etype; } /* enumerations from "IpatchTypeProp.h" */ GType ipatch_splits_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SPLITS_NONE, "IPATCH_SPLITS_NONE", "none" }, { IPATCH_SPLITS_NORMAL, "IPATCH_SPLITS_NORMAL", "normal" }, { IPATCH_SPLITS_NO_OVERLAP, "IPATCH_SPLITS_NO_OVERLAP", "no-overlap" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSplitsType", values); } return etype; } /* enumerations from "IpatchUnit.h" */ GType ipatch_unit_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_UNIT_LOGARITHMIC, "IPATCH_UNIT_LOGARITHMIC", "logarithmic" }, { IPATCH_UNIT_USER, "IPATCH_UNIT_USER", "user" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchUnitFlags", values); } return etype; } GType ipatch_unit_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_UNIT_TYPE_NONE, "IPATCH_UNIT_TYPE_NONE", "none" }, { IPATCH_UNIT_TYPE_INT, "IPATCH_UNIT_TYPE_INT", "int" }, { IPATCH_UNIT_TYPE_UINT, "IPATCH_UNIT_TYPE_UINT", "uint" }, { IPATCH_UNIT_TYPE_RANGE, "IPATCH_UNIT_TYPE_RANGE", "range" }, { IPATCH_UNIT_TYPE_DECIBELS, "IPATCH_UNIT_TYPE_DECIBELS", "decibels" }, { IPATCH_UNIT_TYPE_PERCENT, "IPATCH_UNIT_TYPE_PERCENT", "percent" }, { IPATCH_UNIT_TYPE_SEMITONES, "IPATCH_UNIT_TYPE_SEMITONES", "semitones" }, { IPATCH_UNIT_TYPE_CENTS, "IPATCH_UNIT_TYPE_CENTS", "cents" }, { IPATCH_UNIT_TYPE_TIME_CENTS, "IPATCH_UNIT_TYPE_TIME_CENTS", "time-cents" }, { IPATCH_UNIT_TYPE_SAMPLE_RATE, "IPATCH_UNIT_TYPE_SAMPLE_RATE", "sample-rate" }, { IPATCH_UNIT_TYPE_SAMPLES, "IPATCH_UNIT_TYPE_SAMPLES", "samples" }, { IPATCH_UNIT_TYPE_HERTZ, "IPATCH_UNIT_TYPE_HERTZ", "hertz" }, { IPATCH_UNIT_TYPE_SECONDS, "IPATCH_UNIT_TYPE_SECONDS", "seconds" }, { IPATCH_UNIT_TYPE_MULTIPLIER, "IPATCH_UNIT_TYPE_MULTIPLIER", "multiplier" }, { IPATCH_UNIT_TYPE_DLS_GAIN, "IPATCH_UNIT_TYPE_DLS_GAIN", "dls-gain" }, { IPATCH_UNIT_TYPE_DLS_ABS_TIME, "IPATCH_UNIT_TYPE_DLS_ABS_TIME", "dls-abs-time" }, { IPATCH_UNIT_TYPE_DLS_REL_TIME, "IPATCH_UNIT_TYPE_DLS_REL_TIME", "dls-rel-time" }, { IPATCH_UNIT_TYPE_DLS_ABS_PITCH, "IPATCH_UNIT_TYPE_DLS_ABS_PITCH", "dls-abs-pitch" }, { IPATCH_UNIT_TYPE_DLS_REL_PITCH, "IPATCH_UNIT_TYPE_DLS_REL_PITCH", "dls-rel-pitch" }, { IPATCH_UNIT_TYPE_DLS_PERCENT, "IPATCH_UNIT_TYPE_DLS_PERCENT", "dls-percent" }, { IPATCH_UNIT_TYPE_SF2_ABS_PITCH, "IPATCH_UNIT_TYPE_SF2_ABS_PITCH", "sf2-abs-pitch" }, { IPATCH_UNIT_TYPE_SF2_OFS_PITCH, "IPATCH_UNIT_TYPE_SF2_OFS_PITCH", "sf2-ofs-pitch" }, { IPATCH_UNIT_TYPE_SF2_ABS_TIME, "IPATCH_UNIT_TYPE_SF2_ABS_TIME", "sf2-abs-time" }, { IPATCH_UNIT_TYPE_SF2_OFS_TIME, "IPATCH_UNIT_TYPE_SF2_OFS_TIME", "sf2-ofs-time" }, { IPATCH_UNIT_TYPE_CENTIBELS, "IPATCH_UNIT_TYPE_CENTIBELS", "centibels" }, { IPATCH_UNIT_TYPE_32K_SAMPLES, "IPATCH_UNIT_TYPE_32K_SAMPLES", "32k-samples" }, { IPATCH_UNIT_TYPE_TENTH_PERCENT, "IPATCH_UNIT_TYPE_TENTH_PERCENT", "tenth-percent" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchUnitType", values); } return etype; } GType ipatch_unit_class_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_UNIT_CLASS_NONE, "IPATCH_UNIT_CLASS_NONE", "none" }, { IPATCH_UNIT_CLASS_USER, "IPATCH_UNIT_CLASS_USER", "user" }, { IPATCH_UNIT_CLASS_DLS, "IPATCH_UNIT_CLASS_DLS", "dls" }, { IPATCH_UNIT_CLASS_COUNT, "IPATCH_UNIT_CLASS_COUNT", "count" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchUnitClassType", values); } return etype; } /* enumerations from "IpatchVBankRegion.h" */ GType ipatch_vbank_region_note_range_mode_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_VBANK_REGION_NOTE_RANGE_MODE_INTERSECT, "IPATCH_VBANK_REGION_NOTE_RANGE_MODE_INTERSECT", "intersect" }, { IPATCH_VBANK_REGION_NOTE_RANGE_MODE_OVERRIDE, "IPATCH_VBANK_REGION_NOTE_RANGE_MODE_OVERRIDE", "override" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchVBankRegionNoteRangeMode", values); } return etype; } GType ipatch_vbank_region_root_note_mode_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OFFSET, "IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OFFSET", "offset" }, { IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OVERRIDE, "IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OVERRIDE", "override" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchVBankRegionRootNoteMode", values); } return etype; } /* enumerations from "misc.h" */ GType ipatch_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_ERROR_FAIL, "IPATCH_ERROR_FAIL", "fail" }, { IPATCH_ERROR_IO, "IPATCH_ERROR_IO", "io" }, { IPATCH_ERROR_PROGRAM, "IPATCH_ERROR_PROGRAM", "program" }, { IPATCH_ERROR_INVALID, "IPATCH_ERROR_INVALID", "invalid" }, { IPATCH_ERROR_CORRUPT, "IPATCH_ERROR_CORRUPT", "corrupt" }, { IPATCH_ERROR_NOMEM, "IPATCH_ERROR_NOMEM", "nomem" }, { IPATCH_ERROR_UNSUPPORTED, "IPATCH_ERROR_UNSUPPORTED", "unsupported" }, { IPATCH_ERROR_UNEXPECTED_EOF, "IPATCH_ERROR_UNEXPECTED_EOF", "unexpected-eof" }, { IPATCH_ERROR_UNHANDLED_CONVERSION, "IPATCH_ERROR_UNHANDLED_CONVERSION", "unhandled-conversion" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchError", values); } return etype; } /* enumerations from "sample.h" */ GType ipatch_sample_width_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SAMPLE_INVALID, "IPATCH_SAMPLE_INVALID", "invalid" }, { IPATCH_SAMPLE_8BIT, "IPATCH_SAMPLE_8BIT", "8bit" }, { IPATCH_SAMPLE_16BIT, "IPATCH_SAMPLE_16BIT", "16bit" }, { IPATCH_SAMPLE_24BIT, "IPATCH_SAMPLE_24BIT", "24bit" }, { IPATCH_SAMPLE_32BIT, "IPATCH_SAMPLE_32BIT", "32bit" }, { IPATCH_SAMPLE_FLOAT, "IPATCH_SAMPLE_FLOAT", "float" }, { IPATCH_SAMPLE_DOUBLE, "IPATCH_SAMPLE_DOUBLE", "double" }, { IPATCH_SAMPLE_REAL24BIT, "IPATCH_SAMPLE_REAL24BIT", "real24bit" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSampleWidth", values); } return etype; } GType ipatch_sample_channel_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SAMPLE_MONO, "IPATCH_SAMPLE_MONO", "mono" }, { IPATCH_SAMPLE_STEREO, "IPATCH_SAMPLE_STEREO", "stereo" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSampleChannel", values); } return etype; } GType ipatch_sample_channel_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { IPATCH_SAMPLE_LEFT, "IPATCH_SAMPLE_LEFT", "left" }, { IPATCH_SAMPLE_RIGHT, "IPATCH_SAMPLE_RIGHT", "right" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("IpatchSampleChannelType", values); } return etype; } GType ipatch_sample_sign_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SAMPLE_SIGNED, "IPATCH_SAMPLE_SIGNED", "signed" }, { IPATCH_SAMPLE_UNSIGNED, "IPATCH_SAMPLE_UNSIGNED", "unsigned" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSampleSign", values); } return etype; } GType ipatch_sample_endian_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { IPATCH_SAMPLE_LENDIAN, "IPATCH_SAMPLE_LENDIAN", "lendian" }, { IPATCH_SAMPLE_BENDIAN, "IPATCH_SAMPLE_BENDIAN", "bendian" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("IpatchSampleEndian", values); } return etype; } /* Generated data ends here */ libinstpatch-1.0.0/libinstpatch/IpatchItem.h0000644000175000017500000002613511461332142016005 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchItem * @short_description: Abstract base item object * @see_also: * @stability: Stable * * The abstract base item type from which all instrument objects are derived * and many other object types as well. */ #ifndef __IPATCH_ITEM_H__ #define __IPATCH_ITEM_H__ #include #include #include typedef struct _IpatchItem IpatchItem; typedef struct _IpatchItemClass IpatchItemClass; #include #include #define IPATCH_TYPE_ITEM (ipatch_item_get_type ()) #define IPATCH_ITEM(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_ITEM, IpatchItem)) #define IPATCH_ITEM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_ITEM, IpatchItemClass)) #define IPATCH_IS_ITEM(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_ITEM)) #define IPATCH_IS_ITEM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_ITEM)) #define IPATCH_ITEM_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_ITEM, IpatchItemClass)) /** * IpatchItemCopyLinkFunc: * @item: Item which is being linked (contains a reference to @link). * @link: The item being referenced (can be NULL). * @user_data: User data supplied to copy/duplicate function. * * A callback function called during item copy/duplicate operations for * any item link reference which needs to be resolved. An example usage * is for deep duplicating an object (all references can also be duplicated). * Item copy methods should call this for any linked item references which are * not part of the new object. * * Returns: Pointer to item to use for link property (can be the @link item * if the duplicated/copied item is local to the same file). */ typedef IpatchItem * (*IpatchItemCopyLinkFunc)(IpatchItem *item, IpatchItem *link, gpointer user_data); /* Base patch item object */ struct _IpatchItem { GObject object; /*< private >*/ int flags; /* flag field (atomic int ops used) */ IpatchItem *parent; /* parent item or NULL if not parented or root */ IpatchItem *base; /* base parent object or NULL */ GStaticRecMutex *mutex; /* pointer to mutex (could be a parent's mutex) */ }; /* Base patch item class */ struct _IpatchItemClass { GObjectClass parent_class; /*< public >*/ gboolean mutex_slave; /* set to TRUE to use parent thread mutex */ /* methods */ void (*item_set_property)(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); void (*copy)(IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); void (*remove)(IpatchItem *item); }; typedef enum { IPATCH_ITEM_HOOKS_ACTIVE = 1 << 0, /* hook callbacks active? */ IPATCH_ITEM_FREE_MUTEX = 1 << 1 /* TRUE if item should free its mutex */ } IpatchItemFlags; /* 2 flags + reserve 2 bits for future expansion */ #define IPATCH_ITEM_UNUSED_FLAG_SHIFT 4 /* Multi-thread locking macros. For now there is no distinction between write and read locking since GStaticRWLock is not recursive. */ #define IPATCH_ITEM_WLOCK(item) \ g_static_rec_mutex_lock (((IpatchItem *)(item))->mutex) #define IPATCH_ITEM_WUNLOCK(item) \ g_static_rec_mutex_unlock (((IpatchItem *)(item))->mutex) #define IPATCH_ITEM_RLOCK(item) IPATCH_ITEM_WLOCK(item) #define IPATCH_ITEM_RUNLOCK(item) IPATCH_ITEM_WUNLOCK(item) /** * IpatchItemPropNotify: * @item: Item whose property changed * @pspec: Parameter spec of property which changed * @new_value: New value assigned to the property * @old_value: Old value that the property had (can be %NULL for read only * properties) * @user_data: User defined pointer from when callback was added * @event_ptrs: Per event data defined by users of callback system * * Property notify information structure. */ typedef struct { IpatchItem *item; /* item whose property changed */ GParamSpec *pspec; /* property spec of the property that changed */ const GValue *new_value; /* new value of the property */ const GValue *old_value; /* old value of the property (can be NULL!) */ gpointer user_data; /* user defined data, defined on connect */ /* per event data */ struct { gpointer data; /* implementation defined data per event */ GDestroyNotify destroy; /* function called to cleanup for @data */ } eventdata[4]; } IpatchItemPropNotify; /** * IPATCH_ITEM_PROP_NOTIFY_SET_EVENT: * @info: IpatchItemPropNotify pointer * @index: Pointer index (0-3) * @data: Data to assign to pointer field * @destroy: Callback function to cleanup @data when done (or %NULL) * * A macro for assigning per event pointers to #IpatchItemPropNotify. */ #define IPATCH_ITEM_PROP_NOTIFY_SET_EVENT(info, index, data, destroy) \ (info)->eventdata[index].data = data; (info)->eventdata[index].destroy = destroy /** * IpatchItemPropCallback: * * IpatchItem property change callback function prototype. */ typedef void (*IpatchItemPropCallback)(IpatchItemPropNotify *notify); /** * IpatchItemPropDisconnect: * @item: Item of prop change match criteria * @pspec: Parameter spec of prop change match criteria * @user_data: User defined pointer from when callback was added * * Function prototype which gets called when a property notify callback gets * disconnected. */ typedef void (*IpatchItemPropDisconnect)(IpatchItem *item, GParamSpec *pspec, gpointer user_data); /* Convenience macro used by IpatchItem copy methods to call a copy link function, or use the link pointer directly if function is NULL */ #define IPATCH_ITEM_COPY_LINK_FUNC(item, link, func, userdata) \ (func ? func (item, link, userdata) : link) /* stored publicy for added convenience to derived types */ extern GParamSpec *ipatch_item_pspec_title; GType ipatch_item_get_type (void); /** * ipatch_item_get_flags: * @item: #IpatchItem to get flag field from * * Get the value of the flags field in a patch item. * * Returns: Value of flags field (some of which is user definable). */ static inline int ipatch_item_get_flags (gpointer item) { return (item ? g_atomic_int_get (&((IpatchItem *)item)->flags) : 0); } /** * ipatch_item_set_flags: * @item: #IpatchItem to set flags in * @flags: Flags to set * * Set flags in a patch item. All bits that are set in @flags are set in * the @item flags field. */ static inline void ipatch_item_set_flags (gpointer item, int flags) { int oldval, newval; if (!item) return; do { oldval = g_atomic_int_get (&((IpatchItem *)item)->flags); newval = oldval | flags; } while (!g_atomic_int_compare_and_exchange (&((IpatchItem *)item)->flags, oldval, newval)); } /** * ipatch_item_clear_flags: * @item: #IpatchItem object to clear flags in * @flags: Flags to clear * * Clear (unset) flags in a patch item. All bits that are set in @flags are * cleared in the @item flags field. */ static inline void ipatch_item_clear_flags (gpointer item, int flags) { int oldval, newval; if (!item) return; do { oldval = g_atomic_int_get (&((IpatchItem *)item)->flags); newval = oldval & ~flags; } while (!g_atomic_int_compare_and_exchange (&((IpatchItem *)item)->flags, oldval, newval)); } void ipatch_item_set_parent (IpatchItem *item, IpatchItem *parent); void ipatch_item_unparent (IpatchItem *item); IpatchItem *ipatch_item_get_parent (IpatchItem *item); IpatchItem *ipatch_item_peek_parent (IpatchItem *item); IpatchItem *ipatch_item_get_base (IpatchItem *item); IpatchItem *ipatch_item_peek_base (IpatchItem *item); IpatchItem *ipatch_item_get_ancestor_by_type (IpatchItem *item, GType ancestor_type); IpatchItem *ipatch_item_peek_ancestor_by_type (IpatchItem *item, GType ancestor_type); void ipatch_item_remove (IpatchItem *item); void ipatch_item_changed (IpatchItem *item); void ipatch_item_get_property_fast (IpatchItem *item, GParamSpec *pspec, GValue *value); void ipatch_item_copy (IpatchItem *dest, IpatchItem *src); void ipatch_item_copy_link_func (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); void ipatch_item_copy_replace (IpatchItem *dest, IpatchItem *src, GHashTable *repl_hash); IpatchItem *ipatch_item_duplicate (IpatchItem *item); IpatchItem *ipatch_item_duplicate_link_func (IpatchItem *item, IpatchItemCopyLinkFunc link_func, gpointer user_data); IpatchItem *ipatch_item_duplicate_replace (IpatchItem *item, GHashTable *repl_hash); IpatchList *ipatch_item_duplicate_deep (IpatchItem *item); IpatchItem *ipatch_item_copy_link_func_deep (IpatchItem *item, IpatchItem *link, gpointer user_data); IpatchItem *ipatch_item_copy_link_func_hash (IpatchItem *item, IpatchItem *link, gpointer user_data); gboolean ipatch_item_type_can_conflict (GType item_type); GParamSpec **ipatch_item_type_get_unique_specs (GType item_type, guint32 *groups); GValueArray *ipatch_item_get_unique_props (IpatchItem *item); guint ipatch_item_test_conflict (IpatchItem *item1, IpatchItem *item2); void ipatch_item_set_atomic (gpointer item, const char *first_property_name, ...); void ipatch_item_get_atomic (gpointer item, const char *first_property_name, ...); IpatchItem *ipatch_item_first (IpatchIter *iter); IpatchItem *ipatch_item_next (IpatchIter *iter); /* in IpatchItemProp.c */ void ipatch_item_prop_notify (IpatchItem *item, GParamSpec *pspec, const GValue *new_value, const GValue *old_value); void ipatch_item_prop_notify_by_name (IpatchItem *item, const char *prop_name, const GValue *new_value, const GValue *old_value); guint ipatch_item_prop_connect (IpatchItem *item, GParamSpec *pspec, IpatchItemPropCallback callback, IpatchItemPropDisconnect disconnect, gpointer user_data); guint ipatch_item_prop_connect_by_name (IpatchItem *item, const char *prop_name, IpatchItemPropCallback callback, IpatchItemPropDisconnect disconnect, gpointer user_data); void ipatch_item_prop_disconnect (guint handler_id); void ipatch_item_prop_disconnect_matched (IpatchItem *item, GParamSpec *pspec, IpatchItemPropCallback callback, gpointer user_data); void ipatch_item_prop_disconnect_by_name (IpatchItem *item, const char *prop_name, IpatchItemPropCallback callback, gpointer user_data); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2VoiceCache_SF2.h0000644000175000017500000000553111461332142020062 00000000000000/* * IpatchSF2VoiceCache_SF2.h - Voice cache converters for SoundFont types * * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. * */ #ifndef __IPATCH_SF2_VOICE_CACHE_SF2_H__ #define __IPATCH_SF2_VOICE_CACHE_SF2_H__ #include #include #include typedef IpatchConverterSF2VoiceCache IpatchConverterSF2PresetToSF2VoiceCache; typedef IpatchConverterSF2VoiceCacheClass IpatchConverterSF2PresetToSF2VoiceCacheClass; typedef IpatchConverterSF2VoiceCache IpatchConverterSF2PZoneToSF2VoiceCache; typedef IpatchConverterSF2VoiceCacheClass IpatchConverterSF2PZoneToSF2VoiceCacheClass; typedef IpatchConverterSF2VoiceCache IpatchConverterSF2InstToSF2VoiceCache; typedef IpatchConverterSF2VoiceCacheClass IpatchConverterSF2InstToSF2VoiceCacheClass; typedef IpatchConverterSF2VoiceCache IpatchConverterSF2IZoneToSF2VoiceCache; typedef IpatchConverterSF2VoiceCacheClass IpatchConverterSF2IZoneToSF2VoiceCacheClass; typedef IpatchConverterSF2VoiceCache IpatchConverterSF2SampleToSF2VoiceCache; typedef IpatchConverterSF2VoiceCacheClass IpatchConverterSF2SampleToSF2VoiceCacheClass; #define IPATCH_TYPE_CONVERTER_SF2_PRESET_TO_SF2_VOICE_CACHE \ (ipatch_converter_sf2_preset_to_sf2_voice_cache_get_type ()) #define IPATCH_TYPE_CONVERTER_SF2_PZONE_TO_SF2_VOICE_CACHE \ (ipatch_converter_sf2_pzone_to_sf2_voice_cache_get_type ()) #define IPATCH_TYPE_CONVERTER_SF2_INST_TO_SF2_VOICE_CACHE \ (ipatch_converter_sf2_inst_to_sf2_voice_cache_get_type ()) #define IPATCH_TYPE_CONVERTER_SF2_IZONE_TO_SF2_VOICE_CACHE \ (ipatch_converter_sf2_izone_to_sf2_voice_cache_get_type ()) #define IPATCH_TYPE_CONVERTER_SF2_SAMPLE_TO_SF2_VOICE_CACHE \ (ipatch_converter_sf2_sample_to_sf2_voice_cache_get_type ()) GType ipatch_converter_sf2_preset_to_sf2_voice_cache_get_type (void); GType ipatch_converter_sf2_pzone_to_sf2_voice_cache_get_type (void); GType ipatch_converter_sf2_inst_to_sf2_voice_cache_get_type (void); GType ipatch_converter_sf2_izone_to_sf2_voice_cache_get_type (void); GType ipatch_converter_sf2_sample_to_sf2_voice_cache_get_type (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchDLS2.h0000644000175000017500000000773511461332142015620 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchDLS2 * @short_description: DLS version 2 instrument file object * @see_also: * @stability: Stable * * Object type for DLS version 2 format instruments. */ #ifndef __IPATCH_DLS2_H__ #define __IPATCH_DLS2_H__ #include #include /* forward type declarations */ typedef struct _IpatchDLS2 IpatchDLS2; typedef struct _IpatchDLS2Class IpatchDLS2Class; #include #include #include #include #include #include #define IPATCH_TYPE_DLS2 (ipatch_dls2_get_type ()) #define IPATCH_DLS2(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_DLS2, IpatchDLS2)) #define IPATCH_DLS2_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_DLS2, IpatchDLS2Class)) #define IPATCH_IS_DLS2(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_DLS2)) #define IPATCH_IS_DLS2_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_DLS2)) #define IPATCH_DLS2_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_DLS2, IpatchDLS2Class)) /* DLS level 2 object */ struct _IpatchDLS2 { /*< public >*/ IpatchBase parent_instance; /* NOTE: This is not the DLS version! Optional descriptive stamp version */ guint32 ms_version; /* most significant 32 bits of 64 bit version */ guint32 ls_version; /* least significant 32 bits of 64 bit version */ IpatchDLS2Info *info; /* info strings */ GSList *insts; /* list of #IpatchDLS2Inst objects */ GSList *samples; /* list of #IpatchDLS2Sample objects */ guint8 *dlid; /* 16 bytes or NULL - globally unique ID (indicates changes) */ }; /* DLS level 2 class */ struct _IpatchDLS2Class { IpatchBaseClass parent_class; }; /* IpatchItem flags */ typedef enum { /* set if the ms_version/ls_version values are valid */ IPATCH_DLS2_VERSION_SET = 1 << IPATCH_BASE_UNUSED_FLAG_SHIFT } IpatchDLS2Flags; /* reserve a couple flags for expansion */ #define IPATCH_DLS2_UNUSED_FLAG_SHIFT (IPATCH_BASE_UNUSED_FLAG_SHIFT + 4) GType ipatch_dls2_get_type (void); IpatchDLS2 *ipatch_dls2_new (void); #define ipatch_dls2_get_insts(dls) \ ipatch_container_get_children (IPATCH_CONTAINER (dls), \ IPATCH_TYPE_DLS2_INST) #define ipatch_dls2_get_samples(dls) \ ipatch_container_get_children (IPATCH_CONTAINER (dls), \ IPATCH_TYPE_DLS2_SAMPLE) void ipatch_dls2_set_file (IpatchDLS2 *dls, IpatchDLSFile *file); IpatchDLSFile *ipatch_dls2_get_file (IpatchDLS2 *dls); char *ipatch_dls2_get_info (IpatchDLS2 *dls, guint32 fourcc); void ipatch_dls2_set_info (IpatchDLS2 *dls, guint32 fourcc, const char *val); char *ipatch_dls2_make_unique_name (IpatchDLS2 *dls, GType child_type, const char *name, const IpatchItem *exclude); IpatchDLS2Inst *ipatch_dls2_find_inst (IpatchDLS2 *dls, const char *name, int bank, int program, const IpatchDLS2Inst *exclude); IpatchDLS2Sample *ipatch_dls2_find_sample (IpatchDLS2 *dls, const char *name, const IpatchDLS2Sample *exclude); IpatchList *ipatch_dls2_get_region_references (IpatchDLS2Sample *sample); #endif libinstpatch-1.0.0/libinstpatch/IpatchUnit_generic.c0000644000175000017500000001430311461332142017507 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchUnit_generic.h" #include "IpatchUnit.h" #include "IpatchRange.h" #include "i18n.h" /* used to convert cents (100ths of a semitone) to hertz */ #define HERTZ_CENTS_FACTOR 8.175798915643707 static void ipatch_unit_cents_to_hertz_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_hertz_to_cents_value (const GValue *src_val, GValue *dest_val); void _ipatch_unit_generic_init (void) { IpatchUnitInfo *info; /* register generic unit types */ info = ipatch_unit_info_new (); info->name = "Int"; info->id = IPATCH_UNIT_TYPE_INT; info->label = NULL; info->descr = NULL; info->value_type = G_TYPE_INT; info->flags = 0; info->digits = 0; ipatch_unit_register (info); info->name = "UInt"; info->id = IPATCH_UNIT_TYPE_UINT; info->value_type = G_TYPE_UINT; ipatch_unit_register (info); info->name = "Range"; info->id = IPATCH_UNIT_TYPE_RANGE; info->value_type = IPATCH_TYPE_RANGE; ipatch_unit_register (info); info->name = "Decibels"; info->id = IPATCH_UNIT_TYPE_DECIBELS; info->label = _("dB"); /* abbreviation for decibel */ info->descr = _("Decibels"); info->value_type = G_TYPE_DOUBLE; info->flags = IPATCH_UNIT_LOGARITHMIC | IPATCH_UNIT_USER; info->digits = 3; ipatch_unit_register (info); info->name = "Percent"; info->id = IPATCH_UNIT_TYPE_PERCENT; info->label = _("%"); /* abbreviation for percent */ info->descr = _("Percent"); info->value_type = G_TYPE_DOUBLE; info->flags = IPATCH_UNIT_USER; info->digits = 1; ipatch_unit_register (info); info->name = "Semitones"; info->id = IPATCH_UNIT_TYPE_SEMITONES; info->label = _("Notes"); info->descr = _("Unit of pitch ratio (one note)"); info->value_type = G_TYPE_INT; info->flags = IPATCH_UNIT_USER; info->digits = 0; ipatch_unit_register (info); info->name = "Cents"; info->id = IPATCH_UNIT_TYPE_CENTS; info->label = _("Cents"); info->descr = _("Unit of pitch ratio (100th of a semitone)"); info->value_type = G_TYPE_INT; info->flags = IPATCH_UNIT_USER; info->digits = 0; ipatch_unit_register (info); info->name = "TimeCents"; info->id = IPATCH_UNIT_TYPE_TIME_CENTS; info->label = _("T-Cents"); info->descr = _("Time ratio in cents (1200 cents = 2x)"); info->value_type = G_TYPE_DOUBLE; info->flags = IPATCH_UNIT_USER; info->digits = 3; ipatch_unit_register (info); info->name = "SampleRate"; info->id = IPATCH_UNIT_TYPE_SAMPLE_RATE; info->label = _("Rate"); /* abbreviation for sample rate */ info->descr = _("Audio sampling rate"); info->value_type = G_TYPE_INT; info->flags = IPATCH_UNIT_USER; info->digits = 0; ipatch_unit_register (info); info->name = "Samples"; info->id = IPATCH_UNIT_TYPE_SAMPLES; info->label = _("Samples"); info->descr = _("Number of sample points"); info->value_type = G_TYPE_INT; info->flags = IPATCH_UNIT_USER; info->digits = 0; ipatch_unit_register (info); info->name = "Hertz"; info->id = IPATCH_UNIT_TYPE_HERTZ; info->label = _("Hz"); /* abbreviation for Hertz */ info->descr = _("Frequency in Hertz (cycles per second)"); info->value_type = G_TYPE_DOUBLE; info->flags = IPATCH_UNIT_USER; info->digits = 3; ipatch_unit_register (info); info->name = "Seconds"; info->id = IPATCH_UNIT_TYPE_SECONDS; info->label = _("Sec"); /* abbreviation for seconds */ info->descr = _("Amount of time in seconds"); info->value_type = G_TYPE_DOUBLE; info->flags = IPATCH_UNIT_USER; info->digits = 3; ipatch_unit_register (info); info->name = "Multiplier"; info->id = IPATCH_UNIT_TYPE_MULTIPLIER; info->label = _("X"); /* abbreviation for multiplier */ info->descr = _("Multiplier"); info->value_type = G_TYPE_DOUBLE; info->flags = IPATCH_UNIT_USER; info->digits = 3; ipatch_unit_register (info); ipatch_unit_info_free (info); /* done with unit info structure, free it */ /* conversion functions */ /* Hertz <==> Cents */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_CENTS, IPATCH_UNIT_TYPE_HERTZ, ipatch_unit_cents_to_hertz_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_HERTZ, IPATCH_UNIT_TYPE_CENTS, ipatch_unit_hertz_to_cents_value); } /** * ipatch_unit_cents_to_hertz: * @cents: Value in cents * * Convert cents to relative frequency in Hertz. * * Returns: Value in relative Hertz (cycles per second) */ double ipatch_unit_cents_to_hertz (double cents) { return (HERTZ_CENTS_FACTOR * pow (2.0, cents / 1200.0)); } /** * ipatch_unit_hertz_to_cents: * @hz: Hertz (cycles per second) value * * Convert frequency in Hertz to relative cents. * * Returns: Converted value in relative cents. */ double ipatch_unit_hertz_to_cents (double hz) { return (log (hz / HERTZ_CENTS_FACTOR) / log (2) * 1200); } /* ================================================= GValue conversion functions, duplicated for speed ================================================= */ static void ipatch_unit_cents_to_hertz_value (const GValue *src_val, GValue *dest_val) { double cents = g_value_get_double (src_val); g_value_set_double (dest_val, HERTZ_CENTS_FACTOR * pow (2.0, cents / 1200.0)); } static void ipatch_unit_hertz_to_cents_value (const GValue *src_val, GValue *dest_val) { double hz = g_value_get_double (src_val); g_value_set_double (dest_val, log (hz / HERTZ_CENTS_FACTOR) / log (2) * 1200); } libinstpatch-1.0.0/libinstpatch/IpatchConvert_DLS2.h0000644000175000017500000000370011461332142017304 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchConvert_DLS2 * @short_description: DLS conversion types * @see_also: #IpatchConverter * @stability: Stable * * DLS object converter types. */ #ifndef __IPATCH_CONVERT_DLS2_H__ #define __IPATCH_CONVERT_DLS2_H__ #include #include #include typedef IpatchConverter IpatchConverterDLS2ToFile; typedef IpatchConverterClass IpatchConverterDLS2ToFileClass; typedef IpatchConverter IpatchConverterFileToDLS2; typedef IpatchConverterClass IpatchConverterFileToDLS2Class; typedef IpatchConverter IpatchConverterFileToDLS2Sample; typedef IpatchConverterClass IpatchConverterFileToDLS2SampleClass; #define IPATCH_TYPE_CONVERTER_DLS2_TO_FILE \ (ipatch_converter_dls2_to_file_get_type ()) #define IPATCH_TYPE_CONVERTER_FILE_TO_DLS2 \ (ipatch_converter_file_to_dls2_get_type ()) #define IPATCH_TYPE_CONVERTER_FILE_TO_DLS2_SAMPLE \ (ipatch_converter_file_to_dls2_sample_get_type ()) GType ipatch_converter_dls2_to_file_get_type (void); GType ipatch_converter_file_to_dls2_get_type (void); GType ipatch_converter_file_to_dls2_sample_get_type (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2Inst.h0000644000175000017500000000571011461332142016333 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2Inst * @short_description: SoundFont instrument object * @see_also: #IpatchSF2, #IpatchSF2PZone * @stability: Stable * * SoundFont instruments are children of #IpatchSF2 objects and are referenced * by #IpatchSF2PZone objects. */ #ifndef __IPATCH_SF2_INST_H__ #define __IPATCH_SF2_INST_H__ #include #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchSF2Inst IpatchSF2Inst; typedef struct _IpatchSF2InstClass IpatchSF2InstClass; #define IPATCH_TYPE_SF2_INST (ipatch_sf2_inst_get_type ()) #define IPATCH_SF2_INST(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_INST, \ IpatchSF2Inst)) #define IPATCH_SF2_INST_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_INST, \ IpatchSF2InstClass)) #define IPATCH_IS_SF2_INST(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_INST)) #define IPATCH_IS_SF2_INST_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2_INST)) #define IPATCH_SF2_INST_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SF2_INST, \ IpatchSF2InstClass)) /* SoundFont instrument item */ struct _IpatchSF2Inst { IpatchContainer parent_instance; char *name; /* name of inst */ GSList *zones; /* list of inst zones */ GSList *mods; /* modulators for global zone */ IpatchSF2GenArray genarray; /* generator array for global zone */ }; struct _IpatchSF2InstClass { IpatchContainerClass parent_class; }; GType ipatch_sf2_inst_get_type (void); IpatchSF2Inst *ipatch_sf2_inst_new (void); #define ipatch_sf2_inst_get_zones(inst) \ ipatch_container_get_children (IPATCH_CONTAINER (inst), \ IPATCH_TYPE_SF2_ZONE) IpatchSF2Inst *ipatch_sf2_inst_first (IpatchIter *iter); IpatchSF2Inst *ipatch_sf2_inst_next (IpatchIter *iter); void ipatch_sf2_inst_new_zone (IpatchSF2Inst *inst, IpatchSF2Sample *sample); void ipatch_sf2_inst_set_name (IpatchSF2Inst *inst, const char *name); char *ipatch_sf2_inst_get_name (IpatchSF2Inst *inst); #endif libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreRom.h0000644000175000017500000000426211461332142020020 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleStoreRom * @short_description: Sample storage object for audio in ROM of a sound card * @see_also: * @stability: Stable */ #ifndef __IPATCH_SAMPLE_STORE_ROM_H__ #define __IPATCH_SAMPLE_STORE_ROM_H__ #include #include #include typedef struct _IpatchSampleStoreRom IpatchSampleStoreRom; typedef struct _IpatchSampleStoreRomClass IpatchSampleStoreRomClass; #define IPATCH_TYPE_SAMPLE_STORE_ROM (ipatch_sample_store_rom_get_type ()) #define IPATCH_SAMPLE_STORE_ROM(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_STORE_ROM, \ IpatchSampleStoreRom)) #define IPATCH_SAMPLE_STORE_ROM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_STORE_ROM, \ IpatchSampleStoreRomClass)) #define IPATCH_IS_SAMPLE_STORE_ROM(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_STORE_ROM)) #define IPATCH_IS_SAMPLE_STORE_ROM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_STORE_ROM)) /* ROM sample store instance */ struct _IpatchSampleStoreRom { IpatchSampleStore parent_instance; guint location; }; /* ROM sample store class */ struct _IpatchSampleStoreRomClass { IpatchSampleStoreClass parent_class; }; GType ipatch_sample_store_rom_get_type (void); IpatchSample *ipatch_sample_store_rom_new (guint location); #endif libinstpatch-1.0.0/libinstpatch/IpatchDLSFile.c0000644000175000017500000000564711461363465016345 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchDLSFile.h" #include "ipatch_priv.h" #include "i18n.h" #include "misc.h" static gboolean ipatch_dls_file_identify (IpatchFile *file, IpatchFileHandle *handle, GError **err); G_DEFINE_TYPE (IpatchDLSFile, ipatch_dls_file, IPATCH_TYPE_FILE); static void ipatch_dls_file_class_init (IpatchDLSFileClass *klass) { IpatchFileClass *file_class = IPATCH_FILE_CLASS (klass); file_class->identify = ipatch_dls_file_identify; } static void ipatch_dls_file_init (IpatchDLSFile *file) { } /* DLS/gig file identification function */ static gboolean ipatch_dls_file_identify (IpatchFile *file, IpatchFileHandle *handle, GError **err) { guint32 buf[3]; char *filename; gboolean retval = FALSE; int len = 0; /* Silence gcc */ filename = ipatch_file_get_name (file); /* ++ alloc file name */ /* Check if file ends with .gig extension first, since we can't easily * check by content. Defer to gig identify method. */ if (filename) { len = strlen (filename); if (len >= 4 && g_ascii_strcasecmp (filename + len - 4, ".gig") == 0) { g_free (filename); /* -- free file name */ return (FALSE); } } if (handle) /* Test content */ { if (ipatch_file_read (handle, buf, 12, err) && buf[0] == IPATCH_FOURCC_RIFF && buf[2] == IPATCH_DLS_FOURCC_DLS) retval = TRUE; } else if (filename) /* Test file name extension */ { if ((len >= 4 && g_ascii_strcasecmp (filename + len - 4, ".dls") == 0) || (len >= 5 && g_ascii_strcasecmp (filename + len - 5, ".dls2") == 0)) retval = TRUE; } g_free (filename); /* -- free filename */ return (retval); } /** * ipatch_dls_file_new: * * Create a new DLS file object. * * Returns: New DLS file object (derived from IpatchFile) with a * reference count of 1. Caller owns the reference and removing it will * destroy the item. */ IpatchDLSFile * ipatch_dls_file_new (void) { return (IPATCH_DLS_FILE (g_object_new (IPATCH_TYPE_DLS_FILE, NULL))); } libinstpatch-1.0.0/libinstpatch/sample.c0000644000175000017500000006244011461332142015231 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "sample.h" #include "IpatchSampleTransform.h" /* NOTES: * 24 bit is converted to 4 byte integers first (less of a pain) * Floating point audio is assumed to have a range of -1.0 to 1.0. */ #define NOP (void)0; #define TRANS_FUNC(NAME, INTYPE, OUTTYPE, PRE, CODE, POST) \ void TFF_ ## NAME (IpatchSampleTransform *transform) \ { \ INTYPE *inp = transform->buf1; \ OUTTYPE *outp = transform->buf2; \ guint i, count = transform->samples; \ PRE \ \ for (i = 0; i < count; i++) \ CODE; \ POST \ } /* float transforms */ TRANS_FUNC (floattodouble, gfloat, gdouble, NOP, { outp[i] = inp[i]; }, NOP) TRANS_FUNC (doubletofloat, gdouble, gfloat, NOP, { outp[i] = inp[i]; }, NOP) /* signed bit width change funcs */ TRANS_FUNC (s8to16, gint8, gint16, NOP, { outp[i] = (gint16)inp[i] << 8; }, NOP) TRANS_FUNC (s8to24, gint8, gint32, NOP, { outp[i] = (gint32)inp[i] << 16; }, NOP) TRANS_FUNC (s8to32, gint8, gint32, NOP, { outp[i] = (gint32)inp[i] << 24; }, NOP) TRANS_FUNC (s8tofloat, gint8, gfloat, NOP, { outp[i] = inp[i] / (float)128.0; }, NOP) TRANS_FUNC (s8todouble, gint8, gdouble, NOP, { outp[i] = inp[i] / (double)128.0; }, NOP) TRANS_FUNC (s16to8, gint16, gint8, NOP, { outp[i] = inp[i] >> 8; }, NOP) TRANS_FUNC (s16to24, gint16, gint32, NOP, { outp[i] = inp[i] << 8; }, NOP) TRANS_FUNC (s16to32, gint16, gint32, NOP, { outp[i] = inp[i] << 16; }, NOP) TRANS_FUNC (s16tofloat, gint16, gfloat, NOP, { outp[i] = inp[i] / (float)32768.0; }, NOP) TRANS_FUNC (s16todouble, gint16, gdouble, NOP, { outp[i] = inp[i] / (double)32768.0; }, NOP) TRANS_FUNC (s24to8, gint32, gint8, NOP, { outp[i] = inp[i] >> 16; }, NOP) TRANS_FUNC (s24to16, gint32, gint16, NOP, { outp[i] = inp[i] >> 8; }, NOP) TRANS_FUNC (s24to32, gint32, gint32, NOP, { outp[i] = inp[i] << 8; }, NOP) TRANS_FUNC (s24tofloat, gint32, gfloat, NOP, { outp[i] = inp[i] / (float)8388608.0; }, NOP) TRANS_FUNC (s24todouble, gint32, gdouble, NOP, { outp[i] = inp[i] / (double)8388608.0; }, NOP) TRANS_FUNC (s32to8, gint32, gint8, NOP, { outp[i] = inp[i] >> 24; }, NOP) TRANS_FUNC (s32to16, gint32, gint16, NOP, { outp[i] = inp[i] >> 16; }, NOP) TRANS_FUNC (s32to24, gint32, gint32, NOP, { outp[i] = inp[i] >> 8; }, NOP) TRANS_FUNC (s32tofloat, gint32, gfloat, NOP, { outp[i] = inp[i] / (float)2147483648.0; }, NOP) TRANS_FUNC (s32todouble, gint32, gdouble, NOP, { outp[i] = inp[i] / (double)2147483648.0; }, NOP) TRANS_FUNC (floattos8, gfloat, gint8, NOP, { outp[i] = inp[i] * 127.0; }, NOP) TRANS_FUNC (floattos16, gfloat, gint16, NOP, { outp[i] = inp[i] * 32767.0; }, NOP) TRANS_FUNC (floattos24, gfloat, gint32, NOP, { outp[i] = inp[i] * 8388607.0; }, NOP) TRANS_FUNC (floattos32, gfloat, gint32, NOP, { outp[i] = inp[i] * 2147483647.0; }, NOP) TRANS_FUNC (doubletos8, gdouble, gint8, NOP, { outp[i] = inp[i] * 127.0; }, NOP) TRANS_FUNC (doubletos16, gdouble, gint16, NOP, { outp[i] = inp[i] * 32767.0; }, NOP) TRANS_FUNC (doubletos24, gdouble, gint32, NOP, { outp[i] = inp[i] * 8388607.0; }, NOP) TRANS_FUNC (doubletos32, gdouble, gint32, NOP, { outp[i] = inp[i] * 2147483647.0; }, NOP) /* unsigned bit width change funcs */ TRANS_FUNC (u8to16, guint8, guint16, NOP, { outp[i] = inp[i] << 8; }, NOP) TRANS_FUNC (u8to24, guint8, guint32, NOP, { outp[i] = inp[i] << 16; }, NOP) TRANS_FUNC (u8to32, guint8, guint32, NOP, { outp[i] = inp[i] << 24; }, NOP) TRANS_FUNC (u8tofloat, guint8, gfloat, NOP, { outp[i] = (gint8)(inp[i] ^ 0x80) / (float)128.0; }, NOP) TRANS_FUNC (u8todouble, guint8, gdouble, NOP, { outp[i] = (gint8)(inp[i] ^ 0x80) / (double)128.0; }, NOP) TRANS_FUNC (u16to8, guint16, guint8, NOP, { outp[i] = inp[i] >> 8; }, NOP) TRANS_FUNC (u16to24, guint16, guint32, NOP, { outp[i] = inp[i] << 8; }, NOP) TRANS_FUNC (u16to32, guint16, guint32, NOP, { outp[i] = inp[i] << 16; }, NOP) TRANS_FUNC (u16tofloat, guint16, gfloat, NOP, { outp[i] = (gint16)(inp[i] ^ 0x8000) / (float)32768.0; }, NOP) TRANS_FUNC (u16todouble, guint16, gdouble, NOP, { outp[i] = (gint16)(inp[i] ^ 0x8000) / (double)32768.0; }, NOP) TRANS_FUNC (u24to8, guint32, guint8, NOP, { outp[i] = inp[i] >> 16; }, NOP) TRANS_FUNC (u24to16, guint32, guint16, NOP, { outp[i] = inp[i] >> 8; }, NOP) TRANS_FUNC (u24to32, guint32, guint32, NOP, { outp[i] = inp[i] << 8; }, NOP) TRANS_FUNC (u24tofloat, guint32, gfloat, NOP, { outp[i] = ((gint32)inp[i] - 0x800000) / (float)8388608.0; }, NOP) TRANS_FUNC (u24todouble, guint32, gdouble, NOP, { outp[i] = ((gint32)inp[i] - 0x800000) / (double)8388608.0; }, NOP) TRANS_FUNC (u32to8, guint32, guint8, NOP, { outp[i] = inp[i] >> 24; }, NOP) TRANS_FUNC (u32to16, guint32, guint16, NOP, { outp[i] = inp[i] >> 16; }, NOP) TRANS_FUNC (u32to24, guint32, guint32, NOP, { outp[i] = inp[i] >> 8; }, NOP) TRANS_FUNC (u32tofloat, guint32, gfloat, NOP, { outp[i] = (gint32)(inp[i] ^ 0x80000000) / (float)2147483648.0; }, NOP) TRANS_FUNC (u32todouble, guint32, gdouble, NOP, { outp[i] = (gint32)(inp[i] ^ 0x80000000) / (double)2147483648.0; }, NOP) TRANS_FUNC (floattou8, gfloat, guint8, NOP, { outp[i] = (inp[i] + 1.0) * 127.5 + 0.5; }, NOP) TRANS_FUNC (floattou16, gfloat, guint16, NOP, { outp[i] = (inp[i] + 1.0) * 32767.5 + 0.5; }, NOP) TRANS_FUNC (floattou24, gfloat, guint32, NOP, { outp[i] = (inp[i] + 1.0) * 8388607.5 + 0.5; }, NOP) TRANS_FUNC (floattou32, gfloat, guint32, NOP, { outp[i] = (inp[i] + 1.0) * 2147483647.5 + 0.5; }, NOP) TRANS_FUNC (doubletou8, gdouble, guint8, NOP, { outp[i] = (inp[i] + 1.0) * 127.5 + 0.5; }, NOP) TRANS_FUNC (doubletou16, gdouble, guint16, NOP, { outp[i] = (inp[i] + 1.0) * 32767.5 + 0.5; }, NOP) TRANS_FUNC (doubletou24, gdouble, guint32, NOP, { outp[i] = (inp[i] + 1.0) * 8388607.5 + 0.5; }, NOP) TRANS_FUNC (doubletou32, gdouble, guint32, NOP, { outp[i] = (inp[i] + 1.0) * 2147483647.5 + 0.5; }, NOP) /* sign changer funcs (24 bit in 4 byte integers requires 2 separate funcs) */ TRANS_FUNC (togsign8, guint8, guint8, NOP, { outp[i] = inp[i] ^ 0x80; }, NOP) TRANS_FUNC (togsign16, guint16, guint16, NOP, { outp[i] = inp[i] ^ 0x8000; }, NOP) TRANS_FUNC (signtou24, guint32, guint32, NOP, { outp[i] = inp[i] + 0x800000; }, NOP) TRANS_FUNC (unsigntos24, gint32, gint32, NOP, { outp[i] = ((inp[i] ^ 0x800000) << 8) >> 8; }, NOP) TRANS_FUNC (togsign32, guint32, guint32, NOP, { outp[i] = inp[i] ^ 0x80000000; }, NOP) /* endian swapping funcs */ TRANS_FUNC (swap16, guint16, guint16, guint16 t;, { t = inp[i]; outp[i] = t << 8 | t >> 8; }, NOP) TRANS_FUNC (swap32, guint32, guint32, guint32 t;, { t = inp[i]; outp[i] = ((t & 0xFF) << 24) | ((t & 0xFF00) << 8) | ((t & 0xFF0000) >> 8) | ((t & 0xFF000000) >> 24); }, NOP) TRANS_FUNC (swap64, guint64, guint64, guint64 t;, { t = inp[i]; outp[i] = ((t & 0xFF) << 56) | ((t & 0xFF00) << 40) | ((t & 0xFF0000) << 24) | ((t & 0xFF000000) << 8) | ((t & G_GINT64_CONSTANT (0xFF00000000U)) >> 8) | ((t & G_GINT64_CONSTANT (0xFF0000000000U)) >> 24) | ((t & G_GINT64_CONSTANT (0xFF000000000000U)) >> 40) | ((t & G_GINT64_CONSTANT (0xFF00000000000000U)) >> 56); }, NOP) /* funcs for converting between real signed 24 bit (3 byte) and 4 byte words */ /* signed little endian 3 bytes to 4 bytes */ TRANS_FUNC (sle3bto4b, guint8, guint32, guint i2 = 0;, { outp[i] = inp[i2] | (inp[i2 + 1] << 8) | (inp[i2 + 2] << 16) | ((inp[i2 + 2] & 0x80) ? 0xFF000000 : 0); i2 += 3; }, NOP) /* signed big endian 3 bytes to 4 bytes */ TRANS_FUNC (sbe3bto4b, guint8, guint32, guint i2 = 0;, { outp[i] = inp[i2 + 2] | (inp[i2 + 1] << 8) | (inp[i2] << 16) | ((inp[i2] & 0x80) ? 0xFF000000 : 0); i2 += 3; }, NOP) /* 4 bytes to signed little endian 3 bytes */ TRANS_FUNC (4btosle3b, guint32, guint8, guint i2 = 0; gint32 t;, { t = inp[i]; outp[i2] = t; outp[i2 + 1] = t >> 8; outp[i2 + 2] = t >> 16; i2 += 3; }, NOP) /* 4 bytes to signed big endian 3 bytes */ TRANS_FUNC (4btosbe3b, guint32, guint8, guint i2 = 0; gint32 t;, { t = inp[i]; outp[i2 + 2] = t; outp[i2 + 1] = t >> 8; outp[i2] = t >> 16; i2 += 3; }, NOP) /* funcs for converting between real unsigned 24 bit (3 byte) and 4 byte words */ /* unsigned little endian 3 bytes to 4 bytes */ TRANS_FUNC (ule3bto4b, guint8, guint32, guint i2 = 0;, { outp[i] = inp[i2] | (inp[i2 + 1] << 8) | (inp[i2 + 2] << 16); i2 += 3; }, NOP) /* unsigned big endian 3 bytes to 4 bytes */ TRANS_FUNC (ube3bto4b, guint8, guint32, guint i2 = 0;, { outp[i] = inp[i2 + 2] | (inp[i2 + 1] << 8) | (inp[i2] << 16); i2 += 3; }, NOP) /* 4 bytes to unsigned little endian 3 bytes */ TRANS_FUNC (4btoule3b, guint32, guint8, guint i2 = 0; guint32 t;, { t = inp[i]; outp[i2] = t; outp[i2 + 1] = t >> 8; outp[i2 + 2] = t >> 16; i2 += 3; }, NOP) /* 4 bytes to unsigned big endian 3 bytes */ TRANS_FUNC (4btoube3b, guint32, guint8, guint i2 = 0; guint32 t;, { t = inp[i]; outp[i2 + 2] = t; outp[i2 + 1] = t >> 8; outp[i2] = t >> 16; i2 += 3; }, NOP) /* mono to stereo transforms */ TRANS_FUNC (8mtos, guint8, guint8, NOP, { outp[i << 1] = inp[i]; outp[(i << 1) + 1] = inp[i]; }, transform->samples = count << 1;) TRANS_FUNC (16mtos, guint16, guint16, NOP, { outp[i << 1] = inp[i]; outp[(i << 1) + 1] = inp[i]; }, transform->samples = count << 1;) TRANS_FUNC (32mtos, guint32, guint32, NOP, { outp[i << 1] = inp[i]; outp[(i << 1) + 1] = inp[i]; }, transform->samples = count << 1;) TRANS_FUNC (64mtos, guint64, guint64, NOP, { outp[i << 1] = inp[i]; outp[(i << 1) + 1] = inp[i]; }, transform->samples = count << 1;) /* stereo to left transforms */ TRANS_FUNC (8stol, guint8, guint8, count >>= 1;, { outp[i] = inp[i << 1]; }, transform->samples = count;) TRANS_FUNC (16stol, guint16, guint16, count >>= 1;, { outp[i] = inp[i << 1]; }, transform->samples = count;) TRANS_FUNC (32stol, guint32, guint32, count >>= 1;, { outp[i] = inp[i << 1]; }, transform->samples = count;) TRANS_FUNC (64stol, guint64, guint64, count >>= 1;, { outp[i] = inp[i << 1]; }, transform->samples = count;) /* stereo to right transforms */ TRANS_FUNC (8stor, guint8, guint8, count >>= 1;, { outp[i] = inp[(i << 1) + 1]; }, transform->samples = count;) TRANS_FUNC (16stor, guint16, guint16, count >>= 1;, { outp[i] = inp[(i << 1) + 1]; }, transform->samples = count;) TRANS_FUNC (32stor, guint32, guint32, count >>= 1;, { outp[i] = inp[(i << 1) + 1]; }, transform->samples = count;) TRANS_FUNC (64stor, guint64, guint64, count >>= 1;, { outp[i] = inp[(i << 1) + 1]; }, transform->samples = count;) /* arbitrary channel mapping */ TRANS_FUNC (8chanmap, guint8, guint8, int schans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (transform->src_format); \ int dchans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (transform->dest_format); \ int di; int spos = 0; int dpos = 0;, { \ for (di = 0; di < dchans; di++, dpos++) \ outp[dpos] = inp[spos + transform->channel_map[di]]; \ spos += schans; \ }, NOP) TRANS_FUNC (16chanmap, guint16, guint16, int schans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (transform->src_format); \ int dchans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (transform->dest_format); \ int di; int spos = 0; int dpos = 0;, { \ for (di = 0; di < dchans; di++, dpos++) \ outp[dpos] = inp[spos + transform->channel_map[di]]; \ spos += schans; \ }, NOP) TRANS_FUNC (32chanmap, guint32, guint32, int schans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (transform->src_format); \ int dchans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (transform->dest_format); \ int di; int spos = 0; int dpos = 0;, { \ for (di = 0; di < dchans; di++, dpos++) \ outp[dpos] = inp[spos + transform->channel_map[di]]; \ spos += schans; \ }, NOP) TRANS_FUNC (64chanmap, guint64, guint64, int schans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (transform->src_format); \ int dchans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (transform->dest_format); \ int di; int spos = 0; int dpos = 0;, { \ for (di = 0; di < dchans; di++, dpos++) \ outp[dpos] = inp[spos + transform->channel_map[di]]; \ spos += schans; \ }, NOP) /* signed transform func matrix [infmt][outfmt] */ static IpatchSampleTransformFunc signed_tff[6][6] = { { NULL, TFF_s8to16, TFF_s8to24, TFF_s8to32, TFF_s8tofloat, TFF_s8todouble }, { TFF_s16to8, NULL, TFF_s16to24, TFF_s16to32, TFF_s16tofloat, TFF_s16todouble }, { TFF_s24to8, TFF_s24to16, NULL, TFF_s24to32, TFF_s24tofloat, TFF_s24todouble }, { TFF_s32to8, TFF_s32to16, TFF_s32to24, NULL, TFF_s32tofloat, TFF_s32todouble }, { TFF_floattos8, TFF_floattos16, TFF_floattos24, TFF_floattos32, NULL, TFF_floattodouble }, { TFF_doubletos8, TFF_doubletos16, TFF_doubletos24, TFF_doubletos32, TFF_doubletofloat, NULL } }; /* unsiged transform func matrix [infmt][outfmt] */ static IpatchSampleTransformFunc unsigned_tff[6][6] = { { NULL, TFF_u8to16, TFF_u8to24, TFF_u8to32, TFF_u8tofloat, TFF_u8todouble }, { TFF_u16to8, NULL, TFF_u16to24, TFF_u16to32, TFF_u16tofloat, TFF_u16todouble }, { TFF_u24to8, TFF_u24to16, NULL, TFF_u24to32, TFF_u24tofloat, TFF_u24todouble }, { TFF_u32to8, TFF_u32to16, TFF_u32to24, NULL, TFF_u32tofloat, TFF_u32todouble }, { TFF_floattou8, TFF_floattou16, TFF_floattou24, TFF_floattou32, NULL, TFF_floattodouble }, { TFF_doubletou8, TFF_doubletou16, TFF_doubletou24, TFF_doubletou32, TFF_doubletofloat, NULL } }; /* sign toggle transform functions */ static IpatchSampleTransformFunc sign_tff[6] = { TFF_togsign8, TFF_togsign16, NULL, TFF_togsign32, NULL, NULL }; /* endian swap functions */ static IpatchSampleTransformFunc swap_tff[6] = { NULL, TFF_swap16, TFF_swap32, TFF_swap32, TFF_swap32, TFF_swap64 }; /* mono to stereo transform functions */ static IpatchSampleTransformFunc mono_to_stereo_tff[6] = { TFF_8mtos, TFF_16mtos, TFF_32mtos, TFF_32mtos, TFF_32mtos, TFF_64mtos }; /* stereo to left transform functions */ static IpatchSampleTransformFunc stereo_to_left_tff[6] = { TFF_8stol, TFF_16stol, TFF_32stol, TFF_32stol, TFF_32stol, TFF_64stol }; /* stereo to right transform functions */ static IpatchSampleTransformFunc stereo_to_right_tff[6] = { TFF_8stor, TFF_16stor, TFF_32stor, TFF_32stor, TFF_32stor, TFF_64stor }; /* arbitrary transform functions */ static IpatchSampleTransformFunc chanmap_tff[6] = { TFF_8chanmap, TFF_16chanmap, TFF_32chanmap, TFF_32chanmap, TFF_32chanmap, TFF_64chanmap }; /* IpatchSampleWidth format sizes in bytes (last 8 reserved) */ guint ipatch_sample_width_sizes[16] = { 0, 1, 2, 4, 4, 4, 8, 3, 0, 0, 0, 0, 0, 0, 0, 0 }; static inline void update_max_size (int *curmax, int format); /** * ipatch_sample_format_bit_width: * @format: Sample format * * Like ipatch_sample_format_width() but gets the effective bit width of the * format. Of note is this is not always equivelant to the format width * 8. * For example: #IPATCH_SAMPLE_FLOAT has an effective bit width of 23, * #IPATCH_SAMPLE_24BIT has an effective bit width of 24 but is stored in 32 * bits. This function is really only useful for comparing the relative * "quality" of formats, and the actual returned values may change in the * future. * * Returns: Effective bit width of format. */ int ipatch_sample_format_bit_width (int format) { int width; width = IPATCH_SAMPLE_FORMAT_GET_WIDTH (format); switch (width) { case IPATCH_SAMPLE_FLOAT: /* actually 24 with the sign bit, but we set it to 23 to be less than 24 bit integer audio */ return (23); case IPATCH_SAMPLE_DOUBLE: return (52); case IPATCH_SAMPLE_REAL24BIT: return (24); break; default: return (width * 8); } } /** * ipatch_sample_format_verify: * @format: Sample format (#IpatchSampleWidth | #IpatchSampleSign * | #IpatchSampleEndian | #IpatchSampleChannel). * * Verify a sample format integer. * * Returns: %TRUE if valid, %FALSE otherwise */ gboolean ipatch_sample_format_verify (int format) { int width; width = format & IPATCH_SAMPLE_WIDTH_MASK; if (width < IPATCH_SAMPLE_8BIT || width > IPATCH_SAMPLE_REAL24BIT) return (FALSE); if (IPATCH_SAMPLE_FORMAT_IS_UNSIGNED (format) && (width == IPATCH_SAMPLE_FLOAT || width == IPATCH_SAMPLE_DOUBLE)) return (FALSE); if (IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format) >= IPATCH_SAMPLE_MAX_CHANNELS) return (FALSE); return (TRUE); } /** * ipatch_sample_format_transform_verify: * @src_format: Source sample format * @dest_format: Destination sample format * @channel_map: Channel mapping (use #IPATCH_SAMPLE_UNITY_CHANNEL_MAP * to map all input channels to the same output channels, see * #IPATCH_SAMPLE_MAP_CHANNEL macro for constructing channel map values) * * Verify source and destination sample formats and channel map for a sample * transform operation. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_sample_format_transform_verify (int src_format, int dest_format, guint32 channel_map) { int src_chans, dest_chans, i; if (!ipatch_sample_format_verify (src_format) || !ipatch_sample_format_verify (dest_format)) return (FALSE); src_chans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (src_format); dest_chans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (dest_format); for (i = 0; i < dest_chans; i++) if (((channel_map >> (i * 3)) & 0x07) >= src_chans) return (FALSE); return (TRUE); } /** * ipatch_sample_get_transform_funcs: * @src_format: Source audio format to convert from * @dest_format: Destination audio format to convert to * @channel_map: Channel mapping (use #IPATCH_SAMPLE_UNITY_CHANNEL_MAP * to map all input channels to the same output channels, 3 bits times * #IPATCH_SAMPLE_MAX_CHANNELS (8) = 24 bits total, see * #IPATCH_SAMPLE_MAP_CHANNEL macro for constructing channel map values) * @buf1_max_frame: Output - maximum sample frame size for first buffer * @buf2_max_frame: Output - maximum sample frame size for second buffer * @funcs: Caller provided array to store transform functions to. It should * have at least #IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS elements. * * Get transform function array for converting from @src_format to * @dest_format. * * @func_count: Count of function pointers stored to @funcs. Can be 0 if no * transform is required. */ guint ipatch_sample_get_transform_funcs (int src_format, int dest_format, guint32 channel_map, guint *buf1_max_frame, guint *buf2_max_frame, IpatchSampleTransformFunc *funcs) { int swidth, dwidth, curfmt, schan, dchan; int func_index = 0; int max[2] = { 0 }; /* max frame sizes for buffers */ g_return_val_if_fail (ipatch_sample_format_verify (src_format), 0); g_return_val_if_fail (ipatch_sample_format_verify (dest_format), 0); g_return_val_if_fail (funcs != NULL, 0); if (buf1_max_frame) *buf1_max_frame = 0; if (buf2_max_frame) *buf2_max_frame = 0; swidth = src_format & IPATCH_SAMPLE_WIDTH_MASK; dwidth = dest_format & IPATCH_SAMPLE_WIDTH_MASK; schan = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (src_format); dchan = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (dest_format); curfmt = src_format; /* init max frame size of first buffer to input frame size */ max[0] = ipatch_sample_format_size (curfmt); /* convert to 4 byte 24 bit data before 3 byte */ if (G_UNLIKELY (dwidth == IPATCH_SAMPLE_REAL24BIT)) dwidth = IPATCH_SAMPLE_24BIT; /* if 3 byte 24 bit data, convert to native endian 4 byte integers */ if (G_UNLIKELY (swidth == IPATCH_SAMPLE_REAL24BIT)) { if (IPATCH_SAMPLE_FORMAT_IS_LENDIAN (src_format)) funcs[func_index++] = IPATCH_SAMPLE_FORMAT_IS_SIGNED (src_format) ? TFF_sle3bto4b : TFF_ule3bto4b; else funcs[func_index++] = IPATCH_SAMPLE_FORMAT_IS_SIGNED (src_format) ? TFF_sbe3bto4b : TFF_ube3bto4b; swidth = IPATCH_SAMPLE_24BIT; curfmt = (curfmt & ~IPATCH_SAMPLE_WIDTH_MASK) | IPATCH_SAMPLE_24BIT; update_max_size (&max[func_index & 1], curfmt); } /* if converting from more channels to less */ if (G_UNLIKELY (dchan < schan)) { if (G_LIKELY (dchan == 1 && schan == 2)) /* Stereo to mono mapping? */ { /* Stereo to left map? */ if (IPATCH_SAMPLE_MAP_GET_CHANNEL (channel_map, 0) == 0) funcs[func_index++] = stereo_to_left_tff[swidth - 1]; else /* Stereo to right */ funcs[func_index++] = stereo_to_right_tff[swidth - 1]; } else funcs[func_index++] = chanmap_tff[swidth - 1]; curfmt = (curfmt & ~IPATCH_SAMPLE_CHANNEL_MASK) | (dchan - 1); update_max_size (&max[func_index & 1], curfmt); } /* source format differs from host byte order? - swap REAL24BIT is already swapped by 3 to 4 byte conversion above */ if (G_UNLIKELY (IPATCH_SAMPLE_FORMAT_IS_LENDIAN (src_format) != (G_BYTE_ORDER == G_LITTLE_ENDIAN) && swap_tff[swidth - 1] && (src_format & IPATCH_SAMPLE_WIDTH_MASK) != IPATCH_SAMPLE_REAL24BIT)) { funcs[func_index++] = swap_tff[swidth - 1]; curfmt ^= IPATCH_SAMPLE_BENDIAN; update_max_size (&max[func_index & 1], curfmt); } /* if src and dest aren't floating point and sign differs - toggle sign */ if (G_UNLIKELY (swidth != IPATCH_SAMPLE_FLOAT && swidth != IPATCH_SAMPLE_DOUBLE && dwidth != IPATCH_SAMPLE_FLOAT && dwidth != IPATCH_SAMPLE_DOUBLE && IPATCH_SAMPLE_FORMAT_IS_SIGNED (src_format) != IPATCH_SAMPLE_FORMAT_IS_SIGNED (dest_format))) { if (G_UNLIKELY (swidth == IPATCH_SAMPLE_24BIT)) funcs[func_index++] = IPATCH_SAMPLE_FORMAT_IS_SIGNED (src_format) ? TFF_signtou24 : TFF_unsigntos24; else funcs[func_index++] = sign_tff[swidth - 1]; curfmt ^= IPATCH_SAMPLE_UNSIGNED; update_max_size (&max[func_index & 1], curfmt); } if (G_LIKELY (swidth != dwidth)) /* format differs? */ { if (G_UNLIKELY (IPATCH_SAMPLE_FORMAT_IS_FLOATING (curfmt))) { if (IPATCH_SAMPLE_FORMAT_IS_SIGNED (dest_format)) funcs[func_index++] = signed_tff[swidth - 1][dwidth - 1]; else /* unsigned */ funcs[func_index++] = unsigned_tff[swidth - 1][dwidth - 1]; } else { if (IPATCH_SAMPLE_FORMAT_IS_SIGNED (curfmt)) /* signed transform? */ funcs[func_index++] = signed_tff[swidth - 1][dwidth - 1]; else /* unsigned */ funcs[func_index++] = unsigned_tff[swidth - 1][dwidth - 1]; } curfmt = (curfmt & ~IPATCH_SAMPLE_WIDTH_MASK) | dwidth; update_max_size (&max[func_index & 1], curfmt); } /* destination format differs from host byte order? - swap REAL24BIT is swapped below */ if (G_UNLIKELY (IPATCH_SAMPLE_FORMAT_IS_LENDIAN (dest_format) != (G_BYTE_ORDER == G_LITTLE_ENDIAN) && swap_tff[dwidth - 1] && (dest_format & IPATCH_SAMPLE_WIDTH_MASK) != IPATCH_SAMPLE_REAL24BIT)) { funcs[func_index++] = swap_tff[dwidth - 1]; curfmt ^= IPATCH_SAMPLE_BENDIAN; update_max_size (&max[func_index & 1], curfmt); } /* if converting from less channels to more */ if (G_UNLIKELY (dchan > schan)) { if (G_LIKELY (dchan == 2 && schan == 1)) /* Mono to stereo mapping? */ funcs[func_index++] = mono_to_stereo_tff[dwidth - 1]; else funcs[func_index++] = chanmap_tff[dwidth - 1]; /* Arbitrary channel mapping */ curfmt = (curfmt & ~IPATCH_SAMPLE_CHANNEL_MASK) | (dchan - 1); update_max_size (&max[func_index & 1], curfmt); } /* OPTME - Could create channel transform funcs for real 24 bit */ /* if destination is 3 byte 24 bit data then convert to it */ if (G_UNLIKELY ((dest_format & IPATCH_SAMPLE_WIDTH_MASK) == IPATCH_SAMPLE_REAL24BIT)) { if (IPATCH_SAMPLE_FORMAT_IS_LENDIAN (dest_format)) funcs[func_index++] = IPATCH_SAMPLE_FORMAT_IS_SIGNED (src_format) ? TFF_4btosle3b : TFF_4btoule3b; else funcs[func_index++] = IPATCH_SAMPLE_FORMAT_IS_SIGNED (src_format) ? TFF_4btosbe3b : TFF_4btoube3b; curfmt = (curfmt & ~IPATCH_SAMPLE_WIDTH_MASK) | IPATCH_SAMPLE_REAL24BIT; update_max_size (&max[func_index & 1], curfmt); } if (buf1_max_frame) *buf1_max_frame = max[0]; if (buf2_max_frame) *buf2_max_frame = max[1]; return (func_index); } static inline void update_max_size (int *curmax, int format) { int bytewidth; bytewidth = ipatch_sample_format_size (format); if (bytewidth > *curmax) *curmax = bytewidth; } libinstpatch-1.0.0/libinstpatch/IpatchBase.h0000644000175000017500000000674611461332142015767 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. * */ /** * SECTION: IpatchBase * @short_description: Base instrument file object type * @see_also: * @stability: Stable * * Defines an abstract object type which is used as the basis of instrument * files, such as #IpatchSF2, #IpatchDLS, etc. */ #ifndef __IPATCH_BASE_H__ #define __IPATCH_BASE_H__ #include #include #include /* forward type declarations */ typedef struct _IpatchBase IpatchBase; typedef struct _IpatchBaseClass IpatchBaseClass; #include #include #include #include #include #define IPATCH_TYPE_BASE (ipatch_base_get_type ()) #define IPATCH_BASE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_BASE, IpatchBase)) #define IPATCH_BASE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_BASE, IpatchBaseClass)) #define IPATCH_IS_BASE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_BASE)) #define IPATCH_IS_BASE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_BASE)) #define IPATCH_BASE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_BASE, IpatchBaseClass)) typedef enum { /* patch changed flag */ IPATCH_BASE_CHANGED = 1 << IPATCH_ITEM_UNUSED_FLAG_SHIFT, /* patch been saved ever? */ IPATCH_BASE_SAVED = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 1) } IpatchBaseFlags; /* we reserve a couple flags for backwards compatible expansion */ #define IPATCH_BASE_UNUSED_FLAG_SHIFT (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 4) /* patch base object */ struct _IpatchBase { IpatchContainer parent_instance; /* derived from IpatchContainer */ /*< private >*/ IpatchFile *file; /* file object associated with this patch */ }; /* SoundFont class */ struct _IpatchBaseClass { IpatchContainerClass parent_class; /* methods */ void (*find_unused_locale)(IpatchBase *base, int *bank, int *program, const IpatchItem *exclude, gboolean percussion); IpatchItem * (*find_item_by_locale)(IpatchBase *base, int bank, int program); }; #define IPATCH_BASE_DEFAULT_NAME "Untitled" GType ipatch_base_get_type (void); void ipatch_base_set_file (IpatchBase *base, IpatchFile *file); IpatchFile *ipatch_base_get_file (IpatchBase *base); void ipatch_base_set_file_name (IpatchBase *base, const char *file_name); char *ipatch_base_get_file_name (IpatchBase *base); void ipatch_base_find_unused_midi_locale (IpatchBase *base, int *bank, int *program, const IpatchItem *exclude, gboolean percussion); IpatchItem *ipatch_base_find_item_by_midi_locale (IpatchBase *base, int bank, int program); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2ModItem.h0000644000175000017500000000622711461332142016760 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Moderal Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Moderal Public License for more details. * * You should have received a copy of the GNU Moderal Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2ModItem * @short_description: SoundFont modulator item interface * @see_also: * @stability: Stable * * An interface type which is used by #IpatchSF2Preset, #IpatchSF2Inst, * #IpatchSF2PZone and #IpatchSF2IZone objects to add modulator realtime effect * functionality. */ #ifndef __IPATCH_SF2_MOD_ITEM_H__ #define __IPATCH_SF2_MOD_ITEM_H__ #include #include #include #include /* forward type declarations */ typedef IpatchItem IpatchSF2ModItem; typedef struct _IpatchSF2ModItemIface IpatchSF2ModItemIface; #define IPATCH_TYPE_SF2_MOD_ITEM (ipatch_sf2_mod_item_get_type ()) #define IPATCH_SF2_MOD_ITEM(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_MOD_ITEM, \ IpatchSF2ModItem)) #define IPATCH_SF2_MOD_ITEM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_MOD_ITEM, \ IpatchSF2ModItemIface)) #define IPATCH_IS_SF2_MOD_ITEM(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_MOD_ITEM)) #define IPATCH_SF2_MOD_ITEM_GET_IFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), IPATCH_TYPE_SF2_MOD_ITEM, \ IpatchSF2ModItemIface)) /* modulator item interface */ struct _IpatchSF2ModItemIface { GTypeInterface parent_iface; guint modlist_ofs; /* offset in item instance to modulator list pointer */ GParamSpec *mod_pspec; /* cached value of modulator pspec for fast notifies */ }; /** * ipatch_sf2_mod_item_add_mod: * @item: Item that conforms to #IpatchSF2ModItem interface * @mod: Modulator to append to end of @item object's modulator list * * Just a convenience function which uses ipatch_sf2_mod_item_insert_mod() to * append a modulator. */ #define ipatch_sf2_mod_item_add(item, mod) \ ipatch_sf2_mod_item_insert (item, mod, -1) GType ipatch_sf2_mod_item_get_type (void); GSList *ipatch_sf2_mod_item_get_mods (IpatchSF2ModItem *item); void ipatch_sf2_mod_item_set_mods (IpatchSF2ModItem *item, GSList *mod_list, int flags); void ipatch_sf2_mod_item_insert (IpatchSF2ModItem *item, const IpatchSF2Mod *mod, int pos); void ipatch_sf2_mod_item_remove (IpatchSF2ModItem *item, const IpatchSF2Mod *mod); void ipatch_sf2_mod_item_change (IpatchSF2ModItem *item, const IpatchSF2Mod *oldmod, const IpatchSF2Mod *newmod); guint ipatch_sf2_mod_item_count (IpatchSF2ModItem *item); #endif libinstpatch-1.0.0/libinstpatch/IpatchDLS2Inst.h0000644000175000017500000001001711461332142016441 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchDLS2Inst * @short_description: DLS instrument object * @see_also: * @stability: Stable * * Defines a DLS instrument object. DLS instruments are the toplevel objects * in the DLS instrument file tree hierarchy. */ #ifndef __IPATCH_DLS2_INST_H__ #define __IPATCH_DLS2_INST_H__ #include #include /* forward type declarations */ typedef struct _IpatchDLS2Inst IpatchDLS2Inst; typedef struct _IpatchDLS2InstClass IpatchDLS2InstClass; #include #include #include #define IPATCH_TYPE_DLS2_INST (ipatch_dls2_inst_get_type ()) #define IPATCH_DLS2_INST(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_DLS2_INST, \ IpatchDLS2Inst)) #define IPATCH_DLS2_INST_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_DLS2_INST, \ IpatchDLS2InstClass)) #define IPATCH_IS_DLS2_INST(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_DLS2_INST)) #define IPATCH_IS_DLS2_INST_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_DLS2_INST)) #define IPATCH_DLS2_INST_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_DLS2_INST, \ IpatchDLS2InstClass)) /* DLS instrument object */ struct _IpatchDLS2Inst { IpatchContainer parent_instance; guint16 bank; /* MIDI locale Bank */ guint16 program; /* MIDI locale Program */ IpatchDLS2Info *info; /* info strings */ GSList *regions; /* list of IpatchDLS2Region structures */ GSList *conns; /* list of global IpatchDLS2Conn structures */ guint8 *dlid; /* 16 byte unique ID or NULL */ }; struct _IpatchDLS2InstClass { IpatchContainerClass parent_class; }; /* max value for instrument MIDI bank (14 bits = 2 normalized MIDI bytes) */ #define IPATCH_DLS2_INST_BANK_MAX 0x3FFF /* Flags crammed into IpatchItem flags */ typedef enum { IPATCH_DLS2_INST_PERCUSSION = 1 << IPATCH_CONTAINER_UNUSED_FLAG_SHIFT } IpatchDLS2InstFlags; /* 1 flag */ #define IPATCH_DLS2_INST_UNUSED_FLAG_SHIFT \ (IPATCH_CONTAINER_UNUSED_FLAG_SHIFT + 1) GType ipatch_dls2_inst_get_type (void); IpatchDLS2Inst *ipatch_dls2_inst_new (void); #define ipatch_dls2_inst_get_regions(inst) \ ipatch_container_get_children (IPATCH_CONTAINER (inst), \ IPATCH_TYPE_DLS2_REGION) IpatchDLS2Inst *ipatch_dls2_inst_first (IpatchIter *iter); IpatchDLS2Inst *ipatch_dls2_inst_next (IpatchIter *iter); char *ipatch_dls2_inst_get_info (IpatchDLS2Inst *inst, guint32 fourcc); void ipatch_dls2_inst_set_info (IpatchDLS2Inst *inst, guint32 fourcc, const char *val); void ipatch_dls2_inst_set_midi_locale (IpatchDLS2Inst *inst, int bank, int program); void ipatch_dls2_inst_get_midi_locale (IpatchDLS2Inst *inst, int *bank, int *program); int ipatch_dls2_inst_compare (const IpatchDLS2Inst *p1, const IpatchDLS2Inst *p2); GSList *ipatch_dls2_inst_get_conns (IpatchDLS2Inst *inst); void ipatch_dls2_inst_set_conn (IpatchDLS2Inst *inst, const IpatchDLS2Conn *conn); void ipatch_dls2_inst_unset_conn (IpatchDLS2Inst *inst, const IpatchDLS2Conn *conn); void ipatch_dls2_inst_unset_all_conns (IpatchDLS2Inst *inst); guint ipatch_dls2_inst_conn_count (IpatchDLS2Inst *inst); #endif libinstpatch-1.0.0/libinstpatch/IpatchParamProp.h0000644000175000017500000000623711461332142017011 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchParamProp * @short_description: GParamSpec extended properties * @see_also: * @stability: Stable * * Extensions to standard GParamSpec include flags (for * compact single bit data extensions) and GValue based extensions. * An example of usage is the IPATCH_PARAM_UNIQUE flag which indicates * a parameter that should be unique amongst sibling items and the * "string-max-length" integer GValue which specifies a max * length of a GParamSpecString parameter. */ #ifndef __IPATCH_PARAM_PROP_H__ #define __IPATCH_PARAM_PROP_H__ #include #include /* libInstPatch GParamSpec->flags */ enum { /* Parameter should be unique amongst siblings */ IPATCH_PARAM_UNIQUE = (1 << G_PARAM_USER_SHIFT), /* Hint that a property should be hidden in user interfaces */ IPATCH_PARAM_HIDE = (1 << (G_PARAM_USER_SHIFT + 1)), /* Indicates that property affects audio synthesis */ IPATCH_PARAM_SYNTH = (1 << (G_PARAM_USER_SHIFT + 2)), /* Indicates that property can be a real time synthesis parameter */ IPATCH_PARAM_SYNTH_REALTIME = (1 << (G_PARAM_USER_SHIFT + 3)), /* Used for properties which don't modify the saveable state of an object. * The object's base object save dirty flag wont get set. */ IPATCH_PARAM_NO_SAVE_CHANGE = (1 << (G_PARAM_USER_SHIFT + 4)), /* Indicates that property should not be saved as object state (XML for example) */ IPATCH_PARAM_NO_SAVE = (1 << (G_PARAM_USER_SHIFT + 5)) }; /* next shift value usable by libInstPatch user in GParamSpec->flags */ #define IPATCH_PARAM_USER_SHIFT (G_PARAM_USER_SHIFT + 12) void ipatch_param_install_property (GParamSpec *prop_spec); GParamSpec *ipatch_param_find_property (const char *name); GParamSpec **ipatch_param_list_properties (guint *n_properties); GParamSpec *ipatch_param_set (GParamSpec *spec, const char *first_property_name, ...); void ipatch_param_set_valist (GParamSpec *spec, const char *first_property_name, va_list args); void ipatch_param_set_property (GParamSpec *spec, const char *property_name, const GValue *value); void ipatch_param_get (GParamSpec *spec, const char *first_property_name, ...); void ipatch_param_get_valist (GParamSpec *spec, const char *first_property_name, va_list args); gboolean ipatch_param_get_property (GParamSpec *spec, const char *property_name, GValue *value); #endif libinstpatch-1.0.0/libinstpatch/IpatchFile.h0000644000175000017500000002717011461332142015766 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchFile * @short_description: File abstraction object * @see_also: * @stability: Stable * * Provides an abstraction of file data sources and file type identification. */ #ifndef __IPATCH_FILE_H__ #define __IPATCH_FILE_H__ #include #include /* forward type declarations */ typedef struct _IpatchFile IpatchFile; typedef struct _IpatchFileClass IpatchFileClass; typedef struct _IpatchFileIOFuncs IpatchFileIOFuncs; typedef struct _IpatchFileHandle IpatchFileHandle; #include #define IPATCH_TYPE_FILE (ipatch_file_get_type ()) #define IPATCH_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_FILE, IpatchFile)) #define IPATCH_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_FILE, IpatchFileClass)) #define IPATCH_IS_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_FILE)) #define IPATCH_IS_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_FILE)) #define IPATCH_FILE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_FILE, IpatchFileClass)) /* IO function table for IpatchFile instances */ struct _IpatchFileIOFuncs { gboolean (*open)(IpatchFileHandle *handle, const char *mode, GError **err); void (*close)(IpatchFileHandle *handle); GIOStatus (*read)(IpatchFileHandle *handle, gpointer buf, guint size, guint *bytes_read, GError **err); GIOStatus (*write)(IpatchFileHandle *handle, gconstpointer buf, guint size, GError **err); GIOStatus (*seek)(IpatchFileHandle *handle, int offset, GSeekType type, GError **err); int (*getfd)(IpatchFileHandle *handle); /* optional get file descriptor method */ int (*get_size)(IpatchFile *file, GError **err); /* optional get size method */ }; /* File object */ struct _IpatchFile { IpatchItem parent_instance; /*< private >*/ IpatchFileIOFuncs *iofuncs; /* per instance I/O methods */ char *file_name; /* not always set */ GIOChannel *iochan; /* assigned directly with ipatch_file_set_(fd/iochan) */ }; /* File object class */ struct _IpatchFileClass { IpatchItemClass parent_class; /* File identify method */ gboolean (*identify)(IpatchFile *file, IpatchFileHandle *handle, GError **err); int identify_order; /* Identify execution order (see #IpatchFileIdentifyOrder, 0 = default) */ }; /** * IpatchFileFlags: * @IPATCH_FILE_FLAG_SWAP: Swap multi-byte numbers? * @IPATCH_FILE_FLAG_BIG_ENDIAN: Big endian file? * @IPATCH_FILE_FLAG_FREE_IOFUNCS: Should ->iofuncs be freed? */ typedef enum { IPATCH_FILE_FLAG_SWAP = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT), IPATCH_FILE_FLAG_BIG_ENDIAN = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 1), IPATCH_FILE_FLAG_FREE_IOFUNCS = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 2) } IpatchFileFlags; /** * IpatchFileIdentifyOrder: * @IPATCH_FILE_IDENTIFY_ORDER_LAST: Execute last (toward the end of the list) * @IPATCH_FILE_IDENTIFY_ORDER_DEFAULT: Default execution order (no preference) * @IPATCH_FILE_IDENTIFY_ORDER_FIRST: Execute first (toward the start of the list) * * Some helpful constants for the identify_order #IpatchFileClass field. Note * that any value can be used and this enum just provides some helpful values. * This value determines in what order file identification methods are called. * Higher values are executed first. */ typedef enum { IPATCH_FILE_IDENTIFY_ORDER_LAST = -10, IPATCH_FILE_IDENTIFY_ORDER_DEFAULT = 0, IPATCH_FILE_IDENTIFY_ORDER_FIRST = 10 } IpatchFileIdentifyOrder; /* reserve 6 flags (3 for expansion) */ #define IPATCH_FILE_UNUSED_FLAG_SHIFT (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 6) /* macro to check if multi-byte numbers in file require swapping */ #define IPATCH_FILE_NEED_SWAP(file) \ (ipatch_item_get_flags(file) & IPATCH_FILE_FLAG_SWAP) /* macro to check if file is big endian */ #define IPATCH_FILE_BIG_ENDIAN(file) \ (ipatch_item_get_flags(file) & IPATCH_FILE_FLAG_BIG_ENDIAN) /* runtime byte swapping macros for convenient loading of cross endian files, takes a pointer to the value to swap (like in a buffer) */ #define IPATCH_FILE_SWAP16(file, p16) \ (IPATCH_FILE_NEED_SWAP (file) ? \ GUINT16_SWAP_LE_BE (*(guint16 *)(p16)) : *(guint16 *)(p16)) #define IPATCH_FILE_SWAP32(file, p32) \ (IPATCH_FILE_NEED_SWAP (file) ? \ GUINT32_SWAP_LE_BE (*(guint32 *)(p32)) : *(guint32 *)(p32)) #define IPATCH_FILE_SWAP64(file, p64) \ (IPATCH_FILE_NEED_SWAP (file) ? \ GUINT64_SWAP_LE_BE (*(guint64 *)(p64)) : *(guint64 *)(p64)) #define IPATCH_IS_FILE_HANDLE(handle) \ ((handle) && IPATCH_IS_FILE ((handle)->file)) /** * IpatchFileHandle: * * #IpatchFile handle for opening a file and reading/writing from/to it. */ struct _IpatchFileHandle { IpatchFile *file; /* Parent file object */ guint position; /* Current file position */ GByteArray *buf; /* For buffered reads/writes */ guint buf_position; /* Current position in buffer */ GIOChannel *iochan; /* glib IO channel (default methods) */ gpointer data; /* iofuncs defined data */ }; GType ipatch_file_get_type (void); IpatchFile *ipatch_file_new (void); void ipatch_file_set_name (IpatchFile *file, const char *file_name); char *ipatch_file_get_name (IpatchFile *file); IpatchFileHandle *ipatch_file_open (IpatchFile *file, const char *file_name, const char *mode, GError **err); void ipatch_file_assign_fd (IpatchFile *file, int fd, gboolean close_on_finalize); void ipatch_file_assign_io_channel (IpatchFile *file, GIOChannel *iochan); GIOChannel *ipatch_file_get_io_channel (IpatchFileHandle *handle); int ipatch_file_get_fd (IpatchFileHandle *handle); void ipatch_file_close (IpatchFileHandle *handle); guint ipatch_file_get_position (IpatchFileHandle *handle); void ipatch_file_update_position (IpatchFileHandle *handle, guint offset); gboolean ipatch_file_read (IpatchFileHandle *handle, gpointer buf, guint size, GError **err); GIOStatus ipatch_file_read_eof (IpatchFileHandle *handle, gpointer buf, guint size, guint *bytes_read, GError **err); gboolean ipatch_file_write (IpatchFileHandle *handle, gconstpointer buf, guint size, GError **err); #define ipatch_file_skip(handle, offset, err) \ ipatch_file_seek (handle, offset, G_SEEK_CUR, err) gboolean ipatch_file_seek (IpatchFileHandle *handle, int offset, GSeekType type, GError **err); GIOStatus ipatch_file_seek_eof (IpatchFileHandle *handle, int offset, GSeekType type, GError **err); int ipatch_file_get_size (IpatchFile *file, GError **err); GType ipatch_file_identify (IpatchFile *file, GError **err); GType ipatch_file_identify_by_ext (IpatchFile *file); IpatchFileHandle *ipatch_file_identify_open (const char *file_name, GError **err); void ipatch_file_set_little_endian (IpatchFile *file); void ipatch_file_set_big_endian (IpatchFile *file); gboolean ipatch_file_read_u8 (IpatchFileHandle *handle, guint8 *val, GError **err); gboolean ipatch_file_read_u16 (IpatchFileHandle *handle, guint16 *val, GError **err); gboolean ipatch_file_read_u32 (IpatchFileHandle *handle, guint32 *val, GError **err); gboolean ipatch_file_read_u64 (IpatchFileHandle *handle, guint64 *val, GError **err); gboolean ipatch_file_read_s8 (IpatchFileHandle *handle, gint8 *val, GError **err); gboolean ipatch_file_read_s16 (IpatchFileHandle *handle, gint16 *val, GError **err); gboolean ipatch_file_read_s32 (IpatchFileHandle *handle, gint32 *val, GError **err); gboolean ipatch_file_read_s64 (IpatchFileHandle *handle, gint64 *val, GError **err); gboolean ipatch_file_write_u8 (IpatchFileHandle *handle, guint8 val, GError **err); gboolean ipatch_file_write_u16 (IpatchFileHandle *handle, guint16 val, GError **err); gboolean ipatch_file_write_u32 (IpatchFileHandle *handle, guint32 val, GError **err); gboolean ipatch_file_write_u64 (IpatchFileHandle *handle, guint64 val, GError **err); gboolean ipatch_file_write_s8 (IpatchFileHandle *handle, gint8 val, GError **err); gboolean ipatch_file_write_s16 (IpatchFileHandle *handle, gint16 val, GError **err); gboolean ipatch_file_write_s32 (IpatchFileHandle *handle, gint32 val, GError **err); gboolean ipatch_file_write_s64 (IpatchFileHandle *handle, gint64 val, GError **err); gboolean ipatch_file_buf_load (IpatchFileHandle *handle, guint size, GError **err); void ipatch_file_buf_read (IpatchFileHandle *handle, gpointer buf, guint size); void ipatch_file_buf_write (IpatchFileHandle *handle, gconstpointer buf, guint size); #define ipatch_file_buf_zero(filebuf, size) \ ipatch_file_buf_memset(filebuf, 0, size) void ipatch_file_buf_memset (IpatchFileHandle *handle, char c, guint size); gboolean ipatch_file_buf_commit (IpatchFileHandle *handle, GError **err); #define ipatch_file_buf_skip(filebuf, offset) \ ipatch_file_buf_seek (filebuf, offset, G_SEEK_CUR) void ipatch_file_buf_seek (IpatchFileHandle *handle, int offset, GSeekType type); guint8 ipatch_file_buf_read_u8 (IpatchFileHandle *handle); guint16 ipatch_file_buf_read_u16 (IpatchFileHandle *handle); guint32 ipatch_file_buf_read_u32 (IpatchFileHandle *handle); guint64 ipatch_file_buf_read_u64 (IpatchFileHandle *handle); gint8 ipatch_file_buf_read_s8 (IpatchFileHandle *handle); gint16 ipatch_file_buf_read_s16 (IpatchFileHandle *handle); gint32 ipatch_file_buf_read_s32 (IpatchFileHandle *handle); gint64 ipatch_file_buf_read_s64 (IpatchFileHandle *handle); void ipatch_file_buf_write_u8 (IpatchFileHandle *handle, guint8 val); void ipatch_file_buf_write_u16 (IpatchFileHandle *handle, guint16 val); void ipatch_file_buf_write_u32 (IpatchFileHandle *handle, guint32 val); void ipatch_file_buf_write_u64 (IpatchFileHandle *handle, guint64 val); void ipatch_file_buf_write_s8 (IpatchFileHandle *handle, gint8 val); void ipatch_file_buf_write_s16 (IpatchFileHandle *handle, gint16 val); void ipatch_file_buf_write_s32 (IpatchFileHandle *handle, gint32 val); void ipatch_file_buf_write_s64 (IpatchFileHandle *handle, gint64 val); void ipatch_file_set_iofuncs_static (IpatchFile *file, IpatchFileIOFuncs *funcs); void ipatch_file_set_iofuncs (IpatchFile *file, const IpatchFileIOFuncs *funcs); void ipatch_file_get_iofuncs (IpatchFile *file, IpatchFileIOFuncs *out_funcs); void ipatch_file_set_iofuncs_null (IpatchFile *file); gboolean ipatch_file_default_open_method (IpatchFileHandle *handle, const char *mode, GError **err); void ipatch_file_default_close_method (IpatchFileHandle *handle); GIOStatus ipatch_file_default_read_method (IpatchFileHandle *handle, gpointer buf, guint size, guint *bytes_read, GError **err); GIOStatus ipatch_file_default_write_method (IpatchFileHandle *handle, gconstpointer buf, guint size, GError **err); GIOStatus ipatch_file_default_seek_method (IpatchFileHandle *handle, int offset, GSeekType type, GError **err); int ipatch_file_default_getfd_method (IpatchFileHandle *handle); int ipatch_file_default_get_size_method (IpatchFile *file, GError **err); #endif libinstpatch-1.0.0/libinstpatch/IpatchSampleTransform.c0000644000175000017500000004452111461332142020216 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchSampleTransform.h" #include "sample.h" #include "ipatch_priv.h" G_LOCK_DEFINE_STATIC (transform_pool); static GList *transform_pool = NULL; /** * ipatch_sample_transform_new: * @src_format: Source sample format or 0 to set later * @dest_format: Destination sample format or 0 to set later * @channel_map: Channel mapping (use #IPATCH_SAMPLE_UNITY_CHANNEL_MAP * to map all input channels to the same output channels, see * #IPATCH_SAMPLE_MAP_CHANNEL macro for constructing channel map values) * * Create a new sample transform object. If @src_format and @dest_format are * not 0 then the transform is initialized for the given source and destination * formats, otherwise they are expected to be set later with * ipatch_sample_transform_set_formats(). * * Returns: New allocated sample transform structure which should be freed with * ipatch_sample_transform_free() when done with it. */ IpatchSampleTransform * ipatch_sample_transform_new (int src_format, int dest_format, guint32 channel_map) { IpatchSampleTransform *trans; int i; trans = g_slice_new0 (IpatchSampleTransform); /* Setup straight through 1:1 channel mapping */ for (i = 0; i < 8; i++) trans->channel_map[i] = i; if (src_format != 0 && dest_format != 0) ipatch_sample_transform_set_formats (trans, src_format, dest_format, channel_map); return (trans); } /** * ipatch_sample_transform_free: * @transform: Transform structure * * Free a transform structure as allocated by ipatch_sample_transform_new() and * its allocated resources. */ void ipatch_sample_transform_free (IpatchSampleTransform *transform) { g_return_if_fail (transform != NULL); if (transform->free_buffers) g_free (transform->buf1); g_slice_free (IpatchSampleTransform, transform); } /** * ipatch_sample_transform_init: * @transform: Sample transform to initialize * * Initialize a sample transform structure. Usually only used to initialize transform * structures allocated on the stack, which is done to avoid mallocs. */ void ipatch_sample_transform_init (IpatchSampleTransform *transform) { int i; g_return_if_fail (transform != NULL); memset (transform, 0, sizeof (IpatchSampleTransform)); /* Setup straight through 1:1 channel mapping */ for (i = 0; i < 8; i++) transform->channel_map[i] = i; } /** * ipatch_sample_transform_pool_acquire: * @src_format: Source sample format * @dest_format: Destination sample format * @channel_map: Channel mapping (use #IPATCH_SAMPLE_UNITY_CHANNEL_MAP * to map all input channels to the same output channels, see * #IPATCH_SAMPLE_MAP_CHANNEL macro for constructing channel map values) * * Get an unused sample transform object from the sample transform pool. * Used for quickly getting a transform object for temporary use without the * overhead of allocating one. Note though, that if no more transforms exist * in the pool an allocation will occur. * * Returns: Sample transform object. Should be released after use with * ipatch_sample_transform_pool_release(). */ IpatchSampleTransform * ipatch_sample_transform_pool_acquire (int src_format, int dest_format, guint32 channel_map) { IpatchSampleTransform *trans = NULL; g_return_val_if_fail (ipatch_sample_format_transform_verify (src_format, dest_format, channel_map), NULL); G_LOCK (transform_pool); if (transform_pool) { trans = (IpatchSampleTransform *)(transform_pool->data); transform_pool = g_list_delete_link (transform_pool, transform_pool); } G_UNLOCK (transform_pool); if (!trans) { trans = ipatch_sample_transform_new (src_format, dest_format, channel_map); ipatch_sample_transform_alloc_size (trans, IPATCH_SAMPLE_TRANS_BUFFER_SIZE); } else ipatch_sample_transform_set_formats (trans, src_format, dest_format, channel_map); return (trans); } /** * ipatch_sample_transform_pool_release: * @transform: Sample transform * * Release a sample transform object, returned by * ipatch_sample_transform_pool_grab(), back to the transform pool. */ void ipatch_sample_transform_pool_release (IpatchSampleTransform *transform) { g_return_if_fail (transform != NULL); G_LOCK (transform_pool); transform_pool = g_list_prepend (transform_pool, transform); G_UNLOCK (transform_pool); } /** * ipatch_sample_transform_set_formats: * @transform: Transform object * @src_format: Source audio format to convert from * @dest_format: Destination audio format to convert to * @channel_map: Channel mapping (use #IPATCH_SAMPLE_UNITY_CHANNEL_MAP * to map all input channels to the same output channels, see * #IPATCH_SAMPLE_MAP_CHANNEL macro for constructing channel map values) * * Initialize a sample transform object for converting from * @src_format to @dest_format. */ void ipatch_sample_transform_set_formats (IpatchSampleTransform *transform, int src_format, int dest_format, guint32 channel_map) { guint buf1_max_frame, buf2_max_frame, func_count; int i, chans; g_return_if_fail (transform != NULL); g_return_if_fail (ipatch_sample_format_transform_verify (src_format, dest_format, channel_map)); transform->src_format = src_format; transform->dest_format = dest_format; /* Convert channel map integer to byte array */ for (i = 0; i < 8; i++) transform->channel_map[i] = (channel_map >> (i * 3)) & 0x07; transform->func_count = 0; if (src_format == dest_format) /* Shortcut identical formats */ { chans = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (src_format); /* Straight through channel mapping? */ for (i = 0; i < chans; i++) if (transform->channel_map[i] != i) break; if (i == chans) { transform->buf1_max_frame = ipatch_sample_format_size (src_format); transform->buf2_max_frame = 0; transform->max_frames = transform->combined_size ? transform->combined_size / transform->buf1_max_frame : 0; return; } } func_count = ipatch_sample_get_transform_funcs (src_format, dest_format, channel_map, &buf1_max_frame, &buf2_max_frame, transform->funcs); transform->buf1_max_frame = buf1_max_frame; transform->buf2_max_frame = buf2_max_frame; transform->func_count = func_count; /* update max frames if buffer is already assigned */ if (transform->combined_size) { transform->max_frames = transform->combined_size / (buf1_max_frame + buf2_max_frame); transform->buf2 = transform->buf1 + (transform->buf1_max_frame * transform->max_frames); } else transform->max_frames = 0; } /** * ipatch_sample_transform_alloc: * @transform: Sample transform object * @frames: Number of frames to allocate for (max frames processed in batch) * * Allocate buffers for transforming between two audio formats, for * which @transform has previously been initialized for with * ipatch_sample_transform_new() or ipatch_sample_transform_set_formats(). * * Note: Assigning buffers with this function allows sample formats to be * changed without re-assigning the buffers. */ void ipatch_sample_transform_alloc (IpatchSampleTransform *transform, guint frames) { g_return_if_fail (transform != NULL); g_return_if_fail (frames > 0); g_return_if_fail (transform->src_format != 0); if (transform->free_buffers) g_free (transform->buf1); transform->combined_size = (transform->buf1_max_frame + transform->buf2_max_frame) * frames; transform->buf1 = g_malloc (transform->combined_size); transform->buf2 = transform->buf1 + (transform->buf1_max_frame * frames); transform->free_buffers = TRUE; transform->max_frames = frames; } /** * ipatch_sample_transform_alloc_size: * @transform: Sample transform object * @size: Maximum total size in bytes of allocation for both transform buffers. * * Like ipatch_sample_transform_alloc() but allocates buffers based on a * maximum size and returns the maximum number of sample frames which can be * converted at a time using this size. Another difference is that conversion * formats do not need to be set before calling this function. * * Returns: The maximum number of frames that can be converted at a time for * the given @size of transform buffers. If conversion formats have not yet * been set, then this function returns 0. */ int ipatch_sample_transform_alloc_size (IpatchSampleTransform *transform, guint size) { g_return_val_if_fail (transform != NULL, 0); g_return_val_if_fail (size > 32, 0); /* just a somewhat sane value */ if (transform->free_buffers) g_free (transform->buf1); transform->combined_size = size; transform->buf1 = g_malloc (size); transform->free_buffers = TRUE; transform->buf2 = NULL; transform->max_frames = 0; /* update buffer split if formats already assigned */ if (transform->src_format && transform->dest_format) { transform->max_frames = size / (transform->buf1_max_frame + transform->buf2_max_frame); transform->buf2 = transform->buf1 + (transform->buf1_max_frame * transform->max_frames); } return (transform->max_frames); } /** * ipatch_sample_transform_free_buffers: * @transform: Sample transform object * * Free sample transform buffers. */ void ipatch_sample_transform_free_buffers (IpatchSampleTransform *transform) { g_return_if_fail (transform != NULL); if (transform->free_buffers) g_free (transform->buf1); transform->buf1 = NULL; transform->buf2 = NULL; transform->combined_size = 0; transform->max_frames = 0; } /** * ipatch_sample_transform_set_buffers_size: * @transform: Sample transform object * @buf: Buffer to assign for transforming sample formats * @size: Size of @buf in bytes * * Assign transform buffers using a single buffer of a * specific size in bytes and determine optimal division for source and * destination buffers. Conversion formats must not be set before calling this * function (can be set later). * * Returns: The maximum number of frames that can be converted at a time for * the given @size of transform buffers. If conversion formats have not yet * been set, then this function returns 0. */ guint ipatch_sample_transform_set_buffers_size (IpatchSampleTransform *transform, gpointer buf, guint size) { g_return_val_if_fail (transform != NULL, 0); g_return_val_if_fail (buf != NULL, 0); g_return_val_if_fail (size > 32, 0); /* some slightly sane value */ if (transform->free_buffers) g_free (transform->buf1); transform->buf1 = buf; transform->free_buffers = FALSE; transform->combined_size = size; transform->buf2 = NULL; transform->max_frames = 0; /* update buffer split if formats already assigned */ if (transform->src_format && transform->dest_format) { transform->max_frames = size / (transform->buf1_max_frame + transform->buf2_max_frame); transform->buf2 = transform->buf1 + (transform->buf1_max_frame * transform->max_frames); } return (transform->max_frames); } /** * ipatch_sample_transform_get_buffers: * @transform: Sample transform object * @buf1: Output - first buffer or %NULL to ignore * @buf2: Output - second buffer or %NULL to ignore * * Get the sample data buffers in a sample transform object. */ void ipatch_sample_transform_get_buffers (IpatchSampleTransform *transform, gpointer *buf1, gpointer *buf2) { g_return_if_fail (transform != NULL); if (buf1) *buf1 = transform->buf1; if (buf2) *buf2 = transform->buf2; } /** * ipatch_sample_transform_get_frame_sizes: * @transform: Initialized transform object * @buf1_size: Out: Maximum frame size for buffer 1 or %NULL to ignore * @buf2_size: Out: Maximum frame size for buffer 2 or %NULL to ignore * * Get max frame sizes for transform buffers. When transforming audio the * first buffer must be at least frames * buf1_size bytes in size and the * second buffer must be at least frames * buf2_size, where frames is the * max number of frames to convert in batch. */ void ipatch_sample_transform_get_frame_sizes (IpatchSampleTransform *transform, guint *buf1_size, guint *buf2_size) { g_return_if_fail (transform != NULL); if (buf1_size) *buf1_size = transform->buf1_max_frame; if (buf2_size) *buf2_size = transform->buf2_max_frame; } /** * ipatch_sample_transform_get_max_frames: * @transform: Sample transform object * * Get the maximum frames that the @transform object can convert at a time. * * Returns: Max number of frames that can be converted at a time, 0 if buffers * have not been allocated yet. */ guint ipatch_sample_transform_get_max_frames (IpatchSampleTransform *transform) { g_return_val_if_fail (transform != NULL, 0); return (transform->max_frames); } /** * ipatch_sample_transform_convert: * @transform: An initialized sample transform object * @src: Audio source buffer (@frames X the source frame size in bytes), can * be %NULL to use internal buffer (provided @frames is less than or equal to * the max frames that can be converted at a time), in which case buf1 of * @transform should already be loaded with source data. * @dest: Converted audio destination buffer (@frames X the destination frame * size in bytes), can be %NULL to use internal buffer (provided @frames is * less than or equal to the max frames that can be converted at a time). * @frames: Number of audio frames to convert * * Convert an arbitrary number of audio frames from user provided buffers, * contrary to ipatch_sample_transform_convert_single() which uses internal * buffers and converts a max of 1 buffer at a time. The sample formats * should already be assigned and internal buffers assigned or allocated. * * Returns: Pointer to converted data. Will be @dest if it was not %NULL or * internal buffer containing the converted data otherwise. */ gpointer ipatch_sample_transform_convert (IpatchSampleTransform *transform, gconstpointer src, gpointer dest, guint frames) { int i, func_count, block_size; gpointer buf1, buf2; int src_frame_size, dest_frame_size, srcchan; g_return_val_if_fail (transform != NULL, NULL); g_return_val_if_fail (frames > 0, NULL); g_return_val_if_fail (transform->buf1 != NULL, NULL); g_return_val_if_fail (transform->buf2 != NULL, NULL); g_return_val_if_fail (transform->max_frames > 0, NULL); g_return_val_if_fail ((src && dest) || frames <= transform->max_frames, NULL); block_size = transform->max_frames; func_count = transform->func_count; buf1 = transform->buf1; buf2 = transform->buf2; if (!src) src = buf1; src_frame_size = ipatch_sample_format_size (transform->src_format); srcchan = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (transform->src_format); dest_frame_size = ipatch_sample_format_size (transform->dest_format); if (func_count == 0) /* same format? Just copy it */ { if (dest) { memcpy (dest, src, frames * src_frame_size); return (dest); } else return ((gpointer)src); } while (frames > 0) { if (block_size > frames) block_size = frames; transform->frames = block_size; transform->samples = block_size * srcchan; /* execute first transform function with src buffer directly */ transform->buf1 = (gpointer)src; transform->buf2 = (func_count == 1 && dest) ? dest : buf2; (*transform->funcs[0])(transform); /* execute remaining transform functions */ for (i = 1; i < func_count; i++) { if (i & 1) { transform->buf1 = buf2; transform->buf2 = (i == (func_count - 1) && dest) ? dest : buf1; } else { transform->buf1 = buf1; transform->buf2 = (i == (func_count - 1) && dest) ? dest : buf2; } (*transform->funcs[i])(transform); } frames -= block_size; src += block_size * src_frame_size; if (dest) dest += block_size * dest_frame_size; } transform->buf1 = buf1; transform->buf2 = buf2; if (dest) return (dest); else return ((func_count & 1) ? buf2 : buf1); } /** * ipatch_sample_transform_convert_single: * @transform: An initialized sample transform object * @frames: Number of frames to convert (should be less than or equal to the * maximum frames which can be converted at a time * (see ipatch_sample_transform_get_max_frames()). * * Convert the format of a single buffer of audio. The @transform object must * have had its sample formats set and buffers assigned or allocated. Use * ipatch_sample_transform_convert() to convert from one buffer to another * regardless of the number of frames. * * Returns: Pointer to converted audio data (buffer is internal to @transform * object). */ gpointer ipatch_sample_transform_convert_single (IpatchSampleTransform *transform, guint frames) { gpointer temp; int i, count; g_return_val_if_fail (transform != NULL, NULL); g_return_val_if_fail (frames > 0 && frames <= transform->max_frames, NULL); g_return_val_if_fail (transform->buf1 != NULL, NULL); g_return_val_if_fail (transform->buf2 != NULL, NULL); transform->frames = frames; transform->samples = frames; /* multiply frames by number of channels to get # of samples */ transform->samples *= IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (transform->src_format); count = transform->func_count; /* execute each transform function */ for (i = 0; i < count; i++) { (*transform->funcs[i])(transform); /* swap buffer pointers */ temp = transform->buf1; transform->buf1 = transform->buf2; transform->buf2 = temp; } /* swap 1 more time if odd number of functions to set buffer order right */ if (count & 1) { temp = transform->buf1; transform->buf1 = transform->buf2; transform->buf2 = temp; return (transform->buf2); } else return (transform->buf1); } libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreSndFile.c0000644000175000017500000007132011461332142020601 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchSampleStoreSndFile.h" #include "IpatchSampleStore.h" #include "IpatchSndFile.h" #include "ipatch_priv.h" #include "builtin_enums.h" #include "i18n.h" /* * Notes: * * In read mode the audio file must be identified before being opened for * reading. This is necessary in order to assign the correct #IpatchSample:format * to the sample store, based on the file's format. * * PCM formats are read and written using sf_read/write_raw to allow for more * flexibility and to remove the need to do extra conversions (in the case of * 8 bit, 24 bit or non CPU endian formats). * * Non-PCM formats are read/written as 16 bit CPU endian order data. */ enum { PROP_0, PROP_TITLE, PROP_LOOP_TYPE, PROP_LOOP_START, PROP_LOOP_END, PROP_ROOT_NOTE, PROP_FINE_TUNE, PROP_FILE_NAME, PROP_FILE_FORMAT, PROP_SUB_FORMAT, PROP_ENDIAN }; static void ipatch_sample_store_snd_file_sample_iface_init (IpatchSampleIface *iface); static void ipatch_sample_store_snd_file_get_title (IpatchSampleStoreSndFile *store, GValue *value); static void ipatch_sample_store_snd_file_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sample_store_snd_file_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sample_store_snd_file_finalize (GObject *object); static gboolean ipatch_sample_store_snd_file_sample_iface_open (IpatchSampleHandle *handle, GError **err); static gboolean verify_read_format (IpatchSampleStoreSndFile *store); static gboolean verify_write_format (IpatchSampleStoreSndFile *store); static void ipatch_sample_store_snd_file_sample_iface_close (IpatchSampleHandle *handle); static gboolean ipatch_sample_store_snd_file_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err); static gboolean ipatch_sample_store_snd_file_sample_iface_write (IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err); static int libsndfile_read_format_convert (int sndfile_format, int channels, gboolean *raw); static int libsndfile_write_format_convert (int sndfile_format, int channels); /* Supported loop types */ static int ipatch_sample_store_snd_file_loop_types[] = { IPATCH_SAMPLE_LOOP_NONE, IPATCH_SAMPLE_LOOP_STANDARD, IPATCH_SAMPLE_LOOP_PINGPONG, IPATCH_SAMPLE_LOOP_TYPE_TERM /* terminator */ }; G_DEFINE_TYPE_WITH_CODE (IpatchSampleStoreSndFile, ipatch_sample_store_snd_file, IPATCH_TYPE_SAMPLE_STORE, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sample_store_snd_file_sample_iface_init)) static void ipatch_sample_store_snd_file_sample_iface_init (IpatchSampleIface *iface) { iface->open = ipatch_sample_store_snd_file_sample_iface_open; iface->close = ipatch_sample_store_snd_file_sample_iface_close; iface->read = ipatch_sample_store_snd_file_sample_iface_read; iface->write = ipatch_sample_store_snd_file_sample_iface_write; iface->loop_types = ipatch_sample_store_snd_file_loop_types; } static void ipatch_sample_store_snd_file_class_init (IpatchSampleStoreSndFileClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); GType file_format, file_sub_format; obj_class->finalize = ipatch_sample_store_snd_file_finalize; obj_class->get_property = ipatch_sample_store_snd_file_get_property; item_class->item_set_property = ipatch_sample_store_snd_file_set_property; g_object_class_override_property (obj_class, PROP_TITLE, "title"); ipatch_sample_install_property (obj_class, PROP_LOOP_TYPE, "loop-type"); ipatch_sample_install_property (obj_class, PROP_LOOP_START, "loop-start"); ipatch_sample_install_property (obj_class, PROP_LOOP_END, "loop-end"); ipatch_sample_install_property (obj_class, PROP_ROOT_NOTE, "root-note"); ipatch_sample_install_property (obj_class, PROP_FINE_TUNE, "fine-tune"); g_object_class_install_property (obj_class, PROP_FILE_NAME, g_param_spec_string ("file-name", "File name", "File name", NULL, G_PARAM_READWRITE)); file_format = ipatch_snd_file_format_get_type (); g_object_class_install_property (obj_class, PROP_FILE_FORMAT, g_param_spec_enum ("file-format", "File format", "File format", file_format, IPATCH_SND_FILE_DEFAULT_FORMAT, G_PARAM_READWRITE)); file_sub_format = ipatch_snd_file_sub_format_get_type (); g_object_class_install_property (obj_class, PROP_SUB_FORMAT, g_param_spec_enum ("sub-format", "File sub format", "File sub audio format", file_sub_format, IPATCH_SND_FILE_DEFAULT_SUB_FORMAT, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_ENDIAN, g_param_spec_enum ("endian", "Endian byte order", "Endian byte order of file", IPATCH_TYPE_SND_FILE_ENDIAN, IPATCH_SND_FILE_DEFAULT_ENDIAN, G_PARAM_READWRITE)); } static void ipatch_sample_store_snd_file_get_title (IpatchSampleStoreSndFile *store, GValue *value) { char *filename, *s, *basename = NULL; g_object_get (store, "file-name", &filename, NULL); /* ++ alloc filename */ if (filename) { basename = g_path_get_basename (filename); /* ++ alloc basename */ s = strrchr (basename, '.'); /* search for dot delimiter */ if (s && s > basename) *s = '\0'; /* terminate string at dot */ g_free (filename); /* -- free filename */ } g_value_take_string (value, basename); /* !! caller takes over alloc */ } static void ipatch_sample_store_snd_file_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSampleStoreSndFile *store = IPATCH_SAMPLE_STORE_SND_FILE (object); /* No locking needed - all values should be set prior to multi-thread use */ switch (property_id) { case PROP_LOOP_TYPE: store->loop_type = g_value_get_enum (value); break; case PROP_LOOP_START: store->loop_start = g_value_get_uint (value); break; case PROP_LOOP_END: store->loop_end = g_value_get_uint (value); break; case PROP_ROOT_NOTE: store->root_note = g_value_get_int (value); break; case PROP_FINE_TUNE: store->fine_tune = g_value_get_int (value); break; case PROP_FILE_NAME: g_free (store->filename); store->filename = g_value_dup_string (value); /* IpatchItem notify for "title" property */ { GValue titleval = { 0 }; g_value_init (&titleval, G_TYPE_STRING); ipatch_sample_store_snd_file_get_title (store, &titleval); ipatch_item_prop_notify ((IpatchItem *)store, ipatch_item_pspec_title, &titleval, NULL); g_value_unset (&titleval); } break; case PROP_FILE_FORMAT: store->file_format = g_value_get_enum (value); break; case PROP_SUB_FORMAT: store->sub_format = g_value_get_enum (value); break; case PROP_ENDIAN: store->endian = g_value_get_enum (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_snd_file_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSampleStoreSndFile *store = IPATCH_SAMPLE_STORE_SND_FILE (object); /* No locking needed - all values should be set prior to multi-thread use */ switch (property_id) { case PROP_TITLE: ipatch_sample_store_snd_file_get_title (store, value); break; case PROP_LOOP_TYPE: g_value_set_enum (value, store->loop_type); break; case PROP_LOOP_START: g_value_set_uint (value, store->loop_start); break; case PROP_LOOP_END: g_value_set_uint (value, store->loop_end); break; case PROP_ROOT_NOTE: g_value_set_int (value, store->root_note); break; case PROP_FINE_TUNE: g_value_set_int (value, store->fine_tune); break; case PROP_FILE_NAME: g_value_set_string (value, store->filename); break; case PROP_FILE_FORMAT: g_value_set_enum (value, store->file_format); break; case PROP_SUB_FORMAT: g_value_set_enum (value, store->sub_format); break; case PROP_ENDIAN: g_value_set_enum (value, store->endian); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_snd_file_init (IpatchSampleStoreSndFile *sample) { sample->file_format = IPATCH_SND_FILE_DEFAULT_FORMAT; sample->sub_format = IPATCH_SND_FILE_DEFAULT_SUB_FORMAT; sample->endian = IPATCH_SND_FILE_DEFAULT_ENDIAN; sample->loop_type = IPATCH_SAMPLE_LOOP_NONE; sample->root_note = IPATCH_SAMPLE_ROOT_NOTE_DEFAULT; } static void ipatch_sample_store_snd_file_finalize (GObject *object) { IpatchSampleStoreSndFile *sample = IPATCH_SAMPLE_STORE_SND_FILE (object); g_free (sample->filename); if (G_OBJECT_CLASS (ipatch_sample_store_snd_file_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sample_store_snd_file_parent_class)->finalize (object); } static gboolean ipatch_sample_store_snd_file_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchSampleStoreSndFile *store = IPATCH_SAMPLE_STORE_SND_FILE (handle->sample); SF_INFO info; int format; g_return_val_if_fail (store->filename != NULL, FALSE); format = ipatch_sample_store_get_format (store); if (handle->read_mode) { if (!store->identified) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, _("Sample file '%s' has not yet been identified for reading"), store->filename); return (FALSE); } if (!verify_read_format (store)) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, _("Invalid read format values for sample file '%s'"), store->filename); return (FALSE); } if (store->raw) { handle->data2 = sf_read_raw; /* Just read raw data (conversions handled internally) */ handle->data3 = GUINT_TO_POINTER (ipatch_sample_format_size (format)); } else { switch (IPATCH_SAMPLE_FORMAT_GET_WIDTH (format)) { case IPATCH_SAMPLE_16BIT: handle->data2 = sf_readf_short; break; case IPATCH_SAMPLE_32BIT: handle->data2 = sf_readf_int; break; case IPATCH_SAMPLE_FLOAT: handle->data2 = sf_readf_float; break; case IPATCH_SAMPLE_DOUBLE: handle->data2 = sf_readf_double; break; default: g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, _("Inconsistent state for sample file '%s'"), store->filename); return (FALSE); } handle->data3 = GUINT_TO_POINTER (1); /* Multiplier is 1, for number of frames */ } } else /* Write mode */ { if (!verify_write_format (store)) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, _("Invalid write format values for sample file '%s'"), store->filename); return (FALSE); } switch (IPATCH_SAMPLE_FORMAT_GET_WIDTH (format)) { case IPATCH_SAMPLE_8BIT: handle->data2 = sf_write_raw; /* Just write raw data (conversions handled internally) */ handle->data3 = GUINT_TO_POINTER (ipatch_sample_format_size (format)); break; case IPATCH_SAMPLE_16BIT: handle->data2 = sf_writef_short; handle->data3 = GUINT_TO_POINTER (1); break; case IPATCH_SAMPLE_32BIT: handle->data2 = sf_writef_int; handle->data3 = GUINT_TO_POINTER (1); break; case IPATCH_SAMPLE_FLOAT: handle->data2 = sf_writef_float; handle->data3 = GUINT_TO_POINTER (1); break; case IPATCH_SAMPLE_DOUBLE: handle->data2 = sf_writef_double; handle->data3 = GUINT_TO_POINTER (1); break; } } /* Write mode? - Fill in format structure */ if (!handle->read_mode) { info.samplerate = ((IpatchSampleStore *)store)->rate; info.channels = IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format); info.format = store->file_format | store->sub_format | store->endian; if (!sf_format_check (&info)) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, _("Invalid libsndfile format for file '%s' (format: 0x%08X, chan: %d, rate: %d)"), store->filename, info.format, info.channels, info.samplerate); return (FALSE); } } else info.format = 0; /* Open the file using libsndfile */ handle->data1 = sf_open (store->filename, handle->read_mode ? SFM_READ : SFM_WRITE, &info); if (!handle->data1) { if (handle->read_mode) g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("Error opening file '%s' for reading"), store->filename); else g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("Error opening file '%s' for writing"), store->filename); return (FALSE); } /* Store instrument info if write mode and not default values */ if (!handle->read_mode && (store->loop_type != IPATCH_SAMPLE_LOOP_NONE || store->root_note != IPATCH_SAMPLE_ROOT_NOTE_DEFAULT || store->fine_tune != 0)) { SF_INSTRUMENT instinfo; memset (&instinfo, 0, sizeof (instinfo)); instinfo.basenote = store->root_note; instinfo.detune = store->fine_tune; instinfo.velocity_lo = 0; instinfo.velocity_hi = 127; instinfo.key_lo = 0; instinfo.key_hi = 127; if (store->loop_type != IPATCH_SAMPLE_LOOP_NONE) { instinfo.loop_count = 1; switch (store->loop_type) { case IPATCH_SAMPLE_LOOP_PINGPONG: instinfo.loops[0].mode = SF_LOOP_ALTERNATING; break; case IPATCH_SAMPLE_LOOP_STANDARD: case IPATCH_SAMPLE_LOOP_RELEASE: default: instinfo.loops[0].mode = SF_LOOP_FORWARD; break; } instinfo.loops[0].start = store->loop_start; instinfo.loops[0].end = store->loop_end; } sf_command (handle->data1, SFC_SET_INSTRUMENT, &instinfo, sizeof (instinfo)); } /* Used as current offset (in frames) into file to optimize out seek calls and prevent * failure when attempting unnecessary seeks in formats which don't support it. */ handle->data4 = GUINT_TO_POINTER (0); return (TRUE); } /* Verify that libsndfile and IpatchSample format parameters are consistent for reading */ static gboolean verify_read_format (IpatchSampleStoreSndFile *store) { int format, conv_format; gboolean raw; format = ipatch_sample_store_get_format (store); conv_format = libsndfile_read_format_convert (store->file_format | store->sub_format | store->endian, IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format), &raw); return (format == conv_format && raw == store->raw); } /* Verify that libsndfile and IpatchSample format parameters are consistent for writing */ static gboolean verify_write_format (IpatchSampleStoreSndFile *store) { int format, conv_format; format = ipatch_sample_store_get_format (store); conv_format = libsndfile_write_format_convert (store->file_format | store->sub_format | store->endian, IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format)); return (format == conv_format); } static void ipatch_sample_store_snd_file_sample_iface_close (IpatchSampleHandle *handle) { if (handle->data1) { sf_close (handle->data1); handle->data1 = NULL; } } static gboolean ipatch_sample_store_snd_file_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err) { IpatchSampleStoreSndFile *sample = (IpatchSampleStoreSndFile *)(handle->sample); SNDFILE *sfhandle = (SNDFILE *)(handle->data1); sf_count_t (*readfunc)(SNDFILE *sndfile, gpointer buf, sf_count_t count) = handle->data2; guint count = frames * GPOINTER_TO_UINT (handle->data3); /* data3 is frames multiplier */ guint filepos = GPOINTER_TO_UINT (handle->data4); /* data4 is current offset */ sf_count_t read_count; if (offset != filepos && sf_seek (sfhandle, offset, SEEK_SET) == -1) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("libsndfile error seeking file '%s': %s"), sample->filename, sf_strerror (sfhandle)); return (FALSE); } read_count = readfunc (sfhandle, buf, count); if (read_count != count) { if (sf_error (sfhandle) == SF_ERR_NO_ERROR) g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNEXPECTED_EOF, _("Unexpected end of file in '%s'"), sample->filename); else g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("libsndfile error reading file '%s': %s"), sample->filename, sf_strerror (sfhandle)); return (FALSE); } filepos += frames; handle->data4 = GUINT_TO_POINTER (filepos); return (TRUE); } static gboolean ipatch_sample_store_snd_file_sample_iface_write (IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err) { IpatchSampleStoreSndFile *sample = (IpatchSampleStoreSndFile *)(handle->sample); SNDFILE *sfhandle = (SNDFILE *)(handle->data1); sf_count_t (*writefunc)(SNDFILE *sndfile, gconstpointer buf, sf_count_t count) = handle->data2; guint count = frames * GPOINTER_TO_UINT (handle->data3); /* data3 is frames multiplier */ if (sf_seek (sfhandle, offset, SEEK_SET) == -1) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("libsndfile error seeking file '%s': %s"), sample->filename, sf_strerror (sfhandle)); return (FALSE); } if (writefunc (sfhandle, buf, count) != count) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("libsndfile error writing file '%s': %s"), sample->filename, sf_strerror (sfhandle)); return (FALSE); } return (TRUE); } /** * ipatch_sample_store_snd_file_new: * @filename: File name to assign to the new libsndfile sample store * * Creates a new libsndfile sample store. ipatch_sample_store_snd_file_init_read() * or ipatch_sample_store_snd_file_init_write() must be called, depending on * audio file mode, prior to opening the sample. * * Returns: New libsndfile sample store, cast as a #IpatchSample for convenience. */ IpatchSample * ipatch_sample_store_snd_file_new (const char *filename) { return (IPATCH_SAMPLE (g_object_new (IPATCH_TYPE_SAMPLE_STORE_SND_FILE, "file-name", filename, NULL))); } /** * ipatch_sample_store_snd_file_init_read: * @store: libsndfile sample store * * Initialize a libsndfile sample store for reading. Should be called prior to * opening the sample store and after the filename has been assigned. Fills in * the #IpatchSampleStoreSndFile:file-format, #IpatchSampleStoreSndFile:sub-format, * #IpatchSampleStoreSndFile:endian, #IpatchSample:sample-rate and * #IpatchSample:sample-size information properties. In addition the * #IpatchSample:sample-format property is set to a value for optimal loading of the * audio data (least amount of conversion necessary to yield uncompressed PCM * audio), which will be the audio format of the sample store. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_sample_store_snd_file_init_read (IpatchSampleStoreSndFile *store) { SF_INSTRUMENT instinfo; SNDFILE *sfhandle; SF_INFO info; int format; memset (&info, 0, sizeof (SF_INFO)); /* Open the file for reading using libsndfile */ sfhandle = sf_open (store->filename, SFM_READ, &info); if (!sfhandle) return (FALSE); format = libsndfile_read_format_convert (info.format, info.channels, &store->raw); g_object_set (store, "file-format", info.format & SF_FORMAT_TYPEMASK, "sub-format", info.format & SF_FORMAT_SUBMASK, "endian", info.format & SF_FORMAT_ENDMASK, "sample-rate", info.samplerate, "sample-size", info.frames, NULL); /* FIXME - Weird weird weird bug where adding "sample-format" property to * the end of the above g_object_set() call will not work!!! WTF? */ g_object_set (store, "sample-format", format, NULL); if (sf_command (sfhandle, SFC_GET_INSTRUMENT, &instinfo, sizeof (instinfo))) { int loop_type; unsigned int loop_start, loop_end; if (instinfo.loop_count > 0) { switch (instinfo.loops[0].mode) { case SF_LOOP_NONE: loop_type = IPATCH_SAMPLE_LOOP_NONE; break; case SF_LOOP_ALTERNATING: loop_type = IPATCH_SAMPLE_LOOP_PINGPONG; break; case SF_LOOP_FORWARD: case SF_LOOP_BACKWARD: /* FIXME - Is there really a loop backward mode? */ default: loop_type = IPATCH_SAMPLE_LOOP_STANDARD; break; } loop_start = instinfo.loops[0].start; loop_end = instinfo.loops[0].end; } else { loop_type = IPATCH_SAMPLE_LOOP_NONE; loop_start = loop_end = 0; } g_object_set (store, "root-note", instinfo.basenote, "fine-tune", instinfo.detune, "loop-type", loop_type, "loop-start", loop_start, "loop-end", loop_end, NULL); } sf_close (sfhandle); store->identified = TRUE; return (TRUE); } /** * ipatch_sample_store_snd_file_init_write: * @store: libsndfile sample store * @file_format: libsndfile file format type (GEnum "IpatchSndFileFormat") * @sub_format: libsndfile audio format type (GEnum "IpatchSndFileSubFormat") * @endian: libsndfile endian selection (#IpatchSampleStoreSndFileEndian) * @channels: Number of channels (1-8, 1=mono, 2=stereo, etc) * @samplerate: Audio sample rate * * Initialize a libsndfile sample store for writing. Should be called prior to * opening the sample store. The #IpatchSampleStoreSndFile:file-format, * #IpatchSampleStoreSndFile:sub-format, #IpatchSampleStoreSndFile:endian * and #IpatchSample:sample-rate properties will be assigned the provided values. * In addition the #IpatchSample:sample-format property is set to a value for optimal * writing of the audio data (including the @channels value), which will be the * audio format of the sample store. * * Returns: %TRUE if format variables are valid, %FALSE otherwise */ gboolean ipatch_sample_store_snd_file_init_write (IpatchSampleStoreSndFile *store, int file_format, int sub_format, int endian, int channels, int samplerate) { SF_INFO info; int sample_format; g_return_val_if_fail (IPATCH_IS_SAMPLE_STORE_SND_FILE (store), FALSE); g_return_val_if_fail (channels >= 1 && channels <= 8, FALSE); info.samplerate = samplerate; info.channels = channels; info.format = file_format | sub_format | endian; if (!sf_format_check (&info)) return (FALSE); sample_format = libsndfile_write_format_convert (info.format, channels); g_object_set (store, "file-format", file_format, "sub-format", sub_format, "endian", endian, "sample-rate", samplerate, "sample-format", sample_format, NULL); return (TRUE); } /** * libsndfile_read_format_convert: * @sndfile_format: libsndfile file/audio format * @channels: Number of channels (1-8, 1=mono, 2=stereo, etc) * @raw: Location to store boolean value indicating if data should be read raw, * or %NULL to ignore * * "convert" a libsndfile format to a compatible libinstpatch format for reading. * * Returns: A compatible libinstpatch sample format */ static int libsndfile_read_format_convert (int sndfile_format, int channels, gboolean *raw) { gboolean rawval; int file_format; int format; file_format = sndfile_format & SF_FORMAT_TYPEMASK; /* Some formats return PCM sub formats even if they aren't actually RAW PCM, * such as FLAC. This is bummer dude, since we must upconvert 24 bit to 32 bit, * 8 bit to 16 bit, etc or revert to nasty conversions requiring a second * buffer. We trust that certain formats will have RAW PCM that we can just * read ourselves and do whatever we like with it. An unfortunate limitation of * libsndfile. */ if (file_format == SF_FORMAT_WAV || file_format == SF_FORMAT_AIFF) rawval = TRUE; else rawval = FALSE; switch (sndfile_format & SF_FORMAT_SUBMASK) { case SF_FORMAT_PCM_S8: format = rawval ? IPATCH_SAMPLE_8BIT : IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_ENDIAN_HOST; break; case SF_FORMAT_PCM_16: format = rawval ? IPATCH_SAMPLE_16BIT : IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_ENDIAN_HOST; break; case SF_FORMAT_PCM_24: format = rawval ? IPATCH_SAMPLE_REAL24BIT : IPATCH_SAMPLE_32BIT | IPATCH_SAMPLE_ENDIAN_HOST; break; case SF_FORMAT_PCM_32: format = rawval ? IPATCH_SAMPLE_32BIT : IPATCH_SAMPLE_32BIT | IPATCH_SAMPLE_ENDIAN_HOST; break; case SF_FORMAT_PCM_U8: format = rawval ? IPATCH_SAMPLE_8BIT | IPATCH_SAMPLE_UNSIGNED : IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_ENDIAN_HOST; break; case SF_FORMAT_FLOAT: format = IPATCH_SAMPLE_FLOAT | IPATCH_SAMPLE_ENDIAN_HOST; rawval = FALSE; break; case SF_FORMAT_DOUBLE: format = IPATCH_SAMPLE_DOUBLE | IPATCH_SAMPLE_ENDIAN_HOST; rawval = FALSE; break; default: /* Just read non PCM formats as 16 bit host endian */ format = IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_ENDIAN_HOST; rawval = FALSE; break; } if (rawval) { switch (sndfile_format & SF_FORMAT_ENDMASK) { case SF_ENDIAN_LITTLE: format |= IPATCH_SAMPLE_LENDIAN; break; case SF_ENDIAN_BIG: format |= IPATCH_SAMPLE_BENDIAN; break; default: format |= IPATCH_SAMPLE_ENDIAN_HOST; break; } } format |= ((channels - 1) & 0x07) << IPATCH_SAMPLE_CHANNEL_SHIFT; if (raw) *raw = rawval; return (format); } /** * libsndfile_write_format_convert: * @sndfile_format: libsndfile file/audio format * @channels: Number of channels (1-8, 1=mono, 2=stereo, etc) * * "convert" a libsndfile format to a compatible libinstpatch format for writing. * * Returns: A compatible libinstpatch sample format */ static int libsndfile_write_format_convert (int sndfile_format, int channels) { int format; switch (sndfile_format & SF_FORMAT_SUBMASK) { case SF_FORMAT_PCM_S8: format = IPATCH_SAMPLE_8BIT; break; case SF_FORMAT_PCM_16: format = IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_ENDIAN_HOST; break; case SF_FORMAT_PCM_24: /* No libsndfile function for writing 24 bit */ case SF_FORMAT_PCM_32: format = IPATCH_SAMPLE_32BIT | IPATCH_SAMPLE_ENDIAN_HOST; break; case SF_FORMAT_PCM_U8: format = IPATCH_SAMPLE_8BIT | IPATCH_SAMPLE_UNSIGNED; break; case SF_FORMAT_FLOAT: format = IPATCH_SAMPLE_FLOAT | IPATCH_SAMPLE_ENDIAN_HOST; break; case SF_FORMAT_DOUBLE: format = IPATCH_SAMPLE_DOUBLE | IPATCH_SAMPLE_ENDIAN_HOST; break; default: /* Just write non PCM formats as 16 bit host endian */ format = IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_ENDIAN_HOST; break; } format |= ((channels - 1) & 0x07) << IPATCH_SAMPLE_CHANNEL_SHIFT; return (format); } libinstpatch-1.0.0/libinstpatch/IpatchSF2Writer.c0000644000175000017500000014474511461352441016705 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchSF2Writer.h" #include "IpatchBase.h" #include "IpatchFile.h" #include "IpatchSampleStore.h" #include "IpatchSampleStoreFile.h" #include "IpatchSampleStoreRom.h" #include "IpatchSampleStoreSwap.h" #include "IpatchSampleStoreSplit24.h" #include "IpatchSF2Preset.h" #include "IpatchSF2Inst.h" #include "IpatchSF2Sample.h" #include "IpatchSF2PZone.h" #include "IpatchSF2IZone.h" #include "IpatchSF2Zone.h" #include "IpatchUnit.h" #include "i18n.h" #include "ipatch_priv.h" #include "misc.h" #include "version.h" /* NOTICE: A duplicate SoundFont object is used for saving. This * solves all multi-thread issues and allows one to continue editing * even while a SoundFont is being saved. It also means that the * duplicate SoundFont object can be accessed directly without * locking. Sample data objects are not duplicated though, so they * still need to be dealt with properly. */ enum { PROP_0, PROP_MIGRATE_SAMPLES }; /* Hash value used for sample_hash */ typedef struct { guint index; /* Sample index */ guint position; /* Position in file */ guint position24; /* 24 bit byte file position (or 0 if 16 bit sample) */ } SampleHashValue; /* SoundFont 16 bit sample format */ #define FORMAT_16BIT IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_MONO \ | IPATCH_SAMPLE_SIGNED | IPATCH_SAMPLE_LENDIAN /* SoundFont 24 bit sample format */ #define FORMAT_24BIT IPATCH_SAMPLE_24BIT | IPATCH_SAMPLE_MONO \ | IPATCH_SAMPLE_SIGNED | IPATCH_SAMPLE_LENDIAN static void ipatch_sf2_writer_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sf2_writer_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static SampleHashValue *ipatch_sf2_writer_sample_hash_value_new (void); static void ipatch_sf2_writer_sample_hash_value_destroy (gpointer value); static void ipatch_sf2_writer_finalize (GObject *object); static gboolean sfont_writer_migrate_samples (IpatchSF2Writer *writer, GError **err); static gboolean ipatch_sf2_write_level_0 (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_info (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_strchunk (IpatchSF2Writer *writer, guint32 id, const char *val, GError **err); static gboolean sfont_write_samples (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_samples24 (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_phdrs (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_pbags (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_pmods (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_pgens (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_ihdrs (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_ibags (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_imods (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_igens (IpatchSF2Writer *writer, GError **err); static gboolean sfont_write_shdrs (IpatchSF2Writer *writer, GError **err); G_DEFINE_TYPE (IpatchSF2Writer, ipatch_sf2_writer, IPATCH_TYPE_RIFF) static void ipatch_sf2_writer_class_init (IpatchSF2WriterClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); obj_class->set_property = ipatch_sf2_writer_set_property; obj_class->get_property = ipatch_sf2_writer_get_property; obj_class->finalize = ipatch_sf2_writer_finalize; g_object_class_install_property (obj_class, PROP_MIGRATE_SAMPLES, g_param_spec_boolean ("migrate-samples", _("Migrate Samples"), _("Migrate samples to new file"), FALSE, G_PARAM_READWRITE)); } static void ipatch_sf2_writer_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSF2Writer *writer = IPATCH_SF2_WRITER (object); switch (property_id) { case PROP_MIGRATE_SAMPLES: writer->migrate_samples = g_value_get_boolean (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_sf2_writer_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSF2Writer *writer = IPATCH_SF2_WRITER (object); switch (property_id) { case PROP_MIGRATE_SAMPLES: g_value_set_boolean (value, writer->migrate_samples); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_sf2_writer_init (IpatchSF2Writer *writer) { writer->migrate_samples = FALSE; writer->inst_hash = g_hash_table_new (NULL, NULL); writer->sample_hash = g_hash_table_new_full (NULL, NULL, NULL, ipatch_sf2_writer_sample_hash_value_destroy); } static SampleHashValue * ipatch_sf2_writer_sample_hash_value_new (void) { return (g_slice_new0 (SampleHashValue)); } static void ipatch_sf2_writer_sample_hash_value_destroy (gpointer value) { g_slice_free (SampleHashValue, value); } static void ipatch_sf2_writer_finalize (GObject *object) { IpatchSF2Writer *writer = IPATCH_SF2_WRITER (object); if (writer->orig_sf) { g_object_unref (writer->orig_sf); writer->orig_sf = NULL; } if (writer->sf) { g_object_unref (writer->sf); writer->sf = NULL; } g_hash_table_destroy (writer->inst_hash); g_hash_table_destroy (writer->sample_hash); writer->inst_hash = NULL; writer->sample_hash = NULL; if (G_OBJECT_CLASS (ipatch_sf2_writer_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sf2_writer_parent_class)->finalize (object); } /** * ipatch_sf2_writer_new: * @handle: SoundFont file handle to save to or %NULL to set later * @sfont: SoundFont object to save or %NULL to set later * * Create a new SoundFont 2 file writer. * * Returns: The new SoundFont writer */ IpatchSF2Writer * ipatch_sf2_writer_new (IpatchFileHandle *handle, IpatchSF2 *sfont) { IpatchSF2Writer *writer; g_return_val_if_fail (!sfont || IPATCH_IS_SF2 (sfont), NULL); g_return_val_if_fail (!handle || IPATCH_IS_SF2_FILE (handle->file), NULL); writer = g_object_new (IPATCH_TYPE_SF2_WRITER, NULL); if (sfont) ipatch_sf2_writer_set_patch (writer, sfont); if (handle) ipatch_sf2_writer_set_file_handle (writer, handle); return (writer); } /** * ipatch_sf2_writer_set_patch: * @writer: SoundFont writer object * @sfont: SoundFont patch to save * * Set the SoundFont patch object to save with a SoundFont writer. */ void ipatch_sf2_writer_set_patch (IpatchSF2Writer *writer, IpatchSF2 *sfont) { g_return_if_fail (IPATCH_IS_SF2_WRITER (writer)); g_return_if_fail (IPATCH_IS_SF2 (sfont)); if (writer->orig_sf) g_object_unref (writer->orig_sf); writer->orig_sf = g_object_ref (sfont); } /** * ipatch_sf2_writer_set_file: * @writer: SoundFont writer object * @handle: SoundFont file handle * * Set the SoundFont file handle of a SoundFont writer. A convenience * function, since ipatch_riff_set_file_handle() could also be used, albeit * without stricter type casting. */ void ipatch_sf2_writer_set_file_handle (IpatchSF2Writer *writer, IpatchFileHandle *handle) { g_return_if_fail (IPATCH_IS_SF2_WRITER (writer)); g_return_if_fail (handle && IPATCH_IS_SF2_FILE (handle->file)); ipatch_riff_set_file_handle (IPATCH_RIFF (writer), handle); } /** * ipatch_sf2_writer_save: * @writer: SoundFont writer object * @err: Location to store error info or %NULL * * Write a SoundFont object to a file. * * Returns: %TRUE on success, %FALSE on error */ gboolean ipatch_sf2_writer_save (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff; gboolean b; g_return_val_if_fail (IPATCH_IS_SF2_WRITER (writer), FALSE); g_return_val_if_fail (!err || !*err, FALSE); g_return_val_if_fail (writer->orig_sf != NULL, FALSE); /* shouldn't be set, but.. */ if (writer->sf) g_object_unref (writer->sf); /* set SoundFont version according to whether 24 bit samples are enabled */ b = (ipatch_item_get_flags (IPATCH_ITEM (writer->orig_sf)) & IPATCH_SF2_SAMPLES_24BIT) != 0; g_object_set (writer->orig_sf, "version", b ? "2.04" : "2.01", NULL); /* duplicate for save, so we can be multi-thread friendly :) ++ ref new duplicate object */ writer->sf = IPATCH_SF2 (ipatch_item_duplicate (IPATCH_ITEM (writer->orig_sf))); riff = IPATCH_RIFF (writer); /* write toplevel SoundFont RIFF chunk */ if (!ipatch_riff_write_chunk (riff, IPATCH_RIFF_CHUNK_RIFF, IPATCH_SFONT_FOURCC_SFBK, err)) return (FALSE); if (!ipatch_sf2_write_level_0 (writer, err)) goto err; /* close the RIFF chunk */ if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* migrate samples if requested */ if (writer->migrate_samples && !sfont_writer_migrate_samples (writer, err)) goto err; g_object_set (writer->orig_sf, "changed", FALSE, /* file and object are in sync */ "saved", TRUE, /* has now been saved */ NULL); g_object_unref (writer->sf); /* -- unref duplicate SoundFont */ writer->sf = NULL; return (TRUE); err: g_object_unref (writer->sf); /* -- unref duplicate SoundFont */ writer->sf = NULL; return (FALSE); } /* Sample stores of the samples that have been saved are migrated to the new * file. Samples that reference the SoundFont's old file handle but are not in * the new file are moved to the sample buffer. Also the saved SoundFont's * file object is set to the new file. */ static gboolean sfont_writer_migrate_samples (IpatchSF2Writer *writer, GError **err) { SampleHashValue *hash_value; IpatchSample *newstore; IpatchFile *save_file; IpatchSF2Sample *sample; IpatchIter iter; gboolean smpl24; int rate; save_file = IPATCH_RIFF (writer)->handle->file; smpl24 = (ipatch_item_get_flags (writer->sf) & IPATCH_SF2_SAMPLES_24BIT) != 0; ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_SAMPLE); /* traverse samples */ for (sample = ipatch_sf2_sample_first (&iter); sample; sample = ipatch_sf2_sample_next (&iter)) { hash_value = g_hash_table_lookup (writer->sample_hash, sample); /* Skip ROM samples, hash_value should never be NULL, but.. */ if (!hash_value || hash_value->position == 0) continue; if (!smpl24) { /* ++ ref newstore */ newstore = ipatch_sample_store_file_new (save_file, hash_value->position); ipatch_sample_set_format ((IpatchSample *)newstore, FORMAT_16BIT); } else /* ++ ref newstore */ newstore = ipatch_sample_store_split24_new (save_file, hash_value->position, hash_value->position24); g_object_get (sample, "sample-rate", &rate, NULL); g_object_set (newstore, "sample-rate", rate, NULL); /* Replace the native sample with the new store referencing the saved file */ ipatch_sample_data_replace_native_sample (sample->sample_data, (IpatchSampleStore *)newstore); g_object_unref (newstore); /* -- unref newstore */ } ipatch_sf2_set_file (writer->orig_sf, IPATCH_SF2_FILE (save_file)); return (TRUE); } /** * ipatch_sf2_write_phdr: * @handle: File handle to buffer writes to, commit after calling this function * @phdr: Preset header structure to store * * Buffer writes a preset header into @handle from a @phdr structure. */ void ipatch_sf2_write_phdr (IpatchFileHandle *handle, const IpatchSF2Phdr *phdr) { g_return_if_fail (handle != NULL); g_return_if_fail (phdr != NULL); ipatch_file_buf_write (handle, phdr->name, IPATCH_SFONT_NAME_SIZE); ipatch_file_buf_write_u16 (handle, phdr->program); ipatch_file_buf_write_u16 (handle, phdr->bank); ipatch_file_buf_write_u16 (handle, phdr->bag_index); ipatch_file_buf_write_u32 (handle, phdr->library); ipatch_file_buf_write_u32 (handle, phdr->genre); ipatch_file_buf_write_u32 (handle, phdr->morphology); } /** * ipatch_sf2_write_ihdr: * @handle: File handle to buffer writes to, commit after calling this function * @ihdr: Instrument header structure to store * * Writes an instrument header into @handle from a @ihdr structure. */ void ipatch_sf2_write_ihdr (IpatchFileHandle *handle, const IpatchSF2Ihdr *ihdr) { g_return_if_fail (handle != NULL); g_return_if_fail (ihdr != NULL); ipatch_file_buf_write (handle, ihdr->name, IPATCH_SFONT_NAME_SIZE); ipatch_file_buf_write_u16 (handle, ihdr->bag_index); } /** * ipatch_sf2_write_shdr: * @handle: File handle to buffer writes to, commit after calling this function * @shdr: Sample header structure to store * * Writes a sample header into @handle from a @shdr structure. */ void ipatch_sf2_write_shdr (IpatchFileHandle *handle, const IpatchSF2Shdr *shdr) { g_return_if_fail (handle != NULL); g_return_if_fail (shdr != NULL); ipatch_file_buf_write (handle, shdr->name, IPATCH_SFONT_NAME_SIZE); ipatch_file_buf_write_u32 (handle, shdr->start); ipatch_file_buf_write_u32 (handle, shdr->end); ipatch_file_buf_write_u32 (handle, shdr->loop_start); ipatch_file_buf_write_u32 (handle, shdr->loop_end); ipatch_file_buf_write_u32 (handle, shdr->rate); ipatch_file_buf_write_u8 (handle, shdr->root_note); ipatch_file_buf_write_u8 (handle, shdr->fine_tune); ipatch_file_buf_write_u16 (handle, shdr->link_index); ipatch_file_buf_write_u16 (handle, shdr->type); } /** * ipatch_sf2_write_bag: * @handle: File handle to buffer writes to, commit after calling this function * @bag: Bag structure to store * * Writes a preset or instrument bag into @handle from a @bag structure. */ void ipatch_sf2_write_bag (IpatchFileHandle *handle, const IpatchSF2Bag *bag) { g_return_if_fail (handle != NULL); g_return_if_fail (bag != NULL); ipatch_file_buf_write_u16 (handle, bag->gen_index); ipatch_file_buf_write_u16 (handle, bag->mod_index); } /** * ipatch_sf2_write_mod: * @handle: File handle to buffer writes to, commit after calling this function * @mod: Modulator structure to store * * Writes a modulator into @handle from a @mod structure. */ void ipatch_sf2_write_mod (IpatchFileHandle *handle, const IpatchSF2Mod *mod) { g_return_if_fail (handle != NULL); g_return_if_fail (mod != NULL); ipatch_file_buf_write_u16 (handle, mod->src); ipatch_file_buf_write_u16 (handle, mod->dest); ipatch_file_buf_write_u16 (handle, mod->amount); ipatch_file_buf_write_u16 (handle, mod->amtsrc); ipatch_file_buf_write_u16 (handle, mod->trans); } /** * ipatch_sf2_write_gen: * @handle: File handle to buffer writes to, commit after calling this function * @genid: ID of generator to store * @amount: Generator amount to store * * Writes a generator into @handle from a @genid and @amount * structure. */ void ipatch_sf2_write_gen (IpatchFileHandle *handle, int genid, const IpatchSF2GenAmount *amount) { g_return_if_fail (handle != NULL); g_return_if_fail (amount != NULL); ipatch_file_buf_write_u16 (handle, genid); /* check if genid is valid (preset or inst) and is a range unit */ if (genid != IPATCH_SF2_GEN_INSTRUMENT_ID && genid != IPATCH_SF2_GEN_SAMPLE_ID && ipatch_sf2_gen_is_valid (genid, FALSE) && ipatch_sf2_gen_info[genid].unit == IPATCH_UNIT_TYPE_RANGE) { /* store the range */ ipatch_file_buf_write_u8 (handle, amount->range.low); ipatch_file_buf_write_u8 (handle, amount->range.high); } else ipatch_file_buf_write_s16 (handle, amount->sword); } static gboolean ipatch_sf2_write_level_0 (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Inst *inst; IpatchIter iter; guint index; /* write info list */ if (!ipatch_riff_write_chunk (riff, IPATCH_RIFF_CHUNK_LIST, IPATCH_SFONT_FOURCC_INFO, err)) return (FALSE); if (!sfont_write_info (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* - Sample data list chunk */ if (!ipatch_riff_write_chunk (riff, IPATCH_RIFF_CHUNK_LIST, IPATCH_SFONT_FOURCC_SDTA, err)) return (FALSE); /* if 24 bit samples are enabled write smpl and sm24 chunks */ if (ipatch_item_get_flags (writer->sf) & IPATCH_SF2_SAMPLES_24BIT) { if (!sfont_write_samples24 (writer, err)) return (FALSE); } else if (!sfont_write_samples (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ /* generate instrument pointer => index hash, used by preset generators */ ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_INST); inst = ipatch_sf2_inst_first (&iter); index = 1; while (inst) { /* add instrument and index to instrument hash */ g_hash_table_insert (writer->inst_hash, inst, GUINT_TO_POINTER (index)); index++; inst = ipatch_sf2_inst_next (&iter); } /* - SoundFont parameter "Hydra" list chunk */ if (!ipatch_riff_write_list_chunk (riff, IPATCH_SFONT_FOURCC_PDTA, err)) return (FALSE); /* - Preset headers */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_PHDR, err)) return (FALSE); if (!sfont_write_phdrs (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* - Preset bags */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_PBAG, err)) return (FALSE); if (!sfont_write_pbags (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* - Preset modulators */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_PMOD, err)) return (FALSE); if (!sfont_write_pmods (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* - Preset generators */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_PGEN, err)) return (FALSE); if (!sfont_write_pgens (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* - Instrument headers */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_INST, err)) return (FALSE); if (!sfont_write_ihdrs (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* - Instrument bags */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_IBAG, err)) return (FALSE); if (!sfont_write_ibags (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* - Instrument modulators */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_IMOD, err)) return (FALSE); if (!sfont_write_imods (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* - Instrument generators */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_IGEN, err)) return (FALSE); if (!sfont_write_igens (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* - Sample headers */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_SHDR, err)) return (FALSE); if (!sfont_write_shdrs (writer, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); return (TRUE); } /* save SoundFont info in the recommended order */ static gboolean sfont_write_info (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Info *info_array; char *val, *software; int i; /* save SoundFont version */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_IFIL, err)) return (FALSE); ipatch_file_buf_write_u16 (riff->handle, writer->sf->ver_major); ipatch_file_buf_write_u16 (riff->handle, writer->sf->ver_minor); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* save SoundFont synthesis engine */ if (!(val = ipatch_sf2_get_info (writer->sf, IPATCH_SF2_ENGINE))) val = g_strdup (IPATCH_SF2_DEFAULT_ENGINE); if (!sfont_write_strchunk (writer, IPATCH_SFONT_FOURCC_ISNG, val, err)) { g_free (val); return (FALSE); } g_free (val); /* save SoundFont name */ if (!(val = ipatch_sf2_get_info (writer->sf, IPATCH_SF2_NAME))) val = g_strdup (IPATCH_BASE_DEFAULT_NAME); if (!sfont_write_strchunk (writer, IPATCH_SFONT_FOURCC_INAM, val, err)) { g_free (val); return (FALSE); } g_free (val); /* SoundFont has ROM name set? */ if ((val = ipatch_sf2_get_info (writer->sf, IPATCH_SF2_ROM_NAME))) { /* save ROM name */ if (!sfont_write_strchunk (writer, IPATCH_SFONT_FOURCC_IROM, val, err)) { g_free (val); return (FALSE); } g_free (val); /* save the ROM version too */ if (!ipatch_riff_write_sub_chunk (riff, IPATCH_SFONT_FOURCC_IVER, err)) return (FALSE); ipatch_file_buf_write_u16 (riff->handle, writer->sf->romver_major); ipatch_file_buf_write_u16 (riff->handle, writer->sf->romver_minor); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); } /* write the rest of the info (except ones already written) */ info_array = ipatch_sf2_get_info_array (writer->sf); for (i = 0; info_array[i].id; i++) { if (info_array[i].id != IPATCH_SF2_ENGINE && info_array[i].id != IPATCH_SF2_NAME && info_array[i].id != IPATCH_SF2_ROM_NAME && info_array[i].id != IPATCH_SF2_SOFTWARE) if (!sfont_write_strchunk (writer, info_array[i].id, info_array[i].val, err)) { ipatch_sf2_free_info_array (info_array); return (FALSE); } } ipatch_sf2_free_info_array (info_array); /* compose the libInstPatch software string using application name if any */ if (ipatch_application_name) software = g_strconcat (ipatch_application_name, " (libInstPatch " IPATCH_VERSION ")", NULL); else software = g_strdup ("libInstPatch " IPATCH_VERSION); /* construct software created:modified string */ val = ipatch_sf2_get_info (writer->sf, IPATCH_SF2_SOFTWARE); if (val) { char *tmp; tmp = strchr (val, ':'); /* find colon created:modified separator */ if (tmp) { tmp[1] = '\0'; /* terminate after : */ tmp = g_strconcat (val, software, NULL); g_free (val); val = tmp; } else /* no colon separator? Discard.. */ { g_free (val); val = g_strdup (software); } } else val = g_strdup (software); g_free (software); /* write the software string */ if (!sfont_write_strchunk (writer, IPATCH_SFONT_FOURCC_ISFT, val, err)) { g_free (val); return (FALSE); } g_free (val); return (TRUE); } /* write a even size null terminated string contained in a sub chunk */ static gboolean sfont_write_strchunk (IpatchSF2Writer *writer, guint32 id, const char *val, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); char pad = '\0'; int len; if (!ipatch_riff_write_sub_chunk (riff, id, err)) return (FALSE); len = strlen (val) + 1; if (!ipatch_file_write (riff->handle, val, len, err)) return (FALSE); if (len & 1) /* pad to an even number of bytes */ if (!ipatch_file_write (riff->handle, &pad, 1, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); return (TRUE); } /* save sample data (16 bit mode) */ static gboolean sfont_write_samples (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Sample *sample; IpatchSampleHandle handle; IpatchSF2File *file = IPATCH_SF2_FILE (riff->handle->file); SampleHashValue *sample_hash_value; IpatchRiffChunk *chunk; IpatchIter iter; gpointer buf; guint8 zerobuf[46 * 2]; /* 46 zero values to write at end of each sample */ guint samsize, size, ofs; int index = 0; memset (&zerobuf, 0, sizeof (zerobuf)); /* - Sample data sub chunk */ if (!ipatch_riff_write_chunk (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_SMPL, err)) return (FALSE); /* set the sample position in the IpatchSF2File */ ipatch_sf2_file_set_sample_pos (file, ipatch_riff_get_position (riff)); ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_SAMPLE); /* traverse samples */ for (sample = ipatch_sf2_sample_first (&iter); sample; sample = ipatch_sf2_sample_next (&iter)) { /* add sample info to sample hash */ sample_hash_value = ipatch_sf2_writer_sample_hash_value_new (); sample_hash_value->index = index++; g_hash_table_insert (writer->sample_hash, sample, sample_hash_value); /* ignore ROM samples */ if (ipatch_item_get_flags (sample) & IPATCH_SF2_SAMPLE_FLAG_ROM) continue; /* get sample position in sample chunk and store to sample hash value */ chunk = ipatch_riff_get_chunk (riff, -1); sample_hash_value->position = file->sample_pos + chunk->position; /* ++ open sample handle */ if (!ipatch_sample_data_open_native_sample (sample->sample_data, &handle, 'r', FORMAT_16BIT, IPATCH_SAMPLE_UNITY_CHANNEL_MAP, err)) return (FALSE); size = ipatch_sample_handle_get_max_frames (&handle); samsize = ipatch_sample_get_size ((IpatchSample *)(sample->sample_data), NULL); for (ofs = 0; ofs < samsize; ofs += size) /* loop while data to store */ { if (samsize - ofs < size) /* check for last partial fragment */ size = samsize - ofs; /* read and transform (if necessary) audio data from sample store */ if (!(buf = ipatch_sample_handle_read (&handle, ofs, size, NULL, err))) { ipatch_sample_handle_close (&handle); /* -- close sample handle */ return (FALSE); } /* write 16 bit mono sample data to SoundFont file */ if (!ipatch_file_write (riff->handle, buf, size * 2, err)) { ipatch_sample_handle_close (&handle); /* -- close sample handle */ return (FALSE); } } ipatch_sample_handle_close (&handle); /* -- close sample handle */ /* 46 "zero" samples following sample as per SoundFont spec */ if (!ipatch_file_write (riff->handle, &zerobuf, 46 * 2, err)) return (FALSE); } if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); /* */ return (TRUE); } /* save sample data (24 bit mode) */ static gboolean sfont_write_samples24 (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Sample *sample; IpatchSampleHandle handle; IpatchSF2File *file = IPATCH_SF2_FILE (riff->handle->file); SampleHashValue *sample_hash_value; IpatchIter iter; gpointer buf; guint8 *lsbuf = NULL; /* init to NULL for error: return */ guint lsbuf_size = 0; guint8 zerobuf[46 * 2]; /* 46 zero values to write at end of each sample */ guint samsize, size, start, ofs, total_size, totalofs = 0; guint index = 0; int i; memset (&zerobuf, 0, sizeof (zerobuf)); /* - Sample data sub chunk */ if (!ipatch_riff_write_chunk (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_SMPL, err)) goto error; /* set the sample position in the IpatchSF2File */ ipatch_sf2_file_set_sample_pos (file, ipatch_riff_get_position (riff)); ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_SAMPLE); /* calc total size of smpl chunk, so we can write sm24 chunk simultaneously */ sample = ipatch_sf2_sample_first (&iter); for (total_size = 0; sample; sample = ipatch_sf2_sample_next (&iter)) { /* ignore ROM samples */ if (ipatch_item_get_flags (sample) & IPATCH_SF2_SAMPLE_FLAG_ROM) continue; /* size of audio in samples + 46 silent samples */ total_size += ipatch_sample_get_size ((IpatchSample *)sample, NULL) + 46; } /* seek to end of smpl chunk (sample data written later) */ if (!ipatch_file_seek (riff->handle, total_size * 2, G_SEEK_CUR, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) goto error; /* */ /* - LS bytes of 24 bit sample data sub chunk */ if (!ipatch_riff_write_chunk (riff, IPATCH_RIFF_CHUNK_SUB, IPATCH_SFONT_FOURCC_SM24, err)) return (FALSE); /* set the sample 24 position in the IpatchSF2File */ ipatch_sf2_file_set_sample24_pos (file, ipatch_riff_get_position (riff)); /* allocate extra buffer to store LS bytes of 24 bit samples */ lsbuf = g_malloc (IPATCH_SAMPLE_COPY_BUFFER_SIZE); /* traverse samples */ for (sample = ipatch_sf2_sample_first (&iter); sample; sample = ipatch_sf2_sample_next (&iter)) { /* add sample info to sample hash */ sample_hash_value = ipatch_sf2_writer_sample_hash_value_new (); sample_hash_value->index = index++; g_hash_table_insert (writer->sample_hash, sample, sample_hash_value); /* ignore ROM samples */ if (ipatch_item_get_flags (sample) & IPATCH_SF2_SAMPLE_FLAG_ROM) continue; /* ++ open sample handle */ if (!ipatch_sample_data_open_native_sample (sample->sample_data, &handle, 'r', FORMAT_24BIT, IPATCH_SAMPLE_UNITY_CHANNEL_MAP, err)) goto error; size = ipatch_sample_handle_get_max_frames (&handle); samsize = ipatch_sample_get_size ((IpatchSample *)(sample->sample_data), NULL); /* Allocate/reallocate 24 bit LSB buffer (1 byte per 24 bit sample) */ if (size > lsbuf_size) { lsbuf = g_realloc (lsbuf, size); lsbuf_size = size; } /* start offset in samples of this sample data */ start = totalofs; sample_hash_value->position = file->sample_pos + start * 2; sample_hash_value->position24 = file->sample24_pos + start; /* loop while data to store */ for (ofs = 0; ofs < samsize; ofs += size, totalofs += size) { if (samsize - ofs < size) /* check for last partial fragment */ size = samsize - ofs; /* read and transform (if necessary) audio data from sample store */ if (!(buf = ipatch_sample_handle_read (&handle, ofs, size, NULL, err))) goto error_close_handle; /* copy the LS bytes of the 24 bit samples */ for (i = 0; i < size; i++) ((guint8 *)lsbuf)[i] = ((guint8 *)buf)[i * 4]; /* compact the 16 bit portion of the 24 bit samples */ for (i = 0; i < size; i++) { ((guint8 *)buf)[i * 2] = ((guint8 *)buf)[i * 4 + 1]; ((guint8 *)buf)[i * 2 + 1] = ((guint8 *)buf)[i * 4 + 2]; } /* seek to location in smpl chunk to store 16 bit data */ if (!ipatch_file_seek (riff->handle, file->sample_pos + totalofs * 2, G_SEEK_SET, err)) goto error_close_handle; /* write 16 bit portions of 24 bit samples to file */ if (!ipatch_file_write (riff->handle, buf, size * 2, err)) goto error_close_handle; /* seek to location in sm24 chunk to store LS bytes of 24 bit samples */ if (!ipatch_file_seek (riff->handle, file->sample24_pos + totalofs, G_SEEK_SET, err)) goto error_close_handle; /* write least significant 8 bits of 24 bit samples to file */ if (!ipatch_file_write (riff->handle, lsbuf, size, err)) goto error_close_handle; } ipatch_sample_handle_close (&handle); /* -- close sample handle */ /* seek to location in smpl chunk to store 16 bit zero samples */ if (!ipatch_file_seek (riff->handle, file->sample_pos + totalofs * 2, G_SEEK_SET, err)) goto error; /* 46 "zero" samples following sample as per SoundFont spec */ if (!ipatch_file_write (riff->handle, &zerobuf, 46 * 2, err)) goto error; /* seek to location in sm24 chunk to store LS bytes of zero samples */ if (!ipatch_file_seek (riff->handle, file->sample24_pos + totalofs, G_SEEK_SET, err)) goto error; /* 46 "zero" samples following sample as per SoundFont spec */ if (!ipatch_file_write (riff->handle, &zerobuf, 46, err)) goto error; totalofs += 46; } g_free (lsbuf); /* free lsbuf */ /* must set to NULL in case of error: return */ lsbuf = NULL; /* seek to end of sm24 chunk */ if (!ipatch_file_seek (riff->handle, file->sample24_pos + total_size, G_SEEK_SET, err)) goto error; if (!ipatch_riff_close_chunk (riff, -1, err)) goto error; /* */ return (TRUE); error_close_handle: ipatch_sample_handle_close (&handle); /* -- close sample handle */ error: g_free (lsbuf); /* free lsbuf */ return (FALSE); } /* save preset headers */ static gboolean sfont_write_phdrs (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Preset *preset; IpatchSF2Phdr phdr; IpatchIter iter, zone_iter; guint16 pbagndx = 0; ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_PRESET); preset = ipatch_sf2_preset_first (&iter); while (preset) /* loop over all presets */ { strncpy (phdr.name, preset->name, IPATCH_SFONT_NAME_SIZE); phdr.program = preset->program; phdr.bank = preset->bank; phdr.bag_index = pbagndx; phdr.library = preset->library; phdr.genre = preset->genre; phdr.morphology = preset->morphology; ipatch_sf2_write_phdr (riff->handle, &phdr); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); /* get count of preset zones */ ipatch_container_init_iter ((IpatchContainer *)preset, &zone_iter, IPATCH_TYPE_SF2_PZONE); pbagndx += ipatch_iter_count (&zone_iter); /* if any global generators or modulators then add 1 for global zone */ if (preset->genarray.flags || preset->mods) pbagndx++; preset = ipatch_sf2_preset_next (&iter); /* next preset */ } /* create terminal record */ memset (&phdr, 0, sizeof (phdr)); strcpy (phdr.name, "EOP"); phdr.bag_index = pbagndx; ipatch_sf2_write_phdr (riff->handle, &phdr); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* save preset bags */ static gboolean sfont_write_pbags (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Preset *preset; IpatchSF2Zone *zone; IpatchSF2Bag bag; IpatchIter iter, zone_iter; guint16 genndx = 0, modndx = 0; ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_PRESET); preset = ipatch_sf2_preset_first (&iter); while (preset) /* traverse through presets */ { ipatch_container_init_iter ((IpatchContainer *)preset, &zone_iter, IPATCH_TYPE_SF2_PZONE); /* process global zone if any global modulators or generators */ if (preset->genarray.flags || preset->mods) zone = NULL; else zone = ipatch_sf2_zone_first (&zone_iter); do { bag.gen_index = genndx; bag.mod_index = modndx; ipatch_sf2_write_bag (riff->handle, &bag); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); if (zone) { genndx += ipatch_sf2_gen_array_count_set (&zone->genarray); if (zone->item) genndx++; /* increment for INSTRUMENT_ID */ modndx += g_slist_length (zone->mods); } else /* after global zone */ { genndx += ipatch_sf2_gen_array_count_set (&preset->genarray); modndx += g_slist_length (preset->mods); } if (!zone) zone = ipatch_sf2_zone_first (&zone_iter); /* after global zone */ else zone = ipatch_sf2_zone_next (&zone_iter); } while (zone); /* traverse preset's zones */ preset = ipatch_sf2_preset_next (&iter); } /* terminal record */ bag.gen_index = genndx; bag.mod_index = modndx; ipatch_sf2_write_bag (riff->handle, &bag); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* save preset modulators */ static gboolean sfont_write_pmods (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Preset *preset; IpatchSF2Zone *zone; IpatchSF2Mod *mod; IpatchIter iter, zone_iter; GSList *p; ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_PRESET); preset = ipatch_sf2_preset_first (&iter); while (preset) /* traverse through all presets */ { zone = NULL; p = preset->mods; /* first is the global modulators */ ipatch_container_init_iter ((IpatchContainer *)preset, &zone_iter, IPATCH_TYPE_SF2_PZONE); do { while (p) /* save zone's modulators */ { mod = (IpatchSF2Mod *)(p->data); ipatch_sf2_write_mod (riff->handle, mod); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); p = g_slist_next (p); } if (!zone) zone = ipatch_sf2_zone_first (&zone_iter); /* after global zone */ else zone = ipatch_sf2_zone_next (&zone_iter); if (zone) p = zone->mods; } while (zone); /* traverse this preset's zones */ preset = ipatch_sf2_preset_next (&iter); } /* terminal record */ ipatch_file_buf_zero (riff->handle, IPATCH_SFONT_MOD_SIZE); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* save preset generators */ static gboolean sfont_write_pgens (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Preset *preset; IpatchSF2Zone *zone; IpatchSF2GenArray *genarray; IpatchSF2GenAmount amount; IpatchIter iter, zone_iter; guint inst_index; guint64 flags; int i; ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_PRESET); preset = ipatch_sf2_preset_first (&iter); while (preset) /* traverse through all presets */ { /* global zone */ genarray = &preset->genarray; zone = NULL; ipatch_container_init_iter ((IpatchContainer *)preset, &zone_iter, IPATCH_TYPE_SF2_PZONE); do { if (IPATCH_SF2_GEN_ARRAY_TEST_FLAG /* note range set? */ (genarray, IPATCH_SF2_GEN_NOTE_RANGE)) { ipatch_sf2_write_gen (riff->handle, IPATCH_SF2_GEN_NOTE_RANGE, &genarray->values [IPATCH_SF2_GEN_NOTE_RANGE]); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); } if (IPATCH_SF2_GEN_ARRAY_TEST_FLAG /* velocity range set? */ (genarray, IPATCH_SF2_GEN_VELOCITY_RANGE)) { ipatch_sf2_write_gen (riff->handle, IPATCH_SF2_GEN_VELOCITY_RANGE, &genarray->values [IPATCH_SF2_GEN_VELOCITY_RANGE]); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); } /* clear the note range and velocity since already saved */ flags = genarray->flags & ~(IPATCH_SF2_GENID_SET (IPATCH_SF2_GEN_NOTE_RANGE) | IPATCH_SF2_GENID_SET (IPATCH_SF2_GEN_VELOCITY_RANGE)); /* set the rest of the generators */ for (i = 0; flags != 0; i++, flags >>= 1) { if (flags & 0x1) /* generator set? */ { ipatch_sf2_write_gen (riff->handle, i, &genarray->values[i]); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); } } /* save instrument ID if any */ if (zone && zone->item) { inst_index = GPOINTER_TO_UINT (g_hash_table_lookup (writer->inst_hash, zone->item)); g_return_val_if_fail (inst_index != 0, FALSE); inst_index--; /* index + 1 (to catch NULL), so decrement */ amount.uword = inst_index; ipatch_sf2_write_gen (riff->handle, IPATCH_SF2_GEN_INSTRUMENT_ID, &amount); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); } if (!zone) zone = ipatch_sf2_zone_first (&zone_iter); /* after global zone */ else zone = ipatch_sf2_zone_next (&zone_iter); /* next zone */ if (zone) genarray = &zone->genarray; } while (zone); /* traverse preset's zones */ preset = ipatch_sf2_preset_next (&iter); /* next preset */ } /* terminal record */ ipatch_file_buf_zero (riff->handle, IPATCH_SFONT_GEN_SIZE); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* save instrument headers */ static gboolean sfont_write_ihdrs (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Inst *inst; IpatchSF2Ihdr ihdr; IpatchIter iter, zone_iter; guint16 ibagndx = 0; ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_INST); inst = ipatch_sf2_inst_first (&iter); while (inst) /* loop over all instruments */ { strncpy (ihdr.name, inst->name, IPATCH_SFONT_NAME_SIZE); ihdr.bag_index = ibagndx; ipatch_sf2_write_ihdr (riff->handle, &ihdr); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); ipatch_container_init_iter ((IpatchContainer *)inst, &zone_iter, IPATCH_TYPE_SF2_IZONE); ibagndx += ipatch_iter_count (&zone_iter); /* if any global generators or modulators then add 1 for global zone */ if (inst->genarray.flags || inst->mods) ibagndx++; inst = ipatch_sf2_inst_next (&iter); } /* terminal record */ memset (&ihdr, 0, sizeof (ihdr)); strcpy (ihdr.name, "EOI"); ihdr.bag_index = ibagndx; ipatch_sf2_write_ihdr (riff->handle, &ihdr); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* save instrument bags */ static gboolean sfont_write_ibags (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Inst *inst; IpatchSF2Zone *zone; IpatchSF2Bag bag; IpatchIter iter, zone_iter; guint16 genndx = 0, modndx = 0; ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_INST); inst = ipatch_sf2_inst_first (&iter); while (inst) /* traverse through instruments */ { ipatch_container_init_iter ((IpatchContainer *)inst, &zone_iter, IPATCH_TYPE_SF2_IZONE); /* process global zone if any global modulators or generators */ if (inst->genarray.flags || inst->mods) zone = NULL; else zone = ipatch_sf2_zone_first (&zone_iter); do { bag.gen_index = genndx; bag.mod_index = modndx; ipatch_sf2_write_bag (riff->handle, &bag); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); if (zone) { genndx += ipatch_sf2_gen_array_count_set (&zone->genarray); if (zone->item) genndx++; /* increment for SAMPLE_ID */ modndx += g_slist_length (zone->mods); } else /* after global zone */ { genndx += ipatch_sf2_gen_array_count_set (&inst->genarray); modndx += g_slist_length (inst->mods); } if (!zone) zone = ipatch_sf2_zone_first (&zone_iter); /* after global zone */ else zone = ipatch_sf2_zone_next (&zone_iter); } while (zone); /* traverse instrument's zones */ inst = ipatch_sf2_inst_next (&iter); } /* terminal record */ bag.gen_index = genndx; bag.mod_index = modndx; ipatch_sf2_write_bag (riff->handle, &bag); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* save instrument modulators */ static gboolean sfont_write_imods (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Inst *inst; IpatchSF2Zone *zone; IpatchSF2Mod *mod; IpatchIter iter, zone_iter; GSList *p; ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_INST); inst = ipatch_sf2_inst_first (&iter); while (inst) /* traverse through all instruments */ { zone = NULL; p = inst->mods; /* first is the global modulators */ ipatch_container_init_iter ((IpatchContainer *)inst, &zone_iter, IPATCH_TYPE_SF2_IZONE); do { while (p) /* save modulators */ { mod = (IpatchSF2Mod *)(p->data); ipatch_sf2_write_mod (riff->handle, mod); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); p = g_slist_next (p); } if (!zone) zone = ipatch_sf2_zone_first (&zone_iter); /* after global zone */ else zone = ipatch_sf2_zone_next (&zone_iter); if (zone) p = zone->mods; } while (zone); /* traverse this instrument's zones */ inst = ipatch_sf2_inst_next (&iter); } /* terminal record */ ipatch_file_buf_zero (riff->handle, IPATCH_SFONT_MOD_SIZE); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* save instrument generators */ static gboolean sfont_write_igens (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2Inst *inst; IpatchSF2Zone *zone; IpatchSF2GenArray *genarray; IpatchSF2GenAmount amount; IpatchIter iter, zone_iter; SampleHashValue *sample_hash_value; guint64 flags; int i; ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_INST); inst = ipatch_sf2_inst_first (&iter); while (inst) /* traverse through all instruments */ { /* global zone */ genarray = &inst->genarray; zone = NULL; ipatch_container_init_iter ((IpatchContainer *)inst, &zone_iter, IPATCH_TYPE_SF2_IZONE); do { if (IPATCH_SF2_GEN_ARRAY_TEST_FLAG /* note range set? */ (genarray, IPATCH_SF2_GEN_NOTE_RANGE)) { ipatch_sf2_write_gen (riff->handle, IPATCH_SF2_GEN_NOTE_RANGE, &genarray->values [IPATCH_SF2_GEN_NOTE_RANGE]); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); } if (IPATCH_SF2_GEN_ARRAY_TEST_FLAG /* velocity range set? */ (genarray, IPATCH_SF2_GEN_VELOCITY_RANGE)) { ipatch_sf2_write_gen (riff->handle, IPATCH_SF2_GEN_VELOCITY_RANGE, &genarray->values [IPATCH_SF2_GEN_VELOCITY_RANGE]); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); } /* clear the note range and velocity since already saved */ flags = genarray->flags & ~(IPATCH_SF2_GENID_SET (IPATCH_SF2_GEN_NOTE_RANGE) | IPATCH_SF2_GENID_SET (IPATCH_SF2_GEN_VELOCITY_RANGE)); /* set the rest of the generators */ for (i = 0; flags != 0; i++, flags >>= 1) { if (flags & 0x1) /* generator set? */ { ipatch_sf2_write_gen (riff->handle, i, &genarray->values[i]); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); } } /* save sample ID if any */ if (zone && zone->item) { sample_hash_value = g_hash_table_lookup (writer->sample_hash, zone->item); g_return_val_if_fail (sample_hash_value != NULL, FALSE); amount.uword = sample_hash_value->index; ipatch_sf2_write_gen (riff->handle, IPATCH_SF2_GEN_SAMPLE_ID, &amount); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); } if (!zone) zone = ipatch_sf2_zone_first (&zone_iter); /* after global zone */ else zone = ipatch_sf2_zone_next (&zone_iter); /* next zone */ if (zone) genarray = &zone->genarray; } while (zone); /* traverse instrument's zones */ inst = ipatch_sf2_inst_next (&iter); /* next instrument */ } /* terminal record */ ipatch_file_buf_zero (riff->handle, IPATCH_SFONT_GEN_SIZE); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } /* save sample headers */ static gboolean sfont_write_shdrs (IpatchSF2Writer *writer, GError **err) { IpatchRiff *riff = IPATCH_RIFF (writer); IpatchSF2File *sf2file = IPATCH_SF2_FILE (riff->handle->file); SampleHashValue *sample_hash_value; IpatchSF2Sample *sample; IpatchIter iter; IpatchSampleStore *store; IpatchSF2Shdr shdr; gboolean sample24; guint start; int location; int untitled = 0; sample24 = (ipatch_item_get_flags (writer->sf) & IPATCH_SF2_SAMPLES_24BIT) != 0; ipatch_container_init_iter (IPATCH_CONTAINER (writer->sf), &iter, IPATCH_TYPE_SF2_SAMPLE); /* traverse all samples */ for (sample = ipatch_sf2_sample_first (&iter); sample; sample = ipatch_sf2_sample_next (&iter)) { if (!(ipatch_item_get_flags (sample) & IPATCH_SF2_SAMPLE_FLAG_ROM)) { sample_hash_value = g_hash_table_lookup (writer->sample_hash, sample); g_return_val_if_fail (sample_hash_value != NULL, FALSE); start = sample_hash_value->position; start -= sf2file->sample_pos; /* use offset from start of samples */ shdr.type = 0; } else /* ROM sample */ { store = ipatch_sample_data_get_native_sample (sample->sample_data); g_return_val_if_fail (store != NULL, FALSE); g_object_get (store, "location", &location, NULL); start = location; shdr.type = IPATCH_SF2_FILE_SAMPLE_TYPE_ROM; } memset (shdr.name, 0, IPATCH_SFONT_NAME_SIZE); if (sample->name) strncpy (shdr.name, sample->name, IPATCH_SFONT_NAME_SIZE - 1); else sprintf (shdr.name, _("untitled-%d"), ++untitled); /* i18n: Should be less than 16 chars! */ start /= 2; /* convert start from bytes to samples */ shdr.start = start; shdr.end = ipatch_sample_get_size ((IpatchSample *)sample, NULL) + start; shdr.loop_start = sample->loop_start + start; shdr.loop_end = sample->loop_end + start; shdr.rate = sample->rate; shdr.root_note = sample->root_note; shdr.fine_tune = sample->fine_tune; switch (sample->channel) { case IPATCH_SF2_SAMPLE_CHANNEL_LEFT: shdr.type |= IPATCH_SF2_FILE_SAMPLE_TYPE_LEFT; break; case IPATCH_SF2_SAMPLE_CHANNEL_RIGHT: shdr.type |= IPATCH_SF2_FILE_SAMPLE_TYPE_RIGHT; break; default: shdr.type |= IPATCH_SF2_FILE_SAMPLE_TYPE_MONO; break; } shdr.link_index = 0; if (sample->linked) { sample_hash_value = g_hash_table_lookup (writer->sample_hash, sample->linked); g_return_val_if_fail (sample_hash_value != NULL, FALSE); shdr.link_index = sample_hash_value->index; } ipatch_sf2_write_shdr (riff->handle, &shdr); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); } /* terminal record */ memset (&shdr, 0, IPATCH_SFONT_SHDR_SIZE); strcpy (shdr.name, "EOS"); ipatch_sf2_write_shdr (riff->handle, &shdr); if (!ipatch_file_buf_commit (riff->handle, err)) return (FALSE); return (TRUE); } libinstpatch-1.0.0/libinstpatch/IpatchContainer.h0000644000175000017500000001421411461332142017024 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchContainer * @short_description: Abstract object type used for items containing other * child items. * @see_also: * @stability: Stable * * Objects which are derived from this abstract type can contain other items, * thus forming a tree of items in an instrument file for example. */ #ifndef __IPATCH_CONTAINER_H__ #define __IPATCH_CONTAINER_H__ #include #include #include /* forward type declarations */ typedef struct _IpatchContainer IpatchContainer; typedef struct _IpatchContainerClass IpatchContainerClass; #include #include #include #define IPATCH_TYPE_CONTAINER (ipatch_container_get_type ()) #define IPATCH_CONTAINER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_CONTAINER, IpatchContainer)) #define IPATCH_CONTAINER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_CONTAINER, \ IpatchContainerClass)) #define IPATCH_IS_CONTAINER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_CONTAINER)) #define IPATCH_IS_CONTAINER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_CONTAINER)) #define IPATCH_CONTAINER_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_CONTAINER, \ IpatchContainerClass)) /** * IpatchContainerCallback: * @container: Container item * @item: Item that was added/removed to/from @container * @user_data: User defined pointer assigned when callback connected * * A function prototype callback which is called for container adds or removes * (after adds, before removes). */ typedef void (*IpatchContainerCallback)(IpatchContainer *container, IpatchItem *item, gpointer user_data); /** * IpatchContainerDisconnect: * @container: Container item * @child: Match child item of original connect * (ipatch_container_remove_connect() only, always NULL for * ipatch_container_add_connect()). * @user_data: User defined pointer assigned when callback connected * * A function prototype which is called when a callback gets disconnected. */ typedef void (*IpatchContainerDisconnect)(IpatchContainer *container, IpatchItem *child, gpointer user_data); /* Base patch container object */ struct _IpatchContainer { IpatchItem parent_instance; }; struct _IpatchContainerClass { IpatchItemClass parent_class; /*< public >*/ /* methods */ const GType * (*child_types)(void); const GType * (*virtual_types)(void); gboolean (*init_iter)(IpatchContainer *container, IpatchIter *iter, GType type); void (*make_unique)(IpatchContainer *container, IpatchItem *item); gboolean (*get_dups)(IpatchContainer *container, IpatchItem *item, IpatchList **list); }; /* container uses no item flags */ #define IPATCH_CONTAINER_UNUSED_FLAG_SHIFT IPATCH_ITEM_UNUSED_FLAG_SHIFT #define IPATCH_CONTAINER_ERRMSG_INVALID_CHILD_2 \ "Invalid child type '%s' for parent type '%s'" GType ipatch_container_get_type (void); IpatchList *ipatch_container_get_children (IpatchContainer *container, GType type); const GType *ipatch_container_get_child_types (IpatchContainer *container); const GType *ipatch_container_get_virtual_types (IpatchContainer *container); const GType *ipatch_container_type_get_child_types (GType container_type); void ipatch_container_insert (IpatchContainer *container, IpatchItem *item, int pos); void ipatch_container_append (IpatchContainer *container, IpatchItem *item); // An alias for ipatch_container_append #define ipatch_container_add ipatch_container_append void ipatch_container_prepend (IpatchContainer *container, IpatchItem *item); void ipatch_container_remove (IpatchContainer *container, IpatchItem *item); void ipatch_container_remove_all (IpatchContainer *container); guint ipatch_container_count (IpatchContainer *container, GType type); void ipatch_container_make_unique (IpatchContainer *container, IpatchItem *item); void ipatch_container_add_unique (IpatchContainer *container, IpatchItem *item); gboolean ipatch_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type); void ipatch_container_insert_iter (IpatchContainer *container, IpatchItem *item, IpatchIter *iter); void ipatch_container_remove_iter (IpatchContainer *container, IpatchIter *iter); /* defined in IpatchContainer_notify.c */ void ipatch_container_add_notify (IpatchContainer *container, IpatchItem *child); void ipatch_container_remove_notify (IpatchContainer *container, IpatchItem *child); guint ipatch_container_add_connect (IpatchContainer *container, IpatchContainerCallback callback, IpatchContainerDisconnect disconnect, gpointer user_data); guint ipatch_container_remove_connect (IpatchContainer *container, IpatchItem *child, IpatchContainerCallback callback, IpatchContainerDisconnect disconnect, gpointer user_data); void ipatch_container_add_disconnect (guint handler_id); void ipatch_container_add_disconnect_matched (IpatchContainer *container, IpatchContainerCallback callback, gpointer user_data); void ipatch_container_remove_disconnect (guint handler_id); void ipatch_container_remove_disconnect_matched (IpatchContainer *container, IpatchItem *child, IpatchContainerCallback callback, gpointer user_data); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2VoiceCache_VBank.h0000644000175000017500000000350011461332142020463 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2VoiceCache_VBank * @short_description: Voice cache converters for VBank types * @see_also: * @stability: Stable */ #ifndef __IPATCH_SF2_VOICE_CACHE_VBANK_H__ #define __IPATCH_SF2_VOICE_CACHE_VBANK_H__ #include #include #include typedef IpatchConverter IpatchConverterVBankInstToSF2VoiceCache; typedef IpatchConverterClass IpatchConverterVBankInstToSF2VoiceCacheClass; typedef IpatchConverter IpatchConverterVBankRegionToSF2VoiceCache; typedef IpatchConverterClass IpatchConverterVBankRegionToSF2VoiceCacheClass; #define IPATCH_TYPE_CONVERTER_VBANK_INST_TO_SF2_VOICE_CACHE \ (ipatch_converter_vbank_inst_to_sf2_voice_cache_get_type ()) #define IPATCH_TYPE_CONVERTER_VBANK_REGION_TO_SF2_VOICE_CACHE \ (ipatch_converter_vbank_region_to_sf2_voice_cache_get_type ()) GType ipatch_converter_vbank_inst_to_sf2_voice_cache_get_type (void); GType ipatch_converter_vbank_region_to_sf2_voice_cache_get_type (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchXmlObject.h0000644000175000017500000001447011461332142016775 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. * */ /** * SECTION: IpatchXmlObject * @short_description: GObject related XML tree functions * @see_also: IpatchXml * @stability: Stable * * Functions for saving/loading GObject, GValue and GObject properties * to/from XML trees. Includes a system for registering custom encoding and * decoding handlers for objects, properties and value types. */ #ifndef __IPATCH_XML_OBJECT_H__ #define __IPATCH_XML_OBJECT_H__ #include #include /** * IpatchXmlEncodeFunc: * @node: XML node to encode XML to * @object: Object being encoded (object and property encoders) * @pspec: Spec of property being encoded (property encoders only) * @value: Value to encode (property and GValue encoders only) * @err: Location to store error value (or %NULL if ignoring) * * Function type for encoding objects, properties or GValue types to XML trees. * Forms the basis of serializing GObject and GValues to XML. The caller * handles creating an XML node element to contain the given object, property or * value XML encoding. * * Returns: Should return %TRUE on success and %FALSE on error (in which * case @err should be set). */ typedef gboolean (*IpatchXmlEncodeFunc)(GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); /** * IpatchXmlDecodeFunc: * @node: XML node to be decoded * @object: Object being decoded to (object and property decoders, %NULL otherwise) * @pspec: Spec of property being decoded (property decoders only, %NULL otherwise) * @value: Value to decode to (property and GValue decoders only, %NULL otherwise) * @err: Location to store error value (or %NULL if ignoring) * * Function type for decoding objects, properties or GValue types from XML trees to * their original instance values in memory. For object decoders, only @object * will be set and the decoded XML content should be assigned to the object; * for property decoders @object, @pspec and @value will be set, @value is * initialized to the property value type and the decoded value should be * assigned to it; for GValue decoders, only the @value will be initialized * which the decoded value should be assigned to. * * Returns: Should return TRUE on success, FALSE otherwise (in which case @err * should be set) */ typedef gboolean (*IpatchXmlDecodeFunc)(GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); void ipatch_xml_register_handler (GType type, const char *prop_name, IpatchXmlEncodeFunc encode_func, IpatchXmlDecodeFunc decode_func); gboolean ipatch_xml_lookup_handler (GType type, GParamSpec *pspec, IpatchXmlEncodeFunc *encode_func, IpatchXmlDecodeFunc *decode_func); gboolean ipatch_xml_lookup_handler_by_prop_name (GType type, const char *prop_name, IpatchXmlEncodeFunc *encode_func, IpatchXmlDecodeFunc *decode_func); gboolean ipatch_xml_encode_object (GNode *node, GObject *object, gboolean create_element, GError **err); gboolean ipatch_xml_encode_property (GNode *node, GObject *object, GParamSpec *pspec, gboolean create_element, GError **err); gboolean ipatch_xml_encode_property_by_name (GNode *node, GObject *object, const char *propname, gboolean create_element, GError **err); gboolean ipatch_xml_encode_value (GNode *node, GValue *value, GError **err); gboolean ipatch_xml_decode_object (GNode *node, GObject *object, GError **err); gboolean ipatch_xml_decode_property (GNode *node, GObject *object, GParamSpec *pspec, GError **err); gboolean ipatch_xml_decode_property_by_name (GNode *node, GObject *object, const char *propname, GError **err); gboolean ipatch_xml_decode_value (GNode *node, GValue *value, GError **err); gboolean ipatch_xml_default_encode_object_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); gboolean ipatch_xml_default_encode_property_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); gboolean ipatch_xml_default_encode_value_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); gboolean ipatch_xml_default_decode_object_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); gboolean ipatch_xml_default_decode_property_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); gboolean ipatch_xml_default_decode_value_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); #endif libinstpatch-1.0.0/libinstpatch/IpatchDLSFile.h0000644000175000017500000001450711461332142016331 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchDLSFile * @short_description: DLS file object and functions * @see_also: * @stability: Stable * * Object type for DLS files and other constants and functions dealing with * them. */ #ifndef __IPATCH_DLS_FILE_H__ #define __IPATCH_DLS_FILE_H__ #include #include #include #include typedef struct _IpatchDLSFile IpatchDLSFile; typedef struct _IpatchDLSFileClass IpatchDLSFileClass; #define IPATCH_TYPE_DLS_FILE (ipatch_dls_file_get_type ()) #define IPATCH_DLS_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_DLS_FILE, IpatchDLSFile)) #define IPATCH_DLS_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_DLS_FILE, \ IpatchDLSFileClass)) #define IPATCH_IS_DLS_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_DLS_FILE)) #define IPATCH_IS_DLS_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_DLS_FILE)) #define IPATCH_DLS_FILE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_DLS_FILE, \ IpatchDLSFileClass)) /* DLS file object (derived from IpatchFile) */ struct _IpatchDLSFile { IpatchFile parent_instance; }; /* DLS file class (derived from IpatchFile) */ struct _IpatchDLSFileClass { IpatchFileClass parent_class; }; /* RIFF chunk FOURCC guint32 integers */ #define IPATCH_DLS_FOURCC_DLS IPATCH_FOURCC ('D','L','S',' ') #define IPATCH_DLS_FOURCC_COLH IPATCH_FOURCC ('c','o','l','h') #define IPATCH_DLS_FOURCC_WVPL IPATCH_FOURCC ('w','v','p','l') #define IPATCH_DLS_FOURCC_DWPL IPATCH_FOURCC ('d','w','p','l') #define IPATCH_DLS_FOURCC_PTBL IPATCH_FOURCC ('p','t','b','l') #define IPATCH_DLS_FOURCC_PATH IPATCH_FOURCC ('p','a','t','h') #define IPATCH_DLS_FOURCC_WAVE IPATCH_FOURCC ('w','a','v','e') #define IPATCH_DLS_FOURCC_LINS IPATCH_FOURCC ('l','i','n','s') #define IPATCH_DLS_FOURCC_INS IPATCH_FOURCC ('i','n','s',' ') #define IPATCH_DLS_FOURCC_INSH IPATCH_FOURCC ('i','n','s','h') #define IPATCH_DLS_FOURCC_LRGN IPATCH_FOURCC ('l','r','g','n') #define IPATCH_DLS_FOURCC_RGN IPATCH_FOURCC ('r','g','n',' ') #define IPATCH_DLS_FOURCC_RGNH IPATCH_FOURCC ('r','g','n','h') #define IPATCH_DLS_FOURCC_LART IPATCH_FOURCC ('l','a','r','t') #define IPATCH_DLS_FOURCC_ART1 IPATCH_FOURCC ('a','r','t','1') #define IPATCH_DLS_FOURCC_WLNK IPATCH_FOURCC ('w','l','n','k') #define IPATCH_DLS_FOURCC_WSMP IPATCH_FOURCC ('w','s','m','p') #define IPATCH_DLS_FOURCC_VERS IPATCH_FOURCC ('v','e','r','s') #define IPATCH_DLS_FOURCC_RGN2 IPATCH_FOURCC ('r','g','n','2') #define IPATCH_DLS_FOURCC_LAR2 IPATCH_FOURCC ('l','a','r','2') #define IPATCH_DLS_FOURCC_ART2 IPATCH_FOURCC ('a','r','t','2') #define IPATCH_DLS_FOURCC_CDL IPATCH_FOURCC ('c','d','l',' ') #define IPATCH_DLS_FOURCC_DLID IPATCH_FOURCC ('d','l','i','d') #define IPATCH_DLS_FOURCC_INFO IPATCH_FOURCC ('I','N','F','O') #define IPATCH_DLS_FOURCC_FMT IPATCH_FOURCC ('f','m','t',' ') #define IPATCH_DLS_FOURCC_DATA IPATCH_FOURCC ('d','a','t','a') /* INFO FOURCC ids (user friendly defines in IpatchDLS2Info.h) */ #define IPATCH_DLS_FOURCC_IARL IPATCH_FOURCC ('I','A','R','L') #define IPATCH_DLS_FOURCC_IART IPATCH_FOURCC ('I','A','R','T') #define IPATCH_DLS_FOURCC_ICMS IPATCH_FOURCC ('I','C','M','S') #define IPATCH_DLS_FOURCC_ICMT IPATCH_FOURCC ('I','C','M','T') #define IPATCH_DLS_FOURCC_ICOP IPATCH_FOURCC ('I','C','O','P') #define IPATCH_DLS_FOURCC_ICRD IPATCH_FOURCC ('I','C','R','D') #define IPATCH_DLS_FOURCC_IENG IPATCH_FOURCC ('I','E','N','G') #define IPATCH_DLS_FOURCC_IGNR IPATCH_FOURCC ('I','G','N','R') #define IPATCH_DLS_FOURCC_IKEY IPATCH_FOURCC ('I','K','E','Y') #define IPATCH_DLS_FOURCC_IMED IPATCH_FOURCC ('I','M','E','D') #define IPATCH_DLS_FOURCC_INAM IPATCH_FOURCC ('I','N','A','M') #define IPATCH_DLS_FOURCC_IPRD IPATCH_FOURCC ('I','P','R','D') #define IPATCH_DLS_FOURCC_ISBJ IPATCH_FOURCC ('I','S','B','J') #define IPATCH_DLS_FOURCC_ISFT IPATCH_FOURCC ('I','S','F','T') #define IPATCH_DLS_FOURCC_ISRC IPATCH_FOURCC ('I','S','R','C') #define IPATCH_DLS_FOURCC_ISRF IPATCH_FOURCC ('I','S','R','F') #define IPATCH_DLS_FOURCC_ITCH IPATCH_FOURCC ('I','T','C','H') /* file chunk sizes */ #define IPATCH_DLS_VERS_SIZE 8 /* version chunk size */ #define IPATCH_DLS_INSH_SIZE 12 /* instrument header chunk size */ #define IPATCH_DLS_RGNH_SIZE 12 /* region header size */ #define IPATCH_DLS_RGNH_LAYER_SIZE 14 /* with optional Layer field */ #define IPATCH_DLS_WLNK_SIZE 12 /* wave link chunk size */ #define IPATCH_DLS_WSMP_HEADER_SIZE 20 /* sample info chunk without loops */ #define IPATCH_DLS_WSMP_LOOP_SIZE 16 /* sample loop size */ #define IPATCH_DLS_ART_HEADER_SIZE 8 /* articulator header size */ #define IPATCH_DLS_CONN_SIZE 12 /* connection block size */ #define IPATCH_DLS_PTBL_HEADER_SIZE 8 /* default pool table header size */ #define IPATCH_DLS_POOLCUE_SIZE 4 /* size of a pool cue offset */ #define IPATCH_DLS_WAVE_FMT_SIZE 16 /* PCM wave fmt chunk size */ #define IPATCH_DLS_DLID_SIZE 16 /* DLID unique ID chunk size */ #define IPATCH_DLS_INSH_BANK_MASK 0x3FFF #define IPATCH_DLS_INSH_BANK_PERCUSSION (1 << 31) #define IPATCH_DLS_RGNH_OPTION_SELF_NON_EXCLUSIVE 0x0001 #define IPATCH_DLS_WLNK_PHASE_MASTER 0x0001 #define IPATCH_DLS_WLNK_MULTI_CHANNEL 0x0002 #define IPATCH_DLS_WSMP_NO_TRUNCATION 0x0001 #define IPATCH_DLS_WSMP_NO_COMPRESSION 0x0002 #define IPATCH_DLS_WSMP_LOOP_FORWARD 0x0000 #define IPATCH_DLS_WSMP_LOOP_RELEASE 0x0001 GType ipatch_dls_file_get_type (void); IpatchDLSFile *ipatch_dls_file_new (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchSampleList.c0000644000175000017500000003621011461332142017152 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include "IpatchSampleList.h" #include "ipatch_priv.h" #ifdef HAVE_CONFIG_H #include "config.h" #endif static GList *list_item_free_next (IpatchSampleList *list, GList *itemp); GType ipatch_sample_list_get_type (void) { static GType type = 0; if (!type) type = g_boxed_type_register_static ("IpatchSampleList", (GBoxedCopyFunc)ipatch_sample_list_duplicate, (GBoxedFreeFunc)ipatch_sample_list_free); return (type); } /** * ipatch_sample_list_new: * * Creates a new empty (zero item terminated) sample list. * * Returns: Newly allocated empty sample list. */ IpatchSampleList * ipatch_sample_list_new (void) { return (g_slice_new0 (IpatchSampleList)); } /** * ipatch_sample_list_free: * @list: Sample list to free * * Free a sample list. */ void ipatch_sample_list_free (IpatchSampleList *list) { GList *p; g_return_if_fail (list != NULL); /* free the items in the list */ for (p = list->items; p; p = g_list_delete_link (p, p)) ipatch_sample_list_item_free ((IpatchSampleListItem *)(p->data)); g_slice_free (IpatchSampleList, list); } /** * ipatch_sample_list_duplicate: * @list: Sample list to duplicate * * Duplicate a sample list. * * Returns: Newly allocated duplicate of @list. */ IpatchSampleList * ipatch_sample_list_duplicate (IpatchSampleList *list) { IpatchSampleListItem *item; IpatchSampleList *newlist; GList *p; g_return_val_if_fail (list != NULL, NULL); newlist = ipatch_sample_list_new (); newlist->total_size = list->total_size; for (p = list->items; p; p = p->next) { item = ipatch_sample_list_item_duplicate ((IpatchSampleListItem *)(p->data)); newlist->items = g_list_prepend (newlist->items, item); } newlist->items = g_list_reverse (newlist->items); return (newlist); } /** * ipatch_sample_list_item_new: * * Create a new node for a sample list. * * Returns: Newly allocated list node which should be freed with * ipatch_sample_list_item_free() when finished using it. */ IpatchSampleListItem * ipatch_sample_list_item_new (void) { return (g_slice_new0 (IpatchSampleListItem)); } /** * ipatch_sample_list_item_new_init: * @sample: Sample containing audio for the segment * @ofs: Offset in @sample of audio segment * @size: Size of audio segment in frames * @channel: Channel to use from @sample * * Create a new sample list item and initialize it with the provided parameters. * * Returns: Newly allocated sample list item which should be freed with * ipatch_sample_list_item_free() when done with it. */ IpatchSampleListItem * ipatch_sample_list_item_new_init (IpatchSample *sample, guint ofs, guint size, guint channel) { IpatchSampleListItem *item; guint sample_size; g_return_val_if_fail (IPATCH_IS_SAMPLE (sample), NULL); g_return_val_if_fail (size > 0, NULL); sample_size = ipatch_sample_get_size (sample, NULL); g_return_val_if_fail (ofs + size <= sample_size, NULL); item = ipatch_sample_list_item_new (); item->sample = g_object_ref (sample); item->size = size; item->ofs = ofs; item->channel = channel; return (item); } /** * ipatch_sample_list_item_free: * @item: Sample list item to free * * Free a sample list item previously allocated by ipatch_sample_list_item_new(). */ void ipatch_sample_list_item_free (IpatchSampleListItem *item) { if (item->sample) g_object_unref (item->sample); g_slice_free (IpatchSampleListItem, item); } /** * ipatch_sample_list_item_duplicate: * @item: Sample list item to duplicate * * Duplicate a sample list item node. * * Returns: New duplicate sample list item. */ IpatchSampleListItem * ipatch_sample_list_item_duplicate (IpatchSampleListItem *item) { IpatchSampleListItem *newitem; newitem = ipatch_sample_list_item_new (); newitem->sample = item->sample ? g_object_ref (item->sample) : NULL; newitem->ofs = item->ofs; newitem->size = item->size; newitem->channel = item->channel; return (newitem); } /** * ipatch_sample_list_append: * @list: Sample list * @sample: Sample containing audio segment to append * @ofs: Offset in @sample of beginning of audio segment (in frames) * @size: Number of frames of audio segment to append * @channel: Channel to use from @sample * * Append an audio segment to a sample list. */ void ipatch_sample_list_append (IpatchSampleList *list, IpatchSample *sample, guint ofs, guint size, guint channel) { IpatchSampleListItem *item; g_return_if_fail (list != NULL); item = ipatch_sample_list_item_new_init (sample, ofs, size, channel); g_return_if_fail (item != NULL); list->items = g_list_append (list->items, item); list->total_size += size; } /** * ipatch_sample_list_prepend: * @list: Sample list * @sample: Sample containing audio segment to prepend * @ofs: Offset in @sample of beginning of audio segment (in frames) * @size: Number of frames of audio segment to prepend * @channel: Channel to use from @sample * * Prepend an audio segment to a sample list. */ void ipatch_sample_list_prepend (IpatchSampleList *list, IpatchSample *sample, guint ofs, guint size, guint channel) { IpatchSampleListItem *item; g_return_if_fail (list != NULL); item = ipatch_sample_list_item_new_init (sample, ofs, size, channel); g_return_if_fail (item != NULL); list->items = g_list_prepend (list->items, item); list->total_size += size; } /** * ipatch_sample_list_insert_index: * @list: Sample list * @index: List index to insert segment before (0 = prepend, -1 = append) * @sample: Sample containing audio segment to insert * @ofs: Offset in @sample of beginning of audio segment (in frames) * @size: Number of frames of audio segment to insert * @channel: Channel to use from @sample * * Insert an audio segment into a sample list before a given list segment * @index. */ void ipatch_sample_list_insert_index (IpatchSampleList *list, guint index, IpatchSample *sample, guint ofs, guint size, guint channel) { IpatchSampleListItem *item; g_return_if_fail (list != NULL); item = ipatch_sample_list_item_new_init (sample, ofs, size, channel); g_return_if_fail (item != NULL); list->items = g_list_insert (list->items, item, index); list->total_size += size; } /** * ipatch_sample_list_insert: * @list: Sample list * @pos: Position in audio data in frames to insert segment at * @sample: Sample containing audio segment to insert * @ofs: Offset in @sample of beginning of audio segment (in frames) * @size: Number of frames of audio segment to insert * @channel: Channel to use from @sample * * Insert an audio segment into a sample list at a given sample position * in frames (@pos). Existing segments will be split as needed to accomodate * the inserted segment. */ void ipatch_sample_list_insert (IpatchSampleList *list, guint pos, IpatchSample *sample, guint ofs, guint size, guint channel) { IpatchSampleListItem *item, *newitem, *splititem; guint startofs, sz; GList *p; g_return_if_fail (list != NULL); g_return_if_fail (pos <= list->total_size); newitem = ipatch_sample_list_item_new_init (sample, ofs, size, channel); g_return_if_fail (newitem != NULL); /* search for segment containing pos */ for (p = list->items, startofs = 0; p; p = p->next) { item = (IpatchSampleListItem *)(p->data); if (pos >= startofs && pos < (startofs + item->size)) break; startofs += item->size; } /* if list was exhausted, it means pos is past the end - append */ if (!p) list->items = g_list_append (list->items, newitem); else if (pos != startofs) /* need to split segment? */ { sz = pos - startofs; /* new size of first split segment */ /* create 2nd split segment */ splititem = ipatch_sample_list_item_new_init (item->sample, item->ofs + sz, item->size - sz, item->channel); item->size = sz; /* insert new item after 1st split segment (assign to suppress GCC warning) */ p = g_list_insert (p, newitem, 1); /* insert 2nd split segment */ p = g_list_insert (p, splititem, 2); } /* position is at the beginning of another segment, insert before */ else list->items = g_list_insert_before (list->items, p, newitem); list->total_size += size; } /** * ipatch_sample_list_cut: * @list: Sample list * @pos: Start position of sample data to cut, in frames * @size: Size of area to cut, in frames * * Cut a segment of audio from a sample list. */ void ipatch_sample_list_cut (IpatchSampleList *list, guint pos, guint size) { IpatchSampleListItem *item = NULL, *newitem; guint startofs, fsegsize; GList *p; g_return_if_fail (list != NULL); g_return_if_fail (pos + size <= list->total_size); list->total_size -= size; /* search for segment containing pos */ for (p = list->items, startofs = 0; p; p = p->next) { item = (IpatchSampleListItem *)(p->data); if (pos >= startofs && pos < (startofs + item->size)) break; startofs += item->size; } g_return_if_fail (p != NULL); /* means total_size is out of sync! */ if (pos == startofs) /* position is at start of segment? */ { if (size < item->size) /* size is less than segment size? */ { /* increase segment offset and decrease size, we are done */ item->ofs += size; item->size -= size; return; } /* adjust size for remaining after segment removed */ size -= item->size; /* !! must be before item delete! */ /* size is greater or equal to segment - remove segment and advance p */ p = list_item_free_next (list, p); if (size == 0) return; /* only this segment cut? - done */ } else if (size < item->size - (pos - startofs)) /* cut within segment? */ { fsegsize = pos - startofs; /* size of first segment before cut */ /* create new segment for audio after cut */ newitem = ipatch_sample_list_item_new_init (item->sample, item->ofs + fsegsize + size, item->size - fsegsize - size, item->channel); item->size = fsegsize; /* insert 2nd seg after the 1st segment (assign to suppress GCC warning) */ p = g_list_insert (p, newitem, 1); return; /* done */ } else /* beginning of cut is within segment and continues into more segments */ { fsegsize = pos - startofs; /* new size of truncated segment */ size -= (item->size - fsegsize); /* update size to remaining after seg */ item->size = fsegsize; /* assign new size to segment */ p = p->next; /* next segment */ startofs += fsegsize; /* startofs of next segment */ } /* search for last segment which is cut, and remove all segments in between */ while (p) { item = (IpatchSampleListItem *)(p->data); if (size < item->size) break; /* remaining size is within segment? */ /* remaining cut size includes entire segment - remove it */ size -= item->size; /* !! must be before item delete! */ p = list_item_free_next (list, p); } if (p && size > 0) /* cut goes into this segment? */ { item->ofs += size; /* advance offset to after cut */ item->size -= size; /* decrease segment size by remaining cut size */ } } /* remove the sample item at the given list pointer and return the next item in the list */ static GList * list_item_free_next (IpatchSampleList *list, GList *itemp) { GList *retp; retp = itemp->next; ipatch_sample_list_item_free ((IpatchSampleListItem *)(itemp->data)); list->items = g_list_delete_link (list->items, itemp); return (retp); } /** * ipatch_sample_list_render: * @list: Sample list * @buf: Buffer to store the rendered audio to (should be @size * bytes_per_frame) * @pos: Position in sample list audio to start from, in frames * @size: Size of sample data to render in frames * @format: Sample format to render to (must be mono) * @err: Location to store error to or %NULL to ignore * * Copies sample data from a sample list, converting as necessary and storing * to @buf. */ gboolean ipatch_sample_list_render (IpatchSampleList *list, gpointer buf, guint pos, guint size, int format, GError **err) { IpatchSampleListItem *item = NULL; guint startofs, block, format_size; GList *p; g_return_val_if_fail (list != NULL, FALSE); g_return_val_if_fail (ipatch_sample_format_verify (format), FALSE); g_return_val_if_fail (pos + size <= list->total_size, FALSE); g_return_val_if_fail (buf != NULL, FALSE); g_return_val_if_fail (IPATCH_SAMPLE_FORMAT_GET_CHANNEL_COUNT (format) == 1, FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* search for segment containing pos */ for (p = list->items, startofs = 0; p; p = p->next) { item = (IpatchSampleListItem *)(p->data); if (pos >= startofs && pos < (startofs + item->size)) break; startofs += item->size; } g_return_val_if_fail (p != NULL, FALSE); /* means total_size is out of sync! */ block = item->size - (pos - startofs); /* remaining size of segment */ format_size = ipatch_sample_format_size (format); while (size > 0 && p) { if (block > size) block = size; /* Read sample data and transform (if necessary) */ if (!ipatch_sample_read_transform (item->sample, item->ofs + (pos - startofs), block, buf, format, IPATCH_SAMPLE_MAP_CHANNEL (0, item->channel), err)) return (FALSE); buf += block * format_size; size -= block; p = p->next; if (p) { item = (IpatchSampleListItem *)(p->data); block = item->size; startofs += item->size; pos = startofs; } } g_return_val_if_fail (size == 0, FALSE); /* means total_size is out of sync! */ return (TRUE); } #ifdef IPATCH_DEBUG /* For debugging purposes, dumps sample list info to stdout. */ void ipatch_sample_list_dump (IpatchSampleList *list) { IpatchSampleListItem *item; guint startofs = 0; int sample_format; guint sample_size; GList *p; int i = 0; printf ("Dump of sample list with %d segments totaling %d frames\n", g_list_length (list->items), list->total_size); for (p = list->items; p; p = p->next, i++) { item = (IpatchSampleListItem *)(p->data); if (item->sample) { sample_format = ipatch_sample_get_format (item->sample); sample_size = ipatch_sample_get_size (item->sample, NULL); } else { sample_format = 0; sample_size = 0; } printf ("%02d-%06x size=%d ofs=%d chan=%d sample=(%p format %03x size=%d)\n", i, startofs, item->size, item->ofs, item->channel, item->sample, sample_format, sample_size); startofs += item->size; } } #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2Preset.c0000644000175000017500000005111111461332142016647 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSF2Preset.h" #include "IpatchSF2PZone.h" #include "IpatchSF2File.h" #include "IpatchSF2GenItem.h" #include "IpatchSF2ModItem.h" #include "IpatchParamProp.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" /* properties */ enum { /* generator IDs are used for lower numbers */ PROP_TITLE = IPATCH_SF2_GEN_ITEM_FIRST_PROP_USER_ID, PROP_NAME, PROP_BANK, PROP_PROGRAM, PROP_PERCUSSION, PROP_MODULATORS, PROP_LIBRARY, PROP_GENRE, PROP_MORPHOLOGY }; static void ipatch_sf2_preset_class_init (IpatchSF2PresetClass *klass); static void ipatch_sf2_preset_gen_item_iface_init (IpatchSF2GenItemIface *genitem_iface); static void ipatch_sf2_preset_mod_item_iface_init (IpatchSF2ModItemIface *moditem_iface); static void ipatch_sf2_preset_init (IpatchSF2Preset *preset); static void ipatch_sf2_preset_finalize (GObject *gobject); static void ipatch_sf2_preset_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sf2_preset_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sf2_preset_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static const GType *ipatch_sf2_preset_container_child_types (void); static gboolean ipatch_sf2_preset_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type); static void ipatch_sf2_preset_real_set_name (IpatchSF2Preset *preset, const char *name, gboolean name_notify); static gpointer parent_class = NULL; static GType preset_child_types[2] = { 0 }; static GParamSpec *name_pspec, *bank_pspec, *program_pspec, *percuss_pspec; /* For passing data from class init to gen item interface init */ static GParamSpec **gen_item_specs = NULL; static GParamSpec **gen_item_setspecs = NULL; /* For passing between class init and mod item interface init */ static GParamSpec *modulators_spec = NULL; GType ipatch_sf2_preset_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchSF2PresetClass), NULL, NULL, (GClassInitFunc)ipatch_sf2_preset_class_init, NULL, NULL, sizeof (IpatchSF2Preset), 0, (GInstanceInitFunc)ipatch_sf2_preset_init, }; static const GInterfaceInfo genitem_iface = { (GInterfaceInitFunc) ipatch_sf2_preset_gen_item_iface_init, NULL, NULL }; static const GInterfaceInfo moditem_iface = { (GInterfaceInitFunc) ipatch_sf2_preset_mod_item_iface_init, NULL, NULL }; item_type = g_type_register_static (IPATCH_TYPE_CONTAINER, "IpatchSF2Preset", &item_info, 0); g_type_add_interface_static (item_type, IPATCH_TYPE_SF2_GEN_ITEM, &genitem_iface); g_type_add_interface_static (item_type, IPATCH_TYPE_SF2_MOD_ITEM, &moditem_iface); } return (item_type); } static void ipatch_sf2_preset_class_init (IpatchSF2PresetClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS (klass); parent_class = g_type_class_ref (IPATCH_TYPE_CONTAINER); obj_class->finalize = ipatch_sf2_preset_finalize; obj_class->get_property = ipatch_sf2_preset_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_sf2_preset_set_property; item_class->copy = ipatch_sf2_preset_item_copy; container_class->child_types = ipatch_sf2_preset_container_child_types; container_class->init_iter = ipatch_sf2_preset_container_init_iter; g_object_class_override_property (obj_class, PROP_TITLE, "title"); name_pspec = ipatch_param_set (g_param_spec_string ("name", _("Name"), _("Name"), NULL, G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE), "string-max-length", IPATCH_SFONT_NAME_SIZE, /* max len */ NULL); g_object_class_install_property (obj_class, PROP_NAME, name_pspec); /* bank/program are grouped unique (siblings with same bank/program are considered conflicting) */ bank_pspec = g_param_spec_int ("bank", _("Bank"), _("MIDI bank number"), 0, 128, 0, G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE); ipatch_param_set (bank_pspec, "unique-group-id", 1, NULL); g_object_class_install_property (obj_class, PROP_BANK, bank_pspec); program_pspec = g_param_spec_int ("program", _("Program"), _("MIDI program number"), 0, 127, 0, G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE); ipatch_param_set (program_pspec, "unique-group-id", 1, NULL); g_object_class_install_property (obj_class, PROP_PROGRAM, program_pspec); percuss_pspec = g_param_spec_boolean ("percussion", _("Percussion"), _("Percussion preset?"), FALSE, G_PARAM_READWRITE); g_object_class_install_property (obj_class, PROP_PERCUSSION, percuss_pspec); g_object_class_override_property (obj_class, PROP_MODULATORS, "modulators"); modulators_spec = g_object_class_find_property (obj_class, "modulators"); g_object_class_install_property (obj_class, PROP_LIBRARY, g_param_spec_uint ("library", _("Library"), _("Library category"), 0, 0xFFFFFFFF, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_GENRE, g_param_spec_uint ("genre", _("Genre"), _("Genre category"), 0, 0xFFFFFFFF, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_MORPHOLOGY, g_param_spec_uint ("morphology", _("Morphology"), _("Morphology category"), 0, 0xFFFFFFFF, 0, G_PARAM_READWRITE)); preset_child_types[0] = IPATCH_TYPE_SF2_PZONE; /* install generator properties */ ipatch_sf2_gen_item_iface_install_properties (obj_class, IPATCH_SF2_GEN_PROPS_PRESET_GLOBAL, &gen_item_specs, &gen_item_setspecs); } /* gen item interface initialization */ static void ipatch_sf2_preset_gen_item_iface_init (IpatchSF2GenItemIface *genitem_iface) { genitem_iface->genarray_ofs = G_STRUCT_OFFSET (IpatchSF2Preset, genarray); genitem_iface->propstype = IPATCH_SF2_GEN_PROPS_PRESET_GLOBAL; g_return_if_fail (gen_item_specs != NULL); g_return_if_fail (gen_item_setspecs != NULL); memcpy (&genitem_iface->specs, gen_item_specs, sizeof (genitem_iface->specs)); memcpy (&genitem_iface->setspecs, gen_item_setspecs, sizeof (genitem_iface->setspecs)); g_free (gen_item_specs); g_free (gen_item_setspecs); } /* mod item interface initialization */ static void ipatch_sf2_preset_mod_item_iface_init (IpatchSF2ModItemIface *moditem_iface) { moditem_iface->modlist_ofs = G_STRUCT_OFFSET (IpatchSF2Preset, mods); /* cache the modulators property for fast notifications */ moditem_iface->mod_pspec = modulators_spec; } static void ipatch_sf2_preset_init (IpatchSF2Preset *preset) { ipatch_sf2_gen_array_init (&preset->genarray, TRUE, FALSE); } static void ipatch_sf2_preset_finalize (GObject *gobject) { IpatchSF2Preset *preset = IPATCH_SF2_PRESET (gobject); /* nothing should reference the preset after this, but we set pointers to NULL to help catch invalid references. Locking of preset is required since in reality all its children do still hold references */ IPATCH_ITEM_WLOCK (preset); g_free (preset->name); preset->name = NULL; ipatch_sf2_mod_list_free (preset->mods, TRUE); preset->mods = NULL; IPATCH_ITEM_WUNLOCK (preset); if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (gobject); } static void ipatch_sf2_preset_get_title (IpatchSF2Preset *preset, GValue *value) { int bank, program; char *name, *s; g_object_get (preset, "bank", &bank, "program", &program, "name", &name, NULL); s = g_strdup_printf ("%03d-%03d %s", bank, program, name); g_free (name); g_value_take_string (value, s); } static void ipatch_sf2_preset_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSF2Preset *preset = IPATCH_SF2_PRESET (object); IpatchSF2ModList *list; GValue oldvalue = { 0 }, newvalue = { 0 }; int newbank, oldbank; gboolean newpercuss, oldpercuss; /* generator property? */ if (ipatch_sf2_gen_item_iface_set_property ((IpatchSF2GenItem *)preset, property_id, value)) return; switch (property_id) { case PROP_NAME: ipatch_sf2_preset_real_set_name (preset, g_value_get_string (value), FALSE); break; case PROP_BANK: newbank = g_value_get_int (value); IPATCH_ITEM_WLOCK (preset); oldbank = preset->bank; preset->bank = newbank; IPATCH_ITEM_WUNLOCK (preset); /* do "percussion" property notify if necessary */ if ((newbank == 128) != (oldbank == 128)) { g_value_init (&newvalue, G_TYPE_BOOLEAN); g_value_init (&oldvalue, G_TYPE_BOOLEAN); g_value_set_boolean (&newvalue, newbank == 128); g_value_set_boolean (&oldvalue, oldbank == 128); ipatch_item_prop_notify ((IpatchItem *)preset, percuss_pspec, &newvalue, &oldvalue); g_value_unset (&newvalue); g_value_unset (&oldvalue); } break; case PROP_PROGRAM: IPATCH_ITEM_WLOCK (preset); preset->program = g_value_get_int (value); IPATCH_ITEM_WUNLOCK (preset); break; case PROP_PERCUSSION: newpercuss = g_value_get_boolean (value); IPATCH_ITEM_WLOCK (preset); oldbank = preset->bank; oldpercuss = (preset->bank == 128); if (newpercuss != oldpercuss) preset->bank = newpercuss ? 128 : 0; IPATCH_ITEM_WUNLOCK (preset); /* do "bank" property notify if necessary */ if (newpercuss != oldpercuss) { g_value_init (&newvalue, G_TYPE_INT); g_value_init (&oldvalue, G_TYPE_INT); g_value_set_int (&newvalue, newpercuss ? 128 : 0); g_value_set_int (&oldvalue, oldbank); ipatch_item_prop_notify ((IpatchItem *)preset, bank_pspec, &newvalue, &oldvalue); g_value_unset (&newvalue); g_value_unset (&oldvalue); } break; case PROP_MODULATORS: list = (IpatchSF2ModList *)g_value_get_boxed (value); ipatch_sf2_mod_item_set_mods (IPATCH_SF2_MOD_ITEM (preset), list, IPATCH_SF2_MOD_NO_NOTIFY); break; case PROP_LIBRARY: IPATCH_ITEM_WLOCK (preset); preset->library = g_value_get_uint (value); IPATCH_ITEM_WUNLOCK (preset); break; case PROP_GENRE: IPATCH_ITEM_WLOCK (preset); preset->genre = g_value_get_uint (value); IPATCH_ITEM_WUNLOCK (preset); break; case PROP_MORPHOLOGY: IPATCH_ITEM_WLOCK (preset); preset->morphology = g_value_get_uint (value); IPATCH_ITEM_WUNLOCK (preset); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } /* need to do title notify? */ if (property_id == PROP_NAME || property_id == PROP_BANK || property_id == PROP_PROGRAM || property_id == PROP_PERCUSSION) { GValue titleval = { 0 }; g_value_init (&titleval, G_TYPE_STRING); ipatch_sf2_preset_get_title (preset, &titleval); ipatch_item_prop_notify ((IpatchItem *)preset, ipatch_item_pspec_title, &titleval, NULL); g_value_unset (&titleval); } } static void ipatch_sf2_preset_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSF2Preset *preset = IPATCH_SF2_PRESET (object); IpatchSF2ModList *list; /* generator property? */ if (ipatch_sf2_gen_item_iface_get_property ((IpatchSF2GenItem *)preset, property_id, value)) return; switch (property_id) { case PROP_TITLE: ipatch_sf2_preset_get_title (preset, value); break; case PROP_NAME: g_value_take_string (value, ipatch_sf2_preset_get_name (preset)); break; case PROP_BANK: g_value_set_int (value, preset->bank); break; case PROP_PROGRAM: g_value_set_int (value, preset->program); break; case PROP_PERCUSSION: g_value_set_boolean (value, (preset->bank == 128) ? TRUE : FALSE); break; case PROP_MODULATORS: list = ipatch_sf2_mod_item_get_mods (IPATCH_SF2_MOD_ITEM (preset)); g_value_take_boxed (value, list); break; case PROP_LIBRARY: g_value_set_uint (value, preset->library); break; case PROP_GENRE: g_value_set_uint (value, preset->genre); break; case PROP_MORPHOLOGY: g_value_set_uint (value, preset->morphology); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_sf2_preset_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchSF2Preset *src_pset, *dest_pset; IpatchItem *zitem; GSList *p; src_pset = IPATCH_SF2_PRESET (src); dest_pset = IPATCH_SF2_PRESET (dest); IPATCH_ITEM_RLOCK (src_pset); dest_pset->name = g_strdup (src_pset->name); dest_pset->program = src_pset->program; dest_pset->bank = src_pset->bank; dest_pset->library = src_pset->library; dest_pset->genre = src_pset->genre; dest_pset->morphology = src_pset->morphology; dest_pset->genarray = src_pset->genarray; dest_pset->mods = ipatch_sf2_mod_list_duplicate (src_pset->mods); p = src_pset->zones; while (p) { zitem = ipatch_item_duplicate_link_func (IPATCH_ITEM (p->data), link_func, user_data); dest_pset->zones = g_slist_prepend (dest_pset->zones, zitem); ipatch_item_set_parent (zitem, IPATCH_ITEM (dest_pset)); p = g_slist_next (p); } IPATCH_ITEM_RUNLOCK (src_pset); dest_pset->zones = g_slist_reverse (dest_pset->zones); } static const GType * ipatch_sf2_preset_container_child_types (void) { return (preset_child_types); } /* container is locked by caller */ static gboolean ipatch_sf2_preset_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type) { IpatchSF2Preset *preset = IPATCH_SF2_PRESET (container); if (!g_type_is_a (type, IPATCH_TYPE_SF2_PZONE)) { g_critical ("Invalid child type '%s' for parent of type '%s'", g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); return (FALSE); } ipatch_iter_GSList_init (iter, &preset->zones); return (TRUE); } /** * ipatch_sf2_preset_new: * * Create a new SoundFont preset object. * * Returns: New SoundFont preset with a reference count of 1. Caller * owns the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchSF2Preset * ipatch_sf2_preset_new (void) { return (IPATCH_SF2_PRESET (g_object_new (IPATCH_TYPE_SF2_PRESET, NULL))); } /** * ipatch_sf2_preset_first: * @iter: Patch item iterator containing #IpatchSF2Preset items * * Gets the first item in a preset iterator. A convenience wrapper for * ipatch_iter_first(). * * Returns: The first preset in @iter or %NULL if empty. */ IpatchSF2Preset * ipatch_sf2_preset_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_SF2_PRESET (obj)); else return (NULL); } /** * ipatch_sf2_preset_next: * @iter: Patch item iterator containing #IpatchSF2Preset items * * Gets the next item in a preset iterator. A convenience wrapper for * ipatch_iter_next(). * * Returns: The next preset in @iter or %NULL if at the end of the list. */ IpatchSF2Preset * ipatch_sf2_preset_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_SF2_PRESET (obj)); else return (NULL); } /** * ipatch_sf2_preset_new_zone: * @preset: SoundFont preset * @inst: Referenced instrument for new zone * * A convenience function for quickly creating a new preset zone, adding it * to @preset and setting the zone's referenced instrument to @inst. */ void ipatch_sf2_preset_new_zone (IpatchSF2Preset *preset, IpatchSF2Inst *inst) { IpatchSF2PZone *pzone; g_return_if_fail (IPATCH_IS_SF2_PRESET (preset)); g_return_if_fail (IPATCH_IS_SF2_INST (inst)); pzone = ipatch_sf2_pzone_new (); /* ++ ref new zone */ ipatch_sf2_zone_set_link_item (IPATCH_SF2_ZONE (pzone), IPATCH_ITEM (inst)); ipatch_container_append (IPATCH_CONTAINER (preset), IPATCH_ITEM (pzone)); g_object_unref (pzone); /* -- unref preset zone */ } /** * ipatch_sf2_preset_set_name: * @preset: Preset to set name of * @name: Value to set name to * * Sets the name of a SoundFont preset. */ void ipatch_sf2_preset_set_name (IpatchSF2Preset *preset, const char *name) { g_return_if_fail (IPATCH_IS_SF2_PRESET (preset)); ipatch_sf2_preset_real_set_name (preset, name, TRUE); } /* the real preset name set routine */ static void ipatch_sf2_preset_real_set_name (IpatchSF2Preset *preset, const char *name, gboolean name_notify) { GValue oldname = { 0 }, newname = { 0 }; char *newstr, *oldstr; newstr = g_strdup (name); IPATCH_ITEM_WLOCK (preset); oldstr = preset->name; preset->name = newstr; IPATCH_ITEM_WUNLOCK (preset); g_value_init (&oldname, G_TYPE_STRING); g_value_take_string (&oldname, oldstr); g_value_init (&newname, G_TYPE_STRING); g_value_set_static_string (&newname, name); if (name_notify) ipatch_item_prop_notify ((IpatchItem *)preset, name_pspec, &newname, &oldname); ipatch_item_prop_notify ((IpatchItem *)preset, ipatch_item_pspec_title, &newname, &oldname); g_value_unset (&newname); g_value_unset (&oldname); } /** * ipatch_sf2_preset_get_name: * @preset: Preset to get name of * * Gets the name of a SoundFont preset. * * Returns: Name of preset or %NULL if not set. String value should be freed * when finished with it. */ char * ipatch_sf2_preset_get_name (IpatchSF2Preset *preset) { char *name = NULL; g_return_val_if_fail (IPATCH_IS_SF2_PRESET (preset), NULL); IPATCH_ITEM_RLOCK (preset); if (preset->name) name = g_strdup (preset->name); IPATCH_ITEM_RUNLOCK (preset); return (name); } /** * ipatch_sf2_preset_set_midi_locale: * @preset: Preset to set MIDI locale of * @bank: MIDI bank number to assign to preset * @program: MIDI program number to assign to preset * * Sets the MIDI locale of a preset (bank and program numbers). */ void ipatch_sf2_preset_set_midi_locale (IpatchSF2Preset *preset, int bank, int program) { g_object_set (preset, "bank", bank, "program", program, NULL); } /** * ipatch_sf2_preset_get_midi_locale: * @preset: Preset to get MIDI locale from * @bank: Location to store preset's MIDI bank number or %NULL * @program: Location to store preset's MIDI program number or %NULL * * Gets the MIDI locale of a SoundFont preset (bank and program numbers). */ void ipatch_sf2_preset_get_midi_locale (IpatchSF2Preset *preset, int *bank, int *program) { g_return_if_fail (IPATCH_IS_SF2_PRESET (preset)); IPATCH_ITEM_RLOCK (preset); if (bank) *bank = preset->bank; if (program) *program = preset->program; IPATCH_ITEM_RUNLOCK (preset); } /** * ipatch_sf2_preset_compare: * @p1: First preset in comparison * @p2: Second preset in comparison * * Preset comparison function for sorting. Compare two presets by their * MIDI bank:program numbers. Note that this function is compatible with * GCompareFunc and can therefore be used with g_list_sort, etc. * * Returns: Comparison result that is less than, equal to, or greater than zero * if @p1 is found, respectively, to be less than, to match, or be greater * than @p2. */ int ipatch_sf2_preset_compare (const IpatchSF2Preset *p1, const IpatchSF2Preset *p2) { gint32 aval, bval; aval = ((gint32)(p1->bank) << 16) | p1->program; bval = ((gint32)(p2->bank) << 16) | p2->program; return (aval - bval); } libinstpatch-1.0.0/libinstpatch/IpatchXmlObject.c0000644000175000017500000006401011461361512016766 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. * */ #include #include "IpatchXmlObject.h" #include "IpatchXml.h" #include "IpatchParamProp.h" #include "misc.h" #include "i18n.h" /* Number of decimal places of precision for floating point numbers stored to XML */ #define XML_FLOAT_PRECISION 6 /* structure used as hash key for xml_handlers */ typedef struct { GType type; GParamSpec *pspec; } HandlerHashKey; /* structure used as hash value for xml_handlers */ typedef struct { IpatchXmlEncodeFunc encode_func; IpatchXmlDecodeFunc decode_func; } HandlerHashValue; static guint xml_handlers_hash_func (gconstpointer key); static gboolean xml_handlers_key_equal_func (gconstpointer a, gconstpointer b); static void xml_handlers_key_destroy_func (gpointer data); static void xml_handlers_value_destroy_func (gpointer data); /* Lock for xml_handlers */ G_LOCK_DEFINE_STATIC (xml_handlers); /* hash of XML handlers (HandlerHashKey -> HandlerHashValue) */ static GHashTable *xml_handlers = NULL; void _ipatch_xml_object_init (void) { xml_handlers = g_hash_table_new_full (xml_handlers_hash_func, xml_handlers_key_equal_func, xml_handlers_key_destroy_func, xml_handlers_value_destroy_func); } static guint xml_handlers_hash_func (gconstpointer key) { HandlerHashKey *hkey = (HandlerHashKey *)key; return (hkey->type + GPOINTER_TO_UINT (hkey->pspec)); } static gboolean xml_handlers_key_equal_func (gconstpointer a, gconstpointer b) { HandlerHashKey *akey = (HandlerHashKey *)a, *bkey = (HandlerHashKey *)b; return (akey->type == bkey->type && akey->pspec == bkey->pspec); } static void xml_handlers_key_destroy_func (gpointer data) { g_slice_free (HandlerHashKey, data); } static void xml_handlers_value_destroy_func (gpointer data) { g_slice_free (HandlerHashValue, data); } /** * ipatch_xml_register_handler: * @type: GType to register handler functions for (GObject type if an object or * object property handler, GValue type for value handlers). * @prop_name: GObject property name (or %NULL if not a GObject property handler) * @encode_func: Function to handle encoding (object/property/value -> XML) * @decode_func: Function to handle decoding (XML -> object/property/value) * * Registers XML encoding/decoding handlers for a GObject type, GObject property or * GValue type. */ void ipatch_xml_register_handler (GType type, const char *prop_name, IpatchXmlEncodeFunc encode_func, IpatchXmlDecodeFunc decode_func) { HandlerHashKey *key; HandlerHashValue *val; GParamSpec *pspec = NULL; GObjectClass *obj_class; g_return_if_fail (type != 0); g_return_if_fail (encode_func != NULL); g_return_if_fail (decode_func != NULL); if (prop_name) { obj_class = g_type_class_peek (type); g_return_if_fail (obj_class != NULL); pspec = g_object_class_find_property (obj_class, prop_name); g_return_if_fail (pspec != NULL); } key = g_slice_new (HandlerHashKey); key->type = type; key->pspec = pspec; val = g_slice_new (HandlerHashValue); val->encode_func = encode_func; val->decode_func = decode_func; G_LOCK (xml_handlers); g_hash_table_insert (xml_handlers, key, val); G_UNLOCK (xml_handlers); } /** * ipatch_xml_lookup_handler: * @type: GObject or GValue type of handler to lookup * @pspec: GObject property spec (or %NULL if not a GObject property handler) * @encode_func: Location to store encoding function (or %NULL) * @decode_func: Location to store decoding function (or %NULL) * * Looks up handlers for a given GObject type, GObject property or GValue * type previously registered with ipatch_xml_register_handler(). * These functions are used for encoding/decoding to/from XML. * * Returns: %TRUE if handler found, %FALSE otherwise */ gboolean ipatch_xml_lookup_handler (GType type, GParamSpec *pspec, IpatchXmlEncodeFunc *encode_func, IpatchXmlDecodeFunc *decode_func) { HandlerHashValue *val; HandlerHashKey key; g_return_val_if_fail (type != 0, FALSE); key.type = type; key.pspec = pspec; G_LOCK (xml_handlers); val = g_hash_table_lookup (xml_handlers, &key); G_UNLOCK (xml_handlers); if (encode_func) *encode_func = val ? val->encode_func : NULL; if (decode_func) *decode_func = val ? val->decode_func : NULL; return (val != NULL); } /** * ipatch_xml_lookup_handler_by_prop_name: * @type: GObject or GValue type of handler to lookup * @prop_name: GObject property name (or %NULL if not a GObject property handler) * @encode_func: Location to store encoding function (or %NULL) * @decode_func: Location to store decoding function (or %NULL) * * Like ipatch_xml_lookup_handler() but takes a @prop_name string to indicate which * GObject property to lookup instead of a GParamSpec. * * Returns: %TRUE if handler found, %FALSE otherwise */ gboolean ipatch_xml_lookup_handler_by_prop_name (GType type, const char *prop_name, IpatchXmlEncodeFunc *encode_func, IpatchXmlDecodeFunc *decode_func) { GParamSpec *pspec = NULL; GObjectClass *obj_class; g_return_val_if_fail (type != 0, FALSE); if (prop_name) { obj_class = g_type_class_peek (type); g_return_val_if_fail (obj_class != NULL, FALSE); pspec = g_object_class_find_property (obj_class, prop_name); g_return_val_if_fail (pspec != NULL, FALSE); } return (ipatch_xml_lookup_handler (type, pspec, encode_func, decode_func)); } /** * ipatch_xml_encode_object: * @node: XML node to encode to * @object: Object to encode to XML * @create_element: %TRUE to create a <obj> element, %FALSE to add object * properties to current open element * @err: Location to store error info or %NULL to ignore * * Encodes an object to XML. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_xml_encode_object (GNode *node, GObject *object, gboolean create_element, GError **err) { IpatchXmlEncodeFunc encode_func; GType type; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (!err || !*err, FALSE); type = G_OBJECT_TYPE (object); /* search through type ancestry for Object handler */ do { if (ipatch_xml_lookup_handler (type, NULL, &encode_func, NULL)) break; } while ((type = g_type_parent (type))); /* not found? Use default Object encoder */ if (!type) encode_func = ipatch_xml_default_encode_object_func; if (create_element) node = ipatch_xml_new_node (node, "obj", NULL, "type", g_type_name (type), NULL); return (encode_func (node, object, NULL, NULL, err)); } /** * ipatch_xml_encode_property: * @node: XML node to encode to * @object: GObject to encode property of * @pspec: Parameter specification of property to encode * @create_element: %TRUE to create a <prop name="PROPNAME"> element, %FALSE to * assign object property value to node * @err: Location to store error info or %NULL to ignore * * Encode an object property to an XML node. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_xml_encode_property (GNode *node, GObject *object, GParamSpec *pspec, gboolean create_element, GError **err) { IpatchXmlEncodeFunc encode_func; GValue value = { 0 }; gboolean retval; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* ++ alloc value */ g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); g_object_get_property (object, g_param_spec_get_name (pspec), &value); if (create_element) node = ipatch_xml_new_node (node, "prop", NULL, "name", pspec->name, NULL); if (!ipatch_xml_lookup_handler (pspec->owner_type, pspec, &encode_func, NULL)) retval = ipatch_xml_encode_value (node, &value, err); else retval = encode_func (node, object, pspec, &value, err); g_value_unset (&value); /* -- free value */ if (!retval && create_element) ipatch_xml_destroy (node); /* Cleanup after error (if create_element) */ return (retval); } /** * ipatch_xml_encode_property_by_name: * @node: XML node to encode to * @object: GObject to encode property of * @propname: Name of object property to encode * @create_element: %TRUE to create a <prop name="PROPNAME"> element, %FALSE to * assign object property value to node * @err: Location to store error info or %NULL to ignore * * Encode an object property by name to an XML node. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_xml_encode_property_by_name (GNode *node, GObject *object, const char *propname, gboolean create_element, GError **err) { GParamSpec *pspec; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (propname != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), propname); g_return_val_if_fail (pspec != NULL, FALSE); return (ipatch_xml_encode_property (node, object, pspec, create_element, err)); } /** * ipatch_xml_encode_value: * @node: XML node to encode to * @value: Value to encode * @err: Location to store error info or %NULL to ignore * * Encodes a GValue to an XML node text value. * * Returns: TRUE on success, FALSE on error (@err may be set) */ gboolean ipatch_xml_encode_value (GNode *node, GValue *value, GError **err) { IpatchXmlEncodeFunc encode_func; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (G_IS_VALUE (value), FALSE); g_return_val_if_fail (!err || !*err, FALSE); if (!ipatch_xml_lookup_handler (G_VALUE_TYPE (value), NULL, &encode_func, NULL)) encode_func = ipatch_xml_default_encode_value_func; return (encode_func (node, NULL, NULL, value, err)); } /** * ipatch_xml_decode_object: * @node: XML node to decode from * @object: Object to decode to from XML * @err: Location to store error info or %NULL to ignore * * Decodes XML to an object. The default GObject decoder will only decode * those properties which don't have the #IPATCH_PARAM_NO_SAVE flag set. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_xml_decode_object (GNode *node, GObject *object, GError **err) { IpatchXmlDecodeFunc decode_func; GType type; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (!err || !*err, FALSE); type = G_OBJECT_TYPE (object); /* search through type ancestry for Object handler */ do { if (ipatch_xml_lookup_handler (type, NULL, NULL, &decode_func)) break; } while ((type = g_type_parent (type))); /* not found? Use default Object decoder */ if (!type) decode_func = ipatch_xml_default_decode_object_func; return (decode_func (node, object, NULL, NULL, err)); } /** * ipatch_xml_decode_property: * @node: XML node to decode from * @object: GObject to decode property of * @pspec: Parameter specification of property to decode * @err: Location to store error info or %NULL to ignore * * Decode an object property from an XML node value to an object. Note that * the property is NOT checked for the #IPATCH_PARAM_NO_SAVE flag. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_xml_decode_property (GNode *node, GObject *object, GParamSpec *pspec, GError **err) { IpatchXmlDecodeFunc decode_func; GValue value = { 0 }; gboolean retval; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* ++ alloc value */ g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); if (!ipatch_xml_lookup_handler (pspec->owner_type, pspec, NULL, &decode_func)) retval = ipatch_xml_decode_value (node, &value, err); else retval = decode_func (node, object, pspec, &value, err); if (retval) g_object_set_property (object, pspec->name, &value); g_value_unset (&value); /* -- free value */ return (retval); } /** * ipatch_xml_decode_property_by_name: * @node: XML node to decode from * @object: GObject to decode property of * @propname: Name of object property to decode * @err: Location to store error info or %NULL to ignore * * Decode an object property from an XML node value to an object by property name. * Note that the property is NOT checked for the #IPATCH_PARAM_NO_SAVE flag. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_xml_decode_property_by_name (GNode *node, GObject *object, const char *propname, GError **err) { GParamSpec *pspec; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (propname != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), propname); g_return_val_if_fail (pspec != NULL, FALSE); return (ipatch_xml_decode_property (node, object, pspec, err)); } /** * ipatch_xml_decode_value: * @node: XML node to decode from * @value: Value to decode to * @err: Location to store error info or %NULL to ignore * * Decodes a GValue from an XML node text value. * * Returns: TRUE on success, FALSE on error (@err may be set) */ gboolean ipatch_xml_decode_value (GNode *node, GValue *value, GError **err) { IpatchXmlDecodeFunc decode_func; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (G_IS_VALUE (value), FALSE); g_return_val_if_fail (!err || !*err, FALSE); if (!ipatch_xml_lookup_handler (G_VALUE_TYPE (value), NULL, NULL, &decode_func)) decode_func = ipatch_xml_default_decode_value_func; return (decode_func (node, NULL, NULL, value, err)); } /** * ipatch_xml_default_encode_object_func: * @node: XML node to encode XML to * @object: Object to encode * @pspec: Will be %NULL * @value: Will be %NULL * @err: Location to store error value (or %NULL if ignoring) * * Default GObject encode handler. Useful for custom handlers to chain to * the default if needed. * * Returns: TRUE on success, FALSE on error (@err may be set) */ gboolean ipatch_xml_default_encode_object_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err) { GParamSpec **pspecs; GError *local_err = NULL; guint n_props; guint i; pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (object), /* ++ alloc */ &n_props); for (i = 0; i < n_props; i++) { /* Skip parameters marked as no save or not read/write */ if ((pspecs[i]->flags & IPATCH_PARAM_NO_SAVE) || (pspecs[i]->flags & G_PARAM_READWRITE) != G_PARAM_READWRITE) continue; if (!ipatch_xml_encode_property (node, object, pspecs[i], TRUE, &local_err)) /* ++ alloc */ { g_warning ("Failed to store property '%s' for object of type '%s': %s", pspecs[i]->name, g_type_name (G_OBJECT_TYPE (object)), ipatch_gerror_message (local_err)); g_clear_error (&local_err); } } g_free (pspecs); /* -- free */ return (TRUE); } /** * ipatch_xml_default_encode_property_func: * @node: XML node to encode XML to * @object: Object to encode * @pspec: Parameter spec of property to encode * @value: Value of the property * @err: Location to store error value (or %NULL if ignoring) * * Default GObject property encode handler. Useful for custom handlers to chain * to the default if needed. * * Returns: TRUE on success, FALSE on error (@err may be set) */ gboolean ipatch_xml_default_encode_property_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err) { return (ipatch_xml_encode_value (node, value, err)); } /** * ipatch_xml_default_encode_value_func: * @node: XML node to encode XML to * @object: Will be %NULL * @pspec: Will be %NULL * @value: Value to encode * @err: Location to store error value (or %NULL if ignoring) * * Default GValue encode handler. Useful for custom handlers to chain to * the default if needed. * * Returns: TRUE on success, FALSE on error (@err may be set) */ gboolean ipatch_xml_default_encode_value_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err) { GType valtype; const char *s; g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (G_IS_VALUE (value), FALSE); g_return_val_if_fail (!err || !*err, FALSE); valtype = G_VALUE_TYPE (value); switch (G_TYPE_FUNDAMENTAL (valtype)) { case G_TYPE_CHAR: ipatch_xml_set_value_printf (node, "%d", g_value_get_char (value)); return (TRUE); case G_TYPE_UCHAR: ipatch_xml_set_value_printf (node, "%u", g_value_get_uchar (value)); return (TRUE); case G_TYPE_BOOLEAN: ipatch_xml_set_value_printf (node, "%u", g_value_get_boolean (value) != 0); return (TRUE); case G_TYPE_INT: ipatch_xml_set_value_printf (node, "%d", g_value_get_int (value)); return (TRUE); case G_TYPE_UINT: ipatch_xml_set_value_printf (node, "%u", g_value_get_uint (value)); return (TRUE); case G_TYPE_LONG: ipatch_xml_set_value_printf (node, "%ld", g_value_get_long (value)); return (TRUE); case G_TYPE_ULONG: ipatch_xml_set_value_printf (node, "%lu", g_value_get_ulong (value)); return (TRUE); case G_TYPE_INT64: ipatch_xml_set_value_printf (node, "%" G_GINT64_FORMAT, g_value_get_int64 (value)); return (TRUE); case G_TYPE_UINT64: ipatch_xml_set_value_printf (node, "%" G_GUINT64_FORMAT, g_value_get_uint64 (value)); return (TRUE); case G_TYPE_ENUM: ipatch_xml_set_value_printf (node, "%d", g_value_get_enum (value)); return (TRUE); case G_TYPE_FLAGS: ipatch_xml_set_value_printf (node, "%u", g_value_get_flags (value)); return (TRUE); case G_TYPE_FLOAT: ipatch_xml_set_value_printf (node, "%.*f", XML_FLOAT_PRECISION, (double)g_value_get_float (value)); return (TRUE); case G_TYPE_DOUBLE: ipatch_xml_set_value_printf (node, "%.*f", XML_FLOAT_PRECISION, g_value_get_double (value)); return (TRUE); case G_TYPE_STRING: s = g_value_get_string (value); if (s) ipatch_xml_take_value (node, g_markup_escape_text (s, -1)); else ipatch_xml_set_value (node, NULL); return (TRUE); default: if (valtype == G_TYPE_GTYPE) { ipatch_xml_set_value (node, g_type_name (g_value_get_gtype (value))); return (TRUE); } else { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNHANDLED_CONVERSION, "Unhandled GValue to XML conversion for type '%s'", g_type_name (valtype)); return (FALSE); } } return (TRUE); } /** * ipatch_xml_default_decode_object_func: * @node: XML node to decode XML from * @object: Object to decode to * @pspec: Will be %NULL * @value: Will be %NULL * @err: Location to store error value (or %NULL if ignoring) * * Default GObject decode handler. Useful for custom handlers to chain to * the default if needed. * * Returns: TRUE on success, FALSE on error (@err may be set) */ gboolean ipatch_xml_default_decode_object_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err) { IpatchXmlNode *xmlnode; GObjectClass *klass; GParamSpec *prop; const char *propname; GError *local_err = NULL; GNode *n; klass = G_OBJECT_GET_CLASS (object); /* Look for property child nodes */ for (n = node->children; n; n = n->next) { xmlnode = (IpatchXmlNode *)(n->data); if (strcmp (xmlnode->name, "prop") != 0) continue; propname = ipatch_xml_get_attribute (n, "name"); if (!propname) continue; prop = g_object_class_find_property (klass, propname); if (prop) { if (prop->flags & IPATCH_PARAM_NO_SAVE) { g_warning (_("Ignoring non storeable XML object property '%s' for object type '%s'"), prop->name, g_type_name (G_OBJECT_TYPE (object))); continue; } if (!ipatch_xml_decode_property (n, object, prop, &local_err)) { g_warning (_("Failed to decode object property: %s"), ipatch_gerror_message (local_err)); g_clear_error (&local_err); } } else g_warning (_("XML object property '%s' not valid for object type '%s'"), propname, g_type_name (G_OBJECT_TYPE (object))); } return (TRUE); } /** * ipatch_xml_default_decode_property_func: * @node: XML node to decode XML from * @object: Object whose property is being decoded * @pspec: Parameter spec of property to decode * @value: Initialized value to decode to * @err: Location to store error value (or %NULL if ignoring) * * Default GObject property decode handler. Useful for custom handlers to chain * to the default if needed. * * Returns: TRUE on success, FALSE on error (@err may be set) */ gboolean ipatch_xml_default_decode_property_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err) { return (ipatch_xml_decode_value (node, value, err)); } /** * ipatch_xml_default_decode_value_func: * @node: XML node to decode XML from * @object: Will be %NULL * @pspec: Will be %NULL * @value: Value to decode to * @err: Location to store error value (or %NULL if ignoring) * * Default GValue decode handler. Useful for custom handlers to chain to * the default if needed. * * Returns: TRUE on success, FALSE on error (@err may be set) */ gboolean ipatch_xml_default_decode_value_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err) { GType valtype; guint64 u64; gint64 i64; gulong lu; glong li; guint u; int i; float f; double d; const char *xml; char *endptr; valtype = G_VALUE_TYPE (value); xml = ipatch_xml_get_value (node); if (!xml) xml = ""; switch (G_TYPE_FUNDAMENTAL (valtype)) { case G_TYPE_CHAR: if (sscanf (xml, "%d", &i) != 1) goto malformed_err; if (i < G_MININT8 || i > G_MAXINT8) goto range_err; g_value_set_char (value, i); break; case G_TYPE_UCHAR: if (sscanf (xml, "%u", &u) != 1) goto malformed_err; if (u > G_MAXUINT8) goto range_err; g_value_set_uchar (value, u); break; case G_TYPE_BOOLEAN: if (sscanf (xml, "%u", &u) != 1) goto malformed_err; if (u > 1) goto range_err; g_value_set_boolean (value, u); break; case G_TYPE_INT: if (sscanf (xml, "%d", &i) != 1) goto malformed_err; g_value_set_int (value, i); break; case G_TYPE_UINT: if (sscanf (xml, "%u", &u) != 1) goto malformed_err; g_value_set_uint (value, u); break; case G_TYPE_LONG: if (sscanf (xml, "%ld", &li) != 1) goto malformed_err; g_value_set_long (value, li); break; case G_TYPE_ULONG: if (sscanf (xml, "%lu", &lu) != 1) goto malformed_err; g_value_set_ulong (value, lu); break; case G_TYPE_INT64: i64 = g_ascii_strtoll (xml, &endptr, 10); if (endptr == xml) goto malformed_err; g_value_set_int64 (value, i64); break; case G_TYPE_UINT64: u64 = g_ascii_strtoull (xml, &endptr, 10); if (endptr == xml) goto malformed_err; g_value_set_uint64 (value, u64); break; case G_TYPE_ENUM: if (sscanf (xml, "%d", &i) != 1) goto malformed_err; g_value_set_enum (value, i); break; case G_TYPE_FLAGS: if (sscanf (xml, "%u", &u) != 1) goto malformed_err; g_value_set_flags (value, u); break; case G_TYPE_FLOAT: if (sscanf (xml, "%f", &f) != 1) goto malformed_err; g_value_set_float (value, f); break; case G_TYPE_DOUBLE: if (sscanf (xml, "%lf", &d) != 1) goto malformed_err; g_value_set_double (value, d); break; case G_TYPE_STRING: g_value_set_string (value, xml); break; default: if (valtype == G_TYPE_GTYPE) { g_value_set_gtype (value, g_type_from_name (xml)); return (TRUE); } else { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNHANDLED_CONVERSION, "Unhandled XML to GValue conversion for type '%s'", g_type_name (valtype)); return (FALSE); } } return (TRUE); malformed_err: g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, "Invalid XML GValue '%s' for type '%s'", xml, g_type_name (valtype)); return (FALSE); range_err: g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, "Out of range XML GValue '%s' for type '%s'", xml, g_type_name (valtype)); return (FALSE); } libinstpatch-1.0.0/libinstpatch/md5.c0000644000175000017500000001762711456655761014467 00000000000000/* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * IpatchMD5 structure, pass it to ipatch_md5_init, call ipatch_md5_update as * needed on buffers full of bytes, and then call ipatch_md5_final, which * will fill a supplied 16-byte array with the digest. * * Changed so as no longer to depend on Colin Plumb's `usual.h' header * definitions; now uses stuff from dpkg's config.h. * - Ian Jackson . * Still in the public domain. * * Josh Coalson: made some changes to integrate with libFLAC. * Still in the public domain. * * Josh Green: made some changes to integrate with libInstPatch. * Still in the public domain. */ #include /* for malloc() */ #include /* for memcpy() */ #include #include "md5.h" /* The four core functions - F1 is optimized somewhat */ /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f,w,x,y,z,in,s) \ (w += f(x,y,z) + in, w = (w<>(32-s)) + x) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. ipatch_md5_update blocks * the data and converts bytes into longwords for this routine. */ static inline void MD5Transform (guint32 buf[4], guint32 const in[16]) { register guint32 a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } static inline void byteSwap (guint32 *buf, unsigned words) { guint8 *p = (guint8 *)buf; if (G_BYTE_ORDER != G_BIG_ENDIAN) return; do { *buf++ = (guint32)((unsigned)p[3] << 8 | p[2]) << 16 | ((unsigned)p[1] << 8 | p[0]); p += 4; } while (--words); } /** * ipatch_md5_init: * @ctx: MD5 context * * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ void ipatch_md5_init (IpatchMD5 *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; ctx->buf[3] = 0x10325476; ctx->bytes[0] = 0; ctx->bytes[1] = 0; } /* * ipatch_md5_update: * @ctx: MD5 context * @buf: Buffer of data * @len: Length of data in @buf * * Update MD5 context to reflect the concatenation of another buffer full * of bytes. */ void ipatch_md5_update (IpatchMD5 *ctx, guint8 const *buf, unsigned len) { guint32 t; /* Update byte count */ t = ctx->bytes[0]; if ((ctx->bytes[0] = t + len) < t) ctx->bytes[1]++; /* Carry from low to high */ t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ if (t > len) { memcpy ((guint8 *)ctx->in + 64 - t, buf, len); return; } /* First chunk is an odd size */ memcpy ((guint8 *)ctx->in + 64 - t, buf, t); byteSwap (ctx->in, 16); MD5Transform (ctx->buf, ctx->in); buf += t; len -= t; /* Process data in 64-byte chunks */ while (len >= 64) { memcpy (ctx->in, buf, 64); byteSwap (ctx->in, 16); MD5Transform (ctx->buf, ctx->in); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ memcpy (ctx->in, buf, len); } /** * ipatch_md5_final: * @ctx: MD5 context * @digest: Buffer to store 16 byte MD5 digest into * * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void ipatch_md5_final (IpatchMD5 *ctx, guint8 digest[16]) { int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */ guint8 *p = (guint8 *)ctx->in + count; /* Set the first char of padding to 0x80. There is always room. */ *p++ = 0x80; /* Bytes of padding needed to make 56 bytes (-8..55) */ count = 56 - 1 - count; if (count < 0) { /* Padding forces an extra block */ memset (p, 0, count + 8); byteSwap (ctx->in, 16); MD5Transform (ctx->buf, ctx->in); p = (guint8 *)ctx->in; count = 56; } memset (p, 0, count); byteSwap (ctx->in, 14); /* Append length in bits and transform */ ctx->in[14] = ctx->bytes[0] << 3; ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29; MD5Transform (ctx->buf, ctx->in); byteSwap (ctx->buf, 4); memcpy (digest, ctx->buf, 16); memset (ctx, 0, sizeof (ctx)); /* In case it's sensitive */ } libinstpatch-1.0.0/libinstpatch/IpatchUnit_SF2.h0000644000175000017500000000422111461332142016470 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchUnit_SF2 * @short_description: Unit types and conversions for SoundFont * @see_also: * @stability: Stable */ #ifndef __IPATCH_UNIT_SF2_H__ #define __IPATCH_UNIT_SF2_H__ #include #include int ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch (int sf2_abs_pitch); int ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch (int dls_abs_pitch); double ipatch_unit_sf2_abs_pitch_to_hertz (int sf2_abs_pitch); int ipatch_unit_hertz_to_sf2_abs_pitch (double hz); double ipatch_unit_sf2_ofs_pitch_to_multiplier (int sf2_ofs_pitch); int ipatch_unit_multiplier_to_sf2_ofs_pitch (double multiplier); int ipatch_unit_sf2_abs_time_to_dls_abs_time (int sf2_abs_time); int ipatch_unit_dls_abs_time_to_sf2_abs_time (int dls_abs_time); double ipatch_unit_sf2_abs_time_to_seconds (int sf2_abs_time); int ipatch_unit_seconds_to_sf2_abs_time (double sec); double ipatch_unit_sf2_ofs_time_to_multiplier (int sf2_ofs_time); int ipatch_unit_multiplier_to_sf2_ofs_time (double multiplier); int ipatch_unit_centibels_to_dls_gain (int centibel); int ipatch_unit_dls_gain_to_centibels (int dls_gain); double ipatch_unit_centibels_to_decibels (int cb); int ipatch_unit_decibels_to_centibels (double db); double ipatch_unit_tenth_percent_to_percent (int tenth_percent); int ipatch_unit_percent_to_tenth_percent (double percent); #endif libinstpatch-1.0.0/libinstpatch/libinstpatch.h0000644000175000017500000001012511461360600016432 00000000000000/* * libinstpatch.h - Main public header file for libInstPatch * * libInstPatch - MIDI instrument patch library * Copyright (C) 1999-2007 Josh Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * 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., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA or point your web browser to http://www.gnu.org. */ #ifndef __LIB_INST_PATCH_H__ #define __LIB_INST_PATCH_H__ #include G_BEGIN_DECLS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include G_END_DECLS #endif libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreSplit24.h0000644000175000017500000000537411461332142020531 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleStoreSplit24 * @short_description: Sample storage object for 24 bit audio in 16 and 8 bit segments * @see_also: * @stability: Stable * * SoundFont 2.04 adds support for 24 bit audio. This is done in a semi * backwards compatible fashion where the most significant 16 bits is stored * separately from the remaining 8 bit segments. This storage object handles * this transparently. */ #ifndef __IPATCH_SAMPLE_STORE_SPLIT24_H__ #define __IPATCH_SAMPLE_STORE_SPLIT24_H__ #include #include #include #include /* forward type declarations */ typedef struct _IpatchSampleStoreSplit24 IpatchSampleStoreSplit24; typedef struct _IpatchSampleStoreSplit24Class IpatchSampleStoreSplit24Class; #define IPATCH_TYPE_SAMPLE_STORE_SPLIT24 (ipatch_sample_store_split24_get_type ()) #define IPATCH_SAMPLE_STORE_SPLIT24(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_STORE_SPLIT24, \ IpatchSampleStoreSplit24)) #define IPATCH_SAMPLE_STORE_SPLIT24_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_STORE_SPLIT24, \ IpatchSampleStoreSplit24Class)) #define IPATCH_IS_SAMPLE_STORE_SPLIT24(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_STORE_SPLIT24)) #define IPATCH_IS_SAMPLE_STORE_SPLIT24_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_STORE_SPLIT24)) /* File sample store instance */ struct _IpatchSampleStoreSplit24 { IpatchSampleStoreFile parent_instance; guint loc_lsbytes; /* pos of the least significant bytes of 24 bit audio */ }; /* File sample store class */ struct _IpatchSampleStoreSplit24Class { IpatchSampleStoreFileClass parent_class; }; GType ipatch_sample_store_split24_get_type (void); IpatchSample *ipatch_sample_store_split24_new (IpatchFile *file, guint loc_16bit, guint loc_lsbytes); #endif libinstpatch-1.0.0/libinstpatch/IpatchConvert_SF2.h0000644000175000017500000001271611461332142017201 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchConvert_SF2 * @short_description: SoundFont conversion handlers * @see_also: #IpatchConverter * @stability: Stable * * Conversion handlers for SoundFont objects. */ #ifndef __IPATCH_CONVERT_SF2_H__ #define __IPATCH_CONVERT_SF2_H__ #include #include #include typedef IpatchConverter IpatchConverterSF2ToFile; typedef IpatchConverterClass IpatchConverterSF2ToFileClass; typedef IpatchConverter IpatchConverterFileToSF2; typedef IpatchConverterClass IpatchConverterFileToSF2Class; typedef IpatchConverter IpatchConverterFileToSF2Sample; typedef IpatchConverterClass IpatchConverterFileToSF2SampleClass; typedef IpatchConverter IpatchConverterSF2ToDLS2; typedef IpatchConverterClass IpatchConverterSF2ToDLS2Class; typedef IpatchConverter IpatchConverterDLS2ToSF2; typedef IpatchConverterClass IpatchConverterDLS2ToSF2Class; typedef IpatchConverter IpatchConverterSF2PresetToDLS2Inst; typedef IpatchConverterClass IpatchConverterSF2PresetToDLS2InstClass; typedef IpatchConverter IpatchConverterDLS2InstToSF2Preset; typedef IpatchConverterClass IpatchConverterDLS2InstToSF2PresetClass; typedef IpatchConverter IpatchConverterSF2InstToDLS2Inst; typedef IpatchConverterClass IpatchConverterSF2InstToDLS2InstClass; typedef IpatchConverter IpatchConverterDLS2InstToSF2Inst; typedef IpatchConverterClass IpatchConverterDLS2InstToSF2InstClass; typedef IpatchConverter IpatchConverterSF2PZoneToDLS2Region; typedef IpatchConverterClass IpatchConverterSF2PZoneToDLS2RegionClass; typedef IpatchConverter IpatchConverterDLS2RegionToSF2PZone; typedef IpatchConverterClass IpatchConverterDLS2RegionToSF2PZoneClass; typedef IpatchConverter IpatchConverterSF2IZoneToDLS2Region; typedef IpatchConverterClass IpatchConverterSF2IZoneToDLS2RegionClass; typedef IpatchConverter IpatchConverterDLS2RegionToSF2IZone; typedef IpatchConverterClass IpatchConverterDLS2RegionToSF2IZoneClass; typedef IpatchConverter IpatchConverterSF2SampleToDLS2Sample; typedef IpatchConverterClass IpatchConverterSF2SampleToDLS2SampleClass; typedef IpatchConverter IpatchConverterDLS2SampleToSF2Sample; typedef IpatchConverterClass IpatchConverterDLS2SampleToSF2SampleClass; #define IPATCH_TYPE_CONVERTER_SF2_TO_FILE \ (ipatch_converter_sf2_to_file_get_type ()) #define IPATCH_TYPE_CONVERTER_FILE_TO_SF2 \ (ipatch_converter_file_to_sf2_get_type ()) #define IPATCH_TYPE_CONVERTER_FILE_TO_SF2_SAMPLE \ (ipatch_converter_file_to_sf2_sample_get_type ()) #define IPATCH_TYPE_CONVERTER_SF2_TO_DLS2 \ (ipatch_converter_sf2_to_dls2_get_type ()) #define IPATCH_TYPE_CONVERTER_DLS2_TO_SF2 \ (ipatch_converter_dls2_to_sf2_get_type ()) #define IPATCH_TYPE_CONVERTER_SF2_PRESET_TO_DLS2_INST \ (ipatch_converter_sf2_preset_to_dls2_inst_get_type ()) #define IPATCH_TYPE_CONVERTER_DLS2_INST_TO_SF2_PRESET \ (ipatch_converter_dls2_inst_to_sf2_preset_get_type ()) #define IPATCH_TYPE_CONVERTER_SF2_INST_TO_DLS2_INST \ (ipatch_converter_sf2_inst_to_dls2_inst_get_type ()) #define IPATCH_TYPE_CONVERTER_DLS2_INST_TO_SF2_INST \ (ipatch_converter_dls2_inst_to_sf2_inst_get_type ()) #define IPATCH_TYPE_CONVERTER_SF2_PZONE_TO_DLS2_REGION \ (ipatch_converter_sf2_pzone_to_dls2_region_get_type ()) #define IPATCH_TYPE_CONVERTER_DLS2_REGION_TO_SF2_PZONE \ (ipatch_converter_dls2_region_to_sf2_pzone_get_type ()) #define IPATCH_TYPE_CONVERTER_SF2_IZONE_TO_DLS2_REGION \ (ipatch_converter_sf2_izone_to_dls2_region_get_type ()) #define IPATCH_TYPE_CONVERTER_DLS2_REGION_TO_SF2_IZONE \ (ipatch_converter_dls2_region_to_sf2_izone_get_type ()) #define IPATCH_TYPE_CONVERTER_SF2_SAMPLE_TO_DLS2_SAMPLE \ (ipatch_converter_sf2_sample_to_dls2_sample_get_type ()) #define IPATCH_TYPE_CONVERTER_DLS2_SAMPLE_TO_SF2_SAMPLE \ (ipatch_converter_dls2_sample_to_sf2_sample_get_type ()) GType ipatch_converter_sf2_to_file_get_type (void); GType ipatch_converter_file_to_sf2_get_type (void); GType ipatch_converter_file_to_sf2_sample_get_type (void); GType ipatch_converter_sf2_to_dls2_get_type (void); GType ipatch_converter_dls2_to_sf2_get_type (void); GType ipatch_converter_sf2_preset_to_dls2_inst_get_type (void); GType ipatch_converter_dls2_inst_to_sf2_preset_get_type (void); GType ipatch_converter_sf2_inst_to_dls2_inst_get_type (void); GType ipatch_converter_dls2_inst_to_sf2_inst_get_type (void); GType ipatch_converter_sf2_pzone_to_dls2_region_get_type (void); GType ipatch_converter_dls2_region_to_sf2_pzone_get_type (void); GType ipatch_converter_sf2_izone_to_dls2_region_get_type (void); GType ipatch_converter_dls2_region_to_sf2_izone_get_type (void); GType ipatch_converter_sf2_sample_to_dls2_sample_get_type (void); GType ipatch_converter_dls2_sample_to_sf2_sample_get_type (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchUnit_generic.h0000644000175000017500000000226511461332142017520 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchUnit_generic * @short_description: Generic unit types and conversions * @see_also: * @stability: Stable * * */ #ifndef __IPATCH_UNIT_GENERIC_H__ #define __IPATCH_UNIT_GENERIC_H__ #include #include double ipatch_unit_hertz_to_cents (double hz); double ipatch_unit_cents_to_hertz (double cents); #endif libinstpatch-1.0.0/libinstpatch/IpatchList.c0000644000175000017500000000703211461332142016010 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchList.h" static void ipatch_list_class_init (IpatchListClass *klass); static void ipatch_list_finalize (GObject *gobject); static GObjectClass *parent_class = NULL; GType ipatch_list_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchListClass), NULL, NULL, (GClassInitFunc) ipatch_list_class_init, NULL, NULL, sizeof (IpatchList), 0, (GInstanceInitFunc) NULL, }; item_type = g_type_register_static (G_TYPE_OBJECT, "IpatchList", &item_info, 0); } return (item_type); } static void ipatch_list_class_init (IpatchListClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_peek_parent (klass); obj_class->finalize = ipatch_list_finalize; } static void ipatch_list_finalize (GObject *gobject) { IpatchList *list = IPATCH_LIST (gobject); GList *p; p = list->items; while (p) /* unref all objects in list and destroy the list */ { g_object_unref (p->data); p = g_list_delete_link (p, p); } list->items = NULL; if (parent_class->finalize) parent_class->finalize (gobject); } /** * ipatch_list_new: * * Create a new object list object. #IpatchList objects are often used to * duplicate multi-thread sensitive object lists, so they can be iterated over * at one's own leasure. * * Returns: New object list container object. */ IpatchList * ipatch_list_new (void) { return (IPATCH_LIST (g_object_new (IPATCH_TYPE_LIST, NULL))); } /** * ipatch_list_duplicate: * @list: Object list to duplicate * * Duplicate an object list. * * Returns: New duplicate object list with a ref count of one which the * caller owns. */ IpatchList * ipatch_list_duplicate (IpatchList *list) { IpatchList *newlist; GList *p; g_return_val_if_fail (IPATCH_IS_LIST (list), NULL); newlist = ipatch_list_new (); /* ++ ref new list */ p = list->items; while (p) { if (p->data) g_object_ref (p->data); /* ++ ref object for new list */ newlist->items = g_list_prepend (newlist->items, p->data); p = g_list_next (p); } newlist->items = g_list_reverse (newlist->items); return (newlist); /* !! caller owns the new list reference */ } /** * ipatch_list_init_iter: * @list: List object * @iter: Iterator to initialize * * Initializes a user supplied iterator (usually stack allocated) to iterate * over the object @list. Further operations on @iter will use the @list. */ void ipatch_list_init_iter (IpatchList *list, IpatchIter *iter) { g_return_if_fail (IPATCH_IS_LIST (list)); g_return_if_fail (iter != NULL); ipatch_iter_GList_init (iter, &list->items); } libinstpatch-1.0.0/libinstpatch/IpatchConverterSF2VoiceCache.c0000644000175000017500000000626411461332142021277 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include "IpatchConverterSF2VoiceCache.h" #include "i18n.h" enum { PROP_0, PROP_SOLO_ITEM }; static void ipatch_converter_sf2_voice_cache_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_converter_sf2_voice_cache_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); G_DEFINE_ABSTRACT_TYPE (IpatchConverterSF2VoiceCache, ipatch_converter_sf2_voice_cache, IPATCH_TYPE_CONVERTER) static void ipatch_converter_sf2_voice_cache_class_init (IpatchConverterSF2VoiceCacheClass *klass) { GObjectClass *obj_class = (GObjectClass *)klass; obj_class->set_property = ipatch_converter_sf2_voice_cache_set_property; obj_class->get_property = ipatch_converter_sf2_voice_cache_get_property; g_object_class_install_property (obj_class, PROP_SOLO_ITEM, g_param_spec_object ("solo-item", _("Solo item"), _("Solo item"), IPATCH_TYPE_ITEM, G_PARAM_READWRITE)); } static void ipatch_converter_sf2_voice_cache_init (IpatchConverterSF2VoiceCache *converter) { } static void ipatch_converter_sf2_voice_cache_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchConverterSF2VoiceCache *converter = IPATCH_CONVERTER_SF2_VOICE_CACHE (object); /* No lock needed, since converters aren't multi-threaded */ switch (property_id) { case PROP_SOLO_ITEM: if (converter->solo_item) g_object_unref (converter->solo_item); converter->solo_item = g_value_get_object (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_converter_sf2_voice_cache_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchConverterSF2VoiceCache *converter = IPATCH_CONVERTER_SF2_VOICE_CACHE (object); /* No lock needed, since converters aren't multi-threaded */ switch (property_id) { case PROP_SOLO_ITEM: g_value_set_object (value, converter->solo_item); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } libinstpatch-1.0.0/libinstpatch/IpatchConvert_SF2.c0000644000175000017500000007442311461332142017177 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "misc.h" #include "IpatchConvert_SF2.h" #include "IpatchConverter.h" #include "IpatchConverter_priv.h" #include "IpatchSndFile.h" #include "IpatchSF2.h" #include "IpatchSF2Gen.h" #include "IpatchSF2Inst.h" #include "IpatchSF2IZone.h" #include "IpatchSF2Reader.h" #include "IpatchSF2Mod.h" #include "IpatchSF2Preset.h" #include "IpatchSF2PZone.h" #include "IpatchSF2Sample.h" #include "IpatchSF2Writer.h" #include "IpatchDLS2.h" #include "IpatchDLS2Conn.h" #include "IpatchDLS2Inst.h" #include "IpatchDLS2Region.h" #include "IpatchDLS2Sample.h" #include "IpatchSample.h" #include "IpatchSampleData.h" #include "IpatchSampleStoreSndFile.h" #include "IpatchSampleStoreVirtual.h" #include "IpatchSampleList.h" #include "IpatchBase.h" #include "IpatchFile.h" #include "i18n.h" /* * SoundFont conversion handlers (DLS is master format): * IpatchSF2 <==> IpatchSF2File * IpatchSndFile => IpatchSF2Sample * IpatchSF2 <==> IpatchDLS2 * IpatchSF2Preset <==> IpatchDLS2Inst * IpatchSF2Inst <==> IpatchDLS2Inst * IpatchSF2PZone <==> IpatchDLS2Region * IpatchSF2IZone <==> IpatchDLS2Region * IpatchSF2Sample <==> IpatchDLS2Sample */ static IpatchSF2Sample *create_sf2_sample_helper (IpatchSampleStoreSndFile *store, gboolean left); /* init routine for SF2 conversion types */ void _ipatch_convert_SF2_init (void) { g_type_class_ref (IPATCH_TYPE_CONVERTER_SF2_TO_FILE); g_type_class_ref (IPATCH_TYPE_CONVERTER_FILE_TO_SF2); g_type_class_ref (IPATCH_TYPE_CONVERTER_FILE_TO_SF2_SAMPLE); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_SF2_TO_FILE, 0, IPATCH_TYPE_SF2, 0, 1, IPATCH_TYPE_SF2_FILE, IPATCH_TYPE_FILE, 1); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_FILE_TO_SF2, 0, IPATCH_TYPE_SF2_FILE, IPATCH_TYPE_FILE, 1, IPATCH_TYPE_SF2, IPATCH_TYPE_BASE, 0); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_FILE_TO_SF2_SAMPLE, 0, IPATCH_TYPE_SND_FILE, IPATCH_TYPE_FILE, 1, IPATCH_TYPE_SF2_SAMPLE, 0, 0); } /* ============= * Notes methods * ============= */ #if 0 NULL_NOTES (sf2_to_dls2) static char * _dls2_to_sf2_notes (IpatchConverter *converter) { return (g_strconcat ( _("Loss of precision (DLS has higher precision parameters)\n"), _("Info text for samples and instruments will be lost (except name)\n"), _("8 bit samples will be converted to 16 bit\n"), NULL)); } NULL_NOTES (sf2_preset_to_dls2_inst); NULL_NOTES (dls2_inst_to_sf2_preset); NULL_NOTES (sf2_inst_to_dls2_inst); NULL_NOTES (dls2_inst_to_sf2_inst); NULL_NOTES (sf2_pzone_to_dls2_region); NULL_NOTES (dls2_region_to_sf2_pzone); NULL_NOTES (sf2_izone_to_dls2_region); NULL_NOTES (dls2_region_to_sf2_izone); NULL_NOTES (sf2_sample_to_dls2_sample); static char * _dls2_sample_to_sf2_sample_notes (IpatchConverter *converter) { return (g_strconcat ( _("Info strings will be lost (except name)\n"), _("Loop type will be lost (SoundFont stores loop type in instruments)\n"), _("8bit samples will be converted to 16 bit\n"), NULL)); } #endif /* =============== * Convert methods * =============== */ static gboolean _sf2_to_file_convert (IpatchConverter *converter, GError **err) { IpatchSF2 *sfont; IpatchSF2File *file; IpatchFileHandle *handle; IpatchSF2Writer *writer; int retval; sfont = IPATCH_SF2 (IPATCH_CONVERTER_INPUT (converter)); file = IPATCH_SF2_FILE (IPATCH_CONVERTER_OUTPUT (converter)); handle = ipatch_file_open (IPATCH_FILE (file), NULL, "w", err); if (!handle) return (FALSE); writer = ipatch_sf2_writer_new (handle, sfont); /* ++ ref new writer */ retval = ipatch_sf2_writer_save (writer, err); g_object_unref (writer); /* -- unref writer */ return (retval); } static gboolean _file_to_sf2_convert (IpatchConverter *converter, GError **err) { IpatchSF2 *sfont; IpatchSF2File *file; IpatchFileHandle *handle; IpatchSF2Reader *reader; file = IPATCH_SF2_FILE (IPATCH_CONVERTER_INPUT (converter)); handle = ipatch_file_open (IPATCH_FILE (file), NULL, "r", err); if (!handle) return (FALSE); reader = ipatch_sf2_reader_new (handle); /* ++ ref new reader */ sfont = ipatch_sf2_reader_load (reader, err); /* ++ ref loaded SoundFont */ g_object_unref (reader); /* -- unref reader */ if (sfont) { ipatch_converter_add_output (converter, G_OBJECT (sfont)); g_object_unref (sfont); /* -- unref loaded SoundFont */ return (TRUE); } else return (FALSE); } /* Will produce 2 samples when stereo */ static gboolean _file_to_sf2_sample_convert (IpatchConverter *converter, GError **err) { IpatchSndFile *file; IpatchSF2Sample *sf2sample, *r_sf2sample; IpatchSampleStoreSndFile *store; char *filename, *title; guint length; int format; file = IPATCH_SND_FILE (IPATCH_CONVERTER_INPUT (converter)); filename = ipatch_file_get_name (IPATCH_FILE (file)); /* ++ alloc file name */ if (!filename) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_PROGRAM, _("Sample file object must have a file name")); return (FALSE); } /* ++ ref store */ store = IPATCH_SAMPLE_STORE_SND_FILE (ipatch_sample_store_snd_file_new (filename)); if (!ipatch_sample_store_snd_file_init_read (store)) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNSUPPORTED, _("Sample file '%s' is invalid or unsupported"), filename); g_object_unref (store); /* -- unref store */ g_free (filename); /* -- free filename */ return (FALSE); } g_free (filename); /* -- free filename */ g_object_get (store, "title", &title, /* ++ alloc */ "sample-size", &length, "sample-format", &format, NULL); if (length < 4) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, _("Sample '%s' is too small"), title ? title : _("")); g_free (title); /* -- free title */ g_object_unref (store); /* -- unref store */ return (FALSE); } g_free (title); /* -- free title */ sf2sample = create_sf2_sample_helper (store, TRUE); /* ++ ref sf2sample */ ipatch_converter_add_output (converter, (GObject *)sf2sample); /* Stereo? - Add the right channel too */ if (IPATCH_SAMPLE_FORMAT_GET_CHANNELS (format) == IPATCH_SAMPLE_STEREO) { r_sf2sample = create_sf2_sample_helper (store, FALSE); /* ++ ref r_sf2sample */ ipatch_converter_add_output (converter, (GObject *)r_sf2sample); g_object_set (sf2sample, "linked-sample", r_sf2sample, NULL); g_object_set (r_sf2sample, "linked-sample", sf2sample, NULL); g_object_unref (r_sf2sample); /* -- unref r_sf2sample */ } g_object_unref (sf2sample); /* -- unref sf2sample */ g_object_unref (store); /* -- unref store */ return (TRUE); } /* Helper function to create IpatchSF2Sample objects of mono or left/right * channels of stereo */ static IpatchSF2Sample * create_sf2_sample_helper (IpatchSampleStoreSndFile *store, gboolean left) { IpatchSampleList *samlist; IpatchSample *virtstore; IpatchSF2Sample *sf2sample; IpatchSampleData *sampledata; char newtitle[IPATCH_SFONT_NAME_SIZE + 1]; int format, rate, loop_type, root_note, fine_tune; guint length, loop_start, loop_end; char *title; int channel = IPATCH_SF2_SAMPLE_CHANNEL_MONO; g_object_get (store, "title", &title, /* ++ alloc title */ "sample-size", &length, "sample-format", &format, "sample-rate", &rate, "loop-type", &loop_type, "loop-start", &loop_start, "loop-end", &loop_end, "root-note", &root_note, "fine-tune", &fine_tune, NULL); if (title && title[0] != '\0') { strncpy (newtitle, title, IPATCH_SFONT_NAME_SIZE); newtitle[IPATCH_SFONT_NAME_SIZE] = '\0'; } else strcpy (newtitle, _("Untitled")); g_free (title); /* -- free title */ /* if loop not set, or messed up.. */ if (loop_type == IPATCH_SAMPLE_LOOP_NONE || loop_end <= loop_start || loop_end > length) { if (length >= 48) { loop_start = 8; loop_end = length - 8; } else /* sample is rather small */ { loop_start = 1; loop_end = length - 1; } } if (IPATCH_SAMPLE_FORMAT_GET_CHANNELS (format) == IPATCH_SAMPLE_STEREO) { /* Create sample list containing single channel of stereo */ samlist = ipatch_sample_list_new (); /* ++ alloc samlist */ ipatch_sample_list_append (samlist, (IpatchSample *)store, 0, length, left ? IPATCH_SAMPLE_LEFT : IPATCH_SAMPLE_RIGHT); /* Create virtual store for mono audio and assign the sample list to it */ virtstore = ipatch_sample_store_virtual_new (); /* ++ ref virtstore */ g_object_set (virtstore, "sample-format", format & ~IPATCH_SAMPLE_CHANNEL_MASK, "sample-rate", rate, NULL); ipatch_sample_store_virtual_set_list (IPATCH_SAMPLE_STORE_VIRTUAL (virtstore), 0, samlist); /* !! caller takes over samlist */ sampledata = ipatch_sample_data_new (); /* ++ ref sampledata */ ipatch_sample_data_add (sampledata, IPATCH_SAMPLE_STORE (virtstore)); g_object_unref (virtstore); /* -- unref virtstore */ /* FIXME - Allow for other postfixes for i18n, this could be done by * assigning strings as GObject data to the source file object */ if (strlen (newtitle) > 18) strcpy (newtitle + 18, left ? "_L" : "_R"); else strcat (newtitle, left ? "_L" : "_R"); channel = left ? IPATCH_SF2_SAMPLE_CHANNEL_LEFT : IPATCH_SF2_SAMPLE_CHANNEL_RIGHT; } else { sampledata = ipatch_sample_data_new (); /* ++ ref sampledata */ ipatch_sample_data_add (sampledata, IPATCH_SAMPLE_STORE (store)); } sf2sample = ipatch_sf2_sample_new (); /* ++ ref sf2sample */ g_object_set (sf2sample, "name", &newtitle, "sample-data", sampledata, "sample-rate", rate, "root-note", (root_note != -1) ? root_note : IPATCH_SAMPLE_ROOT_NOTE_DEFAULT, "fine-tune", fine_tune, "loop-start", loop_start, "loop-end", loop_end, "channel", channel, NULL); g_object_unref (sampledata); /* -- unref sampledata */ return (sf2sample); /* !! caller takes over reference */ } #if 0 static gboolean _sf2_to_dls2_convert (IpatchConverter *converter, GError **err) { return (TRUE); } static gboolean _dls2_to_sf2_convert (IpatchConverter *converter, GError **err) { IpatchDLS2 *dls; IpatchSF2 *sfont; IpatchSF2Preset *sf_preset; IpatchDLS2Inst *dls_inst; IpatchList *dlsinst_list; IpatchIter dlsinst_iter; dls = IPATCH_DLS2 (IPATCH_CONVERTER_INPUT (converter)); sfont = IPATCH_SF2 (IPATCH_CONVERTER_OUTPUT (converter)); /* ++ ref new list */ dlsinst_list = ipatch_container_get_children (IPATCH_CONTAINER (dls), IPATCH_TYPE_DLS2_INST); ipatch_list_init_iter (dlsinst_list, &dlsinst_iter); dls_inst = ipatch_dls2_inst_first (&dlsinst_iter); while (dls_inst) /* loop over DLS instruments */ { sf_preset = ipatch_sf2_preset_new (); /* ++ ref new SoundFont preset */ /* convert DLS instrument to SoundFont preset */ if (!ipatch_convert (dls_inst, sf_preset, err, NULL)) { g_object_unref (sf_preset); /* -- unref SoundFont preset */ g_object_unref (dlsinst_list); /* -- unref instrument list */ return (FALSE); } /* add preset to SoundFont */ ipatch_container_append (IPATCH_CONTAINER (sfont), IPATCH_ITEM (sf_preset)); g_object_unref (sf_preset); /* -- unref creator's reference */ dls_inst = ipatch_dls2_inst_next (&dlsinst_iter); } g_object_unref (dlsinst_list); /* -- unref instrument list */ return (TRUE); } static gboolean _sf2_preset_to_dls2_inst_convert (IpatchConverter *converter, GError **err) { return (TRUE); } static gboolean _dls2_inst_to_sf2_preset_convert (IpatchConverter *converter, GError **err) { IpatchDLS2Inst *dls_inst; IpatchSF2Preset *sf_preset; IpatchSF2Inst *sf_inst; IpatchSF2PZone *pzone; char *name; int bank, program; dls_inst = IPATCH_DLS2_INST (IPATCH_CONVERTER_INPUT (converter)); sf_preset = IPATCH_SF2_PRESET (IPATCH_CONVERTER_OUTPUT (converter)); g_object_get (dls_inst, "name", &name, "bank", &bank, "program", &program, NULL); /* FIXME - what about program # clashes with percussion instruments? */ if (bank & IPATCH_DLS2_INST_BANK_PERCUSSION) bank = 128; g_object_set (sf_preset, "name", name, "bank", bank, "program", program, NULL); sf_inst = ipatch_sf2_inst_new (); /* ++ ref new instrument */ /* convert DLS instrument to SoundFont instrument */ if (!ipatch_convert (dls_inst, sf_inst, err, NULL)) { g_object_unref (sf_inst); /* -- unref SoundFont instrument */ return (FALSE); } /* create a new preset zone linking to new instrument */ pzone = ipatch_sf2_preset_new_zone (sf_preset, sf_inst); /* ++ ref */ g_object_unref (sf_inst); /* -- unref instrument */ g_object_unref (pzone); /* -- unref preset zone */ return (TRUE); } static gboolean _sf2_inst_to_dls2_inst_convert (IpatchConverter *converter, GError **err) { return (TRUE); } static gboolean _dls2_inst_to_sf2_inst_convert (IpatchConverter *converter, GError **err) { IpatchDLS2Inst *dls_inst; IpatchDLS2Region *dls_region; IpatchSF2Inst *sf_inst; IpatchSF2Zone *sf_izone; IpatchList *dlsregion_list; IpatchIter dlsregion_iter; char *name; dls_inst = IPATCH_DLS2_INST (IPATCH_CONVERTER_INPUT (converter)); sf_inst = IPATCH_SF2_INST (IPATCH_CONVERTER_OUTPUT (converter)); g_object_get (dls_inst, "name", &name, NULL); g_object_set (dls_inst, "name", name, NULL); /* ++ ref new list */ dlsregion_list = ipatch_container_get_children (IPATCH_CONTAINER (dls_inst), IPATCH_TYPE_DLS2_REGION); ipatch_list_init_iter (dlsregion_list, &dlsregion_iter); dls_region = ipatch_dls2_region_first (&dlsregion_iter); while (dls_region) /* loop over DLS regions */ { sf_izone = ipatch_sf2_izone_new (); /* ++ ref new SoundFont izone */ /* convert DLS region to SoundFont instrument zone */ if (!ipatch_convert (dls_region, sf_izone, err, NULL)) { g_object_unref (sf_izone); /* -- unref SoundFont izone */ g_object_unref (dlsregion_list); /* -- unref region list */ return (FALSE); } /* add SoundFont zone to instrument */ ipatch_container_append (IPATCH_CONTAINER (sf_inst), IPATCH_ITEM (sf_izone)); g_object_unref (sf_izone); /* -- unref creator's reference */ dls_region = ipatch_dls2_region_next (&dlsregion_iter); } g_object_unref (dlsregion_list); /* -- unref region list */ return (TRUE); } static gboolean _sf2_pzone_to_dls2_region_convert (IpatchConverter *converter, GError **err) { return (TRUE); } static gboolean _dls2_region_to_sf2_pzone_convert (IpatchConverter *converter, GError **err) { return (TRUE); } static gboolean _sf2_izone_to_dls2_region_convert (IpatchConverter *converter, GError **err) { return (TRUE); } static gboolean _dls2_region_to_sf2_izone_convert (IpatchConverter *converter, GError **err) { IpatchDLS2Region *dls_region; IpatchSF2Zone *sf_izone; IpatchDLS2Sample *dls_sample; IpatchDLS2SampleInfo *sample_info, *regsample_info, *temp_info; IpatchSF2GenAmount amt; guint32 flags; dls_region = IPATCH_DLS2_REGION (IPATCH_CONVERTER_INPUT (converter)); sf_izone = IPATCH_SF2_ZONE (IPATCH_CONVERTER_INPUT (converter)); IPATCH_ITEM_RLOCK (dls_region); /* note range */ if (!(dls_region->note_range_low == 0 && dls_region->note_range_high == 127)) { amt.range.low = dls_region->note_range_low; amt.range.high = dls_region->note_range_high; IPATCH_SF2_ZONE_GEN_AMT (sf_izone, IPATCH_SF2_GEN_NOTE_RANGE) = amt; IPATCH_SF2_ZONE_GEN_SET_FLAG (sf_izone, IPATCH_SF2_GEN_NOTE_RANGE); } /* velocity range */ if (!(dls_region->velocity_range_low == 0 && dls_region->velocity_range_high == 127)) { amt.range.low = dls_region->velocity_range_low; amt.range.high = dls_region->velocity_range_high; IPATCH_SF2_ZONE_GEN_AMT (sf_izone, IPATCH_SF2_GEN_VELOCITY_RANGE) = amt; IPATCH_SF2_ZONE_GEN_SET_FLAG (sf_izone, IPATCH_SF2_GEN_VELOCITY_RANGE); } /* exclusive key group */ if (dls_region->key_group > 0) { IPATCH_SF2_ZONE_GEN_AMT (sf_izone, IPATCH_SF2_GEN_EXCLUSIVE_CLASS).sword = dls_region->key_group; IPATCH_SF2_ZONE_GEN_SET_FLAG (sf_izone, IPATCH_SF2_GEN_EXCLUSIVE_CLASS); } flags = ipatch_item_get_flags (dls_region); /* get item flags */ /* channel steering override? */ if (flags & IPATCH_DLS2_REGION_MULTI_CHANNEL) { amt.sword = ipatch_dls2_region_channel_map_stereo (dls_region->channel); amt.sword *= 500; /* -500, 0, 500 = left, center, right */ if (amt.sword != 0) /* center is default */ { IPATCH_SF2_ZONE_GEN_AMT (sf_izone, IPATCH_SF2_GEN_PAN) = amt; IPATCH_SF2_ZONE_GEN_SET_FLAG (sf_izone, IPATCH_SF2_GEN_PAN); } if (dls_region->channel > IPATCH_DLS2_REGION_CHANNEL_CENTER) { ipatch_converter_log (converter, G_OBJECT (dls_region), IPATCH_CONVERTER_LOG_WARN, _("Loss of surround sound information")); } } dls_sample = ipatch_dls2_region_get_sample (dls_region); /* ++ ref sample */ g_return_val_if_fail (dls_sample != NULL, FALSE); /* get region override sample info and sample info */ sample_info = dls_sample->sample_info; regsample_info = dls_region->sample_info; /* sample looping */ if (regsample_info && flags & IPATCH_DLS2_REGION_SAMPLE_OVERRIDE_LOOP) temp_info = regsample_info; else temp_info = sample_info; amt.uword = IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP; /* default */ if (temp_info) { switch (temp_info->options & IPATCH_DLS2_SAMPLE_LOOP_MASK) { case IPATCH_DLS2_SAMPLE_LOOP_NORMAL: amt.uword = IPATCH_SF2_GEN_SAMPLE_MODE_LOOP; break; case IPATCH_DLS2_SAMPLE_LOOP_RELEASE: amt.uword = IPATCH_SF2_GEN_SAMPLE_MODE_LOOP_RELEASE; break; } } if (amt.uword != IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP) /* default no loop */ { IPATCH_SF2_ZONE_GEN_AMT (sf_izone, IPATCH_SF2_GEN_SAMPLE_MODES) = amt; IPATCH_SF2_ZONE_GEN_SET_FLAG (sf_izone, IPATCH_SF2_GEN_SAMPLE_MODES); } /* root note */ if (regsample_info && flags & IPATCH_DLS2_REGION_SAMPLE_OVERRIDE_ROOT_NOTE) { IPATCH_SF2_ZONE_GEN_AMT (sf_izone, IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE).sword = regsample_info->root_note; IPATCH_SF2_ZONE_GEN_SET_FLAG (sf_izone, IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE); } /* fine tune */ if (regsample_info && flags & IPATCH_DLS2_REGION_SAMPLE_OVERRIDE_FINE_TUNE) { IPATCH_SF2_ZONE_GEN_AMT (sf_izone, IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE).sword = regsample_info->fine_tune; IPATCH_SF2_ZONE_GEN_SET_FLAG (sf_izone, IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE); } /* gain */ if (regsample_info && flags & IPATCH_DLS2_REGION_SAMPLE_OVERRIDE_GAIN) temp_info = regsample_info; else temp_info = sample_info; if (temp_info && temp_info->gain != 0) { if (temp_info->gain < 0) /* SoundFont only supports attenuation */ { amt.sword = ipatch_unit_dls_gain_to_sf2_atten (temp_info->gain); IPATCH_SF2_ZONE_GEN_AMT (sf_izone, IPATCH_SF2_GEN_ATTENUATION) = amt; IPATCH_SF2_ZONE_GEN_SET_FLAG (sf_izone, IPATCH_SF2_GEN_ATTENUATION); } else ipatch_converter_log (converter, G_OBJECT (dls_region), IPATCH_CONVERTER_LOG_WARN, _("Positive gain not supported")); } /* loop start */ if (regsample_info && flags & IPATCH_DLS2_REGION_SAMPLE_LOOP_START) temp_info = regsample_info; else temp_info = sample_info; here is where you want to continue?? IPATCH_ITEM_RUNLOCK (dls_region); return (TRUE); } static gboolean _sf2_sample_to_dls2_sample_convert (IpatchConverter *converter, GError **err) { IpatchSF2Sample *sf_sample; IpatchDLS2Sample *dls_sample; IpatchDLS2SampleInfo *sample_info; guint32 size; char *name; sf_sample = IPATCH_SF2_SAMPLE (IPATCH_CONVERTER_INPUT (converter)); dls_sample = IPATCH_DLS2_SAMPLE (IPATCH_CONVERTER_OUTPUT (converter)); IPATCH_ITEM_RLOCK (sf_sample); ipatch_dls2_sample_set_data (dls_sample, sf_sample->sample_data); dls_sample->rate = sf_sample->rate; /* FIXME - Handle linked stereo SoundFont samples */ name = ipatch_sf2_sample_get_name (sf_sample); g_object_set (dls_sample, "name", name, "loop-type", IPATCH_SAMPLE_LOOP_NONE, /* default no loop */ "loop-start", sf_sample->loop_start, "loop-end", sf_sample->loop_end, "root-note", sf_sample->root_note, "fine-tune", sf_sample->fine_tune, "gain", 0, /* unity gain */ NULL); g_free (name); IPATCH_ITEM_RUNLOCK (sf_sample); return (TRUE); } static gboolean _dls2_sample_to_sf2_sample_convert (IpatchConverter *converter, GError **err) { IpatchDLS2Sample *dls_sample; IpatchDLS2SampleInfo *sample_info; IpatchSF2Sample *sf_sample; guint32 size; char *name; dls_sample = IPATCH_DLS2_SAMPLE (IPATCH_CONVERTER_INPUT (converter)); sf_sample = IPATCH_SF2_SAMPLE (IPATCH_CONVERTER_OUTPUT (converter)); IPATCH_ITEM_RLOCK (dls_sample); ipatch_sf2_sample_set_data (sf_sample, dls_sample->sample_data); sf_sample->rate = dls_sample->rate; sf_sample->type = 0; /* FIXME - Handle linked stereo SoundFont samples */ ipatch_sf2_sample_set_linked (sf_sample, NULL); g_object_get (dls_sample, "name", &name, NULL); ipatch_sf2_sample_set_name (sf_sample, name); g_free (name); if (dls_sample->sample_info != NULL) { sample_info = dls_sample->sample_info; sf_sample->loop_start = sample_info->loop_start; sf_sample->loop_end = sample_info->loop_end; sf_sample->root_note = sample_info->root_note; sf_sample->fine_tune = sample_info->fine_tune; } else /* default sample info */ { size = ipatch_sample_data_get_size (dls_sample->sample_data); if (size >= 12) { sf_sample->loop_start = 4; sf_sample->loop_end = size - 4; } else { sf_sample->loop_start = 0; sf_sample->loop_end = size; } sf_sample->root_note = 60; sf_sample->fine_tune = 0; } IPATCH_ITEM_RUNLOCK (dls_sample); return (TRUE); } #endif CONVERTER_CLASS_INIT(sf2_to_file); CONVERTER_CLASS_INIT(file_to_sf2); CONVERTER_CLASS_INIT(file_to_sf2_sample); #if 0 CONVERTER_CLASS_INIT(sf2_to_dls2); CONVERTER_CLASS_INIT(dls2_to_sf2); CONVERTER_CLASS_INIT(sf2_preset_to_dls2_inst); CONVERTER_CLASS_INIT(dls2_inst_to_sf2_preset); CONVERTER_CLASS_INIT(sf2_inst_to_dls2_inst); CONVERTER_CLASS_INIT(dls2_inst_to_sf2_inst); CONVERTER_CLASS_INIT(sf2_pzone_to_dls2_region); CONVERTER_CLASS_INIT(dls2_region_to_sf2_pzone); CONVERTER_CLASS_INIT(sf2_izone_to_dls2_region); CONVERTER_CLASS_INIT(dls2_region_to_sf2_izone); CONVERTER_CLASS_INIT(sf2_sample_to_dls2_sample); CONVERTER_CLASS_INIT(dls2_sample_to_sf2_sample); #endif CONVERTER_GET_TYPE(sf2_to_file, SF2ToFile); CONVERTER_GET_TYPE(file_to_sf2, FileToSF2); CONVERTER_GET_TYPE(file_to_sf2_sample, FileToSF2Sample); #if 0 CONVERTER_GET_TYPE(sf2_to_dls2, SF2ToDLS2); CONVERTER_GET_TYPE(dls2_to_sf2, DLS2ToSF2); CONVERTER_GET_TYPE(sf2_preset_to_dls2_inst, SF2PresetToDLS2Inst); CONVERTER_GET_TYPE(dls2_inst_to_sf2_preset, DLS2InstToSF2Preset); CONVERTER_GET_TYPE(sf2_inst_to_dls2_inst, SF2InstToDLS2Inst); CONVERTER_GET_TYPE(dls2_inst_to_sf2_inst, DLS2InstToSF2Inst); CONVERTER_GET_TYPE(sf2_pzone_to_dls2_region, SF2PZoneToDLS2Region); CONVERTER_GET_TYPE(dls2_region_to_sf2_pzone, DLS2RegionToSF2PZone); CONVERTER_GET_TYPE(sf2_izone_to_dls2_region, SF2IZoneToDLS2Region); CONVERTER_GET_TYPE(dls2_region_to_sf2_izone, DLS2RegionToSF2IZone); CONVERTER_GET_TYPE(sf2_sample_to_dls2_sample, SF2SampleToDLS2Sample); CONVERTER_GET_TYPE(dls2_sample_to_sf2_sample, DLS2SampleToSF2Sample); /* DLS destination to generator mapping for constant connections */ gint16 const_conn_to_gen[] = { IPATCH_DLS2_CONN_DEST_LFO_DELAY, IPATCH_SF2_GEN_MOD_LFO_DELAY IPATCH_DLS2_CONN_DEST_LFO_FREQ, IPATCH_SF2_GEN_MOD_LFO_FREQ, IPATCH_DLS2_CONN_DEST_VIB_DELAY, IPATCH_SF2_GEN_VIB_LFO_DELAY, IPATCH_DLS2_CONN_DEST_VIB_FREQ, IPATCH_SF2_GEN_VIB_LFO_FREQ, IPATCH_DLS2_CONN_DEST_EG2_DELAY, IPATCH_SF2_GEN_MOD_ENV_DELAY, IPATCH_DLS2_CONN_DEST_EG2_ATTACK, IPATCH_SF2_GEN_MOD_ENV_ATTACK, IPATCH_DLS2_CONN_DEST_EG2_HOLD, IPATCH_SF2_GEN_MOD_ENV_HOLD, IPATCH_DLS2_CONN_DEST_EG2_DECAY, IPATCH_SF2_GEN_MOD_ENV_DECAY, IPATCH_DLS2_CONN_DEST_EG2_SUSTAIN, IPATCH_SF2_GEN_MOD_ENV_SUSTAIN, IPATCH_DLS2_CONN_DEST_EG2_RELEASE, IPATCH_SF2_GEN_MOD_ENV_RELEASE, IPATCH_DLS2_CONN_DEST_EG1_DELAY, IPATCH_SF2_GEN_VOL_ENV_DELAY, IPATCH_DLS2_CONN_DEST_EG1_ATTACK, IPATCH_SF2_GEN_VOL_ENV_ATTACK, IPATCH_DLS2_CONN_DEST_EG1_HOLD, IPATCH_SF2_GEN_VOL_ENV_HOLD, IPATCH_DLS2_CONN_DEST_EG1_DECAY, IPATCH_SF2_GEN_VOL_ENV_DECAY, IPATCH_DLS2_CONN_DEST_EG1_SUSTAIN, IPATCH_SF2_GEN_VOL_ENV_SUSTAIN, IPATCH_DLS2_CONN_DEST_EG1_RELEASE, IPATCH_SF2_GEN_VOL_ENV_RELEASE, IPATCH_DLS2_CONN_DEST_FILTER_CUTOFF, IPATCH_SF2_GEN_FILTER_FC, IPATCH_DLS2_CONN_DEST_FILTER_Q, IPATCH_SF2_GEN_FILTER_Q, IPATCH_DLS2_CONN_DEST_CHORUS, IPATCH_SF2_GEN_CHORUS_SEND, IPATCH_DLS2_CONN_DEST_REVERB, IPATCH_SF2_GEN_REVERB_SEND, IPATCH_DLS2_CONN_DEST_PAN, IPATCH_SF2_GEN_PAN, -1 }; /* no equivalent, requires duplicate sample data */ IPATCH_SF2_GEN_SAMPLE_START IPATCH_SF2_GEN_SAMPLE_END IPATCH_SF2_GEN_SAMPLE_COARSE_START IPATCH_SF2_GEN_SAMPLE_COARSE_END /* region sample info override */ IPATCH_SF2_GEN_SAMPLE_LOOP_START IPATCH_SF2_GEN_SAMPLE_LOOP_END IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END /* region split values */ IPATCH_SF2_GEN_NOTE_RANGE IPATCH_SF2_GEN_VELOCITY_RANGE /* special */ IPATCH_SF2_GEN_ATTENUATION IPATCH_SF2_GEN_FIXED_NOTE IPATCH_SF2_GEN_FIXED_VELOCITY IPATCH_SF2_GEN_SAMPLE_MODES IPATCH_SF2_GEN_EXCLUSIVE_CLASS IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE /** * ipatch_convert_dls_conns_to_sf2_genmods: * @conns: List of DLS connections * @gens: SoundFont generator array to store parameter values to * @mods: Pointer to an empty list to populate with modulators * * Converts a list of DLS connections into SoundFont generators and modulators. * * Returns: Number of connections successfully converted */ int ipatch_convert_dls_conns_to_sf2_genmods (GSList *conns, IpatchSF2GenArray *gens, GSList **mods) { int converted = 0; IpatchDLS2Conn *conn; GSList *p; int gen; for (p = conns; p; p = g_slist_next (p)) { conn = (IpatchDLS2Conn *)(p->data); /* skip unknown transforms */ if ((conn->trans & IPATCH_DLS2_CONN_MASK_OUTPUT_TRANS) >> IPATCH_DLS2_CONN_SHIFT_OUTPUT_TRANS != IPATCH_DLS2_CONN_OUTPUT_TRANS_NONE || (conn->trans & IPATCH_DLS2_CONN_MASK_CTRLSRC_TRANS) >> IPATCH_DLS2_CONN_SHIFT_CTRLSRC_TRANS > IPATCH_DLS2_CONN_TRANS_SWITCH || (conn->trans & IPATCH_DLS2_CONN_MASK_SRC_TRANS) >> IPATCH_DLS2_CONN_SHIFT_SRC_TRANS > IPATCH_DLS2_CONN_TRANS_SWITCH) continue; /* scaled constant connection? (NONE, NONE) */ if (conn->src == IPATCH_DLS2_CONN_SRC_NONE && conn->ctrlsrc == IPATCH_DLS2_CONN_SRC_NONE) { if (conn->dest == IPATCH_DLS2_CONN_DEST_PITCH) { IPATCH_SF2_GEN_COARSE_TUNE; IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE; } } /* scaled source connection? (SET, NONE) */ else if (conn->ctrlsrc == IPATCH_DLS2_CONN_SRC_NONE) { /* all these match only non-inverting linear transforms */ if (!(conn->trans & IPATCH_DLS2_CONN_MASK_SRC_INVERT) && !(conn->trans & IPATCH_DLS2_CONN_MASK_SRC_TRANS)) switch (conn->src) { case IPATCH_DLS2_CONN_SRC_NOTE: /* all these use unipolar transforms */ if (conn->trans & IPATCH_DLS2_CONN_MASK_SRC_POLARITY) break; if (conn->dest == IPATCH_DLS2_CONN_DEST_PITCH) gen = IPATCH_SF2_GEN_SCALE_TUNE; else if (conn->dest == IPATCH_DLS2_CONN_DEST_EG1_HOLD) gen = IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_HOLD; else if (conn->dest == IPATCH_DLS2_CONN_DEST_EG1_DECAY) gen = IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_DECAY; else if (conn->dest == IPATCH_DLS2_CONN_DEST_EG2_HOLD) gen = IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_HOLD; else if (conn->dest == IPATCH_DLS2_CONN_DEST_EG2_DECAY) gen = IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_DECAY; break; case IPATCH_DLS2_CONN_SRC_LFO: /* all these use bipolar transforms */ if (!(conn->trans & IPATCH_DLS2_CONN_MASK_SRC_POLARITY)) break; if (conn->dest == IPATCH_DLS2_CONN_DEST_PITCH) gen = IPATCH_SF2_GEN_MOD_LFO_TO_PITCH; else if (conn->dest == IPATCH_DLS2_CONN_DEST_FILTER_CUTOFF) gen = IPATCH_SF2_GEN_MOD_LFO_TO_FILTER_FC; else if (conn->dest == IPATCH_DLS2_CONN_DEST_GAIN) gen = IPATCH_SF2_GEN_MOD_LFO_TO_VOL; break; case IPATCH_DLS2_CONN_SRC_EG2: if (conn->dest == IPATCH_DLS2_CONN_DEST_FILTER_CUTOFF && !(conn->trans & IPATCH_DLS2_CONN_MASK_SRC_POLARITY)) gen = IPATCH_SF2_GEN_MOD_ENV_TO_FILTER_FC; else if (conn->dest == IPATCH_DLS2_CONN_DEST_PITCH && conn->trans & IPATCH_DLS2_CONN_MASK_SRC_POLARITY) gen = IPATCH_SF2_GEN_MOD_ENV_TO_PITCH; break; case IPATCH_DLS2_CONN_SRC_VIB: if (conn->dest == IPATCH_DLS2_CONN_DEST_PITCH && conn->trans & IPATCH_DLS2_CONN_MASK_SRC_POLARITY) gen = IPATCH_SF2_GEN_VIB_LFO_TO_PITCH; break; default: break; } } /* controlled scaled source connection? (SET, SET) */ else if (conn->src != IPATCH_DLS2_CONN_SRC_NONE) { } else continue; /* Invalid (NONE, SET), skip */ dls_units = ipatch_dls_conn_get_dest_units (conn->dest); sf2_units = ipatch_sf2_genid_get_units (gen); val = ipatch_unit_convert (dls_units, sf2_units, conn->scale); val = ipatch_sf2_gen_clamp (gen, val); ipatch_sf2_gen_array_set_val (gens, gen, val); } return (converted); } void ipatch_convert_dls_conn_to_sf2_genid (int dest) { } #endif libinstpatch-1.0.0/libinstpatch/IpatchRange.c0000644000175000017500000002211711461332142016132 00000000000000/* * Swami * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include "config.h" #include #include #include #include "IpatchRange.h" #include "IpatchXml.h" #include "IpatchXmlObject.h" #include "misc.h" #include "ipatch_priv.h" static gboolean ipatch_range_xml_encode_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); static gboolean ipatch_range_xml_decode_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); static void ipatch_param_spec_range_set_default (GParamSpec *pspec, GValue *value); static gboolean ipatch_param_spec_range_validate (GParamSpec *pspec, GValue *value); static gint ipatch_param_spec_range_values_cmp (GParamSpec *pspec, const GValue *value1, const GValue *value2); /* init function to register pickle XML encode/decode functions */ void _ipatch_range_init (void) { ipatch_xml_register_handler (IPATCH_TYPE_RANGE, NULL, ipatch_range_xml_encode_func, ipatch_range_xml_decode_func); } /* XML range value encoding function */ static gboolean ipatch_range_xml_encode_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err) { IpatchRange *range; g_return_val_if_fail (IPATCH_VALUE_HOLDS_RANGE (value), FALSE); range = g_value_get_boxed (value); if (range) ipatch_xml_set_value_printf (node, "%d-%d", range->low, range->high); return (TRUE); } static gboolean ipatch_range_xml_decode_func (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err) { IpatchRange *range; int low, high; const char *strval; strval = ipatch_xml_get_value (node); if (!strval) g_value_set_boxed (value, NULL); if (sscanf (strval, "%d-%d", &low, &high) != 2) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, _("Invalid XML '%s' for range value"), strval); return (FALSE); } range = ipatch_range_new (low, high); g_value_take_boxed (value, range); return (TRUE); } GType ipatch_range_get_type (void) { static GType item_type = 0; if (!item_type) { item_type = g_boxed_type_register_static ("IpatchRange", (GBoxedCopyFunc) ipatch_range_copy, (GBoxedFreeFunc) ipatch_range_free); } return (item_type); } /** * ipatch_range_new: * @low: Low value to initialize range to * @high: High value to initialize range to * * Create a new value range structure (to store an integer range). * * Returns: Newly allocated integer range structure. */ IpatchRange * ipatch_range_new (int low, int high) { IpatchRange *range; range = g_slice_new (IpatchRange); range->low = low; range->high = high; return (range); } /** * ipatch_range_copy: * @range: Range structure to duplicate * * Duplicates an integer range structure. * * Returns: New duplicate range structure. */ IpatchRange * ipatch_range_copy (IpatchRange *range) { g_return_val_if_fail (range != NULL, NULL); return (ipatch_range_new (range->low, range->high)); } /** * ipatch_range_free: * @range: Integer range structure to free * * Free a range structure previously allocated with ipatch_range_new(). */ void ipatch_range_free (IpatchRange *range) { g_slice_free (IpatchRange, range); } /** * ipatch_value_set_range: * @value: a valid GValue of IPATCH_TYPE_RANGE boxed type * @range: Range structure to assign to @value * * Set the range values of a IPATCH_TYPE_RANGE GValue. The @range * structure is copied. */ void ipatch_value_set_range (GValue *value, const IpatchRange *range) { g_return_if_fail (IPATCH_VALUE_HOLDS_RANGE (value)); g_value_set_boxed (value, range); } /** * ipatch_value_set_static_range: * @value: A valid GValue of IPATCH_TYPE_RANGE boxed type * @range: Range structure to assign to @value * * Set the range values of a IPATCH_TYPE_RANGE GValue. This function uses * @range directly and so it should be static, use ipatch_value_set_range() * if the @range value should be duplicated. */ void ipatch_value_set_static_range (GValue *value, IpatchRange *range) { g_return_if_fail (IPATCH_VALUE_HOLDS_RANGE (value)); g_value_set_static_boxed (value, range); } /** * ipatch_value_get_range: * @value: A valid GValue of IPATCH_TYPE_RANGE boxed type * * Get the range structure from a IPATCH_TYPE_RANGE GValue. * * Returns: #IpatchRange structure containing the range values of @value or * %NULL if not set. The returned structure is NOT duplicated and is the * same pointer used in @value. */ IpatchRange * ipatch_value_get_range (const GValue *value) { g_return_val_if_fail (IPATCH_VALUE_HOLDS_RANGE (value), NULL); return ((IpatchRange *)g_value_get_boxed (value)); } GType ipatch_param_spec_range_get_type (void) { static GType spec_type = 0; if (!spec_type) { static const GParamSpecTypeInfo spec_info = { sizeof (IpatchParamSpecRange), 0, NULL, /* instance_init */ G_TYPE_BOXED, /* value type */ NULL, /* finalize */ ipatch_param_spec_range_set_default, ipatch_param_spec_range_validate, ipatch_param_spec_range_values_cmp, }; spec_type = g_param_type_register_static ("IpatchParamSpecRange", &spec_info); } return (spec_type); } static void ipatch_param_spec_range_set_default (GParamSpec *pspec, GValue *value) { IpatchParamSpecRange *range_pspec = IPATCH_PARAM_SPEC_RANGE (pspec); IpatchRange *range; range = ipatch_value_get_range (value); if (!range) { range = ipatch_range_new (0, 0); ipatch_value_set_range (value, range); } range->low = range_pspec->default_low; range->high = range_pspec->default_high; } static gboolean ipatch_param_spec_range_validate (GParamSpec *pspec, GValue *value) { IpatchParamSpecRange *range_pspec = IPATCH_PARAM_SPEC_RANGE (pspec); IpatchRange *range, old_range; range = ipatch_value_get_range (value); if (!range) { range = ipatch_range_new (0, 0); range->low = range_pspec->default_low; range->high = range_pspec->default_high; return (TRUE); } old_range = *range; range->low = CLAMP (range->low, range_pspec->min, range_pspec->max); range->high = CLAMP (range->high, range_pspec->min, range_pspec->max); return (old_range.low != range->low || old_range.high != range->high); } static gint ipatch_param_spec_range_values_cmp (GParamSpec *pspec, const GValue *value1, const GValue *value2) { IpatchRange *range1, *range2; range1 = ipatch_value_get_range (value1); range2 = ipatch_value_get_range (value2); /* either one NULL? */ if (!range1 || !range2) { if (!range1 && !range2) return 0; if (!range1) return -1; return 1; } /* check if low value is not equal */ if (range1->low < range2->low) return -1; if (range1->low > range2->low) return 1; /* low values are equal */ /* check if high values are not equal */ if (range1->high < range2->high) return -1; if (range1->high > range2->high) return 1; /* range is equal */ return 0; } /** * ipatch_param_spec_range: * @name: Property name * @nick: Property nick name * @blurb: Property description blurb * @min: Minimum value for range end points (can be -1 to allow undefined * ranges) * @max: Maximum value for range end points * @default_low: Default value for low endpoint of range * @default_high: Default value for high endpoint of range * @flags: Property flags * * Create a parameter specification for IPATCH_TYPE_RANGE GValues. * * Returns: New range parameter specification. */ GParamSpec * ipatch_param_spec_range (const char *name, const char *nick, const char *blurb, int min, int max, int default_low, int default_high, GParamFlags flags) { IpatchParamSpecRange *range_spec; g_return_val_if_fail (min >= -1 && min <= max, NULL); g_return_val_if_fail (default_low >= min && default_low <= max, NULL); g_return_val_if_fail (default_high >= min && default_high <= max, NULL); /* FIXME - Whats the proper way to create a boxed GParamSpec? */ range_spec = g_param_spec_internal (IPATCH_TYPE_PARAM_RANGE, name, nick, blurb, flags); G_PARAM_SPEC (range_spec)->value_type = IPATCH_TYPE_RANGE; range_spec->min = min; range_spec->max = max; range_spec->default_low = default_low; range_spec->default_high = default_high; return ((GParamSpec *)range_spec); } libinstpatch-1.0.0/libinstpatch/IpatchSF2VoiceCache.c0000644000175000017500000004430211461332142017402 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchSF2VoiceCache.h" #include "IpatchSF2Mod.h" #include "IpatchTypeProp.h" #include "i18n.h" /* SoundFont voice native sample format */ #define VOICE_SAMPLE_FORMAT \ (IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_MONO | IPATCH_SAMPLE_ENDIAN_HOST) static void ipatch_sf2_voice_cache_class_init (IpatchSF2VoiceCacheClass *klass); static void ipatch_sf2_voice_cache_init (IpatchSF2VoiceCache *cache); static void ipatch_sf2_voice_cache_finalize (GObject *gobject); static gpointer parent_class = NULL; static IpatchSF2Voice def_voice; /* default voice structure */ /* default selection info */ static IpatchSF2VoiceSelInfo default_sel_info[] = { { IPATCH_SF2_VOICE_SEL_NOTE }, { IPATCH_SF2_VOICE_SEL_VELOCITY } }; GType ipatch_sf2_voice_cache_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchSF2VoiceCacheClass), NULL, NULL, (GClassInitFunc)ipatch_sf2_voice_cache_class_init, NULL, NULL, sizeof (IpatchSF2VoiceCache), 0, (GInstanceInitFunc)ipatch_sf2_voice_cache_init, }; item_type = g_type_register_static (G_TYPE_OBJECT, "IpatchSF2VoiceCache", &item_info, 0); /* install voice update function type property */ ipatch_type_install_property (g_param_spec_pointer ("sf2voice-update-func", "sf2voice-update-func", "sf2voice-update-func", G_PARAM_READWRITE)); } return (item_type); } static void ipatch_sf2_voice_cache_class_init (IpatchSF2VoiceCacheClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_peek_parent (klass); obj_class->finalize = ipatch_sf2_voice_cache_finalize; /* initialize default voice structure */ def_voice.sample_data = NULL; def_voice.sample_store = NULL; def_voice.sample_size = 0; def_voice.loop_start = 0; def_voice.loop_end = 0; def_voice.rate = 44100; def_voice.root_note = 60; def_voice.fine_tune = 0; def_voice.reserved = 0; ipatch_sf2_gen_array_init (&def_voice.gen_array, FALSE, FALSE); def_voice.mod_list = NULL; def_voice.range_index = 0; /* init in ipatch_sf2_voice_cache_add_voice */ } static void ipatch_sf2_voice_cache_init (IpatchSF2VoiceCache *cache) { cache->sel_info = g_memdup (default_sel_info, sizeof (default_sel_info)); cache->sel_count = 2; /* default for velocity and note selection */ cache->voices = g_array_new (FALSE, FALSE, sizeof (IpatchSF2Voice)); cache->ranges = NULL; /* initialized later */ cache->default_mods = ipatch_sf2_mod_list_duplicate (ipatch_sf2_mod_list_get_default ()); cache->default_loop_type = IPATCH_SAMPLE_LOOP_STANDARD; } static void ipatch_sf2_voice_cache_finalize (GObject *gobject) { IpatchSF2VoiceCache *cache = IPATCH_SF2_VOICE_CACHE (gobject); IpatchSF2Voice *voice; int i; g_free (cache->sel_info); for (i = 0; i < cache->voices->len; i++) { voice = &g_array_index (cache->voices, IpatchSF2Voice, i); if (voice->sample_data) /* -- unref sample data */ g_object_unref (voice->sample_data); if (voice->sample_store) /* -- unref sample store */ g_object_unref (voice->sample_store); if (voice->mod_list) /* free modulators */ ipatch_sf2_mod_list_free (voice->mod_list, TRUE); if (cache->voice_user_data_destroy && voice->user_data) cache->voice_user_data_destroy (voice->user_data); } g_array_free (cache->voices, TRUE); if (cache->ranges) g_array_free (cache->ranges, TRUE); if (cache->default_mods) ipatch_sf2_mod_list_free (cache->default_mods, TRUE); if (cache->user_data_destroy && cache->user_data) cache->user_data_destroy (cache->user_data); if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (gobject); } /** * ipatch_sf2_voice_cache_new: * @info: Array of selection info structures (length should be @sel_count), use * %NULL for default selection info (MIDI note and velocity) * @sel_count: Count of selection ranges for this cache (ignored if @info is * %NULL) * * Create a new SoundFont voice cache object. The @sel_count parameter * defines the number of selection ranges for the cache. Examples of selection * ranges include MIDI note and velocity ranges for a voice. The @info * parameter should be a pointer to an array of selection info structures * which describes each selection type. * * Returns: New SoundFont voice cache with a reference count of 1 which the * caller owns. */ IpatchSF2VoiceCache * ipatch_sf2_voice_cache_new (IpatchSF2VoiceSelInfo *info, int sel_count) { IpatchSF2VoiceCache *cache; g_return_val_if_fail (!info || sel_count > 0, NULL); cache = IPATCH_SF2_VOICE_CACHE (g_object_new (IPATCH_TYPE_SF2_VOICE_CACHE, NULL)); if (info) { g_free (cache->sel_info); cache->sel_info = g_memdup (info, sizeof (IpatchSF2VoiceSelInfo) * sel_count); cache->sel_count = sel_count; } return (cache); } /** * ipatch_sf2_voice_cache_set_default_mods: * @cache: Voice cache * @mods: SoundFont modulator list to use as default (used directly) * * Set the default modulator list for the voice cache. Modulator list is used * directly and the allocation of the list is taken over by the voice cache. */ void ipatch_sf2_voice_cache_set_default_mods (IpatchSF2VoiceCache *cache, GSList *mods) { g_return_if_fail (IPATCH_IS_SF2_VOICE_CACHE (cache)); if (cache->default_mods) ipatch_sf2_mod_list_free (mods, TRUE); cache->default_mods = mods; } /** * ipatch_sf2_voice_cache_add_voice: * @cache: Voice cache to create voice for * * Adds a new initialized voice to a SoundFont voice cache. * * Returns: Newly allocated and initialized SoundFont voice structure. * The sample pointer is set to NULL, generator array is initialized to default * absolute unset values, selection ranges are set to G_MININT-G_MAXINT and * all other fields are initialized to defaults. */ IpatchSF2Voice * ipatch_sf2_voice_cache_add_voice (IpatchSF2VoiceCache *cache) { IpatchSF2Voice *voice; int *ranges; int i; g_return_val_if_fail (IPATCH_IS_SF2_VOICE_CACHE (cache), NULL); /* create range integer array if this is the first voice */ if (!cache->ranges) cache->ranges = g_array_new (FALSE, FALSE, 2 * sizeof (int) * cache->sel_count); g_array_append_val (cache->voices, def_voice); voice = &g_array_index (cache->voices, IpatchSF2Voice, cache->voices->len-1); voice->range_index = cache->ranges->len * cache->sel_count * 2; /* add selection ranges for this voice to range array */ g_array_set_size (cache->ranges, cache->ranges->len + 1); /* initialize ranges to wildcard range */ ranges = &((int *)(cache->ranges->data))[voice->range_index]; for (i = 0; i < cache->sel_count; i++) { ranges[i * 2] = G_MININT; ranges[i * 2 + 1] = G_MAXINT; } return (voice); } /** * ipatch_sf2_voice_cache_set_voice_range: * @cache: Voice cache object * @voice: Voice pointer in cache * @sel_index: Selection index * @low: Range low value * @high: Range high value * * Set a voice selection range. Selection ranges are used for selection criteria * such as MIDI velocity and note ranges. */ void ipatch_sf2_voice_cache_set_voice_range (IpatchSF2VoiceCache *cache, IpatchSF2Voice *voice, guint sel_index, int low, int high) { int *rangep; g_return_if_fail (IPATCH_IS_SF2_VOICE_CACHE (cache)); g_return_if_fail (voice != NULL); g_return_if_fail (sel_index < cache->sel_count); g_return_if_fail (low <= high); rangep = (int *)(cache->ranges->data); rangep[voice->range_index + sel_index * 2] = low; rangep[voice->range_index + sel_index * 2 + 1] = high; } /** * ipatch_sf2_voice_set_sample_data: * @voice: SoundFont voice structure * @sample_data: Sample data to assign to voice * @err: Location to store error info or %NULL to ignore * * Assign sample data to a SoundFont voice. */ void ipatch_sf2_voice_set_sample_data (IpatchSF2Voice *voice, IpatchSampleData *sample_data) { g_return_if_fail (voice != NULL); g_return_if_fail (IPATCH_IS_SAMPLE_DATA (sample_data)); if (voice->sample_data) g_object_unref (voice->sample_data); voice->sample_data = g_object_ref (sample_data); /* ++ ref sample data */ if (voice->sample_store) g_object_unref (voice->sample_store); voice->sample_store = NULL; voice->sample_size = ipatch_sample_data_get_size (voice->sample_data); } /** * ipatch_sf2_voice_cache_sample_data: * @voice: SoundFont voice structure * @err: Location to store error info or %NULL to ignore * * Cache an already assigned sample data object of a voice. The sample data is * cached as 16 bit mono native endian format, if not already cached, and the * new cached sample is assigned to the sample_store field. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set) */ gboolean ipatch_sf2_voice_cache_sample_data (IpatchSF2Voice *voice, GError **err) { g_return_val_if_fail (voice != NULL, FALSE); g_return_val_if_fail (!err || !*err, FALSE); g_return_val_if_fail (voice->sample_data != NULL, FALSE); if (voice->sample_store) g_object_unref (voice->sample_store); /* FIXME - Do we need channel_map per voice? */ /* ++ ref cached sample store for voice */ voice->sample_store = ipatch_sample_data_get_cache_sample (voice->sample_data, VOICE_SAMPLE_FORMAT, IPATCH_SAMPLE_UNITY_CHANNEL_MAP, err); return (voice->sample_store != NULL); } /** * ipatch_sf2_voice_copy: * @dest: Destination voice to copy to (initialized to 0s or already valid) * @src: Source voice to copy from * * Copy a source (@src) voice's information to a destination voice (@dest). * Does not copy selection criteria integers in parent #IpatchSF2VoiceCache * objects. */ void ipatch_sf2_voice_copy (IpatchSF2Voice *dest, IpatchSF2Voice *src) { g_return_if_fail (dest != NULL); g_return_if_fail (src != NULL); if (dest->sample_data) g_object_unref (dest->sample_data); if (dest->sample_store) g_object_unref (dest->sample_store); if (src->sample_data) dest->sample_data = g_object_ref (src->sample_data); else dest->sample_data = NULL; if (src->sample_store) dest->sample_store = g_object_ref (src->sample_store); else dest->sample_store = NULL; dest->sample_size = src->sample_size; dest->loop_start = src->loop_start; dest->loop_end = src->loop_end; dest->rate = src->rate; dest->root_note = src->root_note; dest->fine_tune = src->fine_tune; dest->reserved = src->reserved; dest->gen_array = src->gen_array; dest->mod_list = ipatch_sf2_mod_list_duplicate (src->mod_list); } /** * ipatch_sf2_voice_cache_optimize: * @cache: SoundFont voice cache * * Can be called after all voices have been added to a voice cache. * Will optimize voice cache for use with ipatch_sf2_voice_cache_select(). * NOTE: Currently does nothing, but will in the future.. */ void ipatch_sf2_voice_cache_optimize (IpatchSF2VoiceCache *cache) { /* FIXME */ } /** * ipatch_sf2_voice_cache_select: * @cache: SoundFont voice cache * @select_values: Array of select values which must be the same length as * the voice cache was initialized with. Each selection value is tested * against each voice's selection ranges (use #IPATCH_SF2_VOICE_SEL_WILDCARD * as a wildcard selection value). * @index_array: Voice indexes are stored in this array. * @max_indexes: Maximum number of voices to match. @index_array should be * at least this value in size. * * Stores pointers to voices matching @select_values criteria. * * Returns: Number of indexes stored to @index_array. */ int ipatch_sf2_voice_cache_select (IpatchSF2VoiceCache *cache, int *select_values, guint16 *index_array, guint16 max_indexes) { IpatchSF2Voice *voice; guint16 *indexp = index_array; GArray *voices; int *range_array; int i, count, scount, sv, si, ri; int matches; g_return_val_if_fail (IPATCH_IS_SF2_VOICE_CACHE (cache), 0); g_return_val_if_fail (select_values != NULL, 0); g_return_val_if_fail (index_array != NULL, 0); g_return_val_if_fail (max_indexes > 0, 0); /* OPTME - This could be optimized, currently just iterates over array */ count = cache->voices->len; voices = cache->voices; scount = cache->sel_count; if (!cache->ranges) /* no ranges means no voices, return */ return (0); range_array = (int *)(cache->ranges->data); /* array will not change */ /* loop over all voices */ for (i = 0, matches = 0; i < count && matches < max_indexes; i++) { voice = &g_array_index (voices, IpatchSF2Voice, i); /* loop over selection ranges */ for (si = 0, ri = voice->range_index; si < scount; si++, ri += 2) { sv = select_values[si]; /* break out if no match (not -1 and not in range) */ if (sv != -1 && !(sv >= range_array[ri] && sv <= range_array[ri + 1])) break; } if (si == scount) /* all range selection criteria matched? */ { *indexp = i; /* add voice index to index array */ indexp++; matches++; } } return (matches); } /** * ipatch_sf2_voice_cache_updates: * @cache: Voice cache to get updates for * @select_values: The voice selection criteria to use, should be the same * number of select values as in @cache * @cache_item: Original item @cache was created from * @item: Object for which a property changed (only really makes sense if it is * a dependent item of @cache_item). * @pspec: Parameter specification of property which changed * @value: The new value of the property * @updates: Output array to store updates to * @max_updates: Size of @updates array (max possible update values). * * This function is used to re-calculate SoundFont effect generators for a * single object property change. Useful for real time effect changes. * * Returns: Number of updates stored to @updates array or -1 if not handled * (no handler for the given @item). Will be 0 if no updates required. */ int ipatch_sf2_voice_cache_update (IpatchSF2VoiceCache *cache, int *select_values, GObject *cache_item, GObject *item, GParamSpec *pspec, const GValue *value, IpatchSF2VoiceUpdate *updates, guint max_updates) { IpatchSF2VoiceCacheUpdateHandler handler; g_return_val_if_fail (IPATCH_IS_SF2_VOICE_CACHE (cache), -1); g_return_val_if_fail (select_values != NULL, -1); g_return_val_if_fail (G_IS_OBJECT (cache_item), -1); g_return_val_if_fail (G_IS_OBJECT (item), -1); g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), -1); g_return_val_if_fail (G_IS_VALUE (value), -1); g_return_val_if_fail (updates != NULL, -1); ipatch_type_get (G_OBJECT_TYPE (cache_item), "sf2voice-update-func", &handler, NULL); if (!handler) return (-1); if (max_updates == 0) return (0); return handler (cache, select_values, cache_item, item, pspec, value, updates, max_updates); } /* Debugging function to dump a voice cache to stdout */ void _ipatch_sf2_voice_cache_dump (IpatchSF2VoiceCache *cache, int start, int count) { IpatchSF2Voice *voice; char *selnames[] = { "Note", "Vel", "AftTch", "CC" }; int *range; int i, si; g_return_if_fail (IPATCH_IS_SF2_VOICE_CACHE (cache)); if (start == 0) { printf ("Voice cache selection criteria:\n"); for (i = 0; i < cache->sel_count; i++) { switch (cache->sel_info[i].type) { case IPATCH_SF2_VOICE_SEL_NOTE: printf ("%d: Note\n", i); break; case IPATCH_SF2_VOICE_SEL_VELOCITY: printf ("%d: Velocity\n", i); break; case IPATCH_SF2_VOICE_SEL_AFTER_TOUCH: printf ("%d: After touch\n", i); break; case IPATCH_SF2_VOICE_SEL_MIDI_CC: printf ("%d: CC %d\n", i, cache->sel_info[i].param1); break; } } } for (i = start; i < start + count && i < cache->voices->len; i++) { voice = &g_array_index (cache->voices, IpatchSF2Voice, i); printf ("%d (S:%d,SD:%p,SS:%p) L:%d-%d R:%d RN:%d T:%d\n ", i, voice->sample_size, voice->sample_data, voice->sample_store, voice->loop_start, voice->loop_end, voice->rate, voice->root_note, voice->fine_tune); range = &g_array_index (cache->ranges, int, voice->range_index); for (si = 0; si < cache->sel_count; si++) { printf (" %s: %d-%d", selnames[cache->sel_info[si].type], range[si * 2], range[si * 2 + 1]); } printf ("\n"); } } void _ipatch_sf2_voice_cache_dump_select (IpatchSF2VoiceCache *cache, ...) { IpatchSF2Voice *voice; va_list args; char *selnames[] = { "Note", "Vel", "AftTch", "CC" }; guint16 indexes[256]; int selvals[8]; int *range; int count, i, vindex, si; va_start (args, cache); for (i = 0; i < cache->sel_count; i++) selvals[i] = va_arg (args, int); va_end (args); count = ipatch_sf2_voice_cache_select (cache, selvals, indexes, G_N_ELEMENTS (indexes)); printf ("%d voices matched:\n", count); for (i = 0; i < count; i++) { vindex = indexes[i]; voice = &g_array_index (cache->voices, IpatchSF2Voice, vindex); printf ("%d (S:%d,SD:%p,SS:%p) L:%d-%d R:%d RN:%d T:%d\n ", vindex, voice->sample_size, voice->sample_data, voice->sample_store, voice->loop_start, voice->loop_end, voice->rate, voice->root_note, voice->fine_tune); range = &g_array_index (cache->ranges, int, voice->range_index); for (si = 0; si < cache->sel_count; si++) { printf (" %s: %d-%d", selnames[cache->sel_info[si].type], range[si * 2], range[si * 2 + 1]); } printf ("\n"); } } libinstpatch-1.0.0/libinstpatch/IpatchSF2VoiceCache.h0000644000175000017500000002072611461332142017413 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2VoiceCache * @short_description: SoundFont voice cache object * @see_also: * @stability: Stable * * This is used for pre-processing instruments into arrays of SoundFont * compatible voices which can then be accessed very quickly without * multi-thread locking or other issues (during synthesis for example). */ #ifndef __IPATCH_SF2_VOICE_CACHE_H__ #define __IPATCH_SF2_VOICE_CACHE_H__ #include #include #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchSF2VoiceCache IpatchSF2VoiceCache; typedef struct _IpatchSF2VoiceCacheClass IpatchSF2VoiceCacheClass; typedef struct _IpatchSF2Voice IpatchSF2Voice; typedef struct _IpatchSF2VoiceUpdate IpatchSF2VoiceUpdate; typedef struct _IpatchSF2VoiceSelInfo IpatchSF2VoiceSelInfo; #define IPATCH_TYPE_SF2_VOICE_CACHE (ipatch_sf2_voice_cache_get_type ()) #define IPATCH_SF2_VOICE_CACHE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_VOICE_CACHE, \ IpatchSF2VoiceCache)) #define IPATCH_SF2_VOICE_CACHE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_VOICE_CACHE, \ IpatchSF2VoiceCacheClass)) #define IPATCH_IS_SF2_VOICE_CACHE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_VOICE_CACHE)) #define IPATCH_IS_SF2_VOICE_CACHE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2_VOICE_CACHE)) /** * IpatchSF2VoiceCacheItemFunc: * @cache: Voice cache * @item: Item which voice cache is dependent on * * A callback function type which is called during voice cache population * for each item which the voice cache is dependent on. This can be useful * for determining when a voice cache needs to be updated or for real time * effects. */ typedef void (*IpatchSF2VoiceCacheItemFunc)(IpatchSF2VoiceCache *cache, GObject *item); /* SoundFont voice cache object */ struct _IpatchSF2VoiceCache { GObject parent_instance; IpatchSF2VoiceSelInfo *sel_info; /* array of selection criteria info */ int sel_count; /* count of selection ranges per voice (integer pairs) */ GArray *voices; /* array of IpatchSF2Voice structures */ GArray *ranges; /* array of selection integer pairs for each voice */ GSList *default_mods; /* default modulators */ /* default loop type which can be used for objects that don't define it */ IpatchSampleLoopType default_loop_type; /* dependent item callback function */ IpatchSF2VoiceCacheItemFunc item_func; gpointer item_func_data; /* user defined data used by item_func */ /* IpatchSF2VoiceCache user defined */ gpointer user_data; /* Arbitrary data defined by IpatchSF2VoiceCache user */ GDestroyNotify user_data_destroy; /* Optional callback to destroy user_data */ GDestroyNotify voice_user_data_destroy; /* Optional callback to destroy user_data in each voice */ }; struct _IpatchSF2VoiceCacheClass { GObjectClass parent_class; }; /* a SoundFont voice */ struct _IpatchSF2Voice { /* Set by SF2VoiceCache converter via ipatch_sf2_voice_set_sample_data() */ IpatchSampleData *sample_data; /* sample data for voice */ IpatchSampleStore *sample_store; /* Cached store */ guint32 sample_size; /* size of sample in frames */ /* Set by SF2VoiceCache converter */ guint32 loop_start; /* loop start offset (in samples) */ guint32 loop_end; /* loop end offset (in samples, 1st sample after loop) */ guint32 rate; /* sample rate */ guint8 root_note; /* MIDI root note of sample */ gint8 fine_tune; /* fine tune (in cents, -99 - 99) */ guint16 reserved; /* reserved (should be 0) */ IpatchSF2GenArray gen_array; /* generator effect values */ GSList *mod_list; /* modulator list */ /* IpatchSF2VoiceCache user defined */ gpointer user_data; /* Arbitrary data defined by IpatchSF2VoiceCache user */ /* Set internally */ int range_index; /* index in ranges array (int *) to first selection range */ }; /* a voice parameter update (used for realtime effects) */ struct _IpatchSF2VoiceUpdate { guint16 voice; /* index of voice with parameter to update */ union /* new value for parameter */ { gint16 ival; guint16 uval; }; guint8 genid; /* if type == IPATCH_SF2_VOICE_UPDATE_GEN: id of gen */ guint8 reserved[3]; /* padding to 4 bytes */ }; /** * IpatchSF2VoiceCacheUpdateHandler: * @cache: Voice cache to get updates for * @select_values: The voice selection criteria to use, should be the same * number of select values as in @cache * @cache_item: Original item @cache was created from * @item: Object for which a property changed * @pspec: Parameter specification of property which changed * @value: The new value of the property * @updates: Output array to store updates to * @max_updates: Size of @updates array (max possible update values). * * Function prototype used to re-calculate SoundFont effect generators for a * single object property change. Useful for real time effect changes. * * Returns: Should return number of updates stored to @updates array. * Will be 0 if no updates required. */ typedef int (*IpatchSF2VoiceCacheUpdateHandler)(IpatchSF2VoiceCache *cache, int *select_values, GObject *cache_item, GObject *item, GParamSpec *pspec, const GValue *value, IpatchSF2VoiceUpdate *updates, guint max_updates); /* voice selection type */ typedef enum { IPATCH_SF2_VOICE_SEL_NOTE, /* MIDI note range */ IPATCH_SF2_VOICE_SEL_VELOCITY, /* MIDI velocity range */ IPATCH_SF2_VOICE_SEL_AFTER_TOUCH, /* MIDI aftertouch range */ IPATCH_SF2_VOICE_SEL_MIDI_CC /* MIDI custom controller (param1: ctrlnum) */ } IpatchSF2VoiceSelType; /* selection info structure */ struct _IpatchSF2VoiceSelInfo { IpatchSF2VoiceSelType type; int param1; int param2; /* currently not used */ }; /* maximum allowed voice selection criteria (MIDI note, velocity, etc) */ #define IPATCH_SF2_VOICE_CACHE_MAX_SEL_VALUES 32 /* value used for wildcard selection */ #define IPATCH_SF2_VOICE_SEL_WILDCARD (G_MININT) /* For voice cache propagation methods to declare dependent items */ #define ipatch_sf2_voice_cache_declare_item(cache, item) \ if (cache->item_func) cache->item_func (cache, item) /* Macro for retrieving a voice pointer from a cache */ #define IPATCH_SF2_VOICE_CACHE_GET_VOICE(cache, index) \ (&g_array_index (cache->voices, IpatchSF2Voice, index)) GType ipatch_sf2_voice_cache_get_type (void); IpatchSF2VoiceCache *ipatch_sf2_voice_cache_new (IpatchSF2VoiceSelInfo *info, int sel_count); void ipatch_sf2_voice_cache_set_default_mods (IpatchSF2VoiceCache *cache, GSList *mods); IpatchSF2Voice *ipatch_sf2_voice_cache_add_voice (IpatchSF2VoiceCache *cache); void ipatch_sf2_voice_cache_set_voice_range (IpatchSF2VoiceCache *cache, IpatchSF2Voice *voice, guint sel_index, int low, int high); void ipatch_sf2_voice_set_sample_data (IpatchSF2Voice *voice, IpatchSampleData *sample_data); gboolean ipatch_sf2_voice_cache_sample_data (IpatchSF2Voice *voice, GError **err); void ipatch_sf2_voice_copy (IpatchSF2Voice *dest, IpatchSF2Voice *src); void ipatch_sf2_voice_cache_optimize (IpatchSF2VoiceCache *cache); int ipatch_sf2_voice_cache_select (IpatchSF2VoiceCache *cache, int *select_values, guint16 *index_array, guint16 max_indexes); int ipatch_sf2_voice_cache_update (IpatchSF2VoiceCache *cache, int *select_values, GObject *cache_item, GObject *item, GParamSpec *pspec, const GValue *value, IpatchSF2VoiceUpdate *updates, guint max_updates); #endif libinstpatch-1.0.0/libinstpatch/IpatchUnit_DLS.h0000644000175000017500000000371611461332142016530 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchUnit_DLS * @short_description: Unit types and conversions for DLS * @see_also: * @stability: Stable */ #ifndef __IPATCH_UNIT_DLS_H__ #define __IPATCH_UNIT_DLS_H__ #include #include /* Value for 0 seconds in DLS absolute time (a degenerate case) */ #define IPATCH_UNIT_DLS_ABS_TIME_0SECS 0x80000000L int ipatch_unit_dls_class_convert (guint16 src_units, const GValue *src_val); double ipatch_unit_dls_percent_to_percent (int dls_percent); int ipatch_unit_percent_to_dls_percent (double percent); double ipatch_unit_dls_gain_to_decibels (int dls_gain); int ipatch_unit_decibels_to_dls_gain (double db); double ipatch_unit_dls_abs_time_to_seconds (int dls_abs_time); int ipatch_unit_seconds_to_dls_abs_time (double seconds); double ipatch_unit_dls_rel_time_to_time_cents (int dls_rel_time); int ipatch_unit_time_cents_to_dls_rel_time (double time_cents); double ipatch_unit_dls_abs_pitch_to_hertz (int dls_abs_pitch); int ipatch_unit_hertz_to_dls_abs_pitch (double hertz); double ipatch_unit_dls_rel_pitch_to_cents (int dls_rel_pitch); int ipatch_unit_cents_to_dls_rel_pitch (double cents); #endif libinstpatch-1.0.0/libinstpatch/IpatchPaste.c0000644000175000017500000012736511461332142016165 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "misc.h" #include "IpatchPaste.h" #include "IpatchBase.h" #include "IpatchConverter.h" #include "IpatchContainer.h" #include "IpatchTypeProp.h" #include "IpatchVirtualContainer.h" #include "builtin_enums.h" #include "marshals.h" #include "ipatch_priv.h" #include "i18n.h" #include "util.h" typedef struct { IpatchPasteTestFunc test_func; IpatchPasteExecFunc exec_func; int flags; } PasteHandler; /* info for an item add operation */ typedef struct { IpatchItem *additem; /* item to add */ IpatchContainer *parent; /* parent to add additem to */ IpatchItem *conflict; /* conflict item (if any) */ IpatchPasteChoice choice; /* choice of how to handle conflict */ } AddItemBag; /* info for an item link operation */ typedef struct { IpatchItem *from; /* object to link from (set property) */ IpatchItem *to; /* object to link to */ } LinkItemBag; static gint handler_priority_GCompareFunc (gconstpointer a, gconstpointer b); static void ipatch_paste_class_init (IpatchPasteClass *klass); static void ipatch_paste_init (IpatchPaste *paste); static void ipatch_paste_finalize (GObject *gobject); static guint resolve_hash_func (gconstpointer key); static gboolean resolve_equal_func (gconstpointer a, gconstpointer b); static void resolve_key_destroy_func (gpointer data); static guint check_hash_func (gconstpointer key); static gboolean check_equal_func (gconstpointer a, gconstpointer b); static void check_item_conflicts_GHFunc (gpointer key, gpointer value, gpointer user_data); static IpatchItem *paste_copy_link_func_deep (IpatchItem *item, IpatchItem *link, gpointer user_data); G_LOCK_DEFINE_STATIC (paste_handlers); static GSList *paste_handlers = NULL; /* list of PasteHandler structs */ static gpointer parent_class = NULL; /** * ipatch_register_paste_handler: * @test_func: Callback function to test if a paste operation is handled * @exec_func: Paste execution function * @flags: Currently just a value from #IpatchPastePriority or 0 for default * priority. * * Registers a handler function to paste objects for * which @test_func returns %TRUE. */ void ipatch_register_paste_handler (IpatchPasteTestFunc test_func, IpatchPasteExecFunc exec_func, int flags) { PasteHandler *handler; g_return_if_fail (test_func != NULL); g_return_if_fail (exec_func != NULL); if (flags == 0) flags = IPATCH_PASTE_PRIORITY_DEFAULT; handler = g_new (PasteHandler, 1); handler->test_func = test_func; handler->exec_func = exec_func; handler->flags = flags; G_LOCK (paste_handlers); paste_handlers = g_slist_insert_sorted (paste_handlers, handler, handler_priority_GCompareFunc); G_UNLOCK (paste_handlers); } static gint handler_priority_GCompareFunc (gconstpointer a, gconstpointer b) { PasteHandler *ahandler = (PasteHandler *)a, *bhandler = (PasteHandler *)b; /* priority sorts from highest to lowest so subtract a from b */ return ((bhandler->flags & IPATCH_PASTE_FLAGS_PRIORITY_MASK) - (ahandler->flags & IPATCH_PASTE_FLAGS_PRIORITY_MASK)); } /** * ipatch_simple_paste: * @dest: Destination item to paste to * @src: Source item * @err: Location to store error info or %NULL * * Simple paste of a single @src item to @dest item. Any conflicts are * ignored which means that conflicts will remain and should be resolved. * * Returns: %TRUE on success, %FALSE otherwise in which case @err should be set. */ gboolean ipatch_simple_paste (IpatchItem *dest, IpatchItem *src, GError **err) { IpatchPaste *paste; g_return_val_if_fail (IPATCH_IS_ITEM (dest), FALSE); g_return_val_if_fail (IPATCH_IS_ITEM (src), FALSE); g_return_val_if_fail (!err || !*err, FALSE); paste = ipatch_paste_new (); /* ++ ref new object */ /* setup object paste */ if (!ipatch_paste_objects (paste, dest, src, err)) { /* object paste failed */ g_object_unref (paste); /* -- unref paste object */ return (FALSE); } /* finish paste operation */ if (!ipatch_paste_finish (paste, err)) { /* finish paste failed */ g_object_unref (paste); /* -- unref paste object */ return (FALSE); } g_object_unref (paste); return (TRUE); } /** * ipatch_is_paste_possible: * @dest: Destination item * @src: Source item * * Check if the given items can be pasted from @src to @dest. * * Returns: %TRUE if paste is possible, %FALSE otherwise */ gboolean ipatch_is_paste_possible (IpatchItem *dest, IpatchItem *src) { PasteHandler *handler; GSList *p; g_return_val_if_fail (IPATCH_IS_ITEM (dest), FALSE); g_return_val_if_fail (IPATCH_IS_ITEM (src), FALSE); G_LOCK (paste_handlers); for (p = paste_handlers; p; p = p->next) { handler = (PasteHandler *)(p->data); if (handler->test_func (dest, src)) break; } G_UNLOCK (paste_handlers); return (p != NULL); } GType ipatch_paste_get_type (void) { static GType obj_type = 0; if (!obj_type) { static const GTypeInfo obj_info = { sizeof (IpatchPasteClass), NULL, NULL, (GClassInitFunc)ipatch_paste_class_init, NULL, NULL, sizeof (IpatchPaste), 0, (GInstanceInitFunc)ipatch_paste_init, }; obj_type = g_type_register_static (G_TYPE_OBJECT, "IpatchPaste", &obj_info, 0); /* register the default handler */ ipatch_register_paste_handler (ipatch_paste_default_test_func, ipatch_paste_default_exec_func, 0); } return (obj_type); } static void ipatch_paste_class_init (IpatchPasteClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_peek_parent (klass); obj_class->finalize = ipatch_paste_finalize; } static void ipatch_paste_init (IpatchPaste *paste) { paste->add_hash = g_hash_table_new (NULL, NULL); } /* function called when a patch is being destroyed */ static void ipatch_paste_finalize (GObject *gobject) { IpatchPaste *paste = IPATCH_PASTE (gobject); AddItemBag *addbag; LinkItemBag *linkbag; GSList *p; g_hash_table_destroy (paste->add_hash); for (p = paste->add_list; p; p = p->next) { addbag = (AddItemBag *)(p->data); g_object_unref (addbag->additem); g_object_unref (addbag->parent); if (addbag->conflict) g_object_unref (addbag->conflict); } for (p = paste->link_list; p; p = p->next) { linkbag = (LinkItemBag *)(p->data); g_object_unref (linkbag->from); g_object_unref (linkbag->to); } if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (gobject); } /* * ipatch_paste_new: * * Create a new paste object for patch object paste operations. * * Returns: New paste object with refcount of 1 which caller owns. */ IpatchPaste * ipatch_paste_new (void) { return (IPATCH_PASTE (g_object_new (IPATCH_TYPE_PASTE, NULL))); } /** * ipatch_paste_objects: * @paste: Paste object * @dest: Destination item of paste * @src: Source item of paste * @err: Location to store error info or %NULL * * Setup a paste operation. Multiple item pastes can occur for the same * @paste instance. Existing duplicated items are used if present (example: * if multiple instruments are pasted between different IpatchBase objects * and they link to the same sample, they will both use the same sample in * the final paste operation). * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set) */ gboolean ipatch_paste_objects (IpatchPaste *paste, IpatchItem *dest, IpatchItem *src, GError **err) { PasteHandler *handler = NULL; GSList *p; g_return_val_if_fail (IPATCH_IS_PASTE (paste), FALSE); g_return_val_if_fail (IPATCH_IS_ITEM (dest), FALSE); g_return_val_if_fail (IPATCH_IS_ITEM (src), FALSE); g_return_val_if_fail (!err || !*err, FALSE); G_LOCK (paste_handlers); for (p = paste_handlers; p; p = p->next) { handler = (PasteHandler *)(p->data); if (handler->test_func (dest, src)) break; } G_UNLOCK (paste_handlers); if (!p) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNHANDLED_CONVERSION, _("Pasting object of type %s to %s is unsupported"), G_OBJECT_TYPE_NAME (src), G_OBJECT_TYPE_NAME (dest)); return (FALSE); } return (handler->exec_func (paste, dest, src, err)); } /* hash key used by ipatch_paste_resolve */ typedef struct { /* NOTE: item and parent are ref'd by paste->add_list, no need here */ IpatchItem *item; /* item for these property values */ IpatchContainer *parent; /* parent of item (or proposed parent) */ GValueArray *valarray; /* array of all of item's unique prop. values */ GParamSpec **pspecs; /* parameter specs for these properties (NULL term.) */ guint8 index; /* index to first value/pspec of this unique group */ guint8 count; /* # of values/pspecs in this unique prop group */ guint8 free_valarray; /* boolean, TRUE if hash should free valarray */ } ResolveHashKey; /* bag used for passing multiple vars to check_item_conflicts_GHFunc */ typedef struct { IpatchPaste *paste; GHashTable *confl_hash; IpatchPasteResolveFunc resolve_func; gboolean cancel; } CheckBag; /** * ipatch_paste_resolve: * @paste: Paste object * @resolve_func: Resolve callback function which is invoked for each conflict. * @user_data: User defined data to pass to @resolve_func. * * This function is used to make choices as to how conflicts are resolved. * Conflicting objects are those with identical unique property values. For * each conflicting object that would result from a paste, the @resolve_func is * called allowing a choice to be made as to how it is handled. The default * choice is to ignore the duplicate, resulting in conflicting objects. * This function can be executed multiple times, the choices are only executed * once ipatch_paste_finish() is called. * * Returns: %TRUE on success, %FALSE if operation was canceled (@resolve_func * returned #IPATCH_PASTE_CHOICE_CANCEL). */ gboolean ipatch_paste_resolve (IpatchPaste *paste, IpatchPasteResolveFunc resolve_func, gpointer user_data) { GHashTable *confl_hash; /* hash of add item unique property values */ GHashTable *check_hash; /* hash of parent children to check */ GParamSpec **pspecs, **ps; AddItemBag *addbag, *confl_addbag; ResolveHashKey *key, skey; CheckBag checkbag; GValueArray *valarray; gboolean free_valarray; guint32 groups; GSList *p; int i, lastbit, count, index, choice; g_return_val_if_fail (IPATCH_IS_PASTE (paste), FALSE); g_return_val_if_fail (resolve_func != NULL, FALSE); /* create conflict hash, we try and increase performance by hashing items and their unique property values (rather than having to compare every item to every other possible conflicting item) */ confl_hash = g_hash_table_new_full (resolve_hash_func, resolve_equal_func, resolve_key_destroy_func, NULL); /* hash of Parent:ChildType to check for conflicts. Uses existing ResolveHashKey structures. */ check_hash = g_hash_table_new (check_hash_func, check_equal_func); /* add paste items to hash and detect conflicts with other paste items */ for (p = paste->add_list; p; p = p->next) { addbag = (AddItemBag *)(p->data); /* get item's unique property values (if any) */ valarray = ipatch_item_get_unique_props (addbag->additem); if (!valarray) continue; /* no unique props? skip */ free_valarray = TRUE; /* get corresponding property param specs and group bits */ pspecs = ipatch_item_type_get_unique_specs (G_OBJECT_TYPE (addbag->additem), &groups); if (!pspecs) /* should never happen! */ { g_value_array_free (valarray); continue; } lastbit = (groups & 1); count = 0; index = 0; /* loop over unique property groups */ for (i = 0, ps = pspecs; ; i++, ps++, groups >>= 1) { if (!*ps || lastbit != (groups & 1)) /* last val or end of group? */ { /* initialize the static hash key */ skey.valarray = valarray; skey.item = addbag->additem; skey.parent = addbag->parent; skey.pspecs = pspecs; skey.index = index; skey.count = count; /* check for conflict within paste items */ confl_addbag = g_hash_table_lookup (confl_hash, &skey); if (!confl_addbag) /* no conflict? */ { /* add to conflict detect hash */ key = g_new (ResolveHashKey, 1); *key = skey; /* copy static key to allocated key */ key->free_valarray = free_valarray; /* free once only */ g_hash_table_insert (confl_hash, key, addbag); free_valarray = FALSE; /* hash will free it */ /* Parent:ItemType not yet added to check_hash? */ if (!g_hash_table_lookup (check_hash, key)) g_hash_table_insert (check_hash, key, addbag); if (!*ps) break; /* NULL pspec terminator? */ } else /* we have a conflict, tell caller about it */ { choice = resolve_func (paste, confl_addbag->additem, addbag->additem); /* cancel requested? */ if (choice == IPATCH_PASTE_CHOICE_CANCEL) { g_hash_table_destroy (confl_hash); g_hash_table_destroy (check_hash); return (FALSE); } addbag->conflict = g_object_ref (confl_addbag->additem); addbag->choice = choice; } index = i; /* next group index */ count = 1; /* reset group count */ lastbit = (groups & 1); } else count++; /* not end of group, increment current val count */ } /* if valarray was not used in hash, then free it here */ if (free_valarray) g_value_array_free (valarray); } /* bag for passing multilple variables to hash foreach function */ checkbag.paste = paste; checkbag.confl_hash = confl_hash; checkbag.resolve_func = resolve_func; checkbag.cancel = FALSE; g_hash_table_foreach (check_hash, check_item_conflicts_GHFunc, &checkbag); g_hash_table_destroy (confl_hash); g_hash_table_destroy (check_hash); if (checkbag.cancel) return (FALSE); return (TRUE); } /* hash function used for detecting conflicting items quickly (in theory) */ static guint resolve_hash_func (gconstpointer key) { ResolveHashKey *rkey = (ResolveHashKey *)key; GValueArray *valarray; GValue *value; guint hashval; int i, end; /* hash the parent, item type and group value index */ hashval = GPOINTER_TO_UINT (rkey->parent); hashval += G_OBJECT_TYPE (rkey->item); i = rkey->index; hashval += i; valarray = rkey->valarray; end = i + rkey->count; /* value end index */ for (; i < end; i++) /* hash the property values for this group */ { value = g_value_array_get_nth (valarray, i); hashval += ipatch_util_value_hash (value); } return (hashval); } /* hash key compare func for ResolveHashKeys */ static gboolean resolve_equal_func (gconstpointer a, gconstpointer b) { ResolveHashKey *akey = (ResolveHashKey *)a, *bkey = (ResolveHashKey *)b; GValue *aval, *bval; int i, end; /* value index, parent or item type not the same? */ if (akey->index != bkey->index || akey->parent != bkey->parent || G_OBJECT_TYPE (akey->item) != G_OBJECT_TYPE (bkey->item)) return (FALSE); i = akey->index; end = i + akey->count; for (; i < end; i++) /* see if the property values are the same */ { aval = g_value_array_get_nth (akey->valarray, i); bval = g_value_array_get_nth (bkey->valarray, i); if (g_param_values_cmp (akey->pspecs[i], aval, bval) != 0) return (FALSE); } return (TRUE); /* keys match (conflict) */ } static void resolve_key_destroy_func (gpointer data) { ResolveHashKey *rkey = (ResolveHashKey *)data; if (rkey->free_valarray) g_value_array_free (rkey->valarray); g_free (rkey); } /* hash function used for hashing parent:ItemTypes to check later for duplicates. They are hashed so that we only have to check the given children once. */ static guint check_hash_func (gconstpointer key) { ResolveHashKey *rkey = (ResolveHashKey *)key; return (GPOINTER_TO_UINT (rkey->parent) + G_OBJECT_TYPE (rkey->item)); } /* hash key compare func for Parent:ItemType check hash */ static gboolean check_equal_func (gconstpointer a, gconstpointer b) { ResolveHashKey *akey = (ResolveHashKey *)a, *bkey = (ResolveHashKey *)b; return (akey->parent == bkey->parent && G_OBJECT_TYPE (akey->item) == G_OBJECT_TYPE (bkey->item)); } /* check for conflicts in existing items using Parent:ItemType hash */ static void check_item_conflicts_GHFunc (gpointer key, gpointer value, gpointer user_data) { CheckBag *checkbag = (CheckBag *)user_data; ResolveHashKey *rkey = (ResolveHashKey *)key; ResolveHashKey skey; /* static key */ IpatchPasteResolveFunc resolve_func = (IpatchPasteResolveFunc)user_data; AddItemBag *confl_addbag; GParamSpec **pspecs, **ps; GValueArray *valarray; guint32 groups; IpatchIter iter; IpatchItem *item; IpatchList *list; int i, lastbit, count, index, choice; if (checkbag->cancel) return; /* operation cancelled? */ /* get children of specific type for parent */ list = ipatch_container_get_children (rkey->parent, G_OBJECT_TYPE (rkey->item)); ipatch_list_init_iter (list, &iter); /* get property param specs and group bits (all items are of same type) */ pspecs = ipatch_item_type_get_unique_specs (G_OBJECT_TYPE (rkey->item), &groups); /* loop over container children */ for (item = ipatch_item_first (&iter); item; item = ipatch_item_next (&iter)) { /* get item's unique property values */ valarray = ipatch_item_get_unique_props (item); if (!valarray) continue; /* no unique props? skip (shouldn't happen) */ lastbit = (groups & 1); count = 0; index = 0; /* loop over unique property groups */ for (i = 0, ps = pspecs; ; i++, ps++, groups >>= 1) { if (!*ps || lastbit != (groups & 1)) /* last val or end of group? */ { /* initialize the static hash key */ skey.valarray = valarray; skey.item = item; skey.parent = rkey->parent; skey.pspecs = pspecs; skey.index = index; skey.count = count; /* check for conflict within paste items */ confl_addbag = g_hash_table_lookup (checkbag->confl_hash, &skey); if (confl_addbag) /* conflict? */ { choice = resolve_func (checkbag->paste, item, confl_addbag->additem); /* cancel requested? */ if (choice == IPATCH_PASTE_CHOICE_CANCEL) { checkbag->cancel = TRUE; g_value_array_free (valarray); g_object_unref (list); /* -- unref list */ return; } confl_addbag->conflict = g_object_ref (item); confl_addbag->choice = choice; } index = i; /* next group index */ count = 1; /* reset group count */ lastbit = (groups & 1); } else count++; /* not end of group, increment current val count */ g_value_array_free (valarray); } /* for each unique parameter group */ } /* for container items */ g_object_unref (list); /* -- unref list */ } /** * ipatch_paste_finish: * @paste: Paste object * @err: Location to store error info or %NULL * * Complete the paste operation(s) (add/link objects). Conflicts are handled * for the choices made with ipatch_paste_resolve() (defaults to ignore which * will result in conflicts). * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_paste_finish (IpatchPaste *paste, GError **err) { AddItemBag *addbag; LinkItemBag *linkbag; GSList *p; g_return_val_if_fail (IPATCH_IS_PASTE (paste), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* add items in add list */ for (p = paste->add_list; p; p = p->next) { addbag = (AddItemBag *)(p->data); if (addbag->choice == IPATCH_PASTE_CHOICE_IGNORE) ipatch_container_add (addbag->parent, addbag->additem); /* FIXME - Need to implement replace operation */ } /* link items in link list */ for (p = paste->link_list; p; p = p->next) { linkbag = (LinkItemBag *)(p->data); g_object_set (linkbag->from, "link-item", linkbag->to, NULL); } return (TRUE); } /** * ipatch_paste_get_add_list: * @paste: Paste object * * Get list of objects to add with paste operation. This can be called * after ipatch_paste_objects() or after ipatch_paste_finish(). In the first * case the objects have not yet been added, in the second case the paste * operation has been completed. The list of objects returned are only those * which are not conflicting or a choice of #IPATCH_PASTE_CHOICE_IGNORE or * #IPATCH_PASTE_CHOICE_REPLACE was selected. * * Returns: List of objects being added with paste operation or %NULL if none. * Returned list has a refcount of 1 which the caller owns, unref when done. */ IpatchList * ipatch_paste_get_add_list (IpatchPaste *paste) { IpatchList *retlist; GList *newlist = NULL; AddItemBag *bag; GSList *p; g_return_val_if_fail (IPATCH_IS_PASTE (paste), NULL); for (p = paste->add_list; p; p = p->next) { bag = (AddItemBag *)(p->data); if (bag->choice == IPATCH_PASTE_CHOICE_IGNORE || bag->choice == IPATCH_PASTE_CHOICE_REPLACE) newlist = g_list_prepend (newlist, g_object_ref (bag->additem)); } if (newlist) { retlist = ipatch_list_new (); /* ++ ref list */ retlist->items = g_list_reverse (newlist); /* reverse the list, since we prepended */ return (retlist); /* !! caller takes over reference */ } return (NULL); } /** * ipatch_paste_object_add: * @paste: Paste object * @additem: New item to add. * @parent: Container to parent @additem to. * @orig: Original item associated with @additem (if duplicated for example). * If supplied then an association between the @orig object and the @additem * will be made, and any references to @orig of subsequent deep duplications * will use the new @additem instead. * * Used by #IpatchPasteExecFunc handlers. Adds an object addition operation * to a paste instance. */ void ipatch_paste_object_add (IpatchPaste *paste, IpatchItem *additem, IpatchContainer *parent, IpatchItem *orig) { AddItemBag *addbag; GSList *dummy; g_return_if_fail (IPATCH_IS_PASTE (paste)); g_return_if_fail (IPATCH_IS_ITEM (additem)); g_return_if_fail (IPATCH_IS_CONTAINER (parent)); g_return_if_fail (!orig || IPATCH_IS_ITEM (orig)); /* create a bag to hold the item add info and add to add_list */ addbag = g_new (AddItemBag, 1); addbag->additem = g_object_ref (additem); addbag->parent = g_object_ref (parent); addbag->conflict = NULL; addbag->choice = IPATCH_PASTE_CHOICE_IGNORE; if (paste->add_list_last) { dummy = g_slist_append (paste->add_list_last, addbag); paste->add_list_last = paste->add_list_last->next; } else /* Empty list */ { paste->add_list = g_slist_append (paste->add_list, addbag); paste->add_list_last = paste->add_list; } /* set up an association to the original item */ if (orig) g_hash_table_insert (paste->add_hash, orig, addbag); } /** * ipatch_paste_object_add_duplicate: * @paste: Paste object * @item: Item to duplicate and add * @parent: Container to parent duplicated item to. * * Used by #IpatchPasteExecFunc handlers. Duplicates an item and adds an * addition operation to a paste instance. Useful for duplicating an object * within the same IpatchBase parent. For this reason the duplicated item is * automatically forced to be unique and no association is added for @item to * the new duplicate. * * Returns: The new duplicate of @item (no reference added for caller). */ IpatchItem * ipatch_paste_object_add_duplicate (IpatchPaste *paste, IpatchItem *item, IpatchContainer *parent) { IpatchItem *dup; g_return_val_if_fail (IPATCH_IS_PASTE (paste), NULL); g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); g_return_val_if_fail (IPATCH_IS_CONTAINER (parent), NULL); dup = ipatch_item_duplicate (item); /* ++ ref new dup */ /* make unique if requested */ ipatch_container_make_unique (IPATCH_CONTAINER (parent), dup); /* add the object add operation of the duplicated item */ ipatch_paste_object_add (paste, dup, IPATCH_CONTAINER (parent), NULL); g_object_unref (dup); /* -- unref dup object */ return (dup); } /* bag used in ipatch_paste_object_add_duplicate_deep() */ typedef struct { IpatchPaste *paste; IpatchContainer *dest_base; } DupDeepBag; /** * ipatch_paste_object_add_duplicate_deep: * @paste: Paste object * @item: Item to deep duplicate and add. * @parent: Container to parent @item to. * * Used by #IpatchPasteExecFunc handlers. Deep duplicates @item and registers * it as an add to @parent in the @paste operation, also registers all new * duplicated dependencies of @item. Any existing matching duplicate items in * the @paste instance are used rather than duplicating them again. * * Returns: The new duplicate of @item (no reference added for caller). */ IpatchItem * ipatch_paste_object_add_duplicate_deep (IpatchPaste *paste, IpatchItem *item, IpatchContainer *parent) { DupDeepBag bag; IpatchItem *dup; g_return_val_if_fail (IPATCH_IS_PASTE (paste), NULL); g_return_val_if_fail (IPATCH_IS_ITEM (item), NULL); g_return_val_if_fail (IPATCH_IS_CONTAINER (parent), NULL); bag.paste = paste; bag.dest_base = IPATCH_CONTAINER (ipatch_item_get_base (IPATCH_ITEM (parent))); /* ++ ref base */ /* deep duplicate the item (custom link function to use existing dups) */ dup = ipatch_item_duplicate_link_func (item, paste_copy_link_func_deep, &bag); /* add the duplicate object addition operation to paste instance */ ipatch_paste_object_add (paste, dup, parent, item); g_object_unref (dup); /* !! paste instance owns ref */ g_object_unref (bag.dest_base); /* -- unref base */ return (dup); } /* IpatchItemCopyLinkFunc for deep duplicating an object and dependencies but using existing dups in paste instance, if any */ static IpatchItem * paste_copy_link_func_deep (IpatchItem *item, IpatchItem *link, gpointer user_data) { DupDeepBag *dupbag = (DupDeepBag *)user_data; AddItemBag *bag; IpatchItem *dup; if (!link) return (NULL); /* look up link item in paste add hash */ bag = g_hash_table_lookup (dupbag->paste->add_hash, link); /* FIXME - HACK until SoundFont stereo handling is improved. * Reciprocal stereo linking cluster #&*!s things. */ if (IPATCH_IS_SF2_SAMPLE (item)) { if (!bag) return (NULL); /* Re-link the other sample */ ipatch_sf2_sample_set_linked (IPATCH_SF2_SAMPLE (bag->additem), IPATCH_SF2_SAMPLE (item)); return (bag->additem); } if (!bag) /* link not in hash? - Duplicate link and add it to paste. */ { dup = g_object_new (G_OBJECT_TYPE (link), NULL); /* ++ ref new item */ g_return_val_if_fail (dup != NULL, NULL); ipatch_paste_object_add (dupbag->paste, dup, dupbag->dest_base, link); /* recursively copy the link object to the duplicate (finish duping) */ ipatch_item_copy_link_func (dup, link, paste_copy_link_func_deep, user_data); g_object_unref (dup); /* !! paste instance holds a ref */ } else dup = bag->additem; return (dup); } /** * ipatch_paste_object_add_convert: * @paste: Paste object * @conv_type: IpatchConverter derived type to use for conversion. * @item: Item to convert and add. * @parent: Container to parent converted item to. * @item_list: Location to store pointer to the list of added items or %NULL * to ignore. Caller owns a reference to the list. * @err: Location to store error info or %NULL to ignore. * * Used by #IpatchPasteExecFunc handlers. Converts @item using an * #IpatchConverter of type @conv_type and registers * it as an add to @parent in the @paste operation, also registers all new * dependencies of @item. Any existing matching converted item dependencies in * the @paste instance are used rather than duplicating them again. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_paste_object_add_convert (IpatchPaste *paste, GType conv_type, IpatchItem *item, IpatchContainer *parent, IpatchList **item_list, GError **err) { IpatchConverter *converter; IpatchConverterInfo *convinfo; IpatchList *list; GObject *dest; GList *p; g_return_val_if_fail (IPATCH_IS_PASTE (paste), FALSE); g_return_val_if_fail (g_type_is_a (conv_type, IPATCH_TYPE_CONVERTER), FALSE); g_return_val_if_fail (IPATCH_IS_ITEM (item), FALSE); g_return_val_if_fail (IPATCH_IS_CONTAINER (parent), FALSE); g_return_val_if_fail (!err || !*err, FALSE); convinfo = ipatch_lookup_converter_info (conv_type, 0, 0); g_return_val_if_fail (convinfo != NULL, FALSE); converter = IPATCH_CONVERTER (g_object_new (conv_type, NULL)); /* ++ ref */ g_return_val_if_fail (converter != NULL, FALSE); ipatch_converter_add_input (converter, G_OBJECT (item)); /* check if converter needs its destination item supplied */ if (convinfo->dest_count == IPATCH_CONVERTER_COUNT_ONE_OR_MORE || convinfo->dest_count == 1) { dest = g_object_new (convinfo->dest_type, NULL); /* ++ ref */ if (log_if_fail (dest != NULL)) { g_object_unref (converter); /* -- unref converter */ return (FALSE); } ipatch_converter_add_output (converter, dest); g_object_unref (dest); /* -- unref */ } else if (log_if_fail (convinfo->dest_count == 0)) { g_object_unref (converter); /* -- unref converter */ return (FALSE); } if (!ipatch_converter_convert (converter, err)) { g_object_unref (converter); /* -- unref converter */ return (FALSE); } list = ipatch_converter_get_outputs (converter); /* ++ ref list */ g_object_unref (converter); /* -- unref converter */ /* add objects to paste operation */ for (p = list->items; p; p = p->next) ipatch_paste_object_add (paste, IPATCH_ITEM (p->data), parent, item); if (item_list) *item_list = list; /* !! caller takes over reference */ else g_object_unref (list); /* -- unref list */ return (TRUE); } /** * ipatch_paste_object_link: * @paste: Paste object * @from: Item to link from * @to: Item to link to * * Used by #IpatchPasteExecFunc handlers. Registers a link operation. */ void ipatch_paste_object_link (IpatchPaste *paste, IpatchItem *from, IpatchItem *to) { LinkItemBag *linkbag; g_return_if_fail (IPATCH_IS_PASTE (paste)); g_return_if_fail (IPATCH_IS_ITEM (from)); g_return_if_fail (IPATCH_IS_ITEM (to)); /* create a bag to hold the item link info and add to link_list */ linkbag = g_new (LinkItemBag, 1); linkbag->from = g_object_ref (from); linkbag->to = g_object_ref (to); paste->link_list = g_slist_prepend (paste->link_list, linkbag); } /** * ipatch_paste_default_test_func: * @dest: Destination item of paste operation * @src: Source item of paste operation * * Default #IpatchPasteTestFunc. Useful for alternative paste implementations * which would like to chain to the default function (to override only specific * object types for example). * * Returns: %TRUE if paste supported by this handler, %FALSE otherwise */ gboolean ipatch_paste_default_test_func (IpatchItem *dest, IpatchItem *src) { GType src_type, dest_type, link_type, type; const GType *child_types = NULL, *ptype; GParamSpec *spec; g_return_val_if_fail (IPATCH_IS_ITEM (dest), FALSE); g_return_val_if_fail (IPATCH_IS_ITEM (src), FALSE); src_type = G_OBJECT_TYPE (src); dest_type = G_OBJECT_TYPE (dest); /* destination is a container? */ if (IPATCH_IS_CONTAINER (dest)) { /* get child types for destination container */ child_types = ipatch_container_get_child_types (IPATCH_CONTAINER (dest)); if (!child_types) return (FALSE); /* no child types??!! */ /* check if src type in child types */ for (ptype = child_types; *ptype; ptype++) if (g_type_is_a (src_type, *ptype)) return (TRUE); /* if child type found, paste supported */ /* src is a link type of any of container's children types? */ for (ptype = child_types; *ptype; ptype++) { ipatch_type_get (*ptype, "link-type", &link_type, NULL); if (g_type_is_a (src_type, link_type)) return (TRUE); /* link type found, paste supported */ } } else if (IPATCH_IS_VIRTUAL_CONTAINER (dest)) /* dest is a virtual container? */ { /* get the child type of the virtual container */ ipatch_type_get (G_OBJECT_TYPE (dest), "virtual-child-type", &type, NULL); /* does source object conform to the virtual container child type? */ if (type && g_type_is_a (G_OBJECT_TYPE (src), type)) return (TRUE); } else /* destination is not a container - src is link type of dest? */ { /* dest has link item property (FIXME - Future proof?) */ spec = g_object_class_find_property (G_OBJECT_GET_CLASS (dest), "link-item"); /* link item property and src is of the required type? */ if (spec && g_type_is_a (src_type, spec->value_type)) return (TRUE); } /* ## see if paste could occur if source object is converted ## */ /* destination is a container? */ if (IPATCH_IS_CONTAINER (dest)) { /* child_types already retrieved above */ /* check if src type can be converted to any child types */ for (ptype = child_types; *ptype; ptype++) { if (ipatch_lookup_converter_info (0, G_OBJECT_TYPE (src), *ptype)) return (TRUE); } /* can src be converted to a container's child link type? */ for (ptype = child_types; *ptype; ptype++) { ipatch_type_get (*ptype, "link-type", &link_type, NULL); if (ipatch_lookup_converter_info (0, G_OBJECT_TYPE (src), link_type)) return (TRUE); } } else if (IPATCH_IS_VIRTUAL_CONTAINER (dest)) /* dest is a virtual container? */ { /* get the child type of the virtual container */ ipatch_type_get (G_OBJECT_TYPE (dest), "virtual-child-type", &type, NULL); if (type) { /* can object be converted to container child type? */ if (ipatch_lookup_converter_info (0, G_OBJECT_TYPE (src), type)) return (TRUE); } } else /* dest is not a container - can convert src to link type of dest? */ { /* dest has link item property (FIXME - Future proof?) */ spec = g_object_class_find_property (G_OBJECT_GET_CLASS (dest), "link-item"); if (!spec) return (FALSE); /* can src be converted to link type of dest? */ if (ipatch_lookup_converter_info (0, G_OBJECT_TYPE (src), spec->value_type)) return (TRUE); } return (FALSE); } /** * ipatch_paste_default_exec_func: * @paste: Paste object * @src: Source object of paste * @dest: Destination object of paste * @err: Location to store error info or %NULL * * Default #IpatchPasteExecFunc. Useful for alternative paste implementations * which would like to chain to the default function (to override only specific * object types for example). * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set). */ gboolean ipatch_paste_default_exec_func (IpatchPaste *paste, IpatchItem *dest, IpatchItem *src, GError **err) { IpatchItem *src_base, *dest_base; IpatchItem *link, *dup; GParamSpec *spec; GType src_type, dest_type, link_type, type; const GType *child_types = NULL, *ptype; IpatchConverterInfo *convinfo, *matchinfo; IpatchVirtualContainerConformFunc conform_func; IpatchList *list; g_return_val_if_fail (IPATCH_IS_PASTE (paste), FALSE); g_return_val_if_fail (IPATCH_IS_ITEM (src), FALSE); g_return_val_if_fail (IPATCH_IS_ITEM (dest), FALSE); g_return_val_if_fail (!err || !*err, FALSE); src_base = ipatch_item_get_base (src); dest_base = ipatch_item_get_base (dest); src_type = G_OBJECT_TYPE (src); dest_type = G_OBJECT_TYPE (dest); /* destination is a container? */ if (IPATCH_IS_CONTAINER (dest)) { /* get child types for destination container */ child_types = ipatch_container_get_child_types (IPATCH_CONTAINER (dest)); if (!child_types) goto not_handled; /* check if src type in child types */ for (ptype = child_types; *ptype; ptype++) if (g_type_is_a (src_type, *ptype)) break; if (*ptype) /* matching child type found? */ { /* paste is local (within the same IpatchBase?) */ if (src_base == dest_base) ipatch_paste_object_add_duplicate (paste, src, IPATCH_CONTAINER (dest)); else /* deep duplicate the object and add to the paste instance */ ipatch_paste_object_add_duplicate_deep (paste, src, IPATCH_CONTAINER (dest)); return (TRUE); } /* src is a link type of any of container's children types? */ for (ptype = child_types; *ptype; ptype++) { ipatch_type_get (*ptype, "link-type", &link_type, NULL); if (g_type_is_a (src_type, link_type)) break; } /* matching link type found? */ if (*ptype) { GObject *newchild; newchild = g_object_new (*ptype, NULL); /* ++ ref new child object */ if (!newchild) { g_warning ("Failed to create linked child of type %s -> %s", g_type_name (*ptype), g_type_name (link_type)); goto not_handled; } /* add the object add operation of the new child */ ipatch_paste_object_add (paste, IPATCH_ITEM (newchild), IPATCH_CONTAINER (dest), NULL); /* link the new child item to the source object */ g_object_set (newchild, "link-item", src, NULL); g_object_unref (newchild); /* -- unref creator's ref */ return (TRUE); /* paste was handled */ } } else if (IPATCH_IS_VIRTUAL_CONTAINER (dest)) /* dest is a virtual container? */ { /* get the child type of the virtual container */ ipatch_type_get (G_OBJECT_TYPE (dest), "virtual-child-type", &type, "virtual-child-conform-func", &conform_func, NULL); if (!type) goto not_handled; /* does source object conform to the virtual container type? */ if (g_type_is_a (G_OBJECT_TYPE (src), type)) { /* if src is foreign, deep duplicate it, otherwise local duplicate */ if (src_base != dest_base) dup = ipatch_paste_object_add_duplicate_deep (paste, src, IPATCH_CONTAINER (dest_base)); else dup = ipatch_paste_object_add_duplicate (paste, src, IPATCH_CONTAINER (dest_base)); if (conform_func) conform_func (G_OBJECT (dup)); return (TRUE); /* paste was handled */ } } else /* destination is not a container - src is link type of dest? */ { /* dest has link item property (FIXME - Future proof?) */ spec = g_object_class_find_property (G_OBJECT_GET_CLASS (dest), "link-item"); /* if no link item property or src isn't of the required type - error */ if (!spec || !g_type_is_a (src_type, spec->value_type)) goto not_handled; /* if src is foreign, duplicate it */ if (src_base != dest_base) link = ipatch_paste_object_add_duplicate_deep (paste, src, IPATCH_CONTAINER (dest_base)); else link = src; /* add the link operation */ ipatch_paste_object_link (paste, dest, link); return (TRUE); /* we done */ } /* ## see if paste could occur if source object is converted ## */ /* destination is a container? */ if (IPATCH_IS_CONTAINER (dest)) { /* child_types already retrieved above */ /* check if src type can be converted to any child types, pick the highest rated converter */ matchinfo = NULL; for (ptype = child_types; *ptype; ptype++) { convinfo = ipatch_lookup_converter_info (0, G_OBJECT_TYPE (src), *ptype); if (convinfo && (!matchinfo || convinfo->priority > matchinfo->priority)) matchinfo = convinfo; } if (matchinfo) /* found a converter match? */ return (ipatch_paste_object_add_convert (paste, matchinfo->conv_type, src, IPATCH_CONTAINER (dest), NULL, err)); /* can src be converted to a container's child link type? */ for (ptype = child_types; *ptype; ptype++) { ipatch_type_get (*ptype, "link-type", &link_type, NULL); convinfo = ipatch_lookup_converter_info (0, G_OBJECT_TYPE (src), link_type); if (convinfo && (!matchinfo || convinfo->priority > matchinfo->priority)) matchinfo = convinfo; } /* matching converter found? */ if (matchinfo) { GObject *newchild; /* convert the source object to the matching link type */ if (!ipatch_paste_object_add_convert (paste, matchinfo->conv_type, src, IPATCH_CONTAINER (dest_base), &list, err)) /* ++ ref list */ return (FALSE); newchild = g_object_new (*ptype, NULL); /* ++ ref new child object */ if (!newchild) { g_warning ("Failed to create linked child of type %s -> %s", g_type_name (*ptype), g_type_name (link_type)); g_object_unref (list); /* -- unref list */ goto not_handled; } /* add the object add operation of the new child */ ipatch_paste_object_add (paste, IPATCH_ITEM (newchild), IPATCH_CONTAINER (dest), NULL); /* link the new child item to the converted source object */ g_object_set (newchild, "link-item", list->items->data, NULL); g_object_unref (newchild); /* -- unref creator's ref */ g_object_unref (list); /* -- unref list */ return (TRUE); /* paste was handled */ } } else if (IPATCH_IS_VIRTUAL_CONTAINER (dest)) /* dest is a virtual container? */ { /* get the child type of the virtual container */ ipatch_type_get (G_OBJECT_TYPE (dest), "virtual-child-type", &type, "virtual-child-conform-func", &conform_func, NULL); if (!type) goto not_handled; /* can object be converted to container child type? */ convinfo = ipatch_lookup_converter_info (0, G_OBJECT_TYPE (src), type); if (!convinfo) goto not_handled; /* add the conversion operation to the paste */ if (!ipatch_paste_object_add_convert (paste, convinfo->conv_type, src, IPATCH_CONTAINER (dest_base), &list, err)) /* ++ ref list */ return (FALSE); if (conform_func) conform_func (G_OBJECT (list->items->data)); g_object_unref (list); /* -- unref list */ return (TRUE); /* paste was handled */ } else /* dest is not a container - can convert src to link type of dest? */ { /* dest has link item property (FIXME - Future proof?) */ spec = g_object_class_find_property (G_OBJECT_GET_CLASS (dest), "link-item"); if (!spec) goto not_handled; /* can src be converted to link type of dest? */ convinfo = ipatch_lookup_converter_info (0, G_OBJECT_TYPE (src), spec->value_type); if (!convinfo) goto not_handled; /* convert the src object to the link type and add to paste operation */ if (!ipatch_paste_object_add_convert (paste, convinfo->conv_type, src, IPATCH_CONTAINER (dest_base), &list, err)) /* ++ ref list */ return (FALSE); /* add the link operation */ ipatch_paste_object_link (paste, dest, IPATCH_ITEM (list->items->data)); g_object_unref (list); /* -- unref list */ return (TRUE); /* we done */ } not_handled: g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNHANDLED_CONVERSION, _("Unhandled paste operation type '%s' => '%s'"), G_OBJECT_TYPE_NAME (src), G_OBJECT_TYPE_NAME (dest)); return (FALSE); } libinstpatch-1.0.0/libinstpatch/misc.h0000644000175000017500000000536411461332142014712 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: misc * @short_description: Miscellaneous stuff * @see_also: * @stability: Stable */ #ifndef __MISC_H__ #define __MISC_H__ #include #include #include /* libInstPatch domain for g_set_error */ #define IPATCH_ERROR ipatch_error_quark() typedef enum { IPATCH_ERROR_FAIL, /* a general failure */ IPATCH_ERROR_IO, /* I/O error (file operations, etc) */ IPATCH_ERROR_PROGRAM, /* a programming error */ IPATCH_ERROR_INVALID, /* invalid parameter or data */ IPATCH_ERROR_CORRUPT, /* corrupted data */ IPATCH_ERROR_NOMEM, /* out of memory error */ IPATCH_ERROR_UNSUPPORTED, /* unsupported feature */ IPATCH_ERROR_UNEXPECTED_EOF, /* unexpected end of file */ IPATCH_ERROR_UNHANDLED_CONVERSION /* unhandled object conversion */ } IpatchError; #ifdef G_HAVE_ISO_VARARGS #define ipatch_code_error(...) \ _ipatch_code_error (__FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, __VA_ARGS__) #elif defined(G_HAVE_GNUC_VARARGS) #define ipatch_code_error(err, format...) \ _ipatch_code_error (__FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, err, format) #else /* no varargs macros */ static void ipatch_code_error (GError **err, const char *format, ...) { va_list args; va_start (args, format); _ipatch_code_errorv (NULL, -1, NULL, err, format, args); va_end (args); } #endif extern char *ipatch_application_name; void ipatch_init (void); void ipatch_set_application_name (const char *name); GQuark ipatch_error_quark (void); G_CONST_RETURN char *ipatch_gerror_message (GError *err); void _ipatch_code_error (const char *file, guint line, const char *func, GError **err, const char *format, ...); void _ipatch_code_errorv (const char *file, guint line, const char *func, GError **err, const char *format, va_list args); void ipatch_strconcat_num (const char *src, int num, char *dest, int size); void ipatch_dump_object (GObject *object, gboolean recursive, FILE *file); #endif libinstpatch-1.0.0/libinstpatch/IpatchGigEffects.c0000644000175000017500000003363711461332142017115 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchGigEffects.h" /** * ipatch_gig_parse_effects: * @handle: File handle containing buffered 3ewa data * @effects: Pointer to a user supplied GigaSampler effects structure to fill * * Parse an 3ewa GigaSampler effects chunk into a structure. */ void ipatch_gig_parse_effects (IpatchFileHandle *handle, IpatchGigEffects *effects) { g_return_if_fail (handle != NULL); g_return_if_fail (effects != NULL); effects->unknown1 = ipatch_file_buf_read_u32 (handle); /* 0-4 */ effects->lfo3_freq = ipatch_file_buf_read_u32 (handle); effects->eg3_attack = ipatch_file_buf_read_u32 (handle); effects->unknown2 = ipatch_file_buf_read_u16 (handle); /* 12-13 */ effects->lfo1_internal_depth = ipatch_file_buf_read_u16 (handle); effects->unknown3 = ipatch_file_buf_read_u16 (handle); /* 16-17 */ effects->lfo3_internal_depth = ipatch_file_buf_read_u16 (handle); effects->unknown4 = ipatch_file_buf_read_u16 (handle); /* 20-21 */ effects->lfo1_ctrl_depth = ipatch_file_buf_read_u16 (handle); effects->unknown5 = ipatch_file_buf_read_u16 (handle); /* 22-23 */ effects->lfo3_ctrl_depth = ipatch_file_buf_read_u16 (handle); effects->eg1_attack = ipatch_file_buf_read_u32 (handle); effects->eg1_decay = ipatch_file_buf_read_u32 (handle); effects->unknown6 = ipatch_file_buf_read_u16 (handle); /* 36-37 */ effects->eg1_sustain = ipatch_file_buf_read_u16 (handle); effects->eg1_release = ipatch_file_buf_read_u32 (handle); effects->unknown7 = ipatch_file_buf_read_u32 (handle); /* 44-47 */ effects->lfo1_freq = ipatch_file_buf_read_u32 (handle); effects->eg2_attack = ipatch_file_buf_read_u32 (handle); effects->eg2_decay = ipatch_file_buf_read_u32 (handle); effects->unknown8 = ipatch_file_buf_read_u16 (handle); /* 60-61 */ effects->eg2_sustain = ipatch_file_buf_read_u16 (handle); effects->eg2_release = ipatch_file_buf_read_u32 (handle); effects->unknown9 = ipatch_file_buf_read_u16 (handle); /* 68-69 */ effects->lfo2_ctrl_depth = ipatch_file_buf_read_u16 (handle); effects->lfo2_freq = ipatch_file_buf_read_u32 (handle); effects->unknown10 = ipatch_file_buf_read_u16 (handle); /* 76-77 */ effects->lfo2_internal_depth = ipatch_file_buf_read_u16 (handle); effects->eg1_decay2 = ipatch_file_buf_read_u32 (handle); effects->unknown11 = ipatch_file_buf_read_u16 (handle); /* 84-85 */ effects->eg1_pre_attack = ipatch_file_buf_read_u16 (handle); effects->eg2_decay2 = ipatch_file_buf_read_u32 (handle); effects->turbo_lowpass = ipatch_file_buf_read_u8 (handle); effects->unknown12 = ipatch_file_buf_read_u8 (handle); /* 93 */ effects->eg2_pre_attack = ipatch_file_buf_read_u16 (handle); effects->vel_response = ipatch_file_buf_read_u8 (handle); effects->release_vel_response = ipatch_file_buf_read_u8 (handle); effects->unknown13 = ipatch_file_buf_read_u16 (handle); /* 98-99 */ effects->unknown14 = ipatch_file_buf_read_u32 (handle); /* 100-103 */ effects->sample_offset = ipatch_file_buf_read_u16 (handle); effects->unknown15 = ipatch_file_buf_read_u16 (handle); /* 106-107 */ effects->pitch_track_dim_bypass = ipatch_file_buf_read_u8 (handle); effects->layer_pan = ipatch_file_buf_read_u8 (handle); effects->self_mask = ipatch_file_buf_read_u8 (handle); effects->unknown16 = ipatch_file_buf_read_u8 (handle); /* 111 */ effects->lfo3_ctrl = ipatch_file_buf_read_u8 (handle); effects->attn_ctrl = ipatch_file_buf_read_u8 (handle); effects->lfo2_ctrl = ipatch_file_buf_read_u8 (handle); effects->lfo1_ctrl = ipatch_file_buf_read_u8 (handle); effects->unknown17 = ipatch_file_buf_read_u16 (handle); /* 116-117 */ effects->lfo3_internal_depth = ipatch_file_buf_read_u16 (handle); effects->channel_offset = ipatch_file_buf_read_u8 (handle); effects->sust_defeat = ipatch_file_buf_read_u8 (handle); effects->unknown18 = ipatch_file_buf_read_u16 (handle); /* 122-123 */ effects->max_velocity = ipatch_file_buf_read_u8 (handle); effects->unknown19 = ipatch_file_buf_read_u8 (handle); /* 125 */ effects->unknown20 = ipatch_file_buf_read_u16 (handle); /* 126-127 */ effects->release_trigger_decay = ipatch_file_buf_read_u8 (handle); effects->unknown21 = ipatch_file_buf_read_u8 (handle); /* 129 */ effects->unknown22 = ipatch_file_buf_read_u8 (handle); /* 130 */ effects->eg1_hold = ipatch_file_buf_read_u8 (handle); effects->filter_cutoff = ipatch_file_buf_read_u8 (handle); effects->filter_midi_ctrl = ipatch_file_buf_read_u8 (handle); effects->filter_vel_scale = ipatch_file_buf_read_u8 (handle); effects->unknown23 = ipatch_file_buf_read_u8 (handle); /* 135 */ effects->filter_resonance = ipatch_file_buf_read_u8 (handle); effects->filter_breakpoint = ipatch_file_buf_read_u8 (handle); effects->vel_dyn_range = ipatch_file_buf_read_u8 (handle); effects->filter_type = ipatch_file_buf_read_u8 (handle); } /** * ipatch_gig_write_effects: * @handle: File handle to buffer writes to, should be committed after this call * @effects: Pointer to GigaSampler effects structure to store * * Store a 3ewa GigaSampler effects chunk into a file buffer. The file * buffer should be at least #IPATCH_GIG_3EWA_SIZE bytes. */ void ipatch_gig_store_effects (IpatchFileHandle *handle, IpatchGigEffects *effects) { g_return_if_fail (handle != NULL); g_return_if_fail (effects != NULL); ipatch_file_buf_write_u32 (handle, effects->unknown1); /* 0-3 */ ipatch_file_buf_write_u32 (handle, effects->lfo3_freq); ipatch_file_buf_write_u32 (handle, effects->eg3_attack); ipatch_file_buf_write_u16 (handle, effects->unknown2); /* 12-13 */ ipatch_file_buf_write_u16 (handle, effects->lfo1_internal_depth); ipatch_file_buf_write_u16 (handle, effects->unknown3); /* 16-17 unknown */ ipatch_file_buf_write_u16 (handle, effects->lfo3_internal_depth); ipatch_file_buf_write_u16 (handle, effects->unknown4); /* 20-21 unknown */ ipatch_file_buf_write_u16 (handle, effects->lfo1_ctrl_depth); ipatch_file_buf_write_u16 (handle, effects->unknown5); /* 24-25 unknown */ ipatch_file_buf_write_u16 (handle, effects->lfo3_ctrl_depth); ipatch_file_buf_write_u32 (handle, effects->eg1_attack); ipatch_file_buf_write_u32 (handle, effects->eg1_decay); ipatch_file_buf_write_u16 (handle, effects->unknown6); /* 36-37 unknown */ ipatch_file_buf_write_u16 (handle, effects->eg1_sustain); ipatch_file_buf_write_u32 (handle, effects->eg1_release); ipatch_file_buf_write_u32 (handle, effects->unknown7); /* 44-47 unknown */ ipatch_file_buf_write_u32 (handle, effects->lfo1_freq); ipatch_file_buf_write_u32 (handle, effects->eg2_attack); ipatch_file_buf_write_u32 (handle, effects->eg2_decay); ipatch_file_buf_write_u16 (handle, effects->unknown8); /* 60-61 unknown */ ipatch_file_buf_write_u16 (handle, effects->eg2_sustain); ipatch_file_buf_write_u32 (handle, effects->eg2_release); ipatch_file_buf_write_u16 (handle, effects->unknown9); /* 68-69 unknown */ ipatch_file_buf_write_u16 (handle, effects->lfo2_ctrl_depth); ipatch_file_buf_write_u32 (handle, effects->lfo2_freq); ipatch_file_buf_write_u16 (handle, effects->unknown10); /* 76-77 unknown */ ipatch_file_buf_write_u16 (handle, effects->lfo2_internal_depth); ipatch_file_buf_write_u32 (handle, effects->eg1_decay2); ipatch_file_buf_write_u16 (handle, effects->unknown11); /* 84-85 unknown */ ipatch_file_buf_write_u16 (handle, effects->eg1_pre_attack); ipatch_file_buf_write_u32 (handle, effects->eg2_decay2); ipatch_file_buf_write_u8 (handle, effects->turbo_lowpass); ipatch_file_buf_write_u8 (handle, effects->unknown12); /* 93 unknown */ ipatch_file_buf_write_u16 (handle, effects->eg2_pre_attack); ipatch_file_buf_write_u8 (handle, effects->vel_response); ipatch_file_buf_write_u8 (handle, effects->release_vel_response); ipatch_file_buf_write_u16 (handle, effects->unknown13); /* 98-99 unknown */ ipatch_file_buf_write_u32 (handle, effects->unknown14);/* 100-103 unknown */ ipatch_file_buf_write_u16 (handle, effects->sample_offset); ipatch_file_buf_write_u16 (handle, effects->unknown15);/* 106-107 unknown */ ipatch_file_buf_write_u8 (handle, effects->pitch_track_dim_bypass); ipatch_file_buf_write_u8 (handle, effects->layer_pan); ipatch_file_buf_write_u8 (handle, effects->self_mask); ipatch_file_buf_write_u8 (handle, effects->unknown16); /* 111 unknown */ ipatch_file_buf_write_u8 (handle, effects->lfo3_ctrl); ipatch_file_buf_write_u8 (handle, effects->attn_ctrl); ipatch_file_buf_write_u8 (handle, effects->lfo2_ctrl); ipatch_file_buf_write_u8 (handle, effects->lfo1_ctrl); ipatch_file_buf_write_u16 (handle, effects->unknown17); /* 116-117 unknown */ ipatch_file_buf_write_u16 (handle, effects->lfo3_internal_depth); ipatch_file_buf_write_u8 (handle, effects->channel_offset); ipatch_file_buf_write_u8 (handle, effects->sust_defeat); ipatch_file_buf_write_u16 (handle, effects->unknown18);/* 122-123 unknown */ ipatch_file_buf_write_u8 (handle, effects->max_velocity); ipatch_file_buf_write_u8 (handle, effects->unknown19); /* 125 unknown */ ipatch_file_buf_write_u16 (handle, effects->unknown20);/* 126-127 unknown */ ipatch_file_buf_write_u8 (handle, effects->release_trigger_decay); ipatch_file_buf_write_u8 (handle, effects->unknown21); /* 129 unknown */ ipatch_file_buf_write_u8 (handle, effects->unknown22); /* 130 unknown */ ipatch_file_buf_write_u8 (handle, effects->eg1_hold); ipatch_file_buf_write_u8 (handle, effects->filter_cutoff); ipatch_file_buf_write_u8 (handle, effects->filter_midi_ctrl); ipatch_file_buf_write_u8 (handle, effects->filter_vel_scale); ipatch_file_buf_write_u8 (handle, effects->unknown23); /* 135 unknown */ ipatch_file_buf_write_u8 (handle, effects->filter_resonance); ipatch_file_buf_write_u8 (handle, effects->filter_breakpoint); ipatch_file_buf_write_u8 (handle, effects->vel_dyn_range); ipatch_file_buf_write_u8 (handle, effects->filter_type); } /** * ipatch_gig_effects_init: * @effects: GigaSampler effects structure * * Initialize GigaSampler effects structure to default values. */ void ipatch_gig_effects_init (IpatchGigEffects *effects) { memset (effects, 0, sizeof (IpatchGigEffects)); /* FIXME - initialize to defaults */ } /* * GigaSampler has independent Volume/Pitch/Filter envelopes and LFOs where * as SoundFont has a Volume Envelope and combined Pitch/Filter envelope, * and a combined Volume/Filter/Pitch LFO and a second Pitch LFO. * * - Filter parameters are only activated if the filter is of type lowpass. * - Filter envelope parameters take precedence over Pitch envelope * - Second SoundFont pitch LFO is always used for Gig pitch LFO * - Volume LFO parameters take precedence over filter parameters */ /** * ipatch_gig_effects_to_gen_array: * @effects: GigaSampler effects structure * @array: SoundFont generator array * * Convert GigaSampler effects structure to SoundFont generator array */ void ipatch_gig_effects_to_gen_array (IpatchGigEffects *effects, IpatchSF2GenArray *array) { guint64 set_vals = IPATCH_SF2_GENID_SET (IPATCH_SF2_GEN_VOL_ENV_ATTACK) | IPATCH_SF2_GENID_SET (IPATCH_SF2_GEN_VOL_ENV_DECAY) | IPATCH_SF2_GENID_SET (IPATCH_SF2_GEN_VOL_ENV_RELEASE); IpatchSF2GenAmount *vals = array->values; array->flags |= set_vals; /* volume envelope */ /* can we do something with the pre-attack level? */ vals[IPATCH_SF2_GEN_VOL_ENV_ATTACK].sword = ipatch_gig_to_sf2_timecents (effects->eg1_attack); /* GigaSampler doesn't have a hold stage, only a hold until loop toggle */ /* FIXME - we could calculate time until loop */ vals[IPATCH_SF2_GEN_VOL_ENV_DECAY].sword = ipatch_gig_to_sf2_timecents (effects->eg1_decay); /* can we do something with decay2? */ /* vals[IPATCH_SF2_GEN_VOL_ENV_SUSTAIN].sword = ipatch_gig_volsust_to_sf2_centibels (effects->eg1_sustain); */ vals[IPATCH_SF2_GEN_VOL_ENV_RELEASE].sword = ipatch_gig_to_sf2_timecents (effects->eg1_release); /* filter envelope */ #if 0 /* only use filter parameters if its of lowpass type */ if (effects->filter_type == IPATCH_GIG_FILTER_LOWPASS) { vals[IPATCH_SF2_GEN_MOD_ENV_ATTACK].sword = ipatch_gig_to_sf2_timecents (effects->eg2_attack); vals[IPATCH_SF2_GEN_MOD_ENV_DECAY].sword = ipatch_gig_to_sf2_timecents (effects->eg2_decay); /* can we do something with decay2? */ vals[IPATCH_SF2_GEN_VOL_ENV_SUSTAIN].sword = effects->eg1_sustain; vals[IPATCH_SF2_GEN_VOL_ENV_RELEASE].sword = ipatch_gig_to_sf2_timecents (effects->eg1_release); /* filter LFO */ } #endif } /** * ipatch_gig_to_sf2_timecents: * @gig_tc: Amount in GigaSampler timecents * * Convert GigaSampler timecents to SoundFont timecents. * * Returns: SoundFont timecent value */ guint16 ipatch_gig_to_sf2_timecents (gint32 gig_tc) { return (gig_tc >> 16); /* divide by 65536 */ } /** * ipatch_gig_volsust_to_sf2_centibels: * @gig_tperc: Tenth percent sustain level * * Convert GigaSampler volume sustain (tenth percent units) to * centibels (10th of a decibel). * * Returns: SoundFont centibels value */ guint16 ipatch_gig_volsust_to_sf2_centibels (guint gig_tperc) { gig_tperc = CLAMP (gig_tperc, 0, 1000); return (1000 - gig_tperc); /* FIXME - probably wrong! */ } libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreRam.c0000644000175000017500000002101411461332142017767 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSampleStoreRam.h" #include "ipatch_priv.h" #include "i18n.h" /* properties */ enum { PROP_0, PROP_LOCATION, PROP_FREE_DATA }; static void ipatch_sample_store_ram_sample_iface_init (IpatchSampleIface *iface); static void ipatch_sample_store_ram_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sample_store_ram_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sample_store_ram_finalize (GObject *object); static gboolean ipatch_sample_store_ram_sample_iface_open (IpatchSampleHandle *handle, GError **err); static gboolean ipatch_sample_store_ram_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err); static gboolean ipatch_sample_store_ram_sample_iface_write (IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err); G_DEFINE_TYPE_WITH_CODE (IpatchSampleStoreRam, ipatch_sample_store_ram, IPATCH_TYPE_SAMPLE_STORE, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sample_store_ram_sample_iface_init)) static void ipatch_sample_store_ram_sample_iface_init (IpatchSampleIface *iface) { iface->open = ipatch_sample_store_ram_sample_iface_open; iface->read = ipatch_sample_store_ram_sample_iface_read; iface->write = ipatch_sample_store_ram_sample_iface_write; } static void ipatch_sample_store_ram_class_init (IpatchSampleStoreRamClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->finalize = ipatch_sample_store_ram_finalize; obj_class->get_property = ipatch_sample_store_ram_get_property; item_class->item_set_property = ipatch_sample_store_ram_set_property; g_object_class_install_property (obj_class, PROP_LOCATION, g_param_spec_pointer ("location", "Location", "Sample data pointer", G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_FREE_DATA, g_param_spec_boolean ("free-data", "Free data", "Free data when object destroyed", FALSE, G_PARAM_READWRITE)); } static void ipatch_sample_store_ram_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSampleStoreRam *store = IPATCH_SAMPLE_STORE_RAM (object); switch (property_id) { case PROP_LOCATION: g_return_if_fail (store->location == NULL); /* Lock not needed, should be set only once before use */ store->location = g_value_get_pointer (value); break; case PROP_FREE_DATA: ipatch_item_set_flags (object, IPATCH_SAMPLE_STORE_RAM_ALLOCATED); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_ram_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSampleStoreRam *store = IPATCH_SAMPLE_STORE_RAM (object); switch (property_id) { case PROP_LOCATION: /* Lock not needed, should be set only once before use */ g_value_set_pointer (value, store->location); break; case PROP_FREE_DATA: g_value_set_boolean (value, (ipatch_item_get_flags ((IpatchItem *)object) & IPATCH_SAMPLE_STORE_RAM_ALLOCATED) != 0); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_ram_init (IpatchSampleStoreRam *store) { } static void ipatch_sample_store_ram_finalize (GObject *object) { IpatchSampleStoreRam *store = IPATCH_SAMPLE_STORE_RAM (object); if (ipatch_item_get_flags (IPATCH_ITEM (store)) & IPATCH_SAMPLE_STORE_RAM_ALLOCATED) { g_free (store->location); store->location = NULL; } if (G_OBJECT_CLASS (ipatch_sample_store_ram_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sample_store_ram_parent_class)->finalize (object); } static gboolean ipatch_sample_store_ram_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchSampleStoreRam *store = IPATCH_SAMPLE_STORE_RAM (handle->sample); guint bytes; g_return_val_if_fail (!handle->read_mode || store->location, FALSE); /* Locking not needed, since new samples will be written with audio before * being used by multiple threads */ if (!store->location) { ipatch_item_set_flags (IPATCH_ITEM (store), IPATCH_SAMPLE_STORE_RAM_ALLOCATED); ipatch_sample_get_size (handle->sample, &bytes); store->location = g_malloc0 (bytes); } /* Store frame size to data1 */ handle->data1 = GUINT_TO_POINTER (ipatch_sample_format_size (ipatch_sample_store_get_format (store))); return (TRUE); } static gboolean ipatch_sample_store_ram_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err) { IpatchSampleStoreRam *store = (IpatchSampleStoreRam *)(handle->sample); guint8 frame_size = GPOINTER_TO_UINT (handle->data1); /* No need to lock, sample data should not change after initial load */ memcpy (buf, &((gint8 *)(store->location))[offset * frame_size], frames * frame_size); return (TRUE); } static gboolean ipatch_sample_store_ram_sample_iface_write (IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err) { IpatchSampleStoreRam *store = (IpatchSampleStoreRam *)(handle->sample); guint8 frame_size = GPOINTER_TO_UINT (handle->data1); /* No need to lock, sample data written only once and before used by multiple threads */ memcpy (&((gint8 *)(store->location))[offset * frame_size], buf, frames * frame_size); return (TRUE); } /** * ipatch_sample_store_ram_new: * @location: Location of existing sample data or %NULL if the sample buffer * should be allocated (in which case the sample must be written to first). * @free_data: %TRUE if sample data at @location should be freed when object * is destroyed * * Creates a new RAM sample store. * * Returns: New RAM sample store, cast as a #IpatchSample for convenience. */ IpatchSample * ipatch_sample_store_ram_new (gpointer location, gboolean free_data) { return (IPATCH_SAMPLE (g_object_new (IPATCH_TYPE_SAMPLE_STORE_RAM, "location", location, "free-data", free_data, NULL))); } /** * ipatch_sample_store_ram_get_blank: * * Get blank mono RAM sample object. Return's a sample object * with 48 stereo 16 bit samples of silent audio. Only creates it on * the first call, subsequent calls return the same sample object. Therefore it * should not be modified. * * Returns: The blank sample object. Remember to unref it when not * using it anymore with g_object_unref(). */ IpatchSample * ipatch_sample_store_ram_get_blank (void) { static IpatchSample *blank_sample = NULL; gpointer dataptr; if (!blank_sample) { dataptr = g_malloc (48 * 2); blank_sample = ipatch_sample_store_ram_new (dataptr, TRUE); g_object_set (blank_sample, "sample-size", 48, "sample-format", IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_ENDIAN_HOST, "sample-rate", IPATCH_SAMPLE_RATE_DEFAULT, NULL); } else g_object_ref (blank_sample); return (blank_sample); } libinstpatch-1.0.0/libinstpatch/IpatchSF2VoiceCache_DLS.c0000644000175000017500000001776211461332142020116 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSF2VoiceCache_DLS.h" #include "IpatchConverter.h" #include "IpatchConverterSF2VoiceCache.h" #include "IpatchConverter_priv.h" #include "IpatchDLS2Inst.h" #include "IpatchDLS2Region.h" #include "IpatchDLS2Sample.h" #include "IpatchSF2VoiceCache.h" #include "IpatchSample.h" void _ipatch_sf2_voice_cache_init_DLS (void) { g_type_class_ref (IPATCH_TYPE_CONVERTER_DLS2_INST_TO_SF2_VOICE_CACHE); g_type_class_ref (IPATCH_TYPE_CONVERTER_DLS2_REGION_TO_SF2_VOICE_CACHE); g_type_class_ref (IPATCH_TYPE_CONVERTER_DLS2_SAMPLE_TO_SF2_VOICE_CACHE); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_DLS2_INST_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_DLS2_INST, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_DLS2_REGION_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_DLS2_REGION, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_DLS2_SAMPLE_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_DLS2_SAMPLE, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); } static gboolean _dls2_inst_to_sf2_voice_cache_convert (IpatchConverter *converter, GError **err) { IpatchDLS2Inst *inst; IpatchSF2VoiceCache *cache; IpatchSF2Voice *voice; IpatchDLS2Region *region; IpatchDLS2Sample *sample; IpatchDLS2SampleInfo *sample_info; IpatchItem *solo_item; GObject *obj; const GSList *defmods; GSList *p; int looptype; obj = IPATCH_CONVERTER_INPUT (converter); cache = IPATCH_SF2_VOICE_CACHE (IPATCH_CONVERTER_OUTPUT (converter)); solo_item = ((IpatchConverterSF2VoiceCache *)converter)->solo_item; /* check if its an instrument or a region */ if (IPATCH_IS_DLS2_REGION (obj)) /* ++ ref parent instrument */ inst = IPATCH_DLS2_INST (ipatch_item_get_parent (IPATCH_ITEM (obj))); else inst = IPATCH_DLS2_INST (obj); ipatch_sf2_voice_cache_declare_item (cache, (GObject *)inst); defmods = cache->default_mods; IPATCH_ITEM_RLOCK (inst); /* ++ LOCK instrument */ for (p = inst->regions; p; p = p->next) { region = (IpatchDLS2Region *)(p->data); if (solo_item && (IpatchItem *)region != solo_item) continue; ipatch_sf2_voice_cache_declare_item (cache, (GObject *)region); voice = ipatch_sf2_voice_cache_add_voice (cache); IPATCH_ITEM_RLOCK (region); /* ++ LOCK region */ /* convert DLS parameters to SoundFont generator array and modulators */ // ipatch_dls2_region_load_sf2_gen_mods (region, &voice->gen_array, // &voice->mod_list); /* set MIDI note and velocity ranges */ ipatch_sf2_voice_cache_set_voice_range (cache, voice, 0, region->note_range_low, region->note_range_high); ipatch_sf2_voice_cache_set_voice_range (cache, voice, 1, region->velocity_range_low, region->velocity_range_high); sample = (IpatchDLS2Sample *)(region->sample); ipatch_sf2_voice_cache_declare_item (cache, (GObject *)sample); ipatch_sf2_voice_set_sample_data (voice, sample->sample_data); voice->rate = sample->rate; if (region->sample_info) sample_info = region->sample_info; else sample_info = sample->sample_info; if (sample_info) { voice->loop_start = sample_info->loop_start; voice->loop_end = sample_info->loop_end; voice->root_note = sample_info->root_note; voice->fine_tune = sample_info->fine_tune; switch (sample_info->options & IPATCH_DLS2_SAMPLE_LOOP_MASK) { case IPATCH_SAMPLE_LOOP_NONE: looptype = IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP; break; case IPATCH_SAMPLE_LOOP_RELEASE: looptype = IPATCH_SF2_GEN_SAMPLE_MODE_LOOP_RELEASE; break; default: /* default to standard loop */ looptype = IPATCH_SF2_GEN_SAMPLE_MODE_LOOP; break; } /* set loop mode */ voice->gen_array.values[IPATCH_SF2_GEN_SAMPLE_MODES].sword = looptype; IPATCH_SF2_GEN_ARRAY_SET_FLAG (&voice->gen_array, IPATCH_SF2_GEN_SAMPLE_MODES); } IPATCH_ITEM_RUNLOCK (region); /* -- UNLOCK region */ } IPATCH_ITEM_RUNLOCK (inst); /* -- UNLOCK instrument */ /* if convert object was region, unref parent instrument */ if ((void *)obj != (void *)inst) g_object_unref (inst); /* -- unref parent instrument */ return (TRUE); } /* use the instrument converter for regions also */ #define _dls2_region_to_sf2_voice_cache_convert \ _dls2_inst_to_sf2_voice_cache_convert /* DLS2Sample voice cache converter - Not declared static, since used by IpatchSF2VoiceCache_Gig.c */ gboolean _dls2_sample_to_sf2_voice_cache_convert (IpatchConverter *converter, GError **err) { IpatchDLS2Sample *sample; IpatchSF2VoiceCache *cache; IpatchSF2Voice *voice; IpatchSF2GenAmount *amt; int loopmode; sample = IPATCH_DLS2_SAMPLE (IPATCH_CONVERTER_INPUT (converter)); cache = IPATCH_SF2_VOICE_CACHE (IPATCH_CONVERTER_OUTPUT (converter)); ipatch_sf2_voice_cache_declare_item (cache, (GObject *)sample); voice = ipatch_sf2_voice_cache_add_voice (cache); voice->mod_list = ipatch_sf2_mod_list_duplicate (cache->default_mods); /* set MIDI note and velocity ranges */ amt = &voice->gen_array.values[IPATCH_SF2_GEN_NOTE_RANGE]; ipatch_sf2_voice_cache_set_voice_range (cache, voice, 0, amt->range.low, amt->range.high); amt = &voice->gen_array.values[IPATCH_SF2_GEN_VELOCITY_RANGE]; ipatch_sf2_voice_cache_set_voice_range (cache, voice, 1, amt->range.low, amt->range.high); ipatch_sf2_voice_set_sample_data (voice, sample->sample_data); voice->rate = sample->rate; if (sample->sample_info) { voice->loop_start = sample->sample_info->loop_start; voice->loop_end = sample->sample_info->loop_end; voice->root_note = sample->sample_info->root_note; voice->fine_tune = sample->sample_info->fine_tune; switch (sample->sample_info->options & IPATCH_DLS2_SAMPLE_LOOP_MASK) { case IPATCH_SAMPLE_LOOP_NONE: loopmode = IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP; break; case IPATCH_SAMPLE_LOOP_RELEASE: loopmode = IPATCH_SF2_GEN_SAMPLE_MODE_LOOP_RELEASE; break; default: /* default to standard loop */ loopmode = IPATCH_SF2_GEN_SAMPLE_MODE_LOOP; break; } /* set loop mode */ voice->gen_array.values[IPATCH_SF2_GEN_SAMPLE_MODES].sword = loopmode; IPATCH_SF2_GEN_ARRAY_SET_FLAG (&voice->gen_array, IPATCH_SF2_GEN_SAMPLE_MODES); } return (TRUE); } CONVERTER_CLASS_INIT(dls2_inst_to_sf2_voice_cache); CONVERTER_CLASS_INIT(dls2_region_to_sf2_voice_cache); CONVERTER_CLASS_INIT(dls2_sample_to_sf2_voice_cache); CONVERTER_SF2_VOICE_CACHE_GET_TYPE(dls2_inst_to_sf2_voice_cache, DLS2InstToSF2VoiceCache); CONVERTER_SF2_VOICE_CACHE_GET_TYPE(dls2_region_to_sf2_voice_cache, DLS2RegionToSF2VoiceCache); CONVERTER_SF2_VOICE_CACHE_GET_TYPE(dls2_sample_to_sf2_voice_cache, DLS2SampleToSF2VoiceCache); libinstpatch-1.0.0/libinstpatch/IpatchSF2Gen_tables.c0000644000175000017500000001757211461332142017465 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /* * IpatchSF2Gen_tables.c - SoundFont generator table structures */ #include #include "IpatchSF2Gen.h" #include "IpatchUnit.h" #include "ipatch_priv.h" /* Default range value stored in 2 byte form with correct host byte order */ #define DEFRANGE (GUINT16_FROM_LE (0x7F00)) #define MAXNEG -32768 #define MAXPOS 32767 #define UMAX 65535 /* generator info */ const IpatchSF2GenInfo ipatch_sf2_gen_info[] = { /* StartAddrOfs */ { {0}, {MAXPOS}, {0}, IPATCH_UNIT_TYPE_SAMPLES, N_("Sample Start Ofs"), NULL}, /* EndAddrOfs */ { {MAXNEG}, {0}, {0}, IPATCH_UNIT_TYPE_SAMPLES, N_("Sample End Ofs"), NULL}, /* StartLoopAddrOfs */ { {MAXNEG}, {MAXPOS}, {0}, IPATCH_UNIT_TYPE_SAMPLES, N_("Sample Loop Start Ofs"), NULL}, /* EndLoopAddrOfs */ { {MAXNEG}, {MAXPOS}, {0}, IPATCH_UNIT_TYPE_SAMPLES, N_("Sample Loop End Ofs"), NULL}, /* StartAddrCoarseOfs */ { {0}, {MAXPOS}, {0}, IPATCH_UNIT_TYPE_32K_SAMPLES, N_("Sample Start Coarse Ofs"), NULL}, /* ModLFO2Pitch */ { {-12000}, {12000}, {0}, IPATCH_UNIT_TYPE_CENTS, N_("To Pitch"), N_("Modulation oscillator to pitch") }, /* VibLFO2Pitch */ { {-12000}, {12000}, {0}, IPATCH_UNIT_TYPE_CENTS, N_("To Pitch"), N_("Vibrato oscillator to pitch") }, /* ModEnv2Pitch */ { {-12000}, {12000}, {0}, IPATCH_UNIT_TYPE_CENTS, N_("To Pitch"), N_("Modulation envelope to pitch") }, /* FilterFc */ { {1500}, {13500}, {13500}, IPATCH_UNIT_TYPE_SF2_ABS_PITCH, N_("Filter cutoff"), N_("Low pass filter cutoff frequency") }, /* FilterQ */ { {0}, {960}, {0}, IPATCH_UNIT_TYPE_CENTIBELS, N_("Filter Q"), N_("Low pass filter Q factor") }, /* ModLFO2FilterFc */ { {-12000}, {12000}, {0}, IPATCH_UNIT_TYPE_CENTS, N_("To Filter Cutoff"), N_("Modulation oscillator to filter cutoff") }, /* ModEnv2FilterFc */ { {-12000}, {12000}, {0}, IPATCH_UNIT_TYPE_CENTS, N_("To Filter Cutoff"), N_("Modulation envelope to filter cutoff") }, /* EndAddrCoarseOfs */ { {MAXNEG}, {0}, {0}, IPATCH_UNIT_TYPE_32K_SAMPLES, N_("Sample End Coarse Ofs"), NULL}, /* ModLFO2Vol */ { {-960}, {960}, {0}, IPATCH_UNIT_TYPE_CENTIBELS, N_("To Volume"), N_("Modulation oscillator to volume") }, /* Unused1 */ { {0}, {0}, {0}, IPATCH_UNIT_TYPE_NONE, NULL, NULL}, /* ChorusSend */ { {0}, {1000}, {0}, IPATCH_UNIT_TYPE_TENTH_PERCENT, N_("Chorus"), NULL}, /* ReverbSend */ { {0}, {1000}, {0}, IPATCH_UNIT_TYPE_TENTH_PERCENT, N_("Reverb"), NULL}, /* Pan */ { {-500}, {500}, {0}, IPATCH_UNIT_TYPE_TENTH_PERCENT, N_("Pan"), N_("Panning") }, /* Unused2 */ { {0}, {0}, {0}, IPATCH_UNIT_TYPE_NONE, NULL, NULL}, /* Unused3 */ { {0}, {0}, {0}, IPATCH_UNIT_TYPE_NONE, NULL, NULL}, /* Unused4 */ { {0}, {0}, {0}, IPATCH_UNIT_TYPE_NONE, NULL, NULL}, /* ModLFODelay */ { {-12000}, {5000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Delay"), N_("Modulation oscillator delay") }, /* ModLFOFreq */ { {-16000}, {4500}, {0}, IPATCH_UNIT_TYPE_SF2_ABS_PITCH, N_("Frequency"), N_("Modulation oscillator frequency") }, /* VibLFODelay */ { {-12000}, {5000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Delay"), N_("Vibrato oscillator delay") }, /* VibLFOFreq */ { {-16000}, {4500}, {0}, IPATCH_UNIT_TYPE_SF2_ABS_PITCH, N_("Frequency"), N_("Vibrato oscillator frequency") }, /* ModEnvDelay */ { {-12000}, {5000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Delay"), N_("Modulation envelope delay") }, /* ModEnvAttack */ { {-12000}, {8000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Attack"), N_("Modulation envelope attack") }, /* ModEnvHold */ { {-12000}, {5000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Hold"), N_("Modulation envelope hold") }, /* ModEnvDecay */ { {-12000}, {8000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Decay"), N_("Modulation envelope decay") }, /* ModEnvSustain */ { {0}, {1000}, {0}, IPATCH_UNIT_TYPE_TENTH_PERCENT, N_("Sustain"), N_("Modulation envelope sustain") }, /* ModEnvRelease */ { {-12000}, {8000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Release"), N_("Modulation envelope release") }, /* Note2ModEnvHold */ { {-1200}, {1200}, {0}, IPATCH_UNIT_TYPE_CENTS, N_("Note to Hold"), N_("MIDI note to modulation envelope hold") }, /* Note2ModEnvDecay */ { {-1200}, {1200}, {0}, IPATCH_UNIT_TYPE_CENTS, N_("Note to Decay"), N_("MIDI note to modulation envelope decay") }, /* VolEnvDelay */ { {-12000}, {5000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Delay"), N_("Volume envelope delay") }, /* VolEnvAttack */ { {-12000}, {8000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Attack"), N_("Volume envelope attack") }, /* VolEnvHold */ { {-12000}, {5000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Hold"), N_("Volume envelope hold") }, /* VolEnvDecay */ { {-12000}, {8000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Decay"), N_("Volume envelope decay") }, /* VolEnvSustain */ { {0}, {1440}, {0}, IPATCH_UNIT_TYPE_CENTIBELS, N_("Sustain"), N_("Volume envelope sustain") }, /* VolEnvRelease */ { {-12000}, {8000}, {-12000}, IPATCH_UNIT_TYPE_SF2_ABS_TIME, N_("Release"), N_("Volume envelope release") }, /* Note2VolEnvHold */ { {-1200}, {1200}, {0}, IPATCH_UNIT_TYPE_CENTS, N_("Note to Hold"), N_("MIDI note to volume envelope hold") }, /* Note2VolEnvDecay */ { {-1200}, {1200}, {0}, IPATCH_UNIT_TYPE_CENTS, N_("Note to Decay"), N_("MIDI note to volume envelope decay") }, /* Instrument */ { {0}, {uword:UMAX}, {0}, IPATCH_UNIT_TYPE_UINT, N_("Instrument ID"), NULL}, /* Reserved1 */ { {0}, {0}, {0}, IPATCH_UNIT_TYPE_NONE, NULL, NULL}, /* NoteRange */ { {0}, {127}, {DEFRANGE}, IPATCH_UNIT_TYPE_RANGE, N_("Note Range"), NULL}, /* VelRange */ { {0}, {127}, {DEFRANGE}, IPATCH_UNIT_TYPE_RANGE, N_("Velocity Range"), NULL}, /* StartLoopAddrCoarseOfs */ { {MAXNEG}, {MAXPOS}, {0}, IPATCH_UNIT_TYPE_32K_SAMPLES, N_("Sample Loop Start Coarse Ofs"), NULL}, /* FixedNote */ { {-1}, {127}, {-1}, IPATCH_UNIT_TYPE_INT, N_("Fixed Note"), NULL}, /* Velocity */ { {-1}, {127}, {-1}, IPATCH_UNIT_TYPE_INT, N_("Fixed Velocity"), NULL}, /* InitAttenuation */ { {0}, {1440}, {0}, IPATCH_UNIT_TYPE_CENTIBELS, N_("Attenuation"), N_("Volume attenuation") }, /* Reserved2 */ { {0}, {0}, {0}, IPATCH_UNIT_TYPE_NONE, NULL, NULL}, /* EndLoopAddrCoarseOfs */ { {MAXNEG}, {MAXPOS}, {0}, IPATCH_UNIT_TYPE_32K_SAMPLES, N_("Sample Loop End Coarse Ofs"), NULL}, /* CourseTune */ { {-120}, {120}, {0}, IPATCH_UNIT_TYPE_SEMITONES, N_("Coarse Tune"), NULL}, /* FineTune */ { {-99}, {99}, {0}, IPATCH_UNIT_TYPE_CENTS, N_("Fine Tune"), NULL}, /* sampleId */ { {0}, {uword:UMAX}, {0}, IPATCH_UNIT_TYPE_UINT, N_("Sample ID"), NULL}, /* SampleModes */ { {0}, {3}, {0}, IPATCH_UNIT_TYPE_UINT, N_("Sample Modes"), NULL}, /* Reserved3 */ { {0}, {0}, {0}, IPATCH_UNIT_TYPE_NONE, NULL, NULL}, /* ScaleTuning */ { {0}, {1200}, {100}, IPATCH_UNIT_TYPE_CENTS, N_("Scale Tune"), NULL}, /* ExclusiveClass */ { {0}, {127}, {0}, IPATCH_UNIT_TYPE_INT, N_("Exclusive Class"), NULL}, /* RootNote */ { {-1}, {127}, {-1}, IPATCH_UNIT_TYPE_INT, N_("Root Note"), NULL} }; libinstpatch-1.0.0/libinstpatch/IpatchDLS2Region.h0000644000175000017500000002202711461332142016753 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchDLS2Region * @short_description: DLS region object * @see_also: #IpatchDLSInst * @stability: Stable * * DLS regions are child items of #IpatchDLSInst objects and define how an * individual audio sample is synthesized in an instrument. */ #ifndef __IPATCH_DLS2_REGION_H__ #define __IPATCH_DLS2_REGION_H__ #include #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchDLS2Region IpatchDLS2Region; typedef struct _IpatchDLS2RegionClass IpatchDLS2RegionClass; typedef struct _IpatchDLS2ParamArray IpatchDLS2ParamArray; #define IPATCH_TYPE_DLS2_REGION (ipatch_dls2_region_get_type ()) #define IPATCH_DLS2_REGION(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_DLS2_REGION, \ IpatchDLS2Region)) #define IPATCH_DLS2_REGION_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_DLS2_REGION, \ IpatchDLS2RegionClass)) #define IPATCH_IS_DLS2_REGION(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_DLS2_REGION)) #define IPATCH_IS_DLS2_REGION_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_DLS2_REGION)) #define IPATCH_DLS2_REGION_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_DLS2_REGION, \ IpatchDLS2RegionClass)) /* standard fixed connection parameter enums */ typedef enum { IPATCH_DLS2_PARAM_MOD_LFO_FREQ, IPATCH_DLS2_PARAM_MOD_LFO_DELAY, IPATCH_DLS2_PARAM_VIB_LFO_FREQ, IPATCH_DLS2_PARAM_VIB_LFO_DELAY, IPATCH_DLS2_PARAM_VOL_EG_DELAY, IPATCH_DLS2_PARAM_VOL_EG_ATTACK, IPATCH_DLS2_PARAM_VOL_EG_HOLD, IPATCH_DLS2_PARAM_VOL_EG_DECAY, IPATCH_DLS2_PARAM_VOL_EG_SUSTAIN, IPATCH_DLS2_PARAM_VOL_EG_RELEASE, IPATCH_DLS2_PARAM_VOL_EG_SHUTDOWN, IPATCH_DLS2_PARAM_VOL_EG_VELOCITY_TO_ATTACK, IPATCH_DLS2_PARAM_VOL_EG_NOTE_TO_DECAY, IPATCH_DLS2_PARAM_VOL_EG_NOTE_TO_HOLD, IPATCH_DLS2_PARAM_MOD_EG_DELAY, IPATCH_DLS2_PARAM_MOD_EG_ATTACK, IPATCH_DLS2_PARAM_MOD_EG_HOLD, IPATCH_DLS2_PARAM_MOD_EG_DECAY, IPATCH_DLS2_PARAM_MOD_EG_SUSTAIN, IPATCH_DLS2_PARAM_MOD_EG_RELEASE, IPATCH_DLS2_PARAM_MOD_EG_VELOCITY_TO_ATTACK, IPATCH_DLS2_PARAM_MOD_EG_NOTE_TO_DECAY, IPATCH_DLS2_PARAM_MOD_EG_NOTE_TO_HOLD, IPATCH_DLS2_PARAM_SCALE_TUNE, IPATCH_DLS2_PARAM_RPN2_TO_NOTE, IPATCH_DLS2_PARAM_FILTER_CUTOFF, IPATCH_DLS2_PARAM_FILTER_Q, IPATCH_DLS2_PARAM_MOD_LFO_TO_FILTER_CUTOFF, IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_FILTER_CUTOFF, IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_FILTER_CUTOFF, IPATCH_DLS2_PARAM_MOD_EG_TO_FILTER_CUTOFF, IPATCH_DLS2_PARAM_VELOCITY_TO_FILTER_CUTOFF, IPATCH_DLS2_PARAM_NOTE_TO_FILTER_CUTOFF, IPATCH_DLS2_PARAM_MOD_LFO_TO_GAIN, IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_GAIN, IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_GAIN, IPATCH_DLS2_PARAM_VELOCITY_TO_GAIN, IPATCH_DLS2_PARAM_CC7_TO_GAIN, IPATCH_DLS2_PARAM_CC11_TO_GAIN, IPATCH_DLS2_PARAM_TUNE, IPATCH_DLS2_PARAM_PITCH_WHEEL_RPN0_TO_PITCH, IPATCH_DLS2_PARAM_NOTE_NUMBER_TO_PITCH, IPATCH_DLS2_PARAM_RPN1_TO_PITCH, IPATCH_DLS2_PARAM_VIB_LFO_TO_PITCH, IPATCH_DLS2_PARAM_VIB_LFO_CC1_TO_PITCH, IPATCH_DLS2_PARAM_VIB_LFO_CHANNEL_PRESS_TO_PITCH, IPATCH_DLS2_PARAM_MOD_LFO_TO_PITCH, IPATCH_DLS2_PARAM_MOD_LFO_CC1_TO_PITCH, IPATCH_DLS2_PARAM_MOD_LFO_CHANNEL_PRESS_TO_PITCH, IPATCH_DLS2_PARAM_MOD_EG_TO_PITCH, IPATCH_DLS2_PARAM_PAN, IPATCH_DLS2_PARAM_CC10_TO_PAN, IPATCH_DLS2_PARAM_CC91_TO_REVERB_SEND, IPATCH_DLS2_PARAM_REVERB_SEND, IPATCH_DLS2_PARAM_CC93_TO_CHORUS_SEND, IPATCH_DLS2_PARAM_CHORUS_SEND, IPATCH_DLS2_PARAM_COUNT } IpatchDLS2Param; /* DLS2 parameters array */ struct _IpatchDLS2ParamArray { gint32 values[IPATCH_DLS2_PARAM_COUNT]; }; /* DLS2 region item */ struct _IpatchDLS2Region { IpatchItem parent_instance; /*< private >*/ guint8 note_range_low; /* MIDI note range low value */ guint8 note_range_high; /* MIDI note range high value */ guint8 velocity_range_low; /* MIDI velocity range low value */ guint8 velocity_range_high; /* MIDI velocity range high value */ guint16 key_group; /* Exclusive key group number or 0 */ guint16 layer_group; /* layer group (descriptive only) */ guint16 phase_group; /* Phase locked group number or 0 */ guint16 channel; /* channel ID (IpatchDLS2RegionChannelType) */ IpatchDLS2Info *info; /* info string values */ IpatchDLS2SampleInfo *sample_info; /* sample info override or NULL */ IpatchDLS2Sample *sample; /* referenced sample */ IpatchDLS2ParamArray params; /* array of standard parameter connections */ GSList *conns; /* non-standard connections (modulators) */ }; struct _IpatchDLS2RegionClass { IpatchItemClass parent_class; }; /* channel steering enum */ typedef enum { IPATCH_DLS2_REGION_CHANNEL_LEFT = 0, IPATCH_DLS2_REGION_CHANNEL_RIGHT = 1, IPATCH_DLS2_REGION_CHANNEL_CENTER = 2, IPATCH_DLS2_REGION_CHANNEL_LOW_FREQ = 3, IPATCH_DLS2_REGION_CHANNEL_SURROUND_LEFT = 4, IPATCH_DLS2_REGION_CHANNEL_SURROUND_RIGHT = 5, IPATCH_DLS2_REGION_CHANNEL_LEFT_OF_CENTER = 6, IPATCH_DLS2_REGION_CHANNEL_RIGHT_OF_CENTER = 7, IPATCH_DLS2_REGION_CHANNEL_SURROUND_CENTER = 8, IPATCH_DLS2_REGION_CHANNEL_SIDE_LEFT = 9, IPATCH_DLS2_REGION_CHANNEL_SIDE_RIGHT = 10, IPATCH_DLS2_REGION_CHANNEL_TOP = 11, IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_LEFT = 12, IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_CENTER = 13, IPATCH_DLS2_REGION_CHANNEL_TOP_FRONT_RIGHT = 14, IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_LEFT = 15, IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_CENTER = 16, IPATCH_DLS2_REGION_CHANNEL_TOP_REAR_RIGHT = 17 } IpatchDLS2RegionChannelType; /* mono audio alias */ #define IPATCH_DLS2_REGION_CHANNEL_MONO IPATCH_DLS2_REGION_CHANNEL_LEFT /* Flags crammed into IpatchItem flags (ditched 2 - 16 bit flag fields) */ typedef enum { IPATCH_DLS2_REGION_SELF_NON_EXCLUSIVE = 1 << IPATCH_ITEM_UNUSED_FLAG_SHIFT, IPATCH_DLS2_REGION_PHASE_MASTER = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 1), IPATCH_DLS2_REGION_MULTI_CHANNEL = 1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 2), IPATCH_DLS2_REGION_SAMPLE_INFO_OVERRIDE=1 << (IPATCH_ITEM_UNUSED_FLAG_SHIFT+3) } IpatchDLS2RegionFlags; #define IPATCH_DLS2_REGION_FLAG_MASK (0x0F << IPATCH_ITEM_UNUSED_FLAG_SHIFT) /* 4 flags + 2 for expansion */ #define IPATCH_DLS2_REGION_UNUSED_FLAG_SHIFT (IPATCH_ITEM_UNUSED_FLAG_SHIFT + 6) /* parameter info structure for IpatchDLS2Param_tables.c */ typedef struct { gint32 min; /* minimum value for this parameter (soft limit) */ gint32 max; /* maximum value for this parameter (soft limit) */ gint32 def; /* default value for this parameter */ guint unit; /* #IpatchUnitType */ char *label; /* text label for this parameter */ } IpatchDLS2ParamInfo; GType ipatch_dls2_region_get_type (void); IpatchDLS2Region *ipatch_dls2_region_new (void); IpatchDLS2Region *ipatch_dls2_region_first (IpatchIter *iter); IpatchDLS2Region *ipatch_dls2_region_next (IpatchIter *iter); char *ipatch_dls2_region_get_info (IpatchDLS2Region *region, guint32 fourcc); void ipatch_dls2_region_set_info (IpatchDLS2Region *region, guint32 fourcc, const char *val); void ipatch_dls2_region_set_sample (IpatchDLS2Region *region, IpatchDLS2Sample *sample); IpatchDLS2Sample *ipatch_dls2_region_get_sample (IpatchDLS2Region *region); IpatchDLS2Sample *ipatch_dls2_region_peek_sample (IpatchDLS2Region *region); void ipatch_dls2_region_set_note_range (IpatchDLS2Region *region, int low, int high); void ipatch_dls2_region_set_velocity_range (IpatchDLS2Region *region, int low, int high); gboolean ipatch_dls2_region_in_range (IpatchDLS2Region *region, int note, int velocity); void ipatch_dls2_region_set_param (IpatchDLS2Region *region, IpatchDLS2Param param, gint32 val); void ipatch_dls2_region_set_param_array (IpatchDLS2Region *region, IpatchDLS2ParamArray *array); GSList *ipatch_dls2_region_get_conns (IpatchDLS2Region *region); void ipatch_dls2_region_set_conn (IpatchDLS2Region *region, const IpatchDLS2Conn *conn); void ipatch_dls2_region_unset_conn (IpatchDLS2Region *region, const IpatchDLS2Conn *conn); void ipatch_dls2_region_unset_all_conns (IpatchDLS2Region *region); guint ipatch_dls2_region_conn_count (IpatchDLS2Region *region); int ipatch_dls2_region_channel_map_stereo (IpatchDLS2RegionChannelType chan); #endif libinstpatch-1.0.0/libinstpatch/IpatchFile.c0000644000175000017500000010654111461332142015761 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include /* for stat and fstat */ #include #include #include #include #include #include #include "IpatchFile.h" #include "ipatch_priv.h" enum { PROP_0, PROP_FILE_NAME }; #define IPATCH_FILE_FREE_IOFUNCS(file) \ (ipatch_item_get_flags(file) & IPATCH_FILE_FLAG_FREE_IOFUNCS) static void ipatch_file_class_init (IpatchFileClass *klass); static void ipatch_file_init (IpatchFile *file); static void ipatch_file_finalize (GObject *gobject); static void ipatch_file_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_file_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static gboolean ipatch_file_real_set_name (IpatchFile *file, const char *file_name); static GType ipatch_file_real_identify (IpatchFile *file, gboolean byext, GError **err); static GType *type_all_children (GType type, GArray *pass_array); static gint sort_type_by_identify_order (gconstpointer a, gconstpointer b); static gboolean ipatch_file_null_open_method (IpatchFileHandle *handle, const char *mode, GError **err); static GIOStatus ipatch_file_null_read_method (IpatchFileHandle *handle, gpointer buf, guint size, guint *bytes_read, GError **err); static GIOStatus ipatch_file_null_write_method (IpatchFileHandle *handle, gconstpointer buf, guint size, GError **err); static GIOStatus ipatch_file_null_seek_method (IpatchFileHandle *handle, int offset, GSeekType type, GError **err); /* default methods GIOChannel based methods */ static IpatchFileIOFuncs default_iofuncs = { ipatch_file_default_open_method, ipatch_file_default_close_method, ipatch_file_default_read_method, ipatch_file_default_write_method, ipatch_file_default_seek_method, ipatch_file_default_getfd_method, ipatch_file_default_get_size_method }; /* null methods (/dev/null like iofuncs) */ static IpatchFileIOFuncs null_iofuncs = { ipatch_file_null_open_method, NULL, /* close method */ ipatch_file_null_read_method, ipatch_file_null_write_method, ipatch_file_null_seek_method, NULL, /* get fd method */ NULL /* get_size method */ }; G_DEFINE_TYPE (IpatchFile, ipatch_file, IPATCH_TYPE_ITEM); static void ipatch_file_class_init (IpatchFileClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->finalize = ipatch_file_finalize; obj_class->get_property = ipatch_file_get_property; item_class->item_set_property = ipatch_file_set_property; klass->identify = NULL; g_object_class_install_property (obj_class, PROP_FILE_NAME, g_param_spec_string ("file-name", "File Name", "File Name", NULL, G_PARAM_READWRITE)); } static void ipatch_file_init (IpatchFile *file) { file->iofuncs = &default_iofuncs; ipatch_item_clear_flags (file, IPATCH_FILE_FLAG_FREE_IOFUNCS); } static void ipatch_file_finalize (GObject *gobject) { IpatchFile *file = IPATCH_FILE (gobject); IpatchFileClass *file_class; file_class = IPATCH_FILE_GET_CLASS (file); IPATCH_ITEM_WLOCK (file); /* No handles will be open, since they hold refs on the file */ /* free iofuncs structure if needed */ if (file->iofuncs && ipatch_item_get_flags (file) & IPATCH_FILE_FLAG_FREE_IOFUNCS) { g_slice_free (IpatchFileIOFuncs, file->iofuncs); file->iofuncs = NULL; } g_free (file->file_name); file->file_name = NULL; if (file->iochan) g_io_channel_unref (file->iochan); IPATCH_ITEM_WUNLOCK (file); if (G_OBJECT_CLASS (ipatch_file_parent_class)->finalize) G_OBJECT_CLASS (ipatch_file_parent_class)->finalize (gobject); } static void ipatch_file_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchFile *file = IPATCH_FILE (object); switch (property_id) { case PROP_FILE_NAME: ipatch_file_real_set_name (file, g_value_get_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_file_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchFile *file = IPATCH_FILE (object); switch (property_id) { case PROP_FILE_NAME: g_value_take_string (value, ipatch_file_get_name (file)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } /** * ipatch_file_new: * * Create a new file object * * Returns: The new file object */ IpatchFile * ipatch_file_new (void) { return (IPATCH_FILE (g_object_new (IPATCH_TYPE_FILE, NULL))); } /** * ipatch_file_set_name: * @file: File object to assign file name to * @file_name: File name or %NULL to unset the file name * * Sets the file name of a file object. Assigning the file name of an #IpatchFile * object is optional, since a file descriptor could be assigned instead, * but some subsystems depend on it. */ void ipatch_file_set_name (IpatchFile *file, const char *file_name) { if (ipatch_file_real_set_name (file, file_name)) g_object_notify (G_OBJECT (file), "file-name"); } static gboolean ipatch_file_real_set_name (IpatchFile *file, const char *file_name) { g_return_val_if_fail (IPATCH_IS_FILE (file), FALSE); IPATCH_ITEM_WLOCK (file); g_free (file->file_name); if (file_name) file->file_name = g_strdup (file_name); else file->file_name = NULL; IPATCH_ITEM_WUNLOCK (file); return (TRUE); } /** * ipatch_file_get_name: * @file: File object to get file name from * * Gets the assigned file name from a file object. * * Returns: The file name of the file object or %NULL if not set. String * should be freed when finished with it. */ char * ipatch_file_get_name (IpatchFile *file) { char *file_name = NULL; g_return_val_if_fail (IPATCH_IS_FILE (file), NULL); IPATCH_ITEM_RLOCK (file); if (file->file_name) file_name = g_strdup (file->file_name); IPATCH_ITEM_RUNLOCK (file); return (file_name); } /** * ipatch_file_open: * @file: File object to open from a file name. * @file_name: Name of file to open or %NULL to use the file object's assigned * file name (in which case it should not be %NULL). * @mode: File open mode ("r" for read or "w" for write) * @err: Error information * * Opens a handle to a file object. If a I/O channel or file descriptor is * already assigned (with ipatch_file_assign_fd() or * ipatch_file_assign_io_channel()) then it is used instead of opening a file * using @file_name or the already assigned #IpatchFile:file-name property. * * Returns: New file handle or %NULL (in which case @err may be set). The * returned file handle is not multi-thread safe, but the file can be opened * multiple times for this purpose. */ IpatchFileHandle * ipatch_file_open (IpatchFile *file, const char *file_name, const char *mode, GError **err) { IpatchFileHandle *handle; GIOChannel *iochan = NULL; char *old_file_name = NULL; char *dup_file_name; int retval = FALSE; g_return_val_if_fail (IPATCH_IS_FILE (file), NULL); g_return_val_if_fail (file->iofuncs != NULL, NULL); dup_file_name = g_strdup (file_name); /* ++ dup file name */ handle = g_slice_new0 (IpatchFileHandle); /* ++ alloc handle */ handle->file = file; IPATCH_ITEM_WLOCK (file); if (log_if_fail (file->iofuncs->open != NULL)) { IPATCH_ITEM_WUNLOCK (file); g_slice_free (IpatchFileHandle, handle); /* -- free handle */ g_free (dup_file_name); /* -- free dup file name */ return (NULL); } if (dup_file_name) /* set file name if supplied */ { old_file_name = file->file_name; file->file_name = dup_file_name; /* !! takes over allocation of dup file name */ } if (file->iochan) { iochan = g_io_channel_ref (file->iochan); /* ++ ref io channel */ handle->iochan = iochan; } retval = file->iofuncs->open (handle, mode, err); IPATCH_ITEM_WUNLOCK (file); g_free (old_file_name); /* -- free old file name */ if (!retval) { g_slice_free (IpatchFileHandle, handle); /* -- free handle */ if (iochan) g_io_channel_unref (iochan); /* -- unref iochan */ return (NULL); } g_object_ref (file); /* ++ ref file for handle */ handle->buf = g_byte_array_new (); return (handle); /* !! caller takes over handle */ } /** * ipatch_file_assign_fd: * @file: File object * @fd: File descriptor to assign to file object, or -1 to clear it * @close_on_finalize: %TRUE if the descriptor should be closed when @file is * finalized, %FALSE to leave it open * * Assigns a file descriptor to a file, which gets used for calls to * ipatch_file_open(). Note that this means multiple opens will use the same * file descriptor and will therefore conflict, so it should only be used in the * case where the file object is used by a single exclusive handle. */ void ipatch_file_assign_fd (IpatchFile *file, int fd, gboolean close_on_finalize) { GIOChannel *iochan; g_return_if_fail (IPATCH_IS_FILE (file)); iochan = g_io_channel_unix_new (fd); /* ++ ref new io channel */ g_io_channel_set_close_on_unref (iochan, close_on_finalize); g_io_channel_set_encoding (iochan, NULL, NULL); ipatch_file_assign_io_channel (file, iochan); g_io_channel_unref (iochan); /* -- unref creator's ref */ } /** * ipatch_file_assign_io_channel: * @file: File object * @iochan: IO channel to assign to @file or %NULL to clear it * * Assigns an I/O channel to a file, which gets used for calls to * ipatch_file_open(). Note that this means multiple opens will use the same * file descriptor and will therefore conflict, so it should only be used in the * case where the file object is used by a single exclusive handle. */ void ipatch_file_assign_io_channel (IpatchFile *file, GIOChannel *iochan) { GIOChannel *old_iochan; g_return_if_fail (IPATCH_IS_FILE (file)); if (iochan) g_io_channel_ref (iochan); /* ++ ref for file */ IPATCH_ITEM_WLOCK (file); old_iochan = file->iochan; file->iochan = iochan; IPATCH_ITEM_WUNLOCK (file); if (old_iochan) g_io_channel_unref (file->iochan); } /** * ipatch_file_get_io_channel: * @handle: File handle * * Get the glib IO channel object from a file handle. The caller owns a * reference to the returned io channel, and it should be unreferenced with * g_io_channel_unref() when finished with it. * * Returns: GIOChannel assigned to the @handle or %NULL if none (some * derived #IpatchFile types might not use io channels). Remember to unref it * with g_io_channel_unref() when finished. */ GIOChannel * ipatch_file_get_io_channel (IpatchFileHandle *handle) { GIOChannel *iochan; g_return_val_if_fail (handle != NULL, NULL); if ((iochan = handle->iochan)) g_io_channel_ref (iochan); return (iochan); } /** * ipatch_file_get_fd: * @handle: File handle * * Get the unix file descriptor associated with a file handle. Not all file * handles have a real OS file descriptor. * * Returns: File descriptor or -1 if not open or failed to get descriptor. */ int ipatch_file_get_fd (IpatchFileHandle *handle) { int fd = -1; g_return_val_if_fail (handle != NULL, -1); g_return_val_if_fail (IPATCH_IS_FILE (handle->file), -1); if (handle->file->iofuncs && handle->file->iofuncs->getfd) fd = handle->file->iofuncs->getfd (handle); return (fd); } /** * ipatch_file_close: * @handle: File handle * * Close a file handle and free it. */ void ipatch_file_close (IpatchFileHandle *handle) { g_return_if_fail (handle != NULL); g_return_if_fail (IPATCH_IS_FILE (handle->file)); if (handle->file->iofuncs && handle->file->iofuncs->close) handle->file->iofuncs->close (handle); g_object_unref (handle->file); if (handle->buf) g_byte_array_free (handle->buf, TRUE); if (handle->iochan) g_io_channel_unref (handle->iochan); g_slice_free (IpatchFileHandle, handle); } /** * ipatch_file_get_position: * @handle: File handle * * Gets the current position in a file handle. Note that this * might not be the actual position in the file if the file handle was * attached to an already open file or if ipatch_file_update_position() is * used to set virtual positions. * * Returns: Position in file handle. */ guint ipatch_file_get_position (IpatchFileHandle *handle) { g_return_val_if_fail (handle != NULL, 0); return (handle->position); } /** * ipatch_file_update_position: * @handle: File handle * @offset: Offset to add to the position counter (can be negative) * * Adds an offset value to the position counter in a file handle. This can * be used if one is operating directly on the underlying file descriptor (i.e., * not using the #IpatchFile functions) or to add virtual space to the counter. * Adding virtual space is useful when a system uses the position counter to * write data (such as the RIFF parser) to act as a place holder for data that * isn't actually written (sample data for example). */ void ipatch_file_update_position (IpatchFileHandle *handle, guint offset) { g_return_if_fail (handle != NULL); handle->position += offset; } /** * ipatch_file_read: * @handle: File handle * @buf: Buffer to read data into * @size: Amount of data to read, in bytes. * @err: A location to return an error of type GIOChannelError or %NULL. * * Reads data from a file handle. An end of file encountered while * trying to read the specified @size of data is treated as an error. * If this is undesirable use ipatch_file_read_eof() instead. * * Returns: %TRUE on success (the requested @size of data was read), %FALSE * otherwise */ gboolean ipatch_file_read (IpatchFileHandle *handle, gpointer buf, guint size, GError **err) { GIOStatus status; /* we let ipatch_file_read_eof do checks for us */ status = ipatch_file_read_eof (handle, buf, size, NULL, err); if (status == G_IO_STATUS_EOF) { if (err && !*err) g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNEXPECTED_EOF, _("Unexpected end of file")); return (FALSE); } return (status == G_IO_STATUS_NORMAL); } /** * ipatch_file_read_eof: * @handle: File handle * @buf: Buffer to read data into * @size: Amount of data to read, in bytes. * @bytes_read: Pointer to store number of bytes actually read or %NULL. * @err: A location to return an error of type GIOChannelError or %NULL. * * Reads data from a file handle. This function does not treat end of file * as an error and will return #G_IO_STATUS_EOF with the number of bytes * actually read in @bytes_read. Use ipatch_file_read() for convenience to * ensure actual number of requested bytes is read. * * Returns: The status of the operation */ GIOStatus ipatch_file_read_eof (IpatchFileHandle *handle, gpointer buf, guint size, guint *bytes_read, GError **err) { GIOStatus status; guint _bytes_read = 0; if (bytes_read) *bytes_read = 0; g_return_val_if_fail (handle != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (IPATCH_IS_FILE (handle->file), G_IO_STATUS_ERROR); g_return_val_if_fail (handle->file->iofuncs != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (handle->file->iofuncs->read != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (buf != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (size > 0, FALSE); g_return_val_if_fail (!err || !*err, G_IO_STATUS_ERROR); status = handle->file->iofuncs->read (handle, buf, size, &_bytes_read, err); if (bytes_read) *bytes_read = _bytes_read; handle->position += _bytes_read; return (status); } /* Used internally by IpatchFileBuf. Like ipatch_file_read() but does not * update handle->position, since buffered functions do this themselves. */ gboolean _ipatch_file_read_no_pos_update (IpatchFileHandle *handle, gpointer buf, guint size, GError **err) { guint _bytes_read = 0; return (handle->file->iofuncs->read (handle, buf, size, &_bytes_read, err) == G_IO_STATUS_NORMAL); } /** * ipatch_file_write: * @handle: File handle * @buf: Buffer of data to write * @size: Amount of data to write, in bytes. * @err: A location to return an error of type GIOChannelError or %NULL. * * Writes data to a file object. * * Returns: The status of the operation */ gboolean ipatch_file_write (IpatchFileHandle *handle, gconstpointer buf, guint size, GError **err) { GIOStatus status; g_return_val_if_fail (handle != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (IPATCH_IS_FILE (handle->file), G_IO_STATUS_ERROR); g_return_val_if_fail (handle->file->iofuncs != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (handle->file->iofuncs->write != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (buf != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (size > 0, FALSE); g_return_val_if_fail (!err || !*err, G_IO_STATUS_ERROR); status = handle->file->iofuncs->write (handle, buf, size, err); if (status == G_IO_STATUS_NORMAL) handle->position += size; return (status == G_IO_STATUS_NORMAL); } /* Used internally by IpatchFileBuf. Like ipatch_file_write() but does not * update handle->position, since buffered functions do this themselves. */ gboolean _ipatch_file_write_no_pos_update (IpatchFileHandle *handle, gconstpointer buf, guint size, GError **err) { return (handle->file->iofuncs->write (handle, buf, size, err) == G_IO_STATUS_NORMAL); } /** * ipatch_file_seek: * @handle: File handle * @offset: Offset in bytes to seek from the position specified by @type * @type: Position in file to seek from (see g_io_channel_seek_position * for more details, only #G_SEEK_CUR and #G_SEEK_SET allowed). * @err: A location to return error info or %NULL. * * Seek in a file handle. An end of file condition is treated as an error, use * ipatch_file_seek_eof() if this is undesirable. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_file_seek (IpatchFileHandle *handle, int offset, GSeekType type, GError **err) { GIOStatus status; /* we let ipatch_file_seek_eof do checks for us */ status = ipatch_file_seek_eof (handle, offset, type, err); if (status == G_IO_STATUS_EOF) { if (err && !*err) g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNEXPECTED_EOF, _("Unexpected end of file")); return (FALSE); } return (status == G_IO_STATUS_NORMAL); } /** * ipatch_file_seek_eof: * @handle: File handle * @offset: Offset in bytes to seek from the position specified by @type * @type: Position in file to seek from (see g_io_channel_seek_position * for more details, only G_SEEK_CUR and G_SEEK_SET allowed). * @err: A location to return error info or %NULL. * * Seek in a file object. Does not treat end of file as an error, use * ipatch_file_seek() for convenience if this is desirable. * * Returns: The status of the operation */ GIOStatus ipatch_file_seek_eof (IpatchFileHandle *handle, int offset, GSeekType type, GError **err) { GIOStatus status; g_return_val_if_fail (handle != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (IPATCH_IS_FILE (handle->file), G_IO_STATUS_ERROR); g_return_val_if_fail (handle->file->iofuncs != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (handle->file->iofuncs->seek != NULL, G_IO_STATUS_ERROR); g_return_val_if_fail (type == G_SEEK_CUR || type == G_SEEK_SET, G_IO_STATUS_ERROR); g_return_val_if_fail (!err || !*err, G_IO_STATUS_ERROR); status = handle->file->iofuncs->seek (handle, offset, type, err); if (status == G_IO_STATUS_NORMAL) { if (type == G_SEEK_SET) handle->position = offset; else handle->position += offset; } return (status); } /** * ipatch_file_get_size: * @file: File object to get size of * @err: Location to store error information * * Get the size of a file object. * * Returns: File size or -1 on error or if operation unsupported by this file * object (in which case @err may be set) */ int ipatch_file_get_size (IpatchFile *file, GError **err) { int size = -1; g_return_val_if_fail (IPATCH_IS_FILE (file), -1); g_return_val_if_fail (file->iofuncs != NULL, -1); g_return_val_if_fail (!err || !*err, -1); if (file->iofuncs->get_size) /* has get_size IO function? */ size = file->iofuncs->get_size (file, err); return (size); } /** * ipatch_file_identify: * @file: File object to identify type of * @err: Location to store error information * * Attempts to identify the type of a file using the "identify" method of * registered types derived from #IpatchFile. The #IpatchFile:file-name property * should already be assigned. * * Returns: The first #IpatchFile derived type that had an "identify" method * which returned %TRUE, or 0 if unknown file type or error, in which * case error information will be stored in @err provided its not %NULL. */ GType ipatch_file_identify (IpatchFile *file, GError **err) { return (ipatch_file_real_identify (file, FALSE, err)); } /** * ipatch_file_identify_by_ext: * @file: File object to identify type of * * Attempts to identify the type of a file using the "identify" method of * registered types derived from #IpatchFile. The #IpatchFile:file-name property * should already be assigned. Like ipatch_file_identify() but identifies a * file by its file name extension only. * * Returns: The first #IpatchFile derived type that had an "identify" method * which returned %TRUE, or 0 if unknown file type or error, in which * case error information will be stored in @err provided its not %NULL. */ GType ipatch_file_identify_by_ext (IpatchFile *file) { return (ipatch_file_real_identify (file, TRUE, NULL)); } static GType ipatch_file_real_identify (IpatchFile *file, gboolean byext, GError **err) { IpatchFileHandle *handle = NULL; IpatchFileClass *file_class; GType *children, *p; GType found = 0; GError *local_err = NULL; g_return_val_if_fail (IPATCH_IS_FILE (file), 0); g_return_val_if_fail (file->file_name != NULL, 0); if (!byext) { /* Open a handle to the file */ handle = ipatch_file_open (file, NULL, "r", err); if (!handle) return (0); } children = type_all_children (IPATCH_TYPE_FILE, NULL); for (p = children; *p; p++) { file_class = g_type_class_ref (*p); if (!file_class) continue; if (file_class->identify) { if (!file_class->identify (file, handle, &local_err)) { if (local_err) { g_propagate_error (err, local_err); g_type_class_unref (file_class); if (handle) ipatch_file_close (handle); return (0); } } else found = *p; if (handle) ipatch_file_seek (handle, 0, G_SEEK_SET, NULL); } g_type_class_unref (file_class); if (found != 0) break; } if (handle) ipatch_file_close (handle); return (found); } static GType * type_all_children (GType type, GArray *pass_array) { static GType *types = NULL; GArray *array = pass_array; GType *children; int i; if (types) return (types); if (!array) array = g_array_new (TRUE, FALSE, sizeof (GType)); /* Zero terminated */ children = g_type_children (type, NULL); if (children) { for (i = 0; children[i]; i++) { type_all_children (children[i], array); g_array_append_val (array, children[i]); } g_free (children); } if (!pass_array) /* last iteration? */ { types = (array->len > 0) ? (GType *)(array->data) : NULL; g_array_sort (array, sort_type_by_identify_order); g_array_free (array, FALSE); return (types); } else return (NULL); } /* Sort IpatchFile types by their identify_order class field (largest value first order) */ static gint sort_type_by_identify_order (gconstpointer a, gconstpointer b) { const GType *typea = a, *typeb = b; IpatchFileClass *klassa, *klassb; gint retval; klassa = g_type_class_ref (*typea); /* ++ ref class */ klassb = g_type_class_ref (*typeb); /* ++ ref class */ retval = klassb->identify_order - klassa->identify_order; g_type_class_unref (klassa); /* -- unref class */ g_type_class_unref (klassb); /* -- unref class */ return (retval); } /** * ipatch_file_identify_open: * @file_name: File name to identify and open * @err: Location to store error of type GIOChannelError * * A convenience function which calls ipatch_file_identify() to determine the * file type of @file_name. If the type is identified a new file object, of the * identified type, is created and the file is opened with * ipatch_file_open() in read mode. * * Returns: The new opened handle of the identified type or %NULL if unable to * identify. Caller should free the handle with ipatch_file_close() when done * using it, at which point the parent #IpatchFile will be destroyed if no other * reference is held (by calling ipatch_file_handle_get_file() for example). */ IpatchFileHandle * ipatch_file_identify_open (const char *file_name, GError **err) { IpatchFileHandle *handle; IpatchFile *file; GType file_type; g_return_val_if_fail (file_name != NULL, NULL); g_return_val_if_fail (!err || !*err, NULL); file = ipatch_file_new (); /* ++ ref new file */ ipatch_file_set_name (file, file_name); file_type = ipatch_file_identify (file, err); g_object_unref (file); /* -- unref file */ if (file_type == 0) return (NULL); file = g_object_new (file_type, NULL); /* ++ ref file */ handle = ipatch_file_open (file, file_name, "r", err); /* ++ alloc handle */ g_object_unref (file); /* -- unref file (handle holds a ref) */ return (handle); /* !! caller takes over handle */ } /** * ipatch_file_set_little_endian: * @file: File object * * Sets the file object to little endian mode (the default mode). * If the system is big endian, byte swapping will be enabled * (see IPATCH_FILE_SWAPxx macros). The endian mode affects buffered * read and write functions that operate on multi-byte integers. */ void ipatch_file_set_little_endian (IpatchFile *file) { g_return_if_fail (IPATCH_IS_FILE (file)); IPATCH_ITEM_WLOCK (file); ipatch_item_clear_flags (file, IPATCH_FILE_FLAG_BIG_ENDIAN); if (G_BYTE_ORDER != G_LITTLE_ENDIAN) ipatch_item_set_flags (file, IPATCH_FILE_FLAG_SWAP); IPATCH_ITEM_WUNLOCK (file); } /** * ipatch_file_set_big_endian: * @file: File object * * Sets the file object to big endian mode (the default is little endian). * If the system is little endian, byte swapping will be enabled * (see IPATCH_FILE_SWAPxx macros). The endian mode affects buffered * read and write functions that operate on multi-byte integers. */ void ipatch_file_set_big_endian (IpatchFile *file) { g_return_if_fail (IPATCH_IS_FILE (file)); IPATCH_ITEM_WLOCK (file); ipatch_item_set_flags (file, IPATCH_FILE_FLAG_BIG_ENDIAN); if (G_BYTE_ORDER != G_BIG_ENDIAN) ipatch_item_set_flags (file, IPATCH_FILE_FLAG_SWAP); IPATCH_ITEM_WUNLOCK (file); } /** * ipatch_file_set_iofuncs_static: * @file: File object * @funcs: Static IO functions structure or %NULL to set to defaults * * Sets the input/output functions of a file object using a statically * allocated (guaranteed to exist for lifetime of @file) functions structure. * Setting these functions allows one to write custom data sources or hook * into other file functions. */ void ipatch_file_set_iofuncs_static (IpatchFile *file, IpatchFileIOFuncs *funcs) { g_return_if_fail (IPATCH_IS_FILE (file)); IPATCH_ITEM_WLOCK (file); if (IPATCH_FILE_FREE_IOFUNCS (file)) g_slice_free (IpatchFileIOFuncs, file->iofuncs); file->iofuncs = funcs ? funcs : &default_iofuncs; ipatch_item_clear_flags (file, IPATCH_FILE_FLAG_FREE_IOFUNCS); IPATCH_ITEM_WUNLOCK (file); } /** * ipatch_file_set_iofuncs: * @file: File object * @funcs: IO functions structure or %NULL to set to defaults * * Sets the input/output functions of a file object. The @funcs * structure is duplicated so as not to use the original, see * ipatch_file_set_iofuncs_static() for using a static structure. * Setting these functions allows one to write custom data sources or * hook into other file functions. */ void ipatch_file_set_iofuncs (IpatchFile *file, const IpatchFileIOFuncs *funcs) { IpatchFileIOFuncs *dupfuncs = NULL; g_return_if_fail (IPATCH_IS_FILE (file)); if (funcs) /* duplicate functions structure */ { dupfuncs = g_slice_new (IpatchFileIOFuncs); *dupfuncs = *funcs; } IPATCH_ITEM_WLOCK (file); if (IPATCH_FILE_FREE_IOFUNCS (file)) g_slice_free (IpatchFileIOFuncs, file->iofuncs); file->iofuncs = dupfuncs ? dupfuncs : &default_iofuncs; if (dupfuncs) ipatch_item_set_flags (file, IPATCH_FILE_FLAG_FREE_IOFUNCS); else ipatch_item_clear_flags (file, IPATCH_FILE_FLAG_FREE_IOFUNCS); IPATCH_ITEM_WUNLOCK (file); } /** * ipatch_file_get_iofuncs: * @file: File object * @out_funcs: Location to store current IO functions to * * Get the current IO functions from a file object. The function pointers * are stored in a user supplied structure pointed to by @out_funcs. */ void ipatch_file_get_iofuncs (IpatchFile *file, IpatchFileIOFuncs *out_funcs) { g_return_if_fail (IPATCH_IS_FILE (file)); g_return_if_fail (out_funcs != NULL); IPATCH_ITEM_RLOCK (file); *out_funcs = *file->iofuncs; IPATCH_ITEM_RUNLOCK (file); } /** * ipatch_file_set_iofuncs_null: * @file: File object * * Sets the I/O functions of a file object to /dev/null like methods. * Reading from the file will return 0s, writing/seeking will do nothing. */ void ipatch_file_set_iofuncs_null (IpatchFile *file) { g_return_if_fail (IPATCH_IS_FILE (file)); ipatch_file_set_iofuncs_static (file, &null_iofuncs); } /** * ipatch_file_default_open_method: * @handle: File handle * @mode: File open mode * @err: Error info * * Default "open" method for #IpatchFileIOFuncs. Useful when overriding only * some I/O functions. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_file_default_open_method (IpatchFileHandle *handle, const char *mode, GError **err) { if (handle->iochan) /* io channel has been explicitly set? */ { g_io_channel_set_encoding (handle->iochan, NULL, NULL); return (TRUE); } g_return_val_if_fail (mode != NULL, FALSE); g_return_val_if_fail (handle->file->file_name != NULL, FALSE); handle->iochan = g_io_channel_new_file (handle->file->file_name, mode, err); if (handle->iochan) { g_io_channel_set_encoding (handle->iochan, NULL, NULL); return (TRUE); } else return (FALSE); } /** * ipatch_file_default_close_method: * @handle: File handle * * Default "close" method for #IpatchFileIOFuncs. Useful when overriding only * some I/O functions. */ void ipatch_file_default_close_method (IpatchFileHandle *handle) { g_return_if_fail (handle->iochan != NULL); g_io_channel_shutdown (handle->iochan, TRUE, NULL); g_io_channel_unref (handle->iochan); handle->iochan = NULL; } /** * ipatch_file_default_read_method: * @handle: File handle * @buf: Buffer to store data to * @size: Size of data * @bytes_read: Number of bytes actually read * @err: Error info * * Default "read" method for #IpatchFileIOFuncs. Useful when overriding only * some I/O functions. * * Returns: The status of the operation. */ GIOStatus ipatch_file_default_read_method (IpatchFileHandle *handle, gpointer buf, guint size, guint *bytes_read, GError **err) { gsize _bytes_read = 0; GIOStatus status; g_return_val_if_fail (handle->iochan != NULL, G_IO_STATUS_ERROR); status = g_io_channel_read_chars (handle->iochan, buf, size, &_bytes_read, err); *bytes_read = _bytes_read; return (status); } /** * ipatch_file_default_write_method: * @handle: File handle * @buf: Buffer to read data from * @size: Size of data * @err: Error info * * Default "write" method for #IpatchFileIOFuncs. Useful when overriding only * some I/O functions. * * Returns: The status of the operation. */ GIOStatus ipatch_file_default_write_method (IpatchFileHandle *handle, gconstpointer buf, guint size, GError **err) { GIOStatus status; g_return_val_if_fail (handle->iochan != NULL, G_IO_STATUS_ERROR); status = g_io_channel_write_chars (handle->iochan, buf, size, NULL, err); return (status); } /** * ipatch_file_default_seek_method: * @handle: File handle * @offset: Offset (depends on seek @type) * @type: Seek type * @err: Error info * * Default "seek" method for #IpatchFileIOFuncs. Useful when overriding only * some I/O functions. * * Returns: The status of the operation. */ GIOStatus ipatch_file_default_seek_method (IpatchFileHandle *handle, int offset, GSeekType type, GError **err) { g_return_val_if_fail (handle->iochan != NULL, G_IO_STATUS_ERROR); return (g_io_channel_seek_position (handle->iochan, offset, type, err)); } /** * ipatch_file_default_getfd_method: * @handle: File handle * * Default "getfd" method for #IpatchFileIOFuncs. Useful when overriding only * some I/O functions. This method gets a unix file descriptor for the given * file object, it is an optional method. * * Returns: Unix file descriptor or -1 if no file descriptor or error. */ int ipatch_file_default_getfd_method (IpatchFileHandle *handle) { return (handle->iochan ? g_io_channel_unix_get_fd (handle->iochan) : -1); } /** * ipatch_file_default_get_size_method: * @file: File object * @err: Error info * * Default get file size method, which is optional. * * Returns: File size or -1 on error (in which case @err may be set). */ int ipatch_file_default_get_size_method (IpatchFile *file, GError **err) { struct stat info; if (file->file_name) { if (g_stat (file->file_name, &info) != 0) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_IO, _("Error during call to stat(\"%s\"): %s"), file->file_name, g_strerror (errno)); return (-1); } return (info.st_size); } else return (-1); } /* --------------------------------------------------------------- * NULL file iofunc methods (like /dev/null) * --------------------------------------------------------------- */ static gboolean ipatch_file_null_open_method (IpatchFileHandle *handle, const char *mode, GError **err) { return (TRUE); } static GIOStatus ipatch_file_null_read_method (IpatchFileHandle *handle, gpointer buf, guint size, guint *bytes_read, GError **err) { memset (buf, 0, size); *bytes_read = size; return (G_IO_STATUS_NORMAL); } static GIOStatus ipatch_file_null_write_method (IpatchFileHandle *handle, gconstpointer buf, guint size, GError **err) { return (G_IO_STATUS_NORMAL); } static GIOStatus ipatch_file_null_seek_method (IpatchFileHandle *handle, int offset, GSeekType type, GError **err) { return (G_IO_STATUS_NORMAL); } libinstpatch-1.0.0/libinstpatch/IpatchContainer.c0000644000175000017500000004327311461332142017026 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchContainer.h" #include "ipatch_priv.h" /* libInstPatch private functions defined in IpatchContainer_notify.c */ extern void _ipatch_container_notify_init (void); extern void ipatch_container_add_notify (IpatchContainer *container, IpatchItem *child); extern void ipatch_container_remove_notify (IpatchContainer *container, IpatchItem *child); static void ipatch_container_init_class (IpatchContainerClass *klass); static void ipatch_container_finalize (GObject *object); static GObjectClass *parent_class = NULL; /* for fast hook method access */ static IpatchContainerClass *real_container_class = NULL; GType ipatch_container_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchContainerClass), NULL, NULL, (GClassInitFunc) ipatch_container_init_class, NULL, NULL, sizeof (IpatchContainer), 0, (GInstanceInitFunc) NULL, }; item_type = g_type_register_static (IPATCH_TYPE_ITEM, "IpatchContainer", &item_info, G_TYPE_FLAG_ABSTRACT); _ipatch_container_notify_init (); /* init container add/remove notify system */ } return (item_type); } static void ipatch_container_init_class (IpatchContainerClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_peek_parent (klass); real_container_class = klass; obj_class->finalize = ipatch_container_finalize; } static void ipatch_container_finalize (GObject *object) { /* clear hooks flag, we are finalizing, shouldn't be any hook callbacks or should there be? FIXME */ ipatch_item_clear_flags (IPATCH_ITEM (object), IPATCH_ITEM_HOOKS_ACTIVE); ipatch_container_remove_all (IPATCH_CONTAINER (object)); if (parent_class->finalize) parent_class->finalize (object); } /** * ipatch_container_get_children: * @container: Container object * @type: GType of child items to get (will match type descendants as well) * * Get a list of child items from a container object. A new #IpatchList is * created containing all matching child items. The returned list object can * be iterated over safely even in a multi-thread environment. If * performance is an issue, ipatch_container_init_iter() can be used instead, * although it requires locking of the container object. * * Returns: New object list containing all matching items (an empty * list if no items matched). The caller owns a reference to the * object list and removing the reference will destroy it. */ IpatchList * ipatch_container_get_children (IpatchContainer *container, GType type) { IpatchList *list; const GType *child_types; IpatchIter iter; GObject *obj; g_return_val_if_fail (IPATCH_IS_CONTAINER (container), NULL); g_return_val_if_fail (g_type_is_a (type, G_TYPE_OBJECT), NULL); list = ipatch_list_new (); /* get container child types */ child_types = ipatch_container_get_child_types (container); while (*child_types) /* loop over child types */ { if (g_type_is_a (*child_types, type)) /* child type matches type? */ { IPATCH_ITEM_RLOCK (container); ipatch_container_init_iter (container, &iter, *child_types); obj = ipatch_iter_first (&iter); while (obj) /* add object list to children list */ { g_object_ref (obj); /* ++ ref object for list */ list->items = g_list_prepend (list->items, obj); obj = ipatch_iter_next (&iter); } IPATCH_ITEM_RUNLOCK (container); } child_types++; } list->items = g_list_reverse (list->items); /* since we prepended */ return (list); } /** * ipatch_container_get_child_types: * @container: Container object * * Get an array of child types for a container object. The number of types * is the number of individual lists the container has. * * Returns: Pointer to a zero terminated array of types. Array is * static and should not be modified or freed. */ const GType * ipatch_container_get_child_types (IpatchContainer *container) { IpatchContainerClass *klass; const GType *types; g_return_val_if_fail (IPATCH_IS_CONTAINER (container), 0); klass = IPATCH_CONTAINER_GET_CLASS (container); types = klass->child_types (); return (types); } /** * ipatch_container_get_virtual_types: * @container: Container object * * Get an array of virtual types for a container object. Virtual types are * used to group child items in user interfaces (an example is SoundFont * "Percussion Presets" which contains all presets in bank number 128). To * discover what virtual container a child object is part of lookup it's * "virtual-parent-type" type property (ipatch_type_get() or * ipatch_type_object_get()). * * Returns: Pointer to a zero terminated array of types or %NULL if no virtual * types for @container. Array is static and should not be modified or freed. */ const GType * ipatch_container_get_virtual_types (IpatchContainer *container) { IpatchContainerClass *klass; g_return_val_if_fail (IPATCH_IS_CONTAINER (container), 0); klass = IPATCH_CONTAINER_GET_CLASS (container); if (klass->virtual_types) return (klass->virtual_types ()); else return (NULL); } /** * ipatch_container_type_get_child_types: * @container_type: A #IpatchContainer derived type to get child types of * * Get an array of child types for a container type. The number of types * is the number of individual lists the container has. Like * ipatch_container_get_child_types() but takes a container GType instead of * a container object. * * Returns: Pointer to a zero terminated array of types. Array is * static and should not be modified or freed. */ const GType * ipatch_container_type_get_child_types (GType container_type) { IpatchContainerClass *klass; const GType *types; g_return_val_if_fail (g_type_is_a (container_type, IPATCH_TYPE_CONTAINER), NULL); klass = g_type_class_ref (container_type); types = klass->child_types (); g_type_class_unref (klass); return (types); } /** * ipatch_container_insert: * @container: Container item to insert into * @item: Item to insert * @pos: Index position to insert @item into (@item type is used to * determine what list to insert into). 0 = first, less than 0 = last. * * Inserts an item into a patch item container. * * MT-NOTE: If position in list is critical the container item should * be locked and ipatch_container_insert_iter() used instead (see other * special requirements for using this function). * Only inserting in the first or last position (@pos is 0 or less than 0) * is guaranteed. */ void ipatch_container_insert (IpatchContainer *container, IpatchItem *item, int pos) { const GType *child_types; IpatchIter iter; GType type; g_return_if_fail (IPATCH_IS_CONTAINER (container)); g_return_if_fail (IPATCH_IS_ITEM (item)); type = G_OBJECT_TYPE (item); /* get container child types */ child_types = ipatch_container_get_child_types (container); for (; *child_types; child_types++) /* loop over child types */ if (g_type_is_a (type, *child_types)) /* item type matches child type? */ break; if (*child_types) /* matching child type found? */ { IPATCH_ITEM_WLOCK (container); ipatch_container_init_iter (container, &iter, *child_types); /* if position is less than 1 or off the end, get last object */ if (pos < 0 || !ipatch_iter_index (&iter, pos)) ipatch_iter_last (&iter); ipatch_container_insert_iter (container, item, &iter); IPATCH_ITEM_WUNLOCK (container); ipatch_container_add_notify (container, item); /* container add notify */ } else g_critical (IPATCH_CONTAINER_ERRMSG_INVALID_CHILD_2, g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); } /** * ipatch_container_append: * @container: Container item * @item: Item to insert * * Appends an item to a container's children. */ void ipatch_container_append (IpatchContainer *container, IpatchItem *item) { ipatch_container_insert (container, item, -1); } /** * ipatch_container_prepend: * @container: Container item * @item: Item to insert * * Prepends an item to a container's children. */ void ipatch_container_prepend (IpatchContainer *container, IpatchItem *item) { ipatch_container_insert (container, item, 0); } /** * ipatch_container_remove: * @container: Container item to remove from * @item: Item to remove from @container * * Removes an @item from @container. */ void ipatch_container_remove (IpatchContainer *container, IpatchItem *item) { const GType *child_types; IpatchIter iter; GType type; GObject *obj; g_return_if_fail (IPATCH_IS_CONTAINER (container)); g_return_if_fail (IPATCH_IS_ITEM (item)); g_return_if_fail (ipatch_item_peek_parent (item) == (IpatchItem *)container); /* do container remove notify (despite the fact that the remove could be * invalid, not actually a child of container) */ ipatch_container_remove_notify (container, item); type = G_OBJECT_TYPE (item); /* get container child types */ child_types = ipatch_container_get_child_types (container); while (*child_types) /* loop over child types */ { if (g_type_is_a (type, *child_types)) /* item type matches child type? */ { IPATCH_ITEM_WLOCK (container); ipatch_container_init_iter (container, &iter, *child_types); /* search for @item */ obj = ipatch_iter_first (&iter); while (obj && obj != (GObject *)item) obj = ipatch_iter_next (&iter); /* remove the object if found */ if (obj) ipatch_container_remove_iter (container, &iter); IPATCH_ITEM_WUNLOCK (container); if (obj) return; /* return if removed, otherwise keep searching */ } child_types++; } g_critical ("Child of type '%s' not found in parent of type '%s'", g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); } /** * ipatch_container_remove_all: * @container: Container object * * Removes all items from a @container object. */ void ipatch_container_remove_all (IpatchContainer *container) { IpatchList *list; const GType *child_types, *ptype; GList *p; g_return_if_fail (IPATCH_IS_CONTAINER (container)); child_types = ipatch_container_get_child_types (container); /* loop over child types */ for (ptype = child_types; *ptype; ptype++) { list = ipatch_container_get_children (container, *ptype); /* ++ ref new list */ for (p = list->items; p; p = p->next) ipatch_container_remove (container, (IpatchItem *)(p->data)); g_object_unref (list); /* -- unref list */ } } /** * ipatch_container_count: * @container: Container object to count children of * @type: Type of children to count * * Counts children of a specific @type (or derived thereof) in * a @container object. * * Returns: Count of children of @type in @container. */ guint ipatch_container_count (IpatchContainer *container, GType type) { const GType *child_types; IpatchIter iter; int count = 0; g_return_val_if_fail (IPATCH_IS_CONTAINER (container), 0); g_return_val_if_fail (g_type_is_a (type, G_TYPE_OBJECT), 0); /* get container child types */ child_types = ipatch_container_get_child_types (container); while (*child_types) /* loop over child types */ { if (g_type_is_a (*child_types, type)) /* child type matches type? */ { IPATCH_ITEM_RLOCK (container); ipatch_container_init_iter (container, &iter, *child_types); count += ipatch_iter_count (&iter); IPATCH_ITEM_RUNLOCK (container); } child_types++; } return (count); } /** * ipatch_container_make_unique: * @container: Patch item container * @item: An item of a type that can be added to @container (but not * necessarily parented to @container). * * Ensures an @item's duplicate sensitive properties are unique among items of * the same type in @container. The item need not be a child of @container, but * can be. The initial values of the duplicate sensitive properties are used * if already unique, otherwise they are modified (name strings have numbers * appended to them, unused MIDI locale is found, etc). */ void ipatch_container_make_unique (IpatchContainer *container, IpatchItem *item) { IpatchContainerClass *klass; g_return_if_fail (IPATCH_IS_CONTAINER (container)); g_return_if_fail (IPATCH_IS_ITEM (item)); klass = IPATCH_CONTAINER_GET_CLASS (container); if (klass->make_unique) (*klass->make_unique)(container, item); } /** * ipatch_container_add_unique: * @container: Container to add item to * @item: Item to add * * Adds a patch item to a container and ensures that the item's duplicate * sensitive properties are unique (see ipatch_container_make_unique()). */ void ipatch_container_add_unique (IpatchContainer *container, IpatchItem *item) { g_return_if_fail (IPATCH_IS_CONTAINER (container)); g_return_if_fail (IPATCH_IS_ITEM (item)); IPATCH_ITEM_WLOCK (container); ipatch_container_make_unique (container, item); ipatch_container_append (container, item); IPATCH_ITEM_WUNLOCK (container); } /** * ipatch_container_init_iter: * @container: Container object * @iter: Iterator structure to initialize * @type: Container child type list to initialize @iter to * * Initialize an iterator structure to a child list of the specified * @type in a @container object. * * MT-NOTE: The @container must be locked, or single thread access * ensured, for the duration of this call and iteration of @iter as * the @container object's lists are used directly. The iterator related * functions are meant to be used for latency critical operations, and they * should try and minimize the locking duration. * * Returns: %TRUE on success, %FALSE otherwise in which case the contents of * @iter are undefined. */ gboolean ipatch_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type) { IpatchContainerClass *klass; g_return_val_if_fail (IPATCH_IS_CONTAINER (container), FALSE); g_return_val_if_fail (iter != NULL, FALSE); g_return_val_if_fail (g_type_is_a (type, IPATCH_TYPE_ITEM), FALSE); klass = IPATCH_CONTAINER_GET_CLASS (container); g_return_val_if_fail (klass->init_iter != NULL, FALSE); return ((*klass->init_iter)(container, iter, type)); } /** * ipatch_container_insert_iter: * @container: Container object * @item: Patch item to insert * @iter: Iterator marking position to insert after (%NULL position to * prepend). Iterator is advanced after insert to point to new * inserted item. Note that this makes appending multiple items rather * fast. * * This function should not normally be used. It is provided to allow for * custom high performance functions involving container adds. If used, certain * precautions and requirements must be followed. * * Insert a patch @item into a @container after the position marked by * @iter. No checking is done to see if child @item is actually a valid * type in @container, this is left up to the caller for added performance. * Also left up to the caller is a call to ipatch_container_add_notify() to * notify that the item has been added (should be called after this function * and outside of @container lock). It is not necessary to notify if hooks * are not enabled for @container or caller doesn't care. * * MT-NOTE: The @container object should be write locked, or single thread * access ensured, for the duration of this call and prior iterator functions. */ void ipatch_container_insert_iter (IpatchContainer *container, IpatchItem *item, IpatchIter *iter) { g_return_if_fail (IPATCH_IS_CONTAINER (container)); g_return_if_fail (IPATCH_IS_ITEM (item)); g_return_if_fail (iter != NULL); ipatch_iter_insert (iter, (GObject *)item); g_object_ref ((GObject *)item); /* ++ ref object for container */ ipatch_item_set_parent (item, (IpatchItem *)container); /* set item parent */ } /** * ipatch_container_remove_iter: * @container: Container object * @iter: Iterator marking item to remove * * This function should not normally be used. It is provided to allow for * custom high performance functions involving container removes. If used, * certain precautions and requirements must be followed. * * Removes an item from a @container object. The item is specified by the * current position in @iter. It is left up to the caller to call * ipatch_container_remove_notify() (should be called before this function * and out of @container lock) to notify that the item will be removed. * It is not necessary to notify if hooks are not enabled for @container or * caller doesn't care. * * MT-NOTE: The @container object should be write locked, or single thread * access ensured, for the duration of this call and prior iterator functions. */ void ipatch_container_remove_iter (IpatchContainer *container, IpatchIter *iter) { GObject *obj; g_return_if_fail (IPATCH_IS_CONTAINER (container)); g_return_if_fail (iter != NULL); obj = ipatch_iter_get (iter); g_return_if_fail (obj != NULL); ipatch_iter_remove (iter); ipatch_item_unparent (IPATCH_ITEM (obj)); /* unparent item */ g_object_unref (obj); /* -- unref object for container */ } libinstpatch-1.0.0/libinstpatch/IpatchVirtualContainer.h0000644000175000017500000000703211461332142020373 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchVirtualContainer * @short_description: Virtual container object * @see_also: * @stability: Stable * * Virtual containers are used in user interfaces to group items in * containers that aren't actually present in the hierarchy, such as * "Instruments", "Melodic Presets", "Percussion Presets" in SF2 files. */ #ifndef __IPATCH_VIRTUAL_CONTAINER_H__ #define __IPATCH_VIRTUAL_CONTAINER_H__ #include #include /* forward type declarations */ typedef struct _IpatchVirtualContainer IpatchVirtualContainer; typedef struct _IpatchVirtualContainerClass IpatchVirtualContainerClass; #include #define IPATCH_TYPE_VIRTUAL_CONTAINER (ipatch_virtual_container_get_type ()) #define IPATCH_VIRTUAL_CONTAINER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_VIRTUAL_CONTAINER, \ IpatchVirtualContainer)) #define IPATCH_VIRTUAL_CONTAINER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_VIRTUAL_CONTAINER, \ IpatchVirtualContainerClass)) #define IPATCH_IS_VIRTUAL_CONTAINER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_CONTAINER)) /** * IPATCH_VIRTUAL_CONTAINER_CREATE: * @type_under: Type string in the form "type_name" * @TypeCase: Type string in the form "TypeName" * @name: Name type property * @blurb: Blurb type property (more detailed description) * @childtype: Child type of this virtual container type */ #define IPATCH_VIRTUAL_CONTAINER_CREATE(type_under, TypeCase, name, blurb, childtype) \ GType type_under##_get_type (void) \ { \ static GType obj_type = 0; \ \ if (!obj_type) { \ static const GTypeInfo obj_info = { \ sizeof (IpatchVirtualContainerClass), NULL, NULL, \ (GClassInitFunc) NULL, NULL, NULL, \ sizeof (IpatchVirtualContainer), 0, \ (GInstanceInitFunc) NULL, \ }; \ \ obj_type = g_type_register_static (IPATCH_TYPE_VIRTUAL_CONTAINER, \ #TypeCase, &obj_info, 0); \ ipatch_type_set (obj_type, \ "name", name, \ "blurb", blurb, \ "virtual-child-type", childtype, NULL); \ } \ \ return (obj_type); \ } /* virtual container object */ struct _IpatchVirtualContainer { IpatchItem parent_instance; /* derived from IpatchItem */ }; /* virtual container class */ struct _IpatchVirtualContainerClass { IpatchItemClass parent_class; }; /** * IpatchVirtualContainerConformFunc: * @object: Object to conform to a virtual container criteria. * * A function type used to make an item conform to the criteria of a virtual * container (force a SoundFont preset to be a percussion preset for example). */ typedef void (*IpatchVirtualContainerConformFunc)(GObject *object); GType ipatch_virtual_container_get_type (void); #endif libinstpatch-1.0.0/libinstpatch/version.h.in0000644000175000017500000000233011456655761016062 00000000000000/* * version.h - libInstPatch version information * * libInstPatch * Copyright (C) 1999-2002 Josh Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * 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., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA or point your web browser to http://www.gnu.org. */ #ifndef __IPATCH_VERSION_H__ #define __IPATCH_VERSION_H__ #define IPATCH_VERSION @IPATCH_VERSION@ #define IPATCH_VERSION_MAJOR @IPATCH_VERSION_MAJOR@ #define IPATCH_VERSION_MINOR @IPATCH_VERSION_MINOR@ #define IPATCH_VERSION_MICRO @IPATCH_VERSION_MICRO@ void ipatch_version (guint *major, guint *minor, guint *micro); #endif /* __IPATCH_VERSION_H__ */ libinstpatch-1.0.0/libinstpatch/IpatchSample.h0000644000175000017500000002630411461357174016342 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSample * @short_description: Sample audio interface * @see_also: * @stability: Stable * * This interface provides a basic API for accessing audio of sample objects. */ #ifndef __IPATCH_SAMPLE_H__ #define __IPATCH_SAMPLE_H__ #include #include #include /* forward type declarations */ typedef struct _IpatchSample IpatchSample; /* dummy typedef */ typedef struct _IpatchSampleIface IpatchSampleIface; typedef struct _IpatchSampleHandle IpatchSampleHandle; #include #define IPATCH_TYPE_SAMPLE (ipatch_sample_get_type ()) #define IPATCH_SAMPLE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE, \ IpatchSample)) #define IPATCH_SAMPLE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE, \ IpatchSampleIface)) #define IPATCH_IS_SAMPLE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE)) #define IPATCH_SAMPLE_GET_IFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), IPATCH_TYPE_SAMPLE, \ IpatchSampleIface)) /** * IpatchSampleHandleOpenFunc: * @handle: Caller supplied structure to initialize * @err: Location to store error information * * #IpatchSample interface method function type to open a sample for reading * or writing. This method is optional for an #IpatchSample interface and if * not specified then it is assumed that the open was successful and nothing * additional need be done. All fields of @handle structure are already * initialized, except data1, * data2 and data3 * which are available for the interface implementation. * * Returns: %TRUE on success, %FALSE otherwise (in which case an error should * optionally be stored in @err). */ typedef gboolean (*IpatchSampleHandleOpenFunc)(IpatchSampleHandle *handle, GError **err); /** * IpatchSampleHandleCloseFunc: * @handle: Sample handle to close (as returned from #IpatchSampleHandleOpenFunc) * * #IpatchSample interface method to free any resources allocated in * #IpatchSampleOpenFunc to @handle. This method is optional for an * #IpatchSample interface and need not be specified if nothing needs to be done * to release any resources allocated by #IpatchSampleHandleOpenFunc. */ typedef void (*IpatchSampleHandleCloseFunc)(IpatchSampleHandle *handle); /** * IpatchSampleHandleReadFunc: * @handle: Handle to read from (as returned from #IpatchSampleOpenFunc) * @offset: Offset in sample to start read from (in frames), use * #IPATCH_SAMPLE_CUROFS to use current offset (starts at 0 if not specified) * @frames: Size of sample data to read (in frames) * @buf: Buffer to store sample data in * @err: Location to store error information * * #IpatchSample interface method function type to read data from a * sample handle. Can be %NULL in #IpatchSampleIface if sample data is not * readable. Sample data should be stored in its native format. * * Returns: Should return %TRUE on success, %FALSE otherwise (in which case * an error should optionally be stored in @err). */ typedef gboolean (*IpatchSampleHandleReadFunc)(IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err); /** * IpatchSampleHandleWriteFunc: * @handle: Handle to write to (as returned from #IpatchSampleOpenFunc) * @offset: Offset in sample to start write to (in frames), use * #IPATCH_SAMPLE_CUROFS to use current offset (starts at 0 if not specified) * @frames: Size of sample data to write (in frames) * @buf: Buffer to store sample data in * @err: Location to store error information * * #IpatchSample interface method function type to write data to a * sample handle. Can be %NULL in #IpatchSampleIface if sample data is not * writable. Sample data will be supplied in its native format. * * Returns: Should return %TRUE on success, %FALSE otherwise (in which case * an error should optionally be stored in @err). */ typedef gboolean (*IpatchSampleHandleWriteFunc)(IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err); /* Sample interface */ struct _IpatchSampleIface { GTypeInterface parent_class; IpatchSampleHandleOpenFunc open; IpatchSampleHandleCloseFunc close; IpatchSampleHandleReadFunc read; IpatchSampleHandleWriteFunc write; int *loop_types; /* -1 terminated array of supp. loop types (NULL = none) */ }; /* Sample handle for I/O operations */ struct _IpatchSampleHandle { IpatchSample *sample; /* The sample which this handle applies to */ IpatchSampleTransform *transform; /* Set if sample is being converted */ IpatchSampleHandleReadFunc read; /* Read method pointer (copied from IpatchItem interface) */ IpatchSampleHandleWriteFunc write; /* Write method pointer (copied from IpatchItem interface) */ IpatchSampleHandleCloseFunc close; /* Write method pointer (copied from IpatchItem interface) */ guint32 read_mode : 1; /* TRUE if read mode, FALSE if write mode */ guint32 manual_transform : 1; /* Methods handle sample transform */ guint32 release_transform : 1; /* TRUE if transform should be released from transform pool */ guint32 format : 12; /* Format to transform to */ guint32 reserved : 17; guint32 channel_map; /* Channel map for multi-channel audio transform */ gpointer data1; /* sample interface defined */ gpointer data2; /* sample interface defined */ gpointer data3; /* sample interface defined */ gpointer data4; /* sample interface defined */ guint32 reserved2; }; /** * IpatchSampleLoopType: * @IPATCH_SAMPLE_LOOP_NONE: No loop. * @IPATCH_SAMPLE_LOOP_STANDARD: Standard loop. * @IPATCH_SAMPLE_LOOP_RELEASE: Loop till note release stage. * @IPATCH_SAMPLE_LOOP_PINGPONG: Play forward and then in reverse continously. * * Sample looping type. */ typedef enum { IPATCH_SAMPLE_LOOP_NONE, IPATCH_SAMPLE_LOOP_STANDARD, IPATCH_SAMPLE_LOOP_RELEASE, IPATCH_SAMPLE_LOOP_PINGPONG } IpatchSampleLoopType; /** * IPATCH_SAMPLE_FORMAT_DEFAULT: * * Default sample format for #IpatchSample interface. */ #define IPATCH_SAMPLE_FORMAT_DEFAULT (IPATCH_SAMPLE_16BIT | IPATCH_SAMPLE_MONO \ | IPATCH_SAMPLE_LENDIAN | IPATCH_SAMPLE_SIGNED) /** * IPATCH_SAMPLE_RATE_MIN: * * Minimum sample rate. */ #define IPATCH_SAMPLE_RATE_MIN 8000 /** * IPATCH_SAMPLE_RATE_MAX: * * Maximum sample rate. */ #define IPATCH_SAMPLE_RATE_MAX 192000 /** * IPATCH_SAMPLE_RATE_DEFAULT: * * Default sample rate. */ #define IPATCH_SAMPLE_RATE_DEFAULT 44100 /** * IPATCH_SAMPLE_ROOT_NOTE_DEFAULT: * * Default root note. */ #define IPATCH_SAMPLE_ROOT_NOTE_DEFAULT 60 /** * IPATCH_SAMPLE_LOOP_TYPE_TERM: * * Value used for terminating list of supported loop types. */ #define IPATCH_SAMPLE_LOOP_TYPE_TERM (-1) /** * IPATCH_SAMPLE_HANDLE_FORMAT: * @handle: Sample handle * * Macro to access transform sample format of a sample handle. * * Returns: Sample transform format. */ #define IPATCH_SAMPLE_HANDLE_FORMAT(handle) ((handle)->format) /* some convenient loop_type arrays for use by IpatchSample interfaces */ extern int ipatch_sample_loop_types_standard[]; extern int ipatch_sample_loop_types_standard_release[]; GType ipatch_sample_get_type (void); int *ipatch_sample_get_loop_types (IpatchSample *sample); int *ipatch_sample_type_get_loop_types (GType type); void ipatch_sample_set_format (IpatchSample *sample, int format); int ipatch_sample_get_format (IpatchSample *sample); void ipatch_sample_set_size (IpatchSample *sample, guint size); guint ipatch_sample_get_size (IpatchSample *sample, guint *bytes); int ipatch_sample_get_frame_size (IpatchSample *sample); IpatchSampleData *ipatch_sample_get_sample_data (IpatchSample *sample); gboolean ipatch_sample_set_sample_data (IpatchSample *sample, IpatchSampleData *sampledata); gboolean ipatch_sample_read (IpatchSample *sample, guint offset, guint frames, gpointer buf, GError **err); gboolean ipatch_sample_write (IpatchSample *sample, guint offset, guint frames, gconstpointer buf, GError **err); gboolean ipatch_sample_read_transform (IpatchSample *sample, guint offset, guint frames, gpointer buf, int format, guint32 channel_map, GError **err); gboolean ipatch_sample_write_transform (IpatchSample *sample, guint offset, guint frames, gconstpointer buf, int format, guint32 channel_map, GError **err); gboolean ipatch_sample_copy (IpatchSample *dest_sample, IpatchSample *src_sample, guint32 channel_map, GError **err); gboolean ipatch_sample_save_to_file (IpatchSample *sample, const char *filename, int file_format, int sub_format, GError **err); gboolean ipatch_sample_handle_open (IpatchSample *sample, IpatchSampleHandle *handle, char mode, int format, guint32 channel_map, GError **err); void ipatch_sample_handle_close (IpatchSampleHandle *handle); IpatchSampleTransform *ipatch_sample_handle_get_transform (IpatchSampleHandle *handle); void ipatch_sample_handle_set_transform (IpatchSampleHandle *handle, IpatchSampleTransform *transform); int ipatch_sample_handle_get_format (IpatchSampleHandle *handle); int ipatch_sample_handle_get_frame_size (IpatchSampleHandle *handle); guint ipatch_sample_handle_get_max_frames (IpatchSampleHandle *handle); gpointer ipatch_sample_handle_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err); gboolean ipatch_sample_handle_write (IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err); gboolean ipatch_sample_handle_cascade_open (IpatchSampleHandle *handle, IpatchSample *sample, GError **err); GParamSpec *ipatch_sample_install_property (GObjectClass *oclass, guint property_id, const char *property_name); GParamSpec *ipatch_sample_install_property_readonly (GObjectClass *oclass, guint property_id, const char *property_name); GParamSpec *ipatch_sample_new_property_param_spec (const char *property_name, GParamFlags flags); #endif libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreFile.c0000644000175000017500000002150311461332142020132 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSampleStoreFile.h" #include "ipatch_priv.h" #include "i18n.h" enum { PROP_0, PROP_TITLE, PROP_FILE, PROP_LOCATION }; static void ipatch_sample_store_file_sample_iface_init (IpatchSampleIface *iface); static void ipatch_sample_store_file_get_title (IpatchSampleStoreFile *store, GValue *value); static void ipatch_sample_store_file_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sample_store_file_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_sample_store_file_finalize (GObject *object); static gboolean ipatch_sample_store_file_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_sample_store_file_sample_iface_close (IpatchSampleHandle *handle); static gboolean ipatch_sample_store_file_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err); static gboolean ipatch_sample_store_file_sample_iface_write (IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err); G_DEFINE_TYPE_WITH_CODE (IpatchSampleStoreFile, ipatch_sample_store_file, IPATCH_TYPE_SAMPLE_STORE, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sample_store_file_sample_iface_init)) static void ipatch_sample_store_file_sample_iface_init (IpatchSampleIface *iface) { iface->open = ipatch_sample_store_file_sample_iface_open; iface->close = ipatch_sample_store_file_sample_iface_close; iface->read = ipatch_sample_store_file_sample_iface_read; iface->write = ipatch_sample_store_file_sample_iface_write; } static void ipatch_sample_store_file_class_init (IpatchSampleStoreFileClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->finalize = ipatch_sample_store_file_finalize; obj_class->get_property = ipatch_sample_store_file_get_property; item_class->item_set_property = ipatch_sample_store_file_set_property; g_object_class_override_property (obj_class, PROP_TITLE, "title"); g_object_class_install_property (obj_class, PROP_FILE, g_param_spec_object ("file", "File", "File object", IPATCH_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (obj_class, PROP_LOCATION, g_param_spec_uint ("location", "Location", "Sample data file location", 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); } static void ipatch_sample_store_file_get_title (IpatchSampleStoreFile *store, GValue *value) { char *filename, *s, *basename = NULL; if (store->file) { filename = ipatch_file_get_name (store->file); /* ++ alloc filename */ if (filename) { basename = g_path_get_basename (filename); /* ++ alloc basename */ s = strrchr (basename, '.'); /* search for dot delimiter */ if (s && s > basename) *s = '\0'; /* terminate string at dot */ g_free (filename); /* -- free filename */ } } g_value_take_string (value, basename); /* !! caller takes over alloc */ } static void ipatch_sample_store_file_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSampleStoreFile *store = IPATCH_SAMPLE_STORE_FILE (object); /* No lock required since they should be set only once before use */ switch (property_id) { case PROP_FILE: g_return_if_fail (store->file == NULL); store->file = g_value_dup_object (value); /* IpatchItem notify for "title" property */ { GValue titleval = { 0 }; g_value_init (&titleval, G_TYPE_STRING); ipatch_sample_store_file_get_title (store, &titleval); ipatch_item_prop_notify ((IpatchItem *)store, ipatch_item_pspec_title, &titleval, NULL); g_value_unset (&titleval); } break; case PROP_LOCATION: g_return_if_fail (store->location == 0); store->location = g_value_get_uint (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_file_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSampleStoreFile *store = IPATCH_SAMPLE_STORE_FILE (object); /* No lock required since they should be set only once before use */ switch (property_id) { case PROP_TITLE: ipatch_sample_store_file_get_title (store, value); break; case PROP_FILE: g_value_set_object (value, store->file); break; case PROP_LOCATION: g_value_set_uint (value, store->location); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_file_init (IpatchSampleStoreFile *store) { } static void ipatch_sample_store_file_finalize (GObject *object) { IpatchSampleStoreFile *store = IPATCH_SAMPLE_STORE_FILE (object); if (store->file) g_object_unref (store->file); if (G_OBJECT_CLASS (ipatch_sample_store_file_parent_class)->finalize) G_OBJECT_CLASS (ipatch_sample_store_file_parent_class)->finalize (object); } static gboolean ipatch_sample_store_file_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchSampleStoreFile *store = IPATCH_SAMPLE_STORE_FILE (handle->sample); g_return_val_if_fail (store->file != NULL, FALSE); /* No lock needed - file object set only once */ handle->data1 = ipatch_file_open (store->file, NULL, handle->read_mode ? "r" : "w", err); if (!handle->data1) return (FALSE); handle->data2 = GUINT_TO_POINTER (ipatch_sample_format_size (ipatch_sample_store_get_format (store))); return (TRUE); } static void ipatch_sample_store_file_sample_iface_close (IpatchSampleHandle *handle) { if (handle->data1) { ipatch_file_close (handle->data1); handle->data1 = NULL; } } static gboolean ipatch_sample_store_file_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err) { IpatchSampleStoreFile *store = (IpatchSampleStoreFile *)(handle->sample); IpatchFileHandle *fh = (IpatchFileHandle *)(handle->data1); guint8 frame_size = GPOINTER_TO_UINT (handle->data2); if (!ipatch_file_seek (fh, store->location + offset * frame_size, G_SEEK_SET, err)) return (FALSE); if (!ipatch_file_read (fh, buf, frames * frame_size, err)) return (FALSE); return (TRUE); } static gboolean ipatch_sample_store_file_sample_iface_write (IpatchSampleHandle *handle, guint offset, guint frames, gconstpointer buf, GError **err) { IpatchSampleStoreFile *store = (IpatchSampleStoreFile *)(handle->sample); IpatchFileHandle *fh = (IpatchFileHandle *)(handle->data1); guint8 frame_size = GPOINTER_TO_UINT (handle->data2); if (!ipatch_file_seek (fh, store->location + offset * frame_size, G_SEEK_SET, err)) return (FALSE); if (!ipatch_file_write (fh, buf, frames * frame_size, err)) return (FALSE); return (TRUE); } /** * ipatch_sample_store_file_new: * @file: File object to use for file sample store * @location: Location in file of audio data * * Creates a new file sample store. * * Returns: New file sample store, cast as a #IpatchSample for convenience. */ IpatchSample * ipatch_sample_store_file_new (IpatchFile *file, guint location) { return (IPATCH_SAMPLE (g_object_new (IPATCH_TYPE_SAMPLE_STORE_FILE, "file", file, "location", location, NULL))); } libinstpatch-1.0.0/libinstpatch/Makefile.am0000644000175000017500000001551611460365714015654 00000000000000## Process this file with automake to produce Makefile.in lib_LTLIBRARIES = libinstpatch-1.0.la if PLATFORM_WIN32 no_undefined = -no-undefined -export-symbols libinstpatch_la_def = libinstpatch.def endif if OS_WIN32 install-libtool-import-lib: $(INSTALL) .libs/libinstpatch-1.0.dll.a $(DESTDIR)$(libdir) uninstall-libtool-import-lib: -rm $(DESTDIR)$(libdir)/libinstpatch-1.0.dll.a else install-libtool-import-lib: uninstall-libtool-import-lib: endif BUILT_SOURCES = \ builtin_enums.c \ builtin_enums.h \ marshals.c \ marshals.h # correctly clean the generated source files CLEANFILES = $(BUILT_SOURCES) # extra files and optional sources EXTRA_DIST = \ marshals.list \ version.h.in \ libinstpatch.def ipatch_public_h_sources = \ IpatchBase.h \ IpatchContainer.h \ IpatchConverter.h \ IpatchConverterSF2VoiceCache.h \ IpatchConvert_DLS2.h \ IpatchConvert_Gig.h \ IpatchConvert_SF2.h \ IpatchDLS2Conn.h \ IpatchDLS2.h \ IpatchDLS2Info.h \ IpatchDLS2Inst.h \ IpatchDLS2Region.h \ IpatchDLS2Sample.h \ IpatchDLSFile.h \ IpatchDLSReader.h \ IpatchDLSWriter.h \ IpatchFile.h \ IpatchGig.h \ IpatchGigDimension.h \ IpatchGigEffects.h \ IpatchGigFile.h \ IpatchGigInst.h \ IpatchGigRegion.h \ IpatchGigSample.h \ IpatchGigSubRegion.h \ IpatchItem.h \ IpatchIter.h \ IpatchList.h \ IpatchParamProp.h \ IpatchPaste.h \ IpatchRange.h \ IpatchRiff.h \ IpatchSample.h \ IpatchSampleData.h \ IpatchSampleList.h \ IpatchSampleStore.h \ IpatchSampleStoreCache.h \ IpatchSampleStoreFile.h \ IpatchSampleStoreRam.h \ IpatchSampleStoreRom.h \ IpatchSampleStoreSndFile.h \ IpatchSampleStoreSplit24.h \ IpatchSampleStoreSwap.h \ IpatchSampleStoreVirtual.h \ IpatchSampleTransform.h \ IpatchSF2.h \ IpatchSF2File.h \ IpatchSF2Gen.h \ IpatchSF2GenItem.h \ IpatchSF2Inst.h \ IpatchSF2IZone.h \ IpatchSF2Mod.h \ IpatchSF2ModItem.h \ IpatchSF2Preset.h \ IpatchSF2PZone.h \ IpatchSF2Reader.h \ IpatchSF2Sample.h \ IpatchSF2VoiceCache.h \ IpatchSF2VoiceCache_DLS.h \ IpatchSF2VoiceCache_SF2.h \ IpatchSF2VoiceCache_Gig.h \ IpatchSF2VoiceCache_VBank.h \ IpatchSF2Writer.h \ IpatchSF2Zone.h \ IpatchSndFile.h \ IpatchTypeProp.h \ IpatchUnit.h \ IpatchUnit_generic.h \ IpatchUnit_DLS.h \ IpatchUnit_SF2.h \ IpatchVBank.h \ IpatchVBankInst.h \ IpatchVBankRegion.h \ IpatchVirtualContainer.h \ IpatchVirtualContainer_types.h \ IpatchXml.h \ IpatchXmlObject.h \ misc.h \ sample.h \ util.h \ version.h ipatch_sources = \ $(BUILT_SOURCES) \ IpatchBase.c \ IpatchContainer.c \ IpatchContainer_notify.c \ IpatchConverter.c \ IpatchConverterSF2VoiceCache.c \ IpatchConverter_priv.h \ IpatchConvert_DLS2.c \ IpatchConvert_Gig.c \ IpatchConvert_SF2.c \ IpatchDLS2.c \ IpatchDLS2Conn.c \ IpatchDLS2Info.c \ IpatchDLS2Inst.c \ IpatchDLS2Param_tables.c \ IpatchDLS2Region.c \ IpatchDLS2Sample.c \ IpatchDLSFile.c \ IpatchDLSReader.c \ IpatchDLSWriter.c \ IpatchFile.c \ IpatchFileBuf.c \ IpatchGig.c \ IpatchGigDimension.c \ IpatchGigEffects.c \ IpatchGigFile.c \ IpatchGigInst.c \ IpatchGigRegion.c \ IpatchGigSample.c \ IpatchGigSubRegion.c \ IpatchItem.c \ IpatchItemProp.c \ IpatchIter.c \ IpatchList.c \ IpatchParamProp.c \ IpatchPaste.c \ IpatchRange.c \ IpatchRiff.c \ IpatchSample.c \ IpatchSampleData.c \ IpatchSampleList.c \ IpatchSampleStore.c \ IpatchSampleStoreCache.c \ IpatchSampleStoreFile.c \ IpatchSampleStoreRam.c \ IpatchSampleStoreRom.c \ IpatchSampleStoreSndFile.c \ IpatchSampleStoreSplit24.c \ IpatchSampleStoreSwap.c \ IpatchSampleStoreVirtual.c \ IpatchSampleTransform.c \ IpatchSF2.c \ IpatchSF2File.c \ IpatchSF2Gen.c \ IpatchSF2GenItem.c \ IpatchSF2Gen_tables.c \ IpatchSF2Inst.c \ IpatchSF2IZone.c \ IpatchSF2Mod.c \ IpatchSF2ModItem.c \ IpatchSF2Preset.c \ IpatchSF2PZone.c \ IpatchSF2Reader.c \ IpatchSF2Sample.c \ IpatchSF2VoiceCache.c \ IpatchSF2VoiceCache_DLS.c \ IpatchSF2VoiceCache_SF2.c \ IpatchSF2VoiceCache_Gig.c \ IpatchSF2VoiceCache_VBank.c \ IpatchSF2Writer.c \ IpatchSF2Zone.c \ IpatchSndFile.c \ IpatchTypeProp.c \ IpatchUnit.c \ IpatchUnit_generic.c \ IpatchUnit_DLS.c \ IpatchUnit_SF2.c \ IpatchVBank.c \ IpatchVBankInst.c \ IpatchVBankRegion.c \ IpatchVirtualContainer.c \ IpatchVirtualContainer_types.c \ IpatchXml.c \ IpatchXmlObject.c \ i18n.h \ ipatch_priv.h \ md5.c \ md5.h \ misc.c \ sample.c \ util.c libinstpatch_1_0_la_SOURCES = $(ipatch_public_h_sources) $(ipatch_sources) libinstpatch_1_0_la_LDFLAGS = $(no_undefined) $(libinstpatch_la_def) \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -export-dynamic libinstpatch_1_0_la_LIBADD = @SNDFILE_LIBS@ @GOBJECT_LIBS@ ipatchincdir = $(includedir)/libinstpatch-1.0/libinstpatch ipatchinc_HEADERS = $(ipatch_public_h_sources) builtin_enums.h libinstpatch.h INCLUDES = @GOBJECT_CFLAGS@ @SNDFILE_CFLAGS@ -I.. -DLIBINSTPATCH_COMPILATION \ -DG_LOG_DOMAIN=\"libInstPatch\" -DLOCALEDIR=\"$(datadir)/locale\" marshals.c: marshals.list echo "/* Autogenerated file (add to marshals.list and 'make update-marshals') */" >marshals.c glib-genmarshal --body --prefix=ipatch_marshal \ marshals.list >>marshals.c marshals.h: marshals.list echo "/* Autogenerated file (add to marshals.list and 'make update-marshals') */" >marshals.h glib-genmarshal --header --prefix=ipatch_marshal \ marshals.list >>marshals.h builtin_enums.c: s-builtin-enums-c @true s-builtin-enums-c: $(ipatch_public_h_sources) Makefile ( cd $(srcdir) && glib-mkenums \ --fhead "#include \"libinstpatch.h\"\n#include \"ipatch_priv.h\"" \ --fprod "\n/* enumerations from \"@filename@\" */" \ --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \ $(ipatch_public_h_sources) ) \ | sed 's/dl_s2/dls2/g;s/DL_S2/DLS2/g' \ > xgen-enumc && cp xgen-enumc $(srcdir)/builtin_enums.c \ && rm -f xgen-enumc builtin_enums.h: s-builtin-enums-h @true s-builtin-enums-h: $(ipatch_public_h_sources) Makefile ( cd $(srcdir) && glib-mkenums \ --fhead "#ifndef __IPATCH_BUILTIN_ENUMS_H__\n#define __IPATCH_BUILTIN_ENUMS_H__\n\n#include \n\nG_BEGIN_DECLS\n" \ --fprod "/* enumerations from \"@filename@\" */\n" \ --vhead "GType @enum_name@_get_type (void);\n#define IPATCH_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \ --ftail "G_END_DECLS\n\n#endif /* __IPATCH_BUILTIN_ENUMS_H__ */" \ $(ipatch_public_h_sources) ) \ | sed 's/dl_s2/dls2/g;s/DL_S2/DLS2/g' \ > xgen-enumh && (cmp -s xgen-enumh $(srcdir)/builtin_enums.h \ || cp xgen-enumh $(srcdir)/builtin_enums.h ) \ && rm -f xgen-enumh install-data-local: install-libtool-import-lib uninstall-local: uninstall-libtool-import-lib libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreFile.h0000644000175000017500000000502511461332142020140 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleStoreFile * @short_description: Sample store object type for audio in files on disk * @see_also: * @stability: Stable */ #ifndef __IPATCH_SAMPLE_STORE_FILE_H__ #define __IPATCH_SAMPLE_STORE_FILE_H__ #include #include #include #include /* forward type declarations */ typedef struct _IpatchSampleStoreFile IpatchSampleStoreFile; typedef struct _IpatchSampleStoreFileClass IpatchSampleStoreFileClass; #define IPATCH_TYPE_SAMPLE_STORE_FILE (ipatch_sample_store_file_get_type ()) #define IPATCH_SAMPLE_STORE_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_STORE_FILE, \ IpatchSampleStoreFile)) #define IPATCH_SAMPLE_STORE_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_STORE_FILE, \ IpatchSampleStoreFileClass)) #define IPATCH_IS_SAMPLE_STORE_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_STORE_FILE)) #define IPATCH_IS_SAMPLE_STORE_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_STORE_FILE)) /* File sample store instance */ struct _IpatchSampleStoreFile { IpatchSampleStore parent_instance; IpatchFile *file; /* File object */ guint location; /* Position in file of the sample data */ }; /* File sample store class */ struct _IpatchSampleStoreFileClass { IpatchSampleStoreClass parent_class; }; /* reserve 1 private flag (IpatchSampleStoreFile.c) */ #define IPATCH_SAMPLE_STORE_FILE_UNUSED_FLAG_SHIFT \ (IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT + 1) GType ipatch_sample_store_file_get_type (void); IpatchSample *ipatch_sample_store_file_new (IpatchFile *file, guint location); #endif libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreSplit24.c0000644000175000017500000002073111461332142020516 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchSampleStoreSplit24.h" #include "ipatch_priv.h" #include "i18n.h" enum { PROP_0, PROP_LOCATION_LSBYTES }; /* Size of allocated copy buffer for each open sample handle */ #define READBUF_SIZE 16384 static void ipatch_sample_store_split24_sample_iface_init (IpatchSampleIface *iface); static void ipatch_sample_store_split24_class_init (IpatchSampleStoreSplit24Class *klass); static void ipatch_sample_store_split24_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sample_store_split24_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static gboolean ipatch_sample_store_split24_sample_iface_open (IpatchSampleHandle *handle, GError **err); static void ipatch_sample_store_split24_sample_iface_close (IpatchSampleHandle *handle); static gboolean ipatch_sample_store_split24_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err); G_DEFINE_TYPE_WITH_CODE (IpatchSampleStoreSplit24, ipatch_sample_store_split24, IPATCH_TYPE_SAMPLE_STORE_FILE, G_IMPLEMENT_INTERFACE (IPATCH_TYPE_SAMPLE, ipatch_sample_store_split24_sample_iface_init)) static void ipatch_sample_store_split24_sample_iface_init (IpatchSampleIface *iface) { iface->open = ipatch_sample_store_split24_sample_iface_open; iface->close = ipatch_sample_store_split24_sample_iface_close; iface->read = ipatch_sample_store_split24_sample_iface_read; iface->write = NULL; } static void ipatch_sample_store_split24_class_init (IpatchSampleStoreSplit24Class *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->get_property = ipatch_sample_store_split24_get_property; item_class->item_set_property = ipatch_sample_store_split24_set_property; g_object_class_install_property (obj_class, PROP_LOCATION_LSBYTES, g_param_spec_uint ("location-lsbytes", "Location LS-Bytes", "LS byte sample data file position", 0, G_MAXUINT, 0, G_PARAM_READWRITE)); } static void ipatch_sample_store_split24_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSampleStoreSplit24 *split24 = IPATCH_SAMPLE_STORE_SPLIT24 (object); switch (property_id) { case PROP_LOCATION_LSBYTES: g_return_if_fail (split24->loc_lsbytes == 0); /* Only set once before use, no lock required */ split24->loc_lsbytes = g_value_get_uint (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_split24_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSampleStoreSplit24 *split24 = IPATCH_SAMPLE_STORE_SPLIT24 (object); switch (property_id) { case PROP_LOCATION_LSBYTES: /* Only set once before use, no lock required */ g_value_set_uint (value, split24->loc_lsbytes); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void ipatch_sample_store_split24_init (IpatchSampleStoreSplit24 *store) { } static gboolean ipatch_sample_store_split24_sample_iface_open (IpatchSampleHandle *handle, GError **err) { IpatchSampleStoreSplit24 *split24_store = (IpatchSampleStoreSplit24 *)(handle->sample); IpatchSampleStoreFile *file_store = (IpatchSampleStoreFile *)split24_store; int fmt; g_return_val_if_fail (file_store->file != NULL, FALSE); g_return_val_if_fail (file_store->location != 0, FALSE); g_return_val_if_fail (split24_store->loc_lsbytes != 0, FALSE); fmt = ipatch_sample_store_get_format (split24_store); fmt &= ~IPATCH_SAMPLE_ENDIAN_MASK; /* we can do either endian */ g_return_val_if_fail (fmt == IPATCH_SAMPLE_24BIT, FALSE); /* No lock needed - file object set only once */ handle->data1 = ipatch_file_open (file_store->file, NULL, handle->read_mode ? "r" : "w", err); if (!handle->data1) return (FALSE); handle->data2 = g_malloc (READBUF_SIZE); return (TRUE); } static void ipatch_sample_store_split24_sample_iface_close (IpatchSampleHandle *handle) { if (handle->data1) { ipatch_file_close (handle->data1); g_free (handle->data2); handle->data1 = NULL; handle->data2 = NULL; } } static gboolean ipatch_sample_store_split24_sample_iface_read (IpatchSampleHandle *handle, guint offset, guint frames, gpointer buf, GError **err) { IpatchSampleStoreSplit24 *split24_store = (IpatchSampleStoreSplit24 *)(handle->sample); IpatchSampleStoreFile *file_store = (IpatchSampleStoreFile *)split24_store; guint samplepos, thissize, curofs; gboolean lilendian, lilhost; IpatchFileHandle *fhandle = (IpatchFileHandle *)(handle->data1); guint8 *readbuf = (guint8 *)(handle->data2); guint8 *i8p; int i; lilendian = (ipatch_sample_store_get_format (split24_store) & IPATCH_SAMPLE_ENDIAN_MASK) == IPATCH_SAMPLE_LENDIAN; lilhost = G_BYTE_ORDER == G_LITTLE_ENDIAN; samplepos = 0; curofs = offset; thissize = READBUF_SIZE / 2; // 16 bit samples /* copy 16 bit sample data */ while (samplepos < frames) { if (frames - samplepos < thissize) thissize = frames - samplepos; if (!ipatch_file_seek (fhandle, file_store->location + curofs * 2, G_SEEK_SET, err)) return (FALSE); if (!ipatch_file_read (fhandle, readbuf, thissize * 2, err)) return (FALSE); i8p = buf + samplepos * 4; if (lilendian) { for (i = 0; i < thissize; i++) { i8p[i * 4 + 1] = readbuf[i * 2]; i8p[i * 4 + 2] = readbuf[i * 2 + 1]; i8p[i * 4 + 3] = 0; } } else { for (i = 0; i < thissize; i++) { i8p[i * 4 + 2] = readbuf[i * 2]; i8p[i * 4 + 1] = readbuf[i * 2 + 1]; i8p[i * 4 + 0] = 0; } } samplepos += thissize; curofs += thissize; } samplepos = 0; curofs = offset; thissize = READBUF_SIZE; /* copy upper byte of 24 bit samples */ while (samplepos < frames) { if (frames - samplepos < thissize) thissize = frames - samplepos; if (!ipatch_file_seek (fhandle, split24_store->loc_lsbytes + curofs, G_SEEK_SET, err)) return (FALSE); if (!ipatch_file_read (fhandle, readbuf, thissize, err)) return (FALSE); i8p = buf + samplepos * 4; if (lilendian) { for (i = 0; i < thissize; i++) i8p[i * 4] = readbuf[i]; } else { for (i = 0; i < thissize; i++) i8p[i * 4 + 3] = readbuf[i]; } samplepos += thissize; curofs += thissize; } return (TRUE); } /** * ipatch_sample_store_split24_new: * @file: File object * @loc_16bit: Location of 16 bit audio data * @loc_lsbytes: Location of 24 bit LS bytes * * Creates a new split 24 bit sample store (lower byte of 24 bit * samples is stored in a separate block). New SoundFont 2.04 uses this method. * * Returns: New split 24 sample store */ IpatchSample * ipatch_sample_store_split24_new (IpatchFile *file, guint loc_16bit, guint loc_lsbytes) { return (IPATCH_SAMPLE (g_object_new (IPATCH_TYPE_SAMPLE_STORE_SPLIT24, "file", file, "location", loc_16bit, "location-lsbytes", loc_lsbytes, NULL))); } libinstpatch-1.0.0/libinstpatch/IpatchList.h0000644000175000017500000000433711461332142016022 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchList * @short_description: An object containing a list of object pointers * @see_also: * @stability: Stable * * An object which defines a list of object pointers. A #GObject reference * is held to all objects until the #IpatchList itself is released. */ #ifndef __IPATCH_LIST_H__ #define __IPATCH_LIST_H__ #include #include typedef struct _IpatchList IpatchList; typedef struct _IpatchListClass IpatchListClass; #include #define IPATCH_TYPE_LIST (ipatch_list_get_type ()) #define IPATCH_LIST(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_LIST, IpatchList)) #define IPATCH_LIST_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_LIST, IpatchListClass)) #define IPATCH_IS_LIST(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_LIST)) #define IPATCH_IS_LIST_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_LIST)) /* an object containing a duplicated list of referenced objects */ struct _IpatchList { GObject parent_instance; /*< public >*/ GList *items; /* list of GObject items */ }; /* class for iterator list object */ struct _IpatchListClass { GObjectClass parent_class; }; GType ipatch_list_get_type (void); IpatchList *ipatch_list_new (void); IpatchList *ipatch_list_duplicate (IpatchList *list); void ipatch_list_init_iter (IpatchList *list, IpatchIter *iter); #endif libinstpatch-1.0.0/libinstpatch/IpatchConverter.c0000644000175000017500000012103611461332142017045 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "misc.h" #include "IpatchConverter.h" #include "i18n.h" enum { PROP_0, PROP_PROGRESS }; /* structure used for log entries (the log is a prepend log, newest items at the head of the list) */ typedef struct _LogEntry { GObject *item; /* item this message applies to or %NULL */ guint8 type; /* type of message and flags (IpatchConverterLogType) */ union { char *msg; /* LOG_INFO/WARN/CRITICAL/FATAL */ float rating; /* LOG_RATING */ } data; } LogEntry; static gint priority_GCompareFunc (gconstpointer a, gconstpointer b); static IpatchConverterInfo *convert_lookup_map_U (IpatchConverterInfo ***array, GType conv_type, GType src_type, GType dest_type); static IpatchConverterInfo * find_match_from_lists (GSList *src_list, GSList *dest_list, GType conv_type); static void ipatch_converter_class_init (IpatchConverterClass *klass); static void ipatch_converter_finalize (GObject *gobject); static void ipatch_converter_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_converter_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static gboolean ipatch_converter_test_object_list (GList *list, GType type, int count); /* lock used for list and hash tables */ G_LOCK_DEFINE_STATIC (conv_maps); static GList *conv_maps = NULL; /* list of all registered IpatchConverterInfo */ /* hash of source and destination type to info lists. * type -> GSList (IpatchConverterInfo) */ static GHashTable *conv_src_types = NULL; /* source type matching lists */ static GHashTable *conv_derived_types = NULL; /* derived src type match lists */ static GHashTable *conv_dest_types = NULL; /* dest type matching lists */ /* conv_type -> GSList (IpatchConverterInfo) */ static GHashTable *conv_types = NULL; static gpointer parent_class = NULL; /* converter system init function */ void _ipatch_converter_init (void) { conv_src_types = g_hash_table_new (NULL, NULL); conv_derived_types = g_hash_table_new (NULL, NULL); conv_dest_types = g_hash_table_new (NULL, NULL); conv_types = g_hash_table_new (NULL, NULL); } /** * ipatch_convert_objects: * @input: Input object * @output: Output object * @err: Location to store error info or %NULL * * A convenience function for converting from one object to another. This * function will only work for converters which take exactly one input and * output object. * * Returns: %TRUE on success, %FALSE otherwise (in which case @err may be set) */ gboolean ipatch_convert_objects (GObject *input, GObject *output, GError **err) { IpatchConverter *conv; g_return_val_if_fail (G_IS_OBJECT (input), FALSE); g_return_val_if_fail (G_IS_OBJECT (output), FALSE); g_return_val_if_fail (!err || !*err, FALSE); /* ++ ref new converter */ conv = ipatch_create_converter (G_OBJECT_TYPE (input), G_OBJECT_TYPE (output)); if (!conv) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNHANDLED_CONVERSION, _("Unsupported conversion of type %s to %s."), G_OBJECT_TYPE_NAME (input), G_OBJECT_TYPE_NAME (output)); return (FALSE); } ipatch_converter_add_input (conv, input); ipatch_converter_add_output (conv, output); if (!ipatch_converter_convert (conv, err)) { g_object_unref (conv); return (FALSE); } g_object_unref (conv); return (TRUE); } /** * ipatch_convert_object_to_type: * @object: Object to convert from * @type: Type of object to convert to * @err: Location to store error info or %NULL to ignore * * A convenience function to convert an object to another object of a given * type. This function will only work for converters which require 1 * input and one or zero outputs. The output object is created as needed * and returned. * * Returns: The output object or %NULL on error (in which case @err may be set). * The returned object has a refcount of 1 which the caller owns. */ GObject * ipatch_convert_object_to_type (GObject *object, GType type, GError **err) { IpatchConverterInfo *info; IpatchConverter *conv; GObject *output = NULL; GType convtype; convtype = ipatch_find_converter (G_OBJECT_TYPE (object), type); if (!convtype) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNHANDLED_CONVERSION, _("Unsupported conversion of type %s to %s"), G_OBJECT_TYPE_NAME (object), g_type_name (type)); return (NULL); } info = ipatch_lookup_converter_info (convtype, G_OBJECT_TYPE (object), type); g_return_val_if_fail (info != NULL, NULL); /* shouldn't happen */ if (info->dest_count < 0 || info->dest_count > 1) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNSUPPORTED, _("Conversion from %s to %s requires %d outputs"), G_OBJECT_TYPE_NAME (object), g_type_name (type), info->dest_count); return (NULL); } conv = IPATCH_CONVERTER (g_object_new (convtype, NULL)); /* ++ ref */ ipatch_converter_add_input (conv, object); if (info->dest_count == 1) /* if 1 output object expected, create it */ { output = g_object_new (type, NULL); /* ++ ref */ ipatch_converter_add_output (conv, output); } if (!ipatch_converter_convert (conv, err)) /* do the conversion */ { if (output) g_object_unref (output); g_object_unref (conv); return (NULL); } if (!output) output = ipatch_converter_get_output (conv); /* ++ ref */ g_object_unref (conv); return (output); /* !! caller takes over reference */ } /** * ipatch_convert_object_to_type_multi: * @object: Object to convert from * @type: Type of object to convert to * @err: Location to store error info or %NULL to ignore * * A convenience function to convert an object to one or more objects of a given * @type. This function will work for converters which require 1 * input and any number of outputs. * * Returns: List of output objects or %NULL on error (in which case @err may be set). * The returned object list has a refcount of 1 which the caller owns. */ IpatchList * ipatch_convert_object_to_type_multi (GObject *object, GType type, GError **err) { return (ipatch_convert_object_to_type_multi_set (object, type, err, NULL)); } /** * ipatch_convert_object_to_type_multi_set: * @object: Object to convert from * @type: Type of object to convert to * @err: Location to store error info or %NULL to ignore * @first_property_name: Name of first property to assign or %NULL * @...: First property value followed by property name/value pairs (as per * g_object_set()) to assign to the resulting converter, terminated with a * %NULL property name. * * A convenience function to convert an object to one or more objects of a given * @type. This function will work for converters which require 1 * input and any number of outputs. Like ipatch_convert_object_to_type_multi() * but allows for properties of the converter to be assigned. * * Returns: List of output objects or %NULL on error (in which case @err may be set). * The returned object list has a refcount of 1 which the caller owns. */ IpatchList * ipatch_convert_object_to_type_multi_set (GObject *object, GType type, GError **err, const char *first_property_name, ...) { IpatchConverterInfo *info; IpatchConverter *conv; GObject *output = NULL; IpatchList *list; GType convtype; va_list args; int i; g_return_val_if_fail (G_IS_OBJECT (object), NULL); g_return_val_if_fail (!err || !*err, NULL); convtype = ipatch_find_converter (G_OBJECT_TYPE (object), type); if (!convtype) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_UNHANDLED_CONVERSION, _("Unsupported conversion of type %s to %s"), G_OBJECT_TYPE_NAME (object), g_type_name (type)); return (NULL); } info = ipatch_lookup_converter_info (convtype, G_OBJECT_TYPE (object), type); g_return_val_if_fail (info != NULL, NULL); /* shouldn't happen */ conv = IPATCH_CONVERTER (g_object_new (convtype, NULL)); /* ++ ref */ ipatch_converter_add_input (conv, object); if (info->dest_count > 0) /* if outputs are expected, create them */ { for (i = 0; i < info->dest_count; i++) { output = g_object_new (type, NULL); /* ++ ref */ ipatch_converter_add_output (conv, output); g_object_unref (output); /* -- unref */ } } if (first_property_name) { va_start (args, first_property_name); g_object_set_valist ((GObject *)conv, first_property_name, args); va_end (args); } if (!ipatch_converter_convert (conv, err)) /* do the conversion */ { if (output) g_object_unref (output); g_object_unref (conv); return (NULL); } list = ipatch_converter_get_outputs (conv); /* ++ ref object list */ g_object_unref (conv); /* -- unref converter */ return (list); /* !! caller takes over reference */ } /** * ipatch_create_converter: * @src_type: #GObject derived source type * @dest_type: #GObject derived destination type * * Create a converter object for converting an object of type @src_type to * @dest_type. A convenience function, since one could use * ipatch_find_converter() and create an instance of the returned type. * See ipatch_find_converter() for more details. * * Returns: The new converter object with a reference count of 1 which the * caller owns, or %NULL if there is no matching conversion handler type. */ IpatchConverter * ipatch_create_converter (GType src_type, GType dest_type) { GType conv_type; g_return_val_if_fail (g_type_is_a (src_type, G_TYPE_OBJECT), NULL); g_return_val_if_fail (g_type_is_a (dest_type, G_TYPE_OBJECT), NULL); conv_type = ipatch_find_converter (src_type, dest_type); if (!conv_type) return (NULL); /* ++ ref new object and let the caller have it */ return (IPATCH_CONVERTER (g_object_new (conv_type, NULL))); } /** * ipatch_register_converter_map: * @conv_type: #IpatchConverter derived GType of conversion handler * @flags: #IpatchConverterFlags logically ORed with a priority (number from * 0 to 100, 0 will use the default). #IpatchConverterPriority defines some * common priorities. Used for overriding other converters for specific types. * If #IPATCH_CONVERTER_FLAG_SRC_DERIVED is specified then types which are * derived (children) of @src_type will also match. * @src_type: Type for source object (GObject derived type or interface type). * @src_match: The furthest parent type of @src_type to match (all types in * between are also matched, 0 to match only @src_type). * @src_count: Required number of source items (can also be * an #IpatchConverterCount value) * @dest_type: Type for destination object (GObject derived type or interface type). * @dest_match: The furthest parent type of @dest_type to match (all types in * between are also matched, 0 to match only @dest_type). * @dest_count: Required number of destination items (can also be * an #IpatchConverterCount value). This value can be 0 in the case where * no objects should be supplied, but will be instead assigned after * conversion. * * Registers a #IpatchConverter handler to convert objects of @src_type * to @dest_type. */ void ipatch_register_converter_map (GType conv_type, guint flags, GType src_type, GType src_match, gint8 src_count, GType dest_type, GType dest_match, gint8 dest_count) { IpatchConverterInfo *map; GSList *list, *p; GType type; guint8 priority; g_return_if_fail (g_type_is_a (conv_type, IPATCH_TYPE_CONVERTER)); g_return_if_fail (g_type_is_a (src_type, G_TYPE_OBJECT) || G_TYPE_IS_INTERFACE (src_type)); g_return_if_fail (g_type_is_a (dest_type, G_TYPE_OBJECT) || G_TYPE_IS_INTERFACE (dest_type)); g_return_if_fail (!src_match || g_type_is_a (src_type, src_match)); g_return_if_fail (!dest_match || g_type_is_a (dest_type, dest_match)); priority = flags & 0xFF; if (priority == 0) priority = IPATCH_CONVERTER_PRIORITY_DEFAULT; map = g_new (IpatchConverterInfo, 1); map->conv_type = conv_type; map->flags = flags >> 8; map->priority = priority; map->src_type = src_type; map->src_match = src_match; map->src_count = src_count; map->dest_type = dest_type; map->dest_match = dest_match; map->dest_count = dest_count; G_LOCK (conv_maps); conv_maps = g_list_insert_sorted (conv_maps, map, priority_GCompareFunc); /* hash all source matching types to new map */ for (type = src_type; type; type = g_type_parent (type)) { /* lookup the list of maps for this source type */ list = g_hash_table_lookup (conv_src_types, GUINT_TO_POINTER (type)); /* insert the new map sorted by priority */ p = g_slist_insert_sorted (list, map, priority_GCompareFunc); if (p != list) /* update hash list pointer if head item changed */ g_hash_table_insert (conv_src_types, GUINT_TO_POINTER (type), p); if (!src_match || type == src_match) break; } /* hash all dest matching types to new map */ for (type = dest_type; type; type = g_type_parent (type)) { /* lookup the list of maps for this dest type */ list = g_hash_table_lookup (conv_dest_types, GUINT_TO_POINTER (type)); /* insert the new map sorted by priority */ p = g_slist_insert_sorted (list, map, priority_GCompareFunc); if (p != list) /* update hash list pointer if head item changed */ g_hash_table_insert (conv_dest_types, GUINT_TO_POINTER (type), p); if (!dest_match || type == dest_match) break; } /* add to conv_derived_types hash if child derived types flag specified */ if (flags & IPATCH_CONVERTER_FLAG_SRC_DERIVED) { /* lookup any existing type list for this src_type */ list = g_hash_table_lookup (conv_derived_types, GUINT_TO_POINTER (src_type)); /* insert the map into the list sorted by priority */ p = g_slist_insert_sorted (list, map, priority_GCompareFunc); if (p != list) /* update hash list pointer if head item changed */ g_hash_table_insert (conv_derived_types, GUINT_TO_POINTER (src_type), p); } /* add info to converter type hash */ list = g_hash_table_lookup (conv_types, GUINT_TO_POINTER (conv_type)); /* insert sorted by priority */ p = g_slist_insert_sorted (list, map, priority_GCompareFunc); if (p != list) /* update hash list pointer if head item changed */ g_hash_table_insert (conv_types, GUINT_TO_POINTER (conv_type), p); G_UNLOCK (conv_maps); } /* GList GCompareFunc to sort list by mapping priority */ static gint priority_GCompareFunc (gconstpointer a, gconstpointer b) { IpatchConverterInfo *mapa = (IpatchConverterInfo *)a, *mapb = (IpatchConverterInfo *)b; /* priority sorts from highest to lowest, so subtract a from b */ return (mapb->priority - mapa->priority); } /** * ipatch_find_converter: * @src_type: #GObject derived source type * @dest_type: #GObject derived destination type * * Lookup a conversion handler type for a given @src_type to @dest_type * conversion. In some cases there may be multiple conversion handlers for * the given types, this function only returns the highest priority type. * To get a list of all available converters use ipatch_find_converters(). * * Returns: An #IpatchConverter derived GType of the matching conversion * handler or 0 if no matches. */ GType ipatch_find_converter (GType src_type, GType dest_type) { IpatchConverterInfo *info; g_return_val_if_fail (g_type_is_a (src_type, G_TYPE_OBJECT) || G_TYPE_IS_INTERFACE (src_type), 0); g_return_val_if_fail (g_type_is_a (dest_type, G_TYPE_OBJECT) || G_TYPE_IS_INTERFACE (dest_type), 0); G_LOCK (conv_maps); info = convert_lookup_map_U (NULL, 0, src_type, dest_type); G_UNLOCK (conv_maps); return (info ? info->conv_type : 0); } /** * ipatch_find_converters: * @src_type: #GObject derived source type * @dest_type: #GObject derived destination type * * Like ipatch_find_converter() but returns all matching converter types. * * Returns: 0 terminated array of #IpatchConverter derived GTypes or %NULL * if no matching converters. Array should be freed when finished using it. */ GType * ipatch_find_converters (GType src_type, GType dest_type) { IpatchConverterInfo **info_array; GType *type_array; int count, i; g_array_new (TRUE, FALSE, sizeof (GType)); G_LOCK (conv_maps); convert_lookup_map_U (&info_array, 0, src_type, dest_type); G_UNLOCK (conv_maps); if (!info_array) return (NULL); /* no matching converters? */ for (count = 0; info_array[count]; count++); /* count them */ type_array = g_new (GType, count + 1); /* alloc type array */ for (i = 0; i < count; i++) /* copy converter types */ type_array[i] = info_array[i]->conv_type; type_array[count] = 0; /* 0 terminate */ g_free (info_array); /* free info array */ return (type_array); } /* Lookup a IpatchConverterInfo in the conv_maps list (not LOCKED!). * Pass a pointer for "array" if all matching info is desired or NULL to ignore. * Use 0 for conv_type for wild card. */ static IpatchConverterInfo * convert_lookup_map_U (IpatchConverterInfo ***array, GType conv_type, GType src_type, GType dest_type) { GArray *info_array = NULL; IpatchConverterInfo *info; GSList *src_lists = NULL, *dest_lists = NULL; /* list of type lists to test */ GSList *sp, *dp; GType *ifaces, type; GSList *p; int i; if (array) *array = NULL; g_return_val_if_fail (conv_type != 0 || (src_type && dest_type), NULL); /* src_type or dest_type not specified but conv_type is? */ if (!src_type || !dest_type) { /* lookup map info list for this converter type */ sp = g_hash_table_lookup (conv_types, GUINT_TO_POINTER (conv_type)); if (!sp) return (NULL); /* don't want all info? - Return highest priority mapping */ if (!array) return ((IpatchConverterInfo *)(sp->data)); /* create array for all mappings for this converter type */ info_array = g_array_new (TRUE, FALSE, sizeof (IpatchConverterInfo *)); /* add all the mappings to the array */ for (p = sp; p; p = p->next) { info = (IpatchConverterInfo *)(p->data); g_array_append_val (info_array, info); } *array = (IpatchConverterInfo **)g_array_free (info_array, FALSE); return ((*array)[0]); } /* see if source type conforms to any hashed interface types */ ifaces = g_type_interfaces (src_type, NULL); if (ifaces) { for (i = 0; ifaces[i]; i++) { type = ifaces[i]; p = g_hash_table_lookup (conv_src_types, GUINT_TO_POINTER (type)); if (p) src_lists = g_slist_prepend (src_lists, p); /* add list to list */ } g_free (ifaces); } /* check conv_derived_types for any matches in src_type's ancestry */ for (type = g_type_parent (src_type); type; type = g_type_parent (type)) { p = g_hash_table_lookup (conv_derived_types, GUINT_TO_POINTER (type)); if (p) { src_lists = g_slist_prepend (src_lists, p); break; } } /* add the src_type converter info list if any */ p = g_hash_table_lookup (conv_src_types, GUINT_TO_POINTER (src_type)); if (p) src_lists = g_slist_prepend (src_lists, p); /* we prepend and then reverse for added performance */ src_lists = g_slist_reverse (src_lists); /* see if dest type conforms to any hashed interface types */ ifaces = g_type_interfaces (dest_type, NULL); if (ifaces) { for (i = 0; ifaces[i]; i++) { type = ifaces[i]; p = g_hash_table_lookup (conv_dest_types, GUINT_TO_POINTER (type)); if (p) dest_lists = g_slist_prepend (dest_lists, p); /* add list to list */ } g_free (ifaces); } /* add the dest_type converter info list if any */ p = g_hash_table_lookup (conv_dest_types, GUINT_TO_POINTER (dest_type)); if (p) dest_lists = g_slist_prepend (dest_lists, p); /* we prepend and then reverse for added performance */ dest_lists = g_slist_reverse (dest_lists); /* look for match amongst all combinations of types */ for (sp = src_lists; sp; sp = sp->next) { for (dp = dest_lists; dp; dp = dp->next) { info = find_match_from_lists ((GSList *)(sp->data), (GSList *)(dp->data), conv_type); if (info) { if (!array) { g_slist_free (src_lists); g_slist_free (dest_lists); return (info); } if (!info_array) info_array = g_array_new (TRUE, FALSE, sizeof (IpatchConverterInfo *)); for (i = 0; i < info_array->len; i++) /* already in array? */ if (((IpatchConverterInfo **)(info_array->data))[i] == info) break; if (i < info_array->len) /* only add if not already in array */ g_array_append_val (info_array, info); } } } if (src_lists) g_slist_free (src_lists); if (dest_lists) g_slist_free (dest_lists); /* free type array but not the array itself */ if (info_array) { *array = (IpatchConverterInfo **)g_array_free (info_array, FALSE); return ((*array)[0]); } return (NULL); } /* finds the highest priority IpatchConverterInfo that is present in both * src_list and dest_list, if conv_type is not 0 then it must also match. */ static IpatchConverterInfo * find_match_from_lists (GSList *src_list, GSList *dest_list, GType conv_type) { IpatchConverterInfo *sinfo, *dinfo; GSList *sp, *dp; if (!src_list || !dest_list) return (NULL); for (sp = src_list; sp; sp = sp->next) /* loop over source list */ { sinfo = (IpatchConverterInfo *)(sp->data); if (conv_type && sinfo->conv_type != conv_type) continue; /* loop on dest list until the priority is less than source priority (lists are sorted by priority) */ for (dp = dest_list; dp; dp = dp->next) { dinfo = (IpatchConverterInfo *)(dp->data); if (dinfo->priority < sinfo->priority) break; if (sinfo == dinfo) return (sinfo); /* match found? */ } } return (NULL); } /** * ipatch_lookup_converter_info: * @conv_type: #IpatchConverter derived GType to lookup info on (or 0 for wildcard) * @src_type: Source type of conversion map to lookup (or 0 for default map) * @dest_type: Destination type of conversion map (0 if @src_type is 0) * * Lookup converter map info. * * Returns: Converter info structure or %NULL if no match. The returned * pointer is internal and should not be modified or freed. */ IpatchConverterInfo * ipatch_lookup_converter_info (GType conv_type, GType src_type, GType dest_type) { IpatchConverterInfo *info; G_LOCK (conv_maps); info = convert_lookup_map_U (NULL, conv_type, src_type, dest_type); G_UNLOCK (conv_maps); return (info); } GType ipatch_converter_get_type (void) { static GType obj_type = 0; if (!obj_type) { static const GTypeInfo obj_info = { sizeof (IpatchConverterClass), NULL, NULL, (GClassInitFunc)ipatch_converter_class_init, NULL, NULL, sizeof (IpatchConverter), 0, (GInstanceInitFunc) NULL, }; obj_type = g_type_register_static (G_TYPE_OBJECT, "IpatchConverter", &obj_info, G_TYPE_FLAG_ABSTRACT); } return (obj_type); } static void ipatch_converter_class_init (IpatchConverterClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_peek_parent (klass); obj_class->set_property = ipatch_converter_set_property; obj_class->get_property = ipatch_converter_get_property; obj_class->finalize = ipatch_converter_finalize; g_object_class_install_property (obj_class, PROP_PROGRESS, g_param_spec_float ("progress", _("Progress"), _("Conversion progress"), 0.0, 1.0, 0.0, G_PARAM_READWRITE)); } /* function called when a patch is being destroyed */ static void ipatch_converter_finalize (GObject *gobject) { IpatchConverter *converter = IPATCH_CONVERTER (gobject); GList *p; p = converter->inputs; while (p) { g_object_unref (p->data); p = g_list_delete_link (p, p); } p = converter->outputs; while (p) { g_object_unref (p->data); p = g_list_delete_link (p, p); } if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (gobject); } static void ipatch_converter_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchConverter *converter; g_return_if_fail (IPATCH_IS_CONVERTER (object)); converter = IPATCH_CONVERTER (object); switch (property_id) { case PROP_PROGRESS: converter->progress = g_value_get_float (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_converter_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchConverter *converter; g_return_if_fail (IPATCH_IS_CONVERTER (object)); converter = IPATCH_CONVERTER (object); switch (property_id) { case PROP_PROGRESS: g_value_set_float (value, converter->progress); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } /** * ipatch_converter_add_input: * @converter: Converter instance * @object: Object to add * * Add an input object to a converter object. */ void ipatch_converter_add_input (IpatchConverter *converter, GObject *object) { g_return_if_fail (IPATCH_IS_CONVERTER (converter)); g_return_if_fail (G_IS_OBJECT (object)); converter->inputs = g_list_append (converter->inputs, g_object_ref (object)); } /** * ipatch_converter_add_output: * @converter: Converter instance * @object: Object to add * * Add an output object to a converter object. */ void ipatch_converter_add_output (IpatchConverter *converter, GObject *object) { g_return_if_fail (IPATCH_IS_CONVERTER (converter)); g_return_if_fail (G_IS_OBJECT (object)); converter->outputs = g_list_append (converter->outputs, g_object_ref (object)); } /** * ipatch_converter_add_inputs: * @converter: Converter instance * @objects: List of objects to add * * Add a list of input objects to a converter object. */ void ipatch_converter_add_inputs (IpatchConverter *converter, GList *objects) { GList *p; g_return_if_fail (IPATCH_IS_CONVERTER (converter)); g_return_if_fail (objects != NULL); p = objects; while (p) { converter->inputs = g_list_append (converter->inputs, g_object_ref (p->data)); p = g_list_next (p); } } /** * ipatch_converter_add_outputs: * @converter: Converter instance * @objects: List of objects to add * * Add a list of output objects to a converter object. */ void ipatch_converter_add_outputs (IpatchConverter *converter, GList *objects) { GList *p; g_return_if_fail (IPATCH_IS_CONVERTER (converter)); g_return_if_fail (objects != NULL); p = objects; while (p) { converter->outputs = g_list_append (converter->outputs, g_object_ref (p->data)); p = g_list_next (p); } } /** * ipatch_converter_get_input: * @converter: Converter instance * * Get a single input object from a converter. * * Returns: The first input object from a converter or %NULL if * no input objects. The caller owns a reference to the returned * object. */ GObject * ipatch_converter_get_input (IpatchConverter *converter) { GObject *obj = NULL; g_return_val_if_fail (IPATCH_IS_CONVERTER (converter), NULL); if (converter->inputs) obj = (GObject *)(converter->inputs->data); if (obj) g_object_ref (obj); return (obj); } /** * ipatch_converter_get_output: * @converter: Converter instance * * Get a single output object from a converter. * * Returns: The first output object from a converter or %NULL if * no output objects. The caller owns a reference to the returned * object. */ GObject * ipatch_converter_get_output (IpatchConverter *converter) { GObject *obj = NULL; g_return_val_if_fail (IPATCH_IS_CONVERTER (converter), NULL); if (converter->outputs) obj = (GObject *)(converter->outputs->data); if (obj) g_object_ref (obj); return (obj); } /** * ipatch_converter_get_inputs: * @converter: Converter instance * * Get a list of input objects from a converter. * * Returns: A newly created input object list from a converter or * %NULL if no input objects. The caller owns a reference to the * returned list. */ IpatchList * ipatch_converter_get_inputs (IpatchConverter *converter) { IpatchList *list; GList *p; g_return_val_if_fail (IPATCH_IS_CONVERTER (converter), NULL); if (!converter->inputs) return (NULL); list = ipatch_list_new (); /* ++ ref new */ p = converter->inputs; while (p) { list->items = g_list_prepend (list->items, g_object_ref (p->data)); p = g_list_next (p); } list->items = g_list_reverse (list->items); return (list); /* !! caller takes over list reference */ } /** * ipatch_converter_get_outputs: * @converter: Converter instance * * Get a list of output objects from a converter. * * Returns: A newly created output object list from a converter or * %NULL if no output objects. The caller owns a reference to the * returned list. */ IpatchList * ipatch_converter_get_outputs (IpatchConverter *converter) { IpatchList *list; GList *p; g_return_val_if_fail (IPATCH_IS_CONVERTER (converter), NULL); if (!converter->outputs) return (NULL); list = ipatch_list_new (); /* ++ ref new */ p = converter->outputs; while (p) { list->items = g_list_prepend (list->items, g_object_ref (p->data)); p = g_list_next (p); } list->items = g_list_reverse (list->items); return (list); /* !! caller takes over list reference */ } /** * ipatch_converter_verify: * @converter: Converter object * @failmsg: Location to store a failure message if @converter fails * verification. The stored message should be freed when no longer needed. * * Verifies the settings of a converter object. This is automatically called * before a conversion is done, so it doesn't usually need to be explicitly * called. * * Returns: %TRUE if @converter passed verification, %FALSE otherwise in which * case an error message may be stored in @failmsg. Remember to free the * message when finished with it. */ gboolean ipatch_converter_verify (IpatchConverter *converter, char **failmsg) { IpatchConverterClass *klass; IpatchConverterInfo *info; char *msg = NULL; gboolean retval; GSList *list, *p; g_return_val_if_fail (IPATCH_IS_CONVERTER (converter), FALSE); klass = IPATCH_CONVERTER_GET_CLASS (converter); /* if no verify method, check input/output types and counts */ if (!klass->verify) { G_LOCK (conv_maps); list = g_hash_table_lookup (conv_types, GUINT_TO_POINTER (G_OBJECT_TYPE (converter))); list = g_slist_copy (list); /* duplicate so we can use outside of lock */ G_UNLOCK (conv_maps); for (p = list; p; p = p->next) { info = (IpatchConverterInfo *)(p->data); if (ipatch_converter_test_object_list (converter->inputs, info->src_type, info->src_count) && ipatch_converter_test_object_list (converter->outputs, info->dest_type, info->dest_count)) break; } g_slist_free (list); if (!p) /* found a map which is valid for the converter object lists */ { if (failmsg) *failmsg = g_strdup ("Converter objects failed verify"); return (FALSE); } else return (TRUE); } else { retval = (klass->verify)(converter, &msg); if (failmsg) *failmsg = msg; else g_free (msg); return (retval); } return (TRUE); } /* verifies that a GList of objects matches the @type and @count criteria. */ static gboolean ipatch_converter_test_object_list (GList *list, GType type, int count) { GList *p; int i; switch (count) { case 1: if (!list || list->next || !G_TYPE_CHECK_INSTANCE_TYPE (list->data, type)) return (FALSE); break; case 0: if (list) return (FALSE); break; case IPATCH_CONVERTER_COUNT_ONE_OR_MORE: if (!list) return (FALSE); /* fall through */ case IPATCH_CONVERTER_COUNT_ZERO_OR_MORE: for (p = list; p; p = p->next) if (!G_TYPE_CHECK_INSTANCE_TYPE (p->data, type)) return (FALSE); break; default: for (p = list, i = 0; p; p = p->next, i++) if (!G_TYPE_CHECK_INSTANCE_TYPE (p->data, type)) return (FALSE); if (i != count) return (FALSE); break; } return (TRUE); } /** * ipatch_converter_init: * @converter: Converter object * * Allows a converter type to initialize its parameters based on its input * and/or output objects. This function should be called after setting the * input and output objects, but before setting object parameters or * converting. Calling this function is not required, but certain converters * will work more intuitively if it is (an example is an audio sample saver * converter which could initialize the output sample file object format * based on the input sample object format). * * NOTE: Verification of converter parameters is not done by this routine * so converter types implementing an init method are responsible for their * own verification. */ void ipatch_converter_init (IpatchConverter *converter) { IpatchConverterClass *klass; g_return_if_fail (IPATCH_IS_CONVERTER (converter)); klass = IPATCH_CONVERTER_GET_CLASS (converter); if (!klass->init) return; (klass->init)(converter); } /** * ipatch_converter_convert: * @converter: Converter object * @err: Location to store error info or %NULL * * Runs the conversion method of a converter object. The @converter object's * conversion paramters are first verified before the conversion is run. * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_converter_convert (IpatchConverter *converter, GError **err) { IpatchConverterClass *klass; char *failmsg = NULL; g_return_val_if_fail (IPATCH_IS_CONVERTER (converter), FALSE); g_return_val_if_fail (!err || !*err, FALSE); klass = IPATCH_CONVERTER_GET_CLASS (converter); g_return_val_if_fail (klass->convert != NULL, FALSE); if (!ipatch_converter_verify (converter, &failmsg)) { g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_INVALID, _("Verification of conversion parameters failed: %s"), failmsg ? failmsg : _("")); return (FALSE); } return ((klass->convert)(converter, err)); } /** * ipatch_converter_reset: * @converter: Converter object * * Reset a converter object so it can be re-used. */ void ipatch_converter_reset (IpatchConverter *converter) { GList *p; g_return_if_fail (IPATCH_IS_CONVERTER (converter)); p = converter->inputs; while (p) { g_object_unref (p->data); p = g_list_delete_link (p, p); } converter->inputs = NULL; p = converter->outputs; while (p) { g_object_unref (p->data); p = g_list_delete_link (p, p); } converter->outputs = NULL; p = converter->log; while (p) { g_free (p->data); p = g_list_delete_link (p, p); } converter->log = NULL; converter->min_rate = 0.0; converter->max_rate = 0.0; converter->avg_rate = 0.0; converter->sum_rate = 0.0; converter->item_count = 0; } /** * ipatch_converter_get_notes: * @converter: Converter object * * Get notes about a conversion implementation. These notes could include * things such as information about any loss of information in the conversion * that may occur, etc. * * Returns: Newly allocated and possibly multi-line notes and comments * about a given conversion or %NULL if no notes. Meant for display to * the user. This string should be freed when no longer needed. */ char * ipatch_converter_get_notes (IpatchConverter *converter) { IpatchConverterClass *klass; g_return_val_if_fail (IPATCH_IS_CONVERTER (converter), NULL); klass = IPATCH_CONVERTER_GET_CLASS (converter); if (!klass->notes) return (NULL); return ((klass->notes)(converter)); } /** * ipatch_converter_log: * @converter: Converter object * @item: Item the log entry pertains to or %NULL if not item specific * @type: #IpatchConverterLogType and other flags * @msg: Message of the log. If message is dynamically allocated then * the #IPATCH_CONVERTER_LOG_MSG_ALLOC flag should be set in @type * * Logs an entry to a converter log. Usually only used by converter * object handlers. */ void ipatch_converter_log (IpatchConverter *converter, GObject *item, int type, char *msg) { LogEntry *entry; g_return_if_fail (IPATCH_IS_CONVERTER (converter)); g_return_if_fail (!item || G_IS_OBJECT (item)); g_return_if_fail (msg != NULL); entry = g_new0 (LogEntry, 1); if (item) entry->item = g_object_ref (item); entry->type = type; entry->data.msg = msg; converter->log = g_list_prepend (converter->log, entry); } /** * ipatch_converter_log_printf: * @converter: Converter object * @item: Item the log entry pertains to or %NULL if not item specific * @type: #IpatchConverterLogType and other flags * @fmt: Printf format style string * @...: Arguments to @fmt message string * * Logs a printf style message to a converter log. Usually only used by converter * object handlers. The #IPATCH_CONVERTER_LOG_MSG_ALLOC flag is automatically * set on the log entry, since it is dynamically allocated. */ void ipatch_converter_log_printf (IpatchConverter *converter, GObject *item, int type, const char *fmt, ...) { LogEntry *entry; va_list args; g_return_if_fail (IPATCH_IS_CONVERTER (converter)); g_return_if_fail (!item || G_IS_OBJECT (item)); g_return_if_fail (fmt != NULL); entry = g_new0 (LogEntry, 1); if (item) entry->item = g_object_ref (item); entry->type = type | IPATCH_CONVERTER_LOG_MSG_ALLOC; va_start (args, fmt); entry->data.msg = g_strdup_vprintf (fmt, args); va_end (args); converter->log = g_list_prepend (converter->log, entry); } /** * ipatch_converter_log_next: * @converter: Converter object * @pos: Opaque current position in log, should be %NULL on first call to * this function to return first log item (oldest item) * @item: Location to store item of the log entry or %NULL, no reference is * added so the item is only guarenteed to exist for as long as the * @converter does * @type: Location to store the type parameter of the log entry or %NULL * @msg: Location to store the message of the log entry or %NULL, message * is internal and should not be messed with and is only guarenteed for * the lifetime of the @converter * * Get the first or next log entry from a converter object. * * Returns: %TRUE if an entry was returned, %FALSE if no more entries in which * case item, type and msg are all undefined. */ gboolean ipatch_converter_log_next (IpatchConverter *converter, gpointer *pos, GObject **item, int *type, char **msg) { LogEntry *entry; GList *p; g_return_val_if_fail (IPATCH_IS_CONVERTER (converter), FALSE); g_return_val_if_fail (pos != NULL, FALSE); if (!*pos) p = g_list_last (converter->log); else p = g_list_previous ((GList *)(*pos)); if (!p) return (FALSE); entry = (LogEntry *)(p->data); if (item) *item = entry->item; if (type) *type = entry->type; if (msg) *msg = entry->data.msg; return (TRUE); } /** * ipatch_converter_set_link_funcs: * @converter: Converter object * @link_lookup: Set the link lookup callback function * @link_notify: Set the link notify callback function * * This function allows for object link interception by the user of * an #IpatchConverter instance. The callback functions are used by * conversion processes which create objects linking other external * objects which need to be converted. For each link object needing * conversion @link_lookup will be called. If @link_lookup returns a valid * pointer it is used as the converted link object, if %NULL is returned then * the link will be converted and @link_notify will be called with the new * converted item. An example usage of this feature is * the #IpatchPaste system, which does object conversions and substitutes * already converted objects (a conversion pool). */ void ipatch_converter_set_link_funcs (IpatchConverter *converter, IpatchConverterLinkLookupFunc *link_lookup, IpatchConverterLinkNotifyFunc *link_notify) { g_return_if_fail (IPATCH_IS_CONVERTER (converter)); converter->link_lookup = link_lookup; converter->link_notify = link_notify; } libinstpatch-1.0.0/libinstpatch/IpatchTypeProp.c0000644000175000017500000006006611461332142016665 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include #include "IpatchTypeProp.h" #include "IpatchVirtualContainer.h" #include "builtin_enums.h" #include "ipatch_priv.h" #include "i18n.h" /* key used for hash of GType property values */ typedef struct { GType type; /* type this property is bound to */ GParamSpec *spec; /* the parameter spec of the property */ } TypePropValueKey; typedef struct { GValue value; /* a static assigned value (or NULL) */ IpatchTypePropGetFunc func; /* a dynamic prop function (or NULL) */ } TypePropValueVal; static guint type_prop_value_GHashFunc (gconstpointer key); static gboolean type_prop_value_GEqualFunc (gconstpointer a, gconstpointer b); static void type_prop_value_destroy (gpointer user_data); static void type_list_properties_GHFunc (gpointer key, gpointer value, gpointer user_data); static void type_set_property (GType type, GParamSpec *prop_spec, const GValue *value, IpatchTypePropGetFunc func); static void type_get_property (GType type, GParamSpec *prop_spec, GValue *value, GObject *object); G_LOCK_DEFINE_STATIC (type_prop_hash); G_LOCK_DEFINE_STATIC (type_prop_value_hash); /* GType GParamSpec property hash (PropNameQuark -> GParamSpec) */ static GHashTable *type_prop_hash = NULL; /* hash of all GType property values (GType:GParamSpec -> GValue) */ static GHashTable *type_prop_value_hash = NULL; /* initialize GType property system */ void _ipatch_type_prop_init (void) { type_prop_hash = g_hash_table_new (NULL, NULL); type_prop_value_hash = g_hash_table_new_full (type_prop_value_GHashFunc, type_prop_value_GEqualFunc, (GDestroyNotify)g_free, (GDestroyNotify)type_prop_value_destroy); /* install some default type properties */ /* a user friendly type name */ ipatch_type_install_property (g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE)); /* title of the object (usually dynamically created from obj instance) */ ipatch_type_install_property (g_param_spec_string ("title", "Title", "Title", NULL, G_PARAM_READWRITE)); /* a user friendly type detail name */ ipatch_type_install_property (g_param_spec_string ("blurb", "Blurb", "Blurb", NULL, G_PARAM_READWRITE)); /* type classes (see ipatch_type_prop_register_category) */ ipatch_type_install_property (g_param_spec_int ("category", "Category", "Type category", G_MININT, G_MAXINT, IPATCH_CATEGORY_NONE, G_PARAM_READWRITE)); /* virtual parent container type (defined for children of * IpatchVirtualContainer types) */ ipatch_type_install_property (g_param_spec_gtype ("virtual-parent-type", "Virtual parent type", "Virtual parent type", G_TYPE_NONE, G_PARAM_READWRITE)); /* virtual container child type (defined for IpatchVirtualContainer types) */ ipatch_type_install_property (g_param_spec_gtype ("virtual-child-type", "Virtual child type", "Virtual child type", G_TYPE_NONE, G_PARAM_READWRITE)); /* link item type (type of object referenced/linked by another) */ ipatch_type_install_property (g_param_spec_gtype ("link-type", "Link type", "Link type", G_TYPE_NONE, G_PARAM_READWRITE)); /* virtual container conform function (function pointer used for making * a child object conform to the virtual container's criteria, the "percussion" * property for example) See IpatchVirtualContainerConformFunc. */ ipatch_type_install_property (g_param_spec_pointer ("virtual-child-conform-func", "IpatchVirtualContainerConformFunc", "IpatchVirtualContainerConformFunc", G_PARAM_READWRITE)); /* sort a container's children in user interfaces? */ ipatch_type_install_property (g_param_spec_boolean ("sort-children", "Sort children", "Sort children", FALSE, G_PARAM_READWRITE)); /* splits type property (for note and velocity splits) */ ipatch_type_install_property (g_param_spec_enum ("splits-type", "Splits type", "Splits type", IPATCH_TYPE_SPLITS_TYPE, IPATCH_SPLITS_NONE, G_PARAM_READWRITE)); } /* hash function for GType property value hash */ static guint type_prop_value_GHashFunc (gconstpointer key) { TypePropValueKey *valkey = (TypePropValueKey *)key; return ((guint)(valkey->type) + (guint)(valkey->spec)); } /* key equal function for GType property value hash */ static gboolean type_prop_value_GEqualFunc (gconstpointer a, gconstpointer b) { TypePropValueKey *akey = (TypePropValueKey *)a; TypePropValueKey *bkey = (TypePropValueKey *)b; return (akey->type == bkey->type && akey->spec == bkey->spec); } /* destroy notify for GType property values */ static void type_prop_value_destroy (gpointer user_data) { TypePropValueVal *val = (TypePropValueVal *)user_data; g_value_unset (&val->value); g_free (val); } /** * ipatch_type_install_property: * @prop_spec: Specification for the new #GType property. Ownership * of the GParamSpec is taken over by this function. The name field of * the GParamSpec should be a static string and is used as the property's * ID. * * Install a new #GType property which can be used to associate arbitrary * information to GTypes. */ void ipatch_type_install_property (GParamSpec *prop_spec) { GQuark quark; g_return_if_fail (G_IS_PARAM_SPEC (prop_spec)); g_return_if_fail (prop_spec->name != NULL); /* take ownership of the parameter spec */ g_param_spec_ref (prop_spec); g_param_spec_sink (prop_spec); quark = g_quark_from_static_string (prop_spec->name); G_LOCK (type_prop_hash); g_hash_table_insert (type_prop_hash, GUINT_TO_POINTER (quark), prop_spec); G_UNLOCK (type_prop_hash); } /** * ipatch_type_find_property: * @name: Name of GType property * * Lookup a GType property by name. * * Returns: The matching GParamSpec or %NULL if not found. The GParamSpec is * internal and should NOT be modified or freed. */ GParamSpec * ipatch_type_find_property (const char *name) { GParamSpec *spec; GQuark quark; g_return_val_if_fail (name != NULL, NULL); quark = g_quark_try_string (name); if (!quark) return (NULL); G_LOCK (type_prop_hash); spec = g_hash_table_lookup (type_prop_hash, GUINT_TO_POINTER (quark)); G_UNLOCK (type_prop_hash); return (spec); } /** * ipatch_type_list_properties: * @n_properties: Output: Length of returned array * * Get a list of all registered GType properties. * * Returns: An array of GParamSpecs which should be freed when finished. */ GParamSpec ** ipatch_type_list_properties (guint *n_properties) { GParamSpec **specs, **specp; g_return_val_if_fail (n_properties != NULL, NULL); G_LOCK (type_prop_hash); specs = g_new (GParamSpec *, g_hash_table_size (type_prop_hash)); specp = specs; g_hash_table_foreach (type_prop_hash, type_list_properties_GHFunc, &specp); G_UNLOCK (type_prop_hash); return (specs); } /* fills an array with GParamSpecs in the type_prop_hash */ static void type_list_properties_GHFunc (gpointer key, gpointer value, gpointer user_data) { GParamSpec ***specs = user_data; **specs = (GParamSpec *)value; *specs = *specs + 1; } /** * ipatch_type_find_types_with_property: * @name: Name of type property * @value: Optional value to match to type property values (%NULL to match any value) * @n_types: Location to store count of types in returned array or %NULL to ignore * * Get an array of types which have the given type property assigned and match * @value (optional, %NULL matches any value). * * Returns: Newly allocated 0 terminated array of types which have the named * property set or %NULL if type property not found. */ GType * ipatch_type_find_types_with_property (const char *name, const GValue *value, guint *n_types) { TypePropValueKey *key; GParamSpec *pspec; GList *keys, *p, *temp; GType *types; int count = 0; int i; g_return_val_if_fail (name != NULL, NULL); pspec = ipatch_type_find_property (name); g_return_val_if_fail (pspec != NULL, NULL); G_LOCK (type_prop_value_hash); keys = g_hash_table_get_keys (type_prop_value_hash); /* ++ alloc keys list */ /* Convert keys list to list of matching GTypes */ for (p = keys; p; ) { key = p->data; if (key->spec == pspec) { /* Replace list data TypePropValueKey pointer to GType */ p->data = GSIZE_TO_POINTER (key->type); p = p->next; } else /* Doesn't match GParamSpec - remove from list */ { if (p->prev) p->prev->next = p->next; else keys = p->next; if (p->next) p->next->prev = p->prev; temp = p; p = p->next; g_list_free1 (temp); } } G_UNLOCK (type_prop_value_hash); /* Compare values if @value was supplied */ if (value) { GValue cmp_value = { 0 }; GType type; for (p = keys; p; ) { type = GPOINTER_TO_SIZE (p->data); g_value_init (&cmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec)); ipatch_type_get_property (type, pspec->name, &cmp_value); if (g_param_values_cmp (pspec, value, &cmp_value) != 0) { if (p->prev) p->prev->next = p->next; else keys = p->next; if (p->next) p->next->prev = p->prev; temp = p; p = p->next; g_list_free1 (temp); } else p = p->next; g_value_unset (&cmp_value); } } count = g_list_length (keys); types = g_new (GType, count + 1); /* ++ alloc types */ /* Copy GType list to type array and delete the list */ for (p = keys, i = 0; p; p = g_list_delete_link (p, p), i++) /* -- free keys list */ types[i] = GPOINTER_TO_SIZE (p->data); types[i] = 0; if (n_types) *n_types = count; return (types); /* !! caller takes over alloc */ } /** * ipatch_type_set: * @type: GType to set properties of * @first_property_name: Name of first property to set * @Varargs: Value of first property to set and optionally followed by more * property name/value pairs, terminated with %NULL name. * * Set GType properties. GType properties are used to associate arbitrary * information with GTypes. */ void ipatch_type_set (GType type, const char *first_property_name, ...) { va_list args; va_start (args, first_property_name); ipatch_type_set_valist (type, first_property_name, args); va_end (args); } /** * ipatch_type_set_valist: * @type: GType to set properties of * @first_property_name: Name of first property to set * @args: Value of first property to set and optionally followed by more * property name/value pairs, terminated with %NULL name. * * Like ipatch_type_set() but uses a va_list. */ void ipatch_type_set_valist (GType type, const char *first_property_name, va_list args) { const char *name; GValue value = { 0 }; gchar *error = NULL; GParamSpec *prop_spec; g_return_if_fail (type != 0); g_return_if_fail (first_property_name != NULL); name = first_property_name; while (name) { prop_spec = ipatch_type_find_property (name); if (!prop_spec) { g_warning ("%s: no type property named `%s'", G_STRLOC, name); break; } if (!(prop_spec->flags & G_PARAM_WRITABLE)) { g_warning ("%s: type property `%s' is not writable", G_STRLOC, prop_spec->name); break; } g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop_spec)); G_VALUE_COLLECT (&value, args, 0, &error); if (error) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); /* we purposely leak the GValue contents here, it might not be * in a sane state if an error condition occured */ break; } type_set_property (type, prop_spec, &value, NULL); g_value_unset (&value); name = va_arg (args, char *); } } /** * ipatch_type_set_property: * @type: GType to set property of * @property_name: Name of property to set * @value: Value to set the the property to. The value's * type must be the same as the GType property's type. * * Set a single property of a #GType. */ void ipatch_type_set_property (GType type, const char *property_name, const GValue *value) { GParamSpec *prop_spec; g_return_if_fail (type != 0); g_return_if_fail (property_name != NULL); g_return_if_fail (G_IS_VALUE (value)); prop_spec = ipatch_type_find_property (property_name); if (!prop_spec) { g_warning ("%s: no type property named `%s'", G_STRLOC, property_name); return; } if (!(prop_spec->flags & G_PARAM_WRITABLE)) { g_warning ("%s: type property `%s' is not writable", G_STRLOC, property_name); return; } if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (prop_spec)) { g_warning ("%s: value type should be '%s' but is '%s'", G_STRLOC, g_type_name (G_PARAM_SPEC_VALUE_TYPE (prop_spec)), G_VALUE_TYPE_NAME (value)); return; } type_set_property (type, prop_spec, value, NULL); } /* does the actual setting of a GType property, note that the value is is copied and not used directly */ static void type_set_property (GType type, GParamSpec *prop_spec, const GValue *value, IpatchTypePropGetFunc func) { TypePropValueKey *key; TypePropValueVal *val; key = g_new (TypePropValueKey, 1); key->type = type; key->spec = prop_spec; val = g_new0 (TypePropValueVal, 1); if (value) { g_value_init (&val->value, G_VALUE_TYPE (value)); g_value_copy (value, &val->value); } val->func = func; /* value is taken over by the hash table */ G_LOCK (type_prop_value_hash); g_hash_table_insert (type_prop_value_hash, key, val); G_UNLOCK (type_prop_value_hash); } /** * ipatch_type_get: * @type: GType to get properties from * @first_property_name: Name of first property to get * @Varargs: Pointer to store first property value and optionally followed * by more property name/value pairs, terminated with %NULL name. * * Get GType property values. */ void ipatch_type_get (GType type, const char *first_property_name, ...) { va_list args; va_start (args, first_property_name); ipatch_type_get_valist (type, first_property_name, args); va_end (args); } /** * ipatch_type_get_valist: * @type: GType to get properties from * @first_property_name: Name of first property to get * @args: Pointer to store first property value and optionally followed * by more property name/value pairs, terminated with %NULL name. * * Like ipatch_type_get() but uses a va_list. */ void ipatch_type_get_valist (GType type, const char *first_property_name, va_list args) { const char *name; g_return_if_fail (type != 0); g_return_if_fail (first_property_name != NULL); name = first_property_name; while (name) { GValue value = { 0, }; GParamSpec *prop_spec; char *error; prop_spec = ipatch_type_find_property (name); if (!prop_spec) { g_warning ("%s: no type property named `%s'", G_STRLOC, name); break; } if (!(prop_spec->flags & G_PARAM_READABLE)) { g_warning ("%s: type property `%s' is not readable", G_STRLOC, prop_spec->name); break; } g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop_spec)); type_get_property (type, prop_spec, &value, NULL); G_VALUE_LCOPY (&value, args, 0, &error); if (error) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); g_value_unset (&value); break; } g_value_unset (&value); name = va_arg (args, char *); } } /** * ipatch_type_get_property: * @type: GType to get property from * @property_name: Name of property to get * @value: An initialized value to store the property value in. The value's * type must be a type that the property can be transformed to. * * Get a single property from a #GType. */ void ipatch_type_get_property (GType type, const char *property_name, GValue *value) { GParamSpec *prop_spec; g_return_if_fail (type != 0); g_return_if_fail (property_name != NULL); g_return_if_fail (G_IS_VALUE (value)); prop_spec = ipatch_type_find_property (property_name); if (!prop_spec) g_warning ("%s: no type property named `%s'", G_STRLOC, property_name); else if (!(prop_spec->flags & G_PARAM_READABLE)) g_warning ("%s: type property `%s' is not readable", G_STRLOC, prop_spec->name); else { GValue *prop_value, tmp_value = { 0, }; /* auto-conversion of the callers value type */ if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (prop_spec)) { g_value_reset (value); prop_value = value; } else if (!g_value_type_transformable (G_PARAM_SPEC_VALUE_TYPE (prop_spec), G_VALUE_TYPE (value))) { g_warning ("can't retrieve type property `%s' of type" " `%s' as value of type `%s'", prop_spec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (prop_spec)), G_VALUE_TYPE_NAME (value)); return; } else { g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (prop_spec)); prop_value = &tmp_value; } type_get_property (type, prop_spec, prop_value, NULL); if (prop_value != value) { g_value_transform (prop_value, value); g_value_unset (&tmp_value); } } } /* does the actual getting of a GType property */ static void type_get_property (GType type, GParamSpec *prop_spec, GValue *value, GObject *object) { TypePropValueKey key; TypePropValueVal *val; key.type = type; key.spec = prop_spec; G_LOCK (type_prop_value_hash); val = g_hash_table_lookup (type_prop_value_hash, &key); G_UNLOCK (type_prop_value_hash); if (val) { if (val->func) val->func (type, prop_spec, value, object); else g_value_copy (&val->value, value); } else g_param_value_set_default (prop_spec, value); } /** * ipatch_type_object_get: * @object: Object instance to get type property from * @first_property_name: Name of first property to get * @Varargs: Pointer to store first property value and optionally followed * by more property name/value pairs, terminated with %NULL name. * * Get GType property values. Like ipatch_type_get() but takes an object * instance which can be used by any registered dynamic type property * functions. */ void ipatch_type_object_get (GObject *object, const char *first_property_name, ...) { va_list args; va_start (args, first_property_name); ipatch_type_object_get_valist (object, first_property_name, args); va_end (args); } /* * ipatch_type_object_get_valist: * @object: Object instance to get type property from * @first_property_name: Name of first property to get * @args: Pointer to store first property value and optionally followed * by more property name/value pairs, terminated with %NULL name. * * Like ipatch_type_object_get() but uses a va_list. */ void ipatch_type_object_get_valist (GObject *object, const char *first_property_name, va_list args) { GType type; const char *name; g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (first_property_name != NULL); type = G_OBJECT_TYPE (object); g_return_if_fail (type != 0); name = first_property_name; while (name) { GValue value = { 0, }; GParamSpec *prop_spec; char *error; prop_spec = ipatch_type_find_property (name); if (!prop_spec) { g_warning ("%s: no type property named `%s'", G_STRLOC, name); break; } if (!(prop_spec->flags & G_PARAM_READABLE)) { g_warning ("%s: type property `%s' is not readable", G_STRLOC, prop_spec->name); break; } g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop_spec)); type_get_property (type, prop_spec, &value, object); G_VALUE_LCOPY (&value, args, 0, &error); if (error) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); g_value_unset (&value); break; } g_value_unset (&value); name = va_arg (args, char *); } } /** * ipatch_type_object_get_property: * @object: Object instance to get type property from * @property_name: Name of property to get * @value: An initialized value to store the property value in. The value's * type must be a type that the property can be transformed to. * * Get a single type property from an @object instance. */ void ipatch_type_object_get_property (GObject *object, const char *property_name, GValue *value) { GParamSpec *prop_spec; GType type; g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (property_name != NULL); g_return_if_fail (G_IS_VALUE (value)); type = G_OBJECT_TYPE (object); g_return_if_fail (type != 0); prop_spec = ipatch_type_find_property (property_name); if (!prop_spec) g_warning ("%s: no type property named `%s'", G_STRLOC, property_name); else if (!(prop_spec->flags & G_PARAM_READABLE)) g_warning ("%s: type property `%s' is not readable", G_STRLOC, prop_spec->name); else { GValue *prop_value, tmp_value = { 0, }; /* auto-conversion of the callers value type */ if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (prop_spec)) { g_value_reset (value); prop_value = value; } else if (!g_value_type_transformable (G_PARAM_SPEC_VALUE_TYPE (prop_spec), G_VALUE_TYPE (value))) { g_warning ("can't retrieve type property `%s' of type" " `%s' as value of type `%s'", prop_spec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (prop_spec)), G_VALUE_TYPE_NAME (value)); return; } else { g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (prop_spec)); prop_value = &tmp_value; } type_get_property (type, prop_spec, prop_value, object); if (prop_value != value) { g_value_transform (prop_value, value); g_value_unset (&tmp_value); } } } /** * ipatch_type_set_dynamic_func: * @type: GType of the type property * @property_name: Name of a previously registered type property * @func: Callback function used for getting values for this type property * * Registers a callback function for dynamically getting the value of a * type property. * * Example: A dynamic property is created for SoundFont presets to return a * different "virtual-parent-type" depending on if its a percussion or * melodic preset (determined from a preset's bank number). */ void ipatch_type_set_dynamic_func (GType type, const char *property_name, IpatchTypePropGetFunc func) { GParamSpec *prop_spec; g_return_if_fail (type != 0); g_return_if_fail (property_name != NULL); prop_spec = ipatch_type_find_property (property_name); if (!prop_spec) { g_warning ("%s: no type property named `%s'", G_STRLOC, property_name); return; } type_set_property (type, prop_spec, NULL, func); } /** * ipatch_type_get_dynamic_func: * @type: GType of the type property * @property_name: Name of a previously registered type property * * Get a the dynamic function registered for a given @type and @property_name * with ipatch_type_set_dynamic_func(). Also can be used as an indicator of * whether a type property is dynamic or not. * * Returns: Pointer to the registered function or %NULL if no function * registered (not a dynamic type property). */ IpatchTypePropGetFunc ipatch_type_get_dynamic_func (GType type, const char *property_name) { GParamSpec *type_prop_pspec; TypePropValueKey key; TypePropValueVal *val; type_prop_pspec = ipatch_type_find_property (property_name); g_return_val_if_fail (type_prop_pspec != NULL, NULL); key.type = type; key.spec = type_prop_pspec; G_LOCK (type_prop_value_hash); val = g_hash_table_lookup (type_prop_value_hash, &key); G_UNLOCK (type_prop_value_hash); return (val ? val->func : NULL); } libinstpatch-1.0.0/libinstpatch/IpatchSF2PZone.c0000644000175000017500000001720611461332142016447 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSF2PZone.h" #include "IpatchSF2Zone.h" #include "IpatchSF2GenItem.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" enum { /* generator IDs are used for lower numbers */ PROP_LINK_ITEM = IPATCH_SF2_GEN_ITEM_FIRST_PROP_USER_ID }; static void ipatch_sf2_pzone_gen_item_iface_init (IpatchSF2GenItemIface *genitem_iface); static void ipatch_sf2_pzone_class_init (IpatchSF2PZoneClass *klass); static void ipatch_sf2_pzone_init (IpatchSF2PZone *pzone); static void ipatch_sf2_pzone_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sf2_pzone_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); /* For passing data from class init to gen item interface init */ static GParamSpec **gen_item_specs = NULL; static GParamSpec **gen_item_setspecs = NULL; GType ipatch_sf2_pzone_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchSF2PZoneClass), NULL, NULL, (GClassInitFunc) ipatch_sf2_pzone_class_init, NULL, NULL, sizeof (IpatchSF2PZone), 0, (GInstanceInitFunc) ipatch_sf2_pzone_init, }; static const GInterfaceInfo genitem_iface = { (GInterfaceInitFunc) ipatch_sf2_pzone_gen_item_iface_init, NULL, NULL }; item_type = g_type_register_static (IPATCH_TYPE_SF2_ZONE, "IpatchSF2PZone", &item_info, 0); g_type_add_interface_static (item_type, IPATCH_TYPE_SF2_GEN_ITEM, &genitem_iface); } return (item_type); } /* gen item interface initialization */ static void ipatch_sf2_pzone_gen_item_iface_init (IpatchSF2GenItemIface *genitem_iface) { genitem_iface->genarray_ofs = G_STRUCT_OFFSET (IpatchSF2Zone, genarray); genitem_iface->propstype = IPATCH_SF2_GEN_PROPS_PRESET; g_return_if_fail (gen_item_specs != NULL); g_return_if_fail (gen_item_setspecs != NULL); memcpy (&genitem_iface->specs, gen_item_specs, sizeof (genitem_iface->specs)); memcpy (&genitem_iface->setspecs, gen_item_setspecs, sizeof (genitem_iface->setspecs)); g_free (gen_item_specs); g_free (gen_item_setspecs); } static void ipatch_sf2_pzone_class_init (IpatchSF2PZoneClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->get_property = ipatch_sf2_pzone_get_property; item_class->item_set_property = ipatch_sf2_pzone_set_property; g_object_class_install_property (obj_class, PROP_LINK_ITEM, g_param_spec_object ("link-item", _("Link item"), _("Link item"), IPATCH_TYPE_SF2_INST, G_PARAM_READWRITE)); /* install generator properties */ ipatch_sf2_gen_item_iface_install_properties (obj_class, IPATCH_SF2_GEN_PROPS_PRESET, &gen_item_specs, &gen_item_setspecs); } static void ipatch_sf2_pzone_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSF2PZone *pzone = IPATCH_SF2_PZONE (object); IpatchSF2Inst *inst; if (property_id == PROP_LINK_ITEM) { inst = g_value_get_object (value); g_return_if_fail (IPATCH_IS_SF2_INST (inst)); ipatch_sf2_zone_set_link_item_no_notify ((IpatchSF2Zone *)pzone, (IpatchItem *)inst, NULL); } else if (!ipatch_sf2_gen_item_iface_set_property ((IpatchSF2GenItem *)pzone, property_id, value)) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_sf2_pzone_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSF2PZone *pzone = IPATCH_SF2_PZONE (object); if (property_id == PROP_LINK_ITEM) { g_value_take_object (value, ipatch_sf2_zone_get_link_item ((IpatchSF2Zone *)pzone)); } else if (!ipatch_sf2_gen_item_iface_get_property ((IpatchSF2GenItem *)pzone, property_id, value)) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_sf2_pzone_init (IpatchSF2PZone *pzone) { ipatch_sf2_gen_array_init (&((IpatchSF2Zone *)pzone)->genarray, TRUE, FALSE); } /** * ipatch_sf2_pzone_new: * * Create a new SoundFont preset zone object. * * Returns: New SoundFont preset zone with a reference count of 1. Caller * owns the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchSF2PZone * ipatch_sf2_pzone_new (void) { return (IPATCH_SF2_PZONE (g_object_new (IPATCH_TYPE_SF2_PZONE, NULL))); } /** * ipatch_sf2_pzone_first: * @iter: Patch item iterator containing #IpatchSF2PZone items * * Gets the first item in a preset zone iterator. A convenience * wrapper for ipatch_iter_first(). * * Returns: The first preset zone in @iter or %NULL if empty. */ IpatchSF2PZone * ipatch_sf2_pzone_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_SF2_PZONE (obj)); else return (NULL); } /** * ipatch_sf2_pzone_next: * @iter: Patch item iterator containing #IpatchSF2PZone items * * Gets the next item in a preset zone iterator. A convenience wrapper * for ipatch_iter_next(). * * Returns: The next preset zone in @iter or %NULL if at the end of * the list. */ IpatchSF2PZone * ipatch_sf2_pzone_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_SF2_PZONE (obj)); else return (NULL); } /** * ipatch_sf2_pzone_set_inst: * @pzone: Preset zone to set referenced instrument of * @inst: Instrument to set preset zone's referenced item to * * Sets the referenced instrument of a preset zone. */ void ipatch_sf2_pzone_set_inst (IpatchSF2PZone *pzone, IpatchSF2Inst *inst) { g_return_if_fail (IPATCH_IS_SF2_PZONE (pzone)); g_return_if_fail (!inst || IPATCH_IS_SF2_INST (inst)); ipatch_sf2_zone_set_link_item (IPATCH_SF2_ZONE (pzone), IPATCH_ITEM (inst)); } /** * ipatch_sf2_pzone_get_inst: * @pzone: Preset zone to get referenced instrument from * * Gets the referenced instrument from a preset zone. * The returned instrument's reference count is incremented and the caller * is responsible for unrefing it with g_object_unref(). * * Returns: Preset zone's referenced instrument or %NULL if global * zone. Remember to unreference the instrument with g_object_unref() when * done with it. */ IpatchSF2Inst * ipatch_sf2_pzone_get_inst (IpatchSF2PZone *pzone) { IpatchItem *item; g_return_val_if_fail (IPATCH_IS_SF2_PZONE (pzone), NULL); item = ipatch_sf2_zone_get_link_item (IPATCH_SF2_ZONE (pzone)); return (item ? IPATCH_SF2_INST (item) : NULL); } libinstpatch-1.0.0/libinstpatch/IpatchGigEffects.h0000644000175000017500000001521711461332142017114 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchGigEffects * @short_description: GigaSampler instrument parameters and effects * @see_also: * @stability: Stable * * Functions and types for GigaSampler instrument parameters and effects. */ #ifndef __IPATCH_GIG_EFFECTS_H__ #define __IPATCH_GIG_EFFECTS_H__ #include #include typedef struct _IpatchGigEffects IpatchGigEffects; #include #include /* GigaSampler envelope/lfo/filter settings (3ewa chunk) */ struct _IpatchGigEffects { guint32 unknown1; /* byte 0-3, always 0x0000008C? */ guint32 unknown7; /* byte 44-47 */ guint32 unknown14; /* byte 100-103 */ guint16 unknown2; /* byte 12-13 */ guint16 unknown3; /* byte 16-17 */ guint16 unknown4; /* byte 20-21 */ guint16 unknown5; /* byte 24-25 */ guint16 unknown6; /* byte 36-37 */ guint16 unknown8; /* byte 60-61 */ guint16 unknown9; /* byte 68-69 */ guint16 unknown10; /* byte 76-77 */ guint16 unknown11; /* byte 84-85 */ guint16 unknown13; /* byte 98-99 */ guint16 unknown15; /* byte 106-107 */ guint16 unknown17; /* byte 116-117 */ guint16 unknown18; /* byte 122-123 */ guint16 unknown20; /* byte 126-127 */ guint8 unknown12; /* byte 93 */ guint8 unknown16; /* byte 111 */ guint8 unknown19; /* byte 125 */ guint8 unknown21; /* byte 129 */ guint8 unknown22; /* byte 130 */ guint8 unknown23; /* byte 135 */ /* EG1 - Volume envelope */ guint16 eg1_pre_attack; /* 10th percent */ guint16 eg1_sustain; /* 10th percent */ guint32 eg1_attack; /* timecents */ guint32 eg1_decay; /* timecents */ guint32 eg1_decay2; /* timecents (where is the "inf" flag?) */ guint32 eg1_release; /* timecents */ guint8 eg1_hold; /* bit 8=1:true */ /* EG2 - Filter envelope */ guint16 eg2_pre_attack; /* 10th percent */ guint16 eg2_sustain; /* 10th percent */ guint32 eg2_attack; /* timecents */ guint32 eg2_decay; /* timecents */ guint32 eg2_decay2; /* timecents */ guint32 eg2_release; /* timecents */ /* EG3 - Pitch envelope */ guint32 eg3_attack; /* timecents */ guint16 eg3_depth; /* 12 bit signed (cents) */ /* LFO1 - Volume LFO */ guint16 lfo1_internal_depth; /* 0-1200 */ guint32 lfo1_freq; /* pitch cents */ guint16 lfo1_ctrl_depth; /* 0-1200 */ guint8 lfo1_ctrl; /* 0=internal, 1=mod wheel, 2=breath ctrl, 3=internal/mod wheel, 4=internal/breath ctrl */ /* bit 8=1:flip phase */ /* bit 7=1:synch */ /* bits 5 en 6: Res midictrl: 0=18, 1=19, 2=80, 3=81 */ /* LFO2 - Filter LFO */ guint8 lfo2_ctrl; /* 0=internal, 1=mod wheel, 2=breath ctrl, 3=internal/mod wheel, 4=internal/breath ctrl */ /* bit 6=1:synch */ /* bit 8=1:flip phase */ /* bit 7=1:Resonance midi ctrl */ guint32 lfo2_freq; /* pitch cents */ guint16 lfo2_internal_depth; /* 0-1200 */ guint16 lfo2_ctrl_depth; /* 0-1200 */ /* LFO3 - Pitch LFO */ guint32 lfo3_freq; /* pitch cents */ guint16 lfo3_internal_depth; /* cents */ guint16 lfo3_ctrl_depth; /* cents */ guint8 lfo3_ctrl; /* bit 6: LFO3 synch bit 8:invert attentuation ctrl */ /* filter parameters */ guint8 filter_type; /* 0=lowpass, 1=bandpass, 2=highpass, 3=bandreject */ guint8 turbo_lowpass; /* bit 7=0: on */ guint8 filter_cutoff; /* bit 8=1:on */ guint8 filter_midi_ctrl; /* bit 8=1:use ctrl rest 0:aftertouch */ guint8 filter_vel_scale; guint8 filter_resonance; /* bit 8=0:dynamic */ guint8 filter_breakpoint; /* bit 8=1:keyboard tracking */ /* velocity parameters */ guint8 vel_response; /* 0-4 = nonlinear, 5-9 = linear, 10-14 = special */ guint8 vel_dyn_range; /* release velocity paramaters */ guint8 release_vel_response; /* 0-4 = nonlinear, 5-9 = linear, 10-14 = special */ /* release velocity dynamic range? */ guint8 release_trigger_decay; guint8 attn_ctrl; /* bit 1:on, rest=ctrl, 0xFF=velocity */ guint8 max_velocity; /* Used for velocity split */ guint16 sample_offset; guint8 pitch_track_dim_bypass; /* bit 0=0: pitch track */ /* 0x10/0x20=dim bypass ctrl 94/95 */ guint8 layer_pan; /* 7-bit signed */ guint8 self_mask; /* 1=true */ guint8 channel_offset; /* (*4) */ guint8 sust_defeat; /* 2=on */ }; typedef enum { IPATCH_GIG_FILTER_LOWPASS = 0, IPATCH_GIG_FILTER_BANDPASS = 1, IPATCH_GIG_FILTER_HIGHPASS = 2, IPATCH_GIG_FILTER_BANDREJECT = 3 } IpatchGigFilterType; /* MIDI controllers used in GigaSampler files */ typedef enum { IPATCH_GIG_CTRL_MOD_WHEEL = 0x01, IPATCH_GIG_CTRL_BREATH = 0x02, IPATCH_GIG_CTRL_FOOT = 0x04, IPATCH_GIG_CTRL_PORTAMENTO_TIME = 0x05, IPATCH_GIG_CTRL_EFFECT_1 = 0x0C, IPATCH_GIG_CTRL_EFFECT_2 = 0x0D, IPATCH_GIG_CTRL_GEN_PURPOSE_1 = 0x10, IPATCH_GIG_CTRL_GEN_PURPOSE_2 = 0x11, IPATCH_GIG_CTRL_GEN_PURPOSE_3 = 0x12, IPATCH_GIG_CTRL_GEN_PURPOSE_4 = 0x13, IPATCH_GIG_CTRL_SUSTAIN_PEDAL = 0x40, IPATCH_GIG_CTRL_PORTAMENTO = 0x41, IPATCH_GIG_CTRL_SOSTENUTO = 0x42, IPATCH_GIG_CTRL_SOFT_PEDAL = 0x43, IPATCH_GIG_CTRL_GEN_PURPOSE_5 = 0x50, IPATCH_GIG_CTRL_GEN_PURPOSE_6 = 0x51, IPATCH_GIG_CTRL_GEN_PURPOSE_7 = 0x52, IPATCH_GIG_CTRL_GEN_PURPOSE_8 = 0x53, IPATCH_GIG_CTRL_EFFECT_DEPTH_1 = 0x5B, IPATCH_GIG_CTRL_EFFECT_DEPTH_2 = 0x5C, IPATCH_GIG_CTRL_EFFECT_DEPTH_3 = 0x5D, IPATCH_GIG_CTRL_EFFECT_DEPTH_4 = 0x5E, IPATCH_GIG_CTRL_EFFECT_DEPTH_5 = 0x5F } IpatchGigControlType; void ipatch_gig_parse_effects (IpatchFileHandle *handle, IpatchGigEffects *effects); void ipatch_gig_store_effects (IpatchFileHandle *handle, IpatchGigEffects *effects); void ipatch_gig_effects_init (IpatchGigEffects *effects); void ipatch_gig_effects_to_gen_array (IpatchGigEffects *effects, IpatchSF2GenArray *array); guint16 ipatch_gig_to_sf2_timecents (gint32 gig_tc); guint16 ipatch_gig_volsust_to_sf2_centibels (guint gig_tperc); #endif libinstpatch-1.0.0/libinstpatch/IpatchDLS2Conn.h0000644000175000017500000001651211461332142016427 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchDLS2Conn * @short_description: DLS version 2 connection structures and functions * @see_also: * @stability: Stable * * Defines structures and functions used for DLS version 2 instrument * parameters (called connections in DLS terminology). */ #ifndef __IPATCH_DLS2_CONN_H__ #define __IPATCH_DLS2_CONN_H__ #include #include /* forward type declarations */ typedef struct _IpatchDLS2Conn IpatchDLS2Conn; typedef struct _IpatchDLS2ConnInfo IpatchDLS2ConnInfo; /* IpatchDLS2Conn has a GObject boxed type */ #define IPATCH_TYPE_DLS2_CONN (ipatch_dls2_conn_get_type ()) /* DLS2 connection (to set parameter values and define modulators) */ struct _IpatchDLS2Conn { /*< public >*/ guint16 src; /* source enum */ guint16 ctrlsrc; /* second source enum */ guint16 dest; /* destination enum */ guint16 trans; /* transform enum */ gint32 scale; /* scale value */ }; /* Compare two DLS connections to see if they are identical (source, control and dest are identical) */ #define IPATCH_DLS2_CONN_ARE_IDENTICAL(a, b) \ ((a)->src == (b)->src && (a)->ctrlsrc == (b)->ctrlsrc \ && (a)->dest == (b)->dest) /* connection info and constraints structure */ struct _IpatchDLS2ConnInfo { /*< public >*/ guint16 type; /* IpatchDLS2ConnDestType */ gint32 min; /* minimum value allowed */ gint32 max; /* maximum value allowed */ gint32 def; /* default value */ int unit; /* #IpatchUnitType type */ char *label; /* short descriptive label */ char *descr; /* more complete description */ }; /* source connection types */ typedef enum { IPATCH_DLS2_CONN_SRC_NONE = 0, /* No source */ IPATCH_DLS2_CONN_SRC_LFO = 1, /* Modulation LFO */ IPATCH_DLS2_CONN_SRC_VELOCITY = 2, /* MIDI Note-On velocity */ IPATCH_DLS2_CONN_SRC_NOTE = 3, /* MIDI Note number */ IPATCH_DLS2_CONN_SRC_EG1 = 4, /* Envelope Generator 1 */ IPATCH_DLS2_CONN_SRC_EG2 = 5, /* Envelope Generator 2 */ IPATCH_DLS2_CONN_SRC_PITCH_WHEEL = 6, /* Pitch Wheel */ IPATCH_DLS2_CONN_SRC_POLY_PRESSURE = 7, /* Polyphonic pressure */ IPATCH_DLS2_CONN_SRC_CHANNEL_PRESSURE = 8, /* Channel Pressure */ IPATCH_DLS2_CONN_SRC_VIBRATO = 9, /* Vibrato LFO */ /* defined MIDI controller sources */ IPATCH_DLS2_CONN_SRC_CC1 = 0x0081, /* Modulation */ IPATCH_DLS2_CONN_SRC_CC7 = 0x0087, /* Volume */ IPATCH_DLS2_CONN_SRC_CC10 = 0x008A, /* Pan */ IPATCH_DLS2_CONN_SRC_CC11 = 0x008B, /* Expression */ IPATCH_DLS2_CONN_SRC_CC91 = 0x00DB, /* Chorus Send */ IPATCH_DLS2_CONN_SRC_CC93 = 0x00DD, /* Reverb Send */ /* MIDI registered parameter numbers */ IPATCH_DLS2_CONN_SRC_RPN0 = 0x0100, /* Pitch bend range */ IPATCH_DLS2_CONN_SRC_RPN1 = 0x0101, /* Fine tune */ IPATCH_DLS2_CONN_SRC_RPN2 = 0x0102 /* Coarse tune */ } IpatchDLS2ConnSrcType; /* destination connection types */ typedef enum { IPATCH_DLS2_CONN_DEST_NONE = 0, IPATCH_DLS2_CONN_DEST_GAIN = 1, IPATCH_DLS2_CONN_DEST_RESERVED = 2, IPATCH_DLS2_CONN_DEST_PITCH = 3, IPATCH_DLS2_CONN_DEST_PAN = 4, IPATCH_DLS2_CONN_DEST_NOTE = 5, IPATCH_DLS2_CONN_DEST_LEFT = 0x0010, IPATCH_DLS2_CONN_DEST_RIGHT = 0x0011, IPATCH_DLS2_CONN_DEST_CENTER = 0x0012, IPATCH_DLS2_CONN_DEST_LFE_CHANNEL = 0x0013, IPATCH_DLS2_CONN_DEST_LEFT_REAR = 0x0014, IPATCH_DLS2_CONN_DEST_RIGHT_REAR = 0x0015, IPATCH_DLS2_CONN_DEST_CHORUS = 0x0080, IPATCH_DLS2_CONN_DEST_REVERB = 0x0081, IPATCH_DLS2_CONN_DEST_LFO_FREQ = 0x0104, IPATCH_DLS2_CONN_DEST_LFO_DELAY = 0x0105, IPATCH_DLS2_CONN_DEST_VIB_FREQ = 0x0114, IPATCH_DLS2_CONN_DEST_VIB_DELAY = 0x0115, IPATCH_DLS2_CONN_DEST_EG1_ATTACK = 0x0206, IPATCH_DLS2_CONN_DEST_EG1_DECAY = 0x0207, IPATCH_DLS2_CONN_DEST_EG1_RESERVED = 0x0208, IPATCH_DLS2_CONN_DEST_EG1_RELEASE = 0x0209, IPATCH_DLS2_CONN_DEST_EG1_SUSTAIN = 0x020A, IPATCH_DLS2_CONN_DEST_EG1_DELAY = 0x020B, IPATCH_DLS2_CONN_DEST_EG1_HOLD = 0x020C, IPATCH_DLS2_CONN_DEST_EG1_SHUTDOWN = 0x020D, IPATCH_DLS2_CONN_DEST_EG2_ATTACK = 0x030A, IPATCH_DLS2_CONN_DEST_EG2_DECAY = 0x030B, IPATCH_DLS2_CONN_DEST_EG2_RESERVED = 0x030C, IPATCH_DLS2_CONN_DEST_EG2_RELEASE = 0x030D, IPATCH_DLS2_CONN_DEST_EG2_SUSTAIN = 0x030E, IPATCH_DLS2_CONN_DEST_EG2_DELAY = 0x030F, IPATCH_DLS2_CONN_DEST_EG2_HOLD = 0x0310, IPATCH_DLS2_CONN_DEST_FILTER_CUTOFF = 0x0500, IPATCH_DLS2_CONN_DEST_FILTER_Q = 0x0501 } IpatchDLS2ConnDestType; #define IPATCH_DLS2_CONN_OUTPUT_TRANS_NONE 0 /* connection transform types */ typedef enum { IPATCH_DLS2_CONN_TRANS_LINEAR = 0, IPATCH_DLS2_CONN_TRANS_CONCAVE = 1, IPATCH_DLS2_CONN_TRANS_CONVEX = 2, IPATCH_DLS2_CONN_TRANS_SWITCH = 3 } IpatchDLS2ConnTransformType; /* connection polarity types */ typedef enum { IPATCH_DLS2_CONN_POLARITY_UNI = 0, IPATCH_DLS2_CONN_POLARITY_BI = 1 } IpatchDLS2ConnPolarityType; /* masks for IpatchDLS2Conn->trans field */ typedef enum { IPATCH_DLS2_CONN_MASK_OUTPUT_TRANS = 0x000F, /* Output transform mask */ IPATCH_DLS2_CONN_MASK_CTRLSRC_TRANS = 0x00F0, /* Control transform mask */ IPATCH_DLS2_CONN_MASK_CTRLSRC_POLARITY = 0x0100, /* Control polarity mask */ IPATCH_DLS2_CONN_MASK_CTRLSRC_INVERT = 0x0200, /* Control invert mask */ IPATCH_DLS2_CONN_MASK_SRC_TRANS = 0x3C00, /* Source transform mask */ IPATCH_DLS2_CONN_MASK_SRC_POLARITY = 0x4000, /* Source polarity mask */ IPATCH_DLS2_CONN_MASK_SRC_INVERT = 0x8000 /* Source invert mask */ } IpatchDLS2ConnTransformMasks; /* bit shifts for IpatchDLS2Conn->trans field */ typedef enum { IPATCH_DLS2_CONN_SHIFT_OUTPUT_TRANS = 0, /* Output transform shift */ IPATCH_DLS2_CONN_SHIFT_CTRLSRC_TRANS = 4, /* Control transform shift */ IPATCH_DLS2_CONN_SHIFT_CTRLSRC_POLARITY = 8, /* Control polarity shift */ IPATCH_DLS2_CONN_SHIFT_CTRLSRC_INVERT = 9, /* Control invert shift */ IPATCH_DLS2_CONN_SHIFT_SRC_TRANS = 10, /* Source transform shift */ IPATCH_DLS2_CONN_SHIFT_SRC_POLARITY = 14, /* Source polarity shift */ IPATCH_DLS2_CONN_SHIFT_SRC_INVERT = 15 /* Source invert shift */ } IpatchDLS2ConnTransformShifts; extern IpatchDLS2ConnInfo ipatch_dls2_conn_info[]; GType ipatch_dls2_conn_get_type (void); IpatchDLS2Conn *ipatch_dls2_conn_new (void); void ipatch_dls2_conn_free (IpatchDLS2Conn *conn); IpatchDLS2Conn *ipatch_dls2_conn_duplicate (const IpatchDLS2Conn *conn); void ipatch_dls2_conn_list_set (GSList **list, const IpatchDLS2Conn *conn); void ipatch_dls2_conn_list_unset (GSList **list, const IpatchDLS2Conn *conn); GSList *ipatch_dls2_conn_list_duplicate (const GSList *list); GSList *ipatch_dls2_conn_list_duplicate_fast (const GSList *list); void ipatch_dls2_conn_list_free (GSList *list, gboolean free_conns); #endif libinstpatch-1.0.0/libinstpatch/IpatchGigDimension.c0000644000175000017500000001626411461332142017460 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchGigDimension.h" #include "IpatchRange.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" #include "builtin_enums.h" enum { PROP_0, PROP_NAME, PROP_TYPE, PROP_SPLIT_COUNT }; static void ipatch_gig_dimension_class_init (IpatchGigDimensionClass *klass); static void ipatch_gig_dimension_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_gig_dimension_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_gig_dimension_init (IpatchGigDimension *gig_dimension); static void ipatch_gig_dimension_finalize (GObject *gobject); static void ipatch_gig_dimension_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static GObjectClass *parent_class = NULL; GType ipatch_gig_dimension_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchGigDimensionClass), NULL, NULL, (GClassInitFunc)ipatch_gig_dimension_class_init, NULL, NULL, sizeof (IpatchGigDimension), 0, (GInstanceInitFunc)ipatch_gig_dimension_init, }; item_type = g_type_register_static (IPATCH_TYPE_ITEM, "IpatchGigDimension", &item_info, 0); } return (item_type); } static void ipatch_gig_dimension_class_init (IpatchGigDimensionClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); parent_class = g_type_class_peek_parent (klass); obj_class->finalize = ipatch_gig_dimension_finalize; obj_class->get_property = ipatch_gig_dimension_get_property; item_class->item_set_property = ipatch_gig_dimension_set_property; item_class->copy = ipatch_gig_dimension_item_copy; /* use parent's mutex (IpatchGigRegion) */ item_class->mutex_slave = TRUE; g_object_class_override_property (obj_class, PROP_NAME, "title"); g_object_class_install_property (obj_class, PROP_NAME, g_param_spec_string ("name", _("Name"), _("Dimension name"), NULL, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_TYPE, g_param_spec_enum ("type", _("Type"), _("Dimension type"), IPATCH_TYPE_GIG_DIMENSION_TYPE, IPATCH_GIG_DIMENSION_NONE, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_TYPE, g_param_spec_int ("split-count", _("Split count"), _("Number of split bits"), 1, 5, 1, G_PARAM_READWRITE)); } static void ipatch_gig_dimension_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchGigDimension *dimension = IPATCH_GIG_DIMENSION (object); switch (property_id) { case PROP_NAME: IPATCH_ITEM_WLOCK (dimension); g_free (dimension->name); dimension->name = g_value_dup_string (value); IPATCH_ITEM_WUNLOCK (dimension); /* title property notify */ ipatch_item_prop_notify ((IpatchItem *)dimension, ipatch_item_pspec_title, value, NULL); break; case PROP_TYPE: dimension->type = g_value_get_enum (value); break; case PROP_SPLIT_COUNT: dimension->split_count = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_gig_dimension_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchGigDimension *dimension = IPATCH_GIG_DIMENSION (object); switch (property_id) { case PROP_NAME: IPATCH_ITEM_RLOCK (dimension); g_value_set_string (value, dimension->name); IPATCH_ITEM_RUNLOCK (dimension); break; case PROP_TYPE: g_value_set_enum (value, dimension->type); break; case PROP_SPLIT_COUNT: g_value_set_int (value, dimension->split_count); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_gig_dimension_init (IpatchGigDimension *dimension) { } static void ipatch_gig_dimension_finalize (GObject *gobject) { IpatchGigDimension *dimension = IPATCH_GIG_DIMENSION (gobject); IPATCH_ITEM_WLOCK (dimension); g_free (dimension->name); dimension->name = NULL; IPATCH_ITEM_WUNLOCK (dimension); if (parent_class->finalize) parent_class->finalize (gobject); } static void ipatch_gig_dimension_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchGigDimension *src_dim, *dest_dim; src_dim = IPATCH_GIG_DIMENSION (src); dest_dim = IPATCH_GIG_DIMENSION (dest); IPATCH_ITEM_RLOCK (src_dim); dest_dim->name = g_strdup (src_dim->name); dest_dim->type = src_dim->type; dest_dim->split_count = src_dim->split_count; dest_dim->split_mask = src_dim->split_mask; dest_dim->split_shift = src_dim->split_shift; IPATCH_ITEM_RUNLOCK (src_dim); } /** * ipatch_gig_dimension_new: * * Create a new GigaSampler instrument dimension. * * Returns: New GigaSampler dimension with a ref count of 1 which the caller * owns. */ IpatchGigDimension * ipatch_gig_dimension_new (void) { return (IPATCH_GIG_DIMENSION (g_object_new (IPATCH_TYPE_GIG_DIMENSION, NULL))); } /** * ipatch_gig_dimension_first: * @iter: Patch item iterator containing #IpatchGigDimension items * * Gets the first item in a dimension iterator. A convenience * wrapper for ipatch_iter_first(). * * Returns: The first dimension in @iter or %NULL if empty. */ IpatchGigDimension * ipatch_gig_dimension_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_GIG_DIMENSION (obj)); else return (NULL); } /** * ipatch_gig_dimension_next: * @iter: Patch item iterator containing #IpatchGigDimension items * * Gets the next item in a dimension iterator. A convenience wrapper * for ipatch_iter_next(). * * Returns: The next dimension in @iter or %NULL if at the end of * the list. */ IpatchGigDimension * ipatch_gig_dimension_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_GIG_DIMENSION (obj)); else return (NULL); } libinstpatch-1.0.0/libinstpatch/IpatchSF2File.c0000644000175000017500000002300311461332142016263 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchSF2File.h" #include "ipatch_priv.h" /* IpatchSF2File properties */ enum { PROP_FILE_0, PROP_FILE_SAMPLE_POS, /* position in file of sample chunk */ PROP_FILE_SAMPLE_SIZE, /* size of sample chunk */ PROP_FILE_SAMPLE24_POS /* position in file of LS bytes of 24 bit samples */ }; static void ipatch_sf2_file_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_sf2_file_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static gboolean ipatch_sf2_file_identify (IpatchFile *file, IpatchFileHandle *handle, GError **err); static gboolean ipatch_sf2_file_real_set_sample_pos (IpatchSF2File *file, guint sample_pos); static gboolean ipatch_sf2_file_real_set_sample_size (IpatchSF2File *file, guint sample_size); static gboolean ipatch_sf2_file_real_set_sample24_pos (IpatchSF2File *file, guint sample24_pos); G_DEFINE_TYPE (IpatchSF2File, ipatch_sf2_file, IPATCH_TYPE_FILE); /* SoundFont file class init function */ static void ipatch_sf2_file_class_init (IpatchSF2FileClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchFileClass *file_class = IPATCH_FILE_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); obj_class->get_property = ipatch_sf2_file_get_property; file_class->identify = ipatch_sf2_file_identify; item_class->item_set_property = ipatch_sf2_file_set_property; g_object_class_install_property (obj_class, PROP_FILE_SAMPLE_POS, g_param_spec_uint ("sample-pos", "Sample Chunk Position", "Position in file of sample data chunk", 0, 0xFFFFFFFF, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_FILE_SAMPLE_SIZE, g_param_spec_uint ("sample-size", "Sample Chunk Size", "Size of sample data chunk, in samples", 0, 0xFFFFFFFF, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_FILE_SAMPLE24_POS, g_param_spec_uint ("sample24-pos", "Sample24 Chunk Position", "Position in file of 24 bit sample chunk", 0, 0xFFFFFFFF, 0, G_PARAM_READWRITE)); } static void ipatch_sf2_file_init (IpatchSF2File *file) { } static void ipatch_sf2_file_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchSF2File *sfont_file = IPATCH_SF2_FILE (object); switch (property_id) { case PROP_FILE_SAMPLE_POS: ipatch_sf2_file_real_set_sample_pos (sfont_file, g_value_get_uint (value)); break; case PROP_FILE_SAMPLE_SIZE: ipatch_sf2_file_real_set_sample_size (sfont_file, g_value_get_uint (value)); break; case PROP_FILE_SAMPLE24_POS: ipatch_sf2_file_real_set_sample24_pos (sfont_file, g_value_get_uint (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_sf2_file_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchSF2File *sfont_file = IPATCH_SF2_FILE (object); switch (property_id) { case PROP_FILE_SAMPLE_POS: g_value_set_uint (value, ipatch_sf2_file_get_sample_pos (sfont_file)); break; case PROP_FILE_SAMPLE_SIZE: g_value_set_uint (value, ipatch_sf2_file_get_sample_size (sfont_file)); break; case PROP_FILE_SAMPLE24_POS: g_value_set_uint (value, ipatch_sf2_file_get_sample24_pos (sfont_file)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } /* SoundFont file identification method */ static gboolean ipatch_sf2_file_identify (IpatchFile *file, IpatchFileHandle *handle, GError **err) { guint32 buf[3]; char *filename; int len; if (handle) /* Test content */ { if (!ipatch_file_read (handle, buf, 12, err)) return (FALSE); if (buf[0] == IPATCH_FOURCC_RIFF && buf[2] == IPATCH_SFONT_FOURCC_SFBK) return (TRUE); } /* Test file name extension */ else if ((filename = ipatch_file_get_name (file))) /* ++ alloc file name */ { len = strlen (filename); if (len >= 4 && g_ascii_strcasecmp (filename + len - 4, ".sf2") == 0) { g_free (filename); /* -- free file name */ return (TRUE); } g_free (filename); /* -- free file name */ } return (FALSE); } /** * ipatch_sf2_file_new: * * Create a new SoundFont file object. * * Returns: New SoundFont file object (derived from IpatchFile) with a * reference count of 1. Caller owns the reference and removing it will * destroy the item. */ IpatchSF2File * ipatch_sf2_file_new (void) { return (IPATCH_SF2_FILE (g_object_new (IPATCH_TYPE_SF2_FILE, NULL))); } /** * ipatch_sf2_file_set_sample_pos: * @file: SoundFont file object to set position of sample chunk * @sample_pos: Position in the SoundFont file of the first sample of the * sample data chunk, in bytes * * Sets the position of the sample data chunk in a SoundFont file object. */ void ipatch_sf2_file_set_sample_pos (IpatchSF2File *file, guint sample_pos) { if (ipatch_sf2_file_real_set_sample_pos (file, sample_pos)) g_object_notify (G_OBJECT (file), "sample-pos"); } /* the real SoundFont file set sample chunk position routine */ static gboolean ipatch_sf2_file_real_set_sample_pos (IpatchSF2File *file, guint sample_pos) { g_return_val_if_fail (IPATCH_IS_SF2_FILE (file), FALSE); /* atomic write */ file->sample_pos = sample_pos; return (TRUE); } /** * ipatch_sf2_file_get_sample_pos: * @file: SoundFont file object to get position of sample chunk from * * Gets the position of the sample data chunk in a SoundFont file object. * * Returns: Position in the SoundFont file of the first sample of the * sample data chunk, in bytes */ guint ipatch_sf2_file_get_sample_pos (IpatchSF2File *file) { guint pos; g_return_val_if_fail (IPATCH_IS_SF2_FILE (file), 0); /* atomic read */ pos = file->sample_pos; return (pos); } /** * ipatch_sf2_file_set_sample_size: * @file: SoundFont file object to set the size of the sample chunk * @sample_size: Size of the sample data chunk, in samples * * Sets the size of the sample data chunk in a SoundFont file object. */ void ipatch_sf2_file_set_sample_size (IpatchSF2File *file, guint sample_size) { if (ipatch_sf2_file_real_set_sample_size (file, sample_size)) g_object_notify (G_OBJECT (file), "sample-size"); } /* the real SoundFont file set sample chunk size routine */ static gboolean ipatch_sf2_file_real_set_sample_size (IpatchSF2File *file, guint sample_size) { g_return_val_if_fail (IPATCH_IS_SF2_FILE (file), FALSE); /* atomic write */ file->sample_size = sample_size; return (TRUE); } /** * ipatch_sf2_file_get_sample_size: * @file: SoundFont file object to get the size of the sample chunk from * * Gets the size of the sample data chunk in a SoundFont file object. * * Returns: Size of the sample data chunk, in samples */ guint ipatch_sf2_file_get_sample_size (IpatchSF2File *file) { guint size; g_return_val_if_fail (IPATCH_IS_SF2_FILE (file), 0); /* atomic read */ size = file->sample_size; return (size); } /** * ipatch_sf2_file_set_sample24_pos: * @file: SoundFont file object to set position of sample24 chunk * @sample24_pos: Position in the SoundFont file of the first sample of the * sample 24 data chunk, in bytes * * Sets the position of the sample 24 data chunk in a SoundFont file object. * This optional chunk contains the lower significant bytes of 24 bit samples. */ void ipatch_sf2_file_set_sample24_pos (IpatchSF2File *file, guint sample24_pos) { if (ipatch_sf2_file_real_set_sample24_pos (file, sample24_pos)) g_object_notify (G_OBJECT (file), "sample24-pos"); } /* the real SoundFont file set sample24 chunk position routine */ static gboolean ipatch_sf2_file_real_set_sample24_pos (IpatchSF2File *file, guint sample24_pos) { g_return_val_if_fail (IPATCH_IS_SF2_FILE (file), FALSE); /* atomic write */ file->sample24_pos = sample24_pos; return (TRUE); } /** * ipatch_sf2_file_get_sample24_pos: * @file: SoundFont file object to get position of sample24 chunk from * * Gets the position of the sample24 data chunk in a SoundFont file object. * * Returns: Position in the SoundFont file of the first byte of the * sample24 data chunk, in bytes */ guint ipatch_sf2_file_get_sample24_pos (IpatchSF2File *file) { g_return_val_if_fail (IPATCH_IS_SF2_FILE (file), 0); /* atomic read */ return (file->sample24_pos); } libinstpatch-1.0.0/libinstpatch/marshals.h0000644000175000017500000000126611456656123015602 00000000000000/* Autogenerated file (add to marshals.list and 'make update-marshals') */ #ifndef __ipatch_marshal_MARSHAL_H__ #define __ipatch_marshal_MARSHAL_H__ #include G_BEGIN_DECLS /* ENUM:FLAGS (marshals.list:25) */ extern void ipatch_marshal_ENUM__FLAGS (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); G_END_DECLS #endif /* __ipatch_marshal_MARSHAL_H__ */ libinstpatch-1.0.0/libinstpatch/IpatchSampleStore.h0000644000175000017500000001101611461332142017335 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleStore * @short_description: Abstract sample storage object * @see_also: * @stability: Stable * * Sample stores provide for various storage methods for audio data. * Examples include: #IpatchSampleStoreFile for audio data stored in files * on disk, #IpatchSampleStoreRAM for audio in RAM, #IpatchSampleStoreROM for * samples in ROM of a sound card, etc. */ #ifndef __IPATCH_SAMPLE_STORE_H__ #define __IPATCH_SAMPLE_STORE_H__ /* forward type declarations */ typedef struct _IpatchSampleStore IpatchSampleStore; typedef struct _IpatchSampleStoreClass IpatchSampleStoreClass; #include #include #include #include #include #include #include #define IPATCH_TYPE_SAMPLE_STORE (ipatch_sample_store_get_type ()) #define IPATCH_SAMPLE_STORE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_STORE, \ IpatchSampleStore)) #define IPATCH_SAMPLE_STORE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_STORE, \ IpatchSampleStoreClass)) #define IPATCH_IS_SAMPLE_STORE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_STORE)) #define IPATCH_IS_SAMPLE_STORE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_STORE)) #define IPATCH_SAMPLE_STORE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SAMPLE_STORE, \ IpatchSampleStoreClass)) /* sample store base instance */ struct _IpatchSampleStore { IpatchItem parent_instance; guint32 size; /* size of sample data (in samples) */ guint32 rate; /* sample rate in hz */ }; /* sample store base class */ struct _IpatchSampleStoreClass { IpatchItemClass parent_class; }; /* IpatchSampleWidth | sign | endian | channels stored in flags field (9 bits) - see sample.h */ /* flags bit shift value to sample format field */ #define IPATCH_SAMPLE_STORE_FORMAT_SHIFT IPATCH_ITEM_UNUSED_FLAG_SHIFT /** * ipatch_sample_store_get_format: * * Macro for getting the sample format from a sample store. No lock is required * since format can only be set prior to the store being actively used. * * Returns: Sample format field. See #sample. */ #define ipatch_sample_store_get_format(store) \ ((ipatch_item_get_flags (store) >> IPATCH_SAMPLE_STORE_FORMAT_SHIFT) \ & IPATCH_SAMPLE_FORMAT_MASK) /** * ipatch_sample_store_get_size: * * Macro for getting the sample size in frames of a sample store. No lock is required * since size can only be set prior to the store being actively used. * * Returns: Sample store size in frames. */ #define ipatch_sample_store_get_size(store) ((store)->size) /** * ipatch_sample_store_get_rate: * * Macro for getting the sample rate from a sample store. No lock is required * since rate can only be set prior to the store being actively used. * * Returns: Sample rate in HZ. */ #define ipatch_sample_store_get_rate(store) ((store)->rate) /** * ipatch_sample_store_get_size_bytes: * * Macro for getting the sample store data size in bytes. No lock is required * since format and size can only be set prior to the store being actively used. * * Returns: Sample store size in bytes. */ #define ipatch_sample_store_get_size_bytes(store) \ (ipatch_sample_format_size (ipatch_sample_store_get_format (store)) * (store)->size) /* we reserve flags for format and 3 for expansion */ #define IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT \ (IPATCH_ITEM_UNUSED_FLAG_SHIFT + IPATCH_SAMPLE_FORMAT_BITCOUNT + 3) GType ipatch_sample_store_get_type (void); IpatchSampleStore *ipatch_sample_store_first (IpatchIter *iter); IpatchSampleStore *ipatch_sample_store_next (IpatchIter *iter); #endif libinstpatch-1.0.0/libinstpatch/IpatchGigRegion.c0000644000175000017500000005327411461332142016760 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchGigRegion.h" #include "IpatchGigFile.h" #include "IpatchGigSample.h" #include "IpatchRange.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" enum { PROP_0, PROP_TITLE, PROP_NOTE_RANGE, PROP_VELOCITY_RANGE, PROP_KEY_GROUP, PROP_LAYER_GROUP, PROP_PHASE_GROUP, PROP_CHANNEL, /* IpatchItem flags (no one needs to know that though) */ PROP_SELF_NON_EXCLUSIVE, PROP_PHASE_MASTER, PROP_MULTI_CHANNEL }; static void ipatch_gig_region_class_init (IpatchGigRegionClass *klass); static void ipatch_gig_region_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_gig_region_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_gig_region_init (IpatchGigRegion *gig_region); static void ipatch_gig_region_finalize (GObject *gobject); static void ipatch_gig_region_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static const GType *ipatch_gig_region_container_child_types (void); static gboolean ipatch_gig_region_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type); static GObjectClass *parent_class = NULL; static GType gig_region_child_types[3] = { 0 }; GType ipatch_gig_region_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchGigRegionClass), NULL, NULL, (GClassInitFunc)ipatch_gig_region_class_init, NULL, NULL, sizeof (IpatchGigRegion), 0, (GInstanceInitFunc)ipatch_gig_region_init, }; item_type = g_type_register_static (IPATCH_TYPE_CONTAINER, "IpatchGigRegion", &item_info, 0); } return (item_type); } static void ipatch_gig_region_class_init (IpatchGigRegionClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS (klass); parent_class = g_type_class_peek_parent (klass); obj_class->finalize = ipatch_gig_region_finalize; obj_class->get_property = ipatch_gig_region_get_property; item_class->item_set_property = ipatch_gig_region_set_property; item_class->copy = ipatch_gig_region_item_copy; container_class->child_types = ipatch_gig_region_container_child_types; container_class->init_iter = ipatch_gig_region_container_init_iter; container_class->make_unique = NULL; g_object_class_override_property (obj_class, PROP_TITLE, "title"); g_object_class_install_property (obj_class, PROP_NOTE_RANGE, ipatch_param_spec_range ("note-range", _("Note range"), _("MIDI note range"), 0, 127, 0, 127, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_VELOCITY_RANGE, ipatch_param_spec_range ("velocity-range", _("Velocity range"), _("MIDI velocity range"), 0, 127, 0, 127, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_KEY_GROUP, g_param_spec_int ("key-group", _("Key group"), _("Percussion key group"), 0, 15, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_LAYER_GROUP, g_param_spec_int ("layer-group", _("Layer group"), _("Layer group"), 0, G_MAXUSHORT, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_PHASE_GROUP, g_param_spec_int ("phase-group", _("Phase group"), _("Phase locked sample group"), 0, G_MAXUSHORT, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_CHANNEL, g_param_spec_int ("channel", _("Channel"), _("DLS audio channel identifier"), 0, 0x03FFFF, 0, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_SELF_NON_EXCLUSIVE, g_param_spec_boolean ("self-non-exclusive", _("Non exclusive"), _("Self non exclusive"), FALSE, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_PHASE_MASTER, g_param_spec_boolean ("phase-master", _("Phase master"), _("Multi channel phase lock master"), FALSE, G_PARAM_READWRITE)); g_object_class_install_property (obj_class, PROP_MULTI_CHANNEL, g_param_spec_boolean ("multi-channel", _("Multi channel"), _("Multi channel"), FALSE, G_PARAM_READWRITE)); gig_region_child_types[0] = IPATCH_TYPE_GIG_DIMENSION; gig_region_child_types[1] = IPATCH_TYPE_GIG_SUB_REGION; } static void ipatch_gig_region_get_title (IpatchGigRegion *region, GValue *value) { IpatchRange *range = NULL; char *s = NULL; g_object_get (region, "note-range", &range, NULL); if (range) { if (range->low != range->high) s = g_strdup_printf (_("Note %d-%d"), range->low, range->high); else s = g_strdup_printf (_("Note %d"), range->low); ipatch_range_free (range); } g_value_take_string (value, s); } static void ipatch_gig_region_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchGigRegion *region = IPATCH_GIG_REGION (object); IpatchRange *range; gboolean retval; switch (property_id) { case PROP_NOTE_RANGE: range = ipatch_value_get_range (value); if (range) ipatch_gig_region_set_note_range (region, range->low, range->high); break; case PROP_VELOCITY_RANGE: range = ipatch_value_get_range (value); if (range) { IPATCH_ITEM_WLOCK (region); region->velocity_range_low = range->low; region->velocity_range_high = range->high; IPATCH_ITEM_WUNLOCK (region); } break; case PROP_KEY_GROUP: region->key_group = g_value_get_int (value); break; case PROP_LAYER_GROUP: region->layer_group = g_value_get_int (value); break; case PROP_PHASE_GROUP: region->phase_group = g_value_get_int (value); break; case PROP_CHANNEL: region->channel = g_value_get_int (value); break; case PROP_SELF_NON_EXCLUSIVE: if (g_value_get_boolean (value)) ipatch_item_set_flags (IPATCH_ITEM (object), IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE); else ipatch_item_clear_flags (IPATCH_ITEM (object), IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE); break; case PROP_PHASE_MASTER: if (g_value_get_boolean (value)) ipatch_item_set_flags (IPATCH_ITEM (object), IPATCH_GIG_REGION_PHASE_MASTER); else ipatch_item_clear_flags (IPATCH_ITEM (object), IPATCH_GIG_REGION_PHASE_MASTER); break; case PROP_MULTI_CHANNEL: if (g_value_get_boolean (value)) ipatch_item_set_flags (IPATCH_ITEM (object), IPATCH_GIG_REGION_MULTI_CHANNEL); else ipatch_item_clear_flags (IPATCH_ITEM (object), IPATCH_GIG_REGION_MULTI_CHANNEL); break; default: IPATCH_ITEM_WLOCK (region); retval = ipatch_dls2_info_set_property (®ion->info, property_id, value); IPATCH_ITEM_WUNLOCK (region); if (!retval) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } break; } } static void ipatch_gig_region_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchGigRegion *region = IPATCH_GIG_REGION (object); IpatchRange range; gboolean bool, retval; switch (property_id) { case PROP_TITLE: ipatch_gig_region_get_title (region, value); break; case PROP_NOTE_RANGE: IPATCH_ITEM_RLOCK (region); range.low = region->note_range_low; range.high = region->note_range_high; IPATCH_ITEM_RUNLOCK (region); ipatch_value_set_range (value, &range); break; case PROP_VELOCITY_RANGE: IPATCH_ITEM_RLOCK (region); range.low = region->velocity_range_low; range.high = region->velocity_range_high; IPATCH_ITEM_RUNLOCK (region); ipatch_value_set_range (value, &range); break; case PROP_KEY_GROUP: g_value_set_int (value, region->key_group); break; case PROP_LAYER_GROUP: g_value_set_int (value, region->layer_group); break; case PROP_PHASE_GROUP: g_value_set_int (value, region->phase_group); break; case PROP_CHANNEL: g_value_set_int (value, region->channel); break; case PROP_SELF_NON_EXCLUSIVE: bool = (ipatch_item_get_flags (IPATCH_ITEM (object)) & IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE) > 0; g_value_set_boolean (value, bool); break; case PROP_PHASE_MASTER: bool = (ipatch_item_get_flags (IPATCH_ITEM (object)) & IPATCH_GIG_REGION_PHASE_MASTER) > 0; g_value_set_boolean (value, bool); break; case PROP_MULTI_CHANNEL: bool = (ipatch_item_get_flags (IPATCH_ITEM (object)) & IPATCH_GIG_REGION_MULTI_CHANNEL) > 0; g_value_set_boolean (value, bool); break; default: IPATCH_ITEM_RLOCK (region); retval = ipatch_dls2_info_get_property (region->info, property_id, value); IPATCH_ITEM_RUNLOCK (region); if (!retval) G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_gig_region_init (IpatchGigRegion *region) { int i; region->note_range_low = 0; region->note_range_high = 127; region->velocity_range_low = 0; region->velocity_range_high = 127; region->key_group = 0; region->layer_group = 0; region->phase_group = 0; region->channel = 0; region->info = NULL; region->dimension_count = 0; region->sub_region_count = 1; /* always at least 1 sub region */ region->sub_regions[0] = ipatch_gig_sub_region_new (); ipatch_item_set_parent (IPATCH_ITEM (region->sub_regions[0]), IPATCH_ITEM (region)); /* FIXME - What is this for really? */ for (i = 0; i < IPATCH_GIG_3DDP_SIZE; i++) region->chunk_3ddp[i] = 0xFF; } static void ipatch_gig_region_finalize (GObject *gobject) { IpatchGigRegion *gig_region = IPATCH_GIG_REGION (gobject); int i; IPATCH_ITEM_WLOCK (gig_region); /* delete all dimensions */ for (i = 0; i < gig_region->dimension_count; i++) { g_object_unref (gig_region->dimensions[i]); gig_region->dimensions[i] = NULL; } /* delete all sub regions */ for (i = 0; i < gig_region->sub_region_count; i++) { g_object_unref (gig_region->sub_regions[i]); gig_region->sub_regions[i] = NULL; } IPATCH_ITEM_WUNLOCK (gig_region); if (parent_class->finalize) parent_class->finalize (gobject); } static void ipatch_gig_region_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchGigRegion *src_reg, *dest_reg; IpatchGigDimension *src_dim; IpatchGigSubRegion *src_sub; IpatchItem *new_dim, *new_sub; int i; src_reg = IPATCH_GIG_REGION (src); dest_reg = IPATCH_GIG_REGION (dest); IPATCH_ITEM_RLOCK (src_reg); /* duplicate the flags */ ipatch_item_set_flags (dest_reg, ipatch_item_get_flags (src_reg) & IPATCH_GIG_REGION_FLAG_MASK); dest_reg->note_range_low = src_reg->note_range_low; dest_reg->note_range_high = src_reg->note_range_high; dest_reg->velocity_range_low = src_reg->velocity_range_low; dest_reg->velocity_range_high = src_reg->velocity_range_high; dest_reg->key_group = src_reg->key_group; dest_reg->layer_group = src_reg->layer_group; dest_reg->phase_group = src_reg->phase_group; dest_reg->channel = src_reg->channel; dest_reg->info = ipatch_dls2_info_duplicate (src_reg->info); /* copy dimensions */ for (i = 0; i < src_reg->dimension_count; i++) { src_dim = src_reg->dimensions[i]; new_dim = ipatch_item_duplicate_link_func ((IpatchItem *)src_dim, link_func, user_data); g_return_if_fail (new_dim != NULL); dest_reg->dimensions[i] = IPATCH_GIG_DIMENSION (new_dim); dest_reg->dimension_count = i + 1; /* update count in case of failure */ } /* copy sub regions */ for (i = 0; i < src_reg->sub_region_count; i++) { src_sub = src_reg->sub_regions[i]; new_sub = ipatch_item_duplicate_link_func ((IpatchItem *)src_sub, link_func, user_data); g_return_if_fail (new_sub != NULL); dest_reg->sub_regions[i] = IPATCH_GIG_SUB_REGION (new_sub); dest_reg->sub_region_count = i + 1; /* update count in case of failure */ } IPATCH_ITEM_RUNLOCK (src_reg); } static const GType * ipatch_gig_region_container_child_types (void) { return (gig_region_child_types); } /* container is locked by caller */ static gboolean ipatch_gig_region_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type) { IpatchGigRegion *region = IPATCH_GIG_REGION (container); if (g_type_is_a (type, IPATCH_TYPE_GIG_DIMENSION)) ipatch_iter_array_init (iter, (gpointer *)(region->dimensions), region->dimension_count); else if (g_type_is_a (type, IPATCH_TYPE_GIG_SUB_REGION)) ipatch_iter_array_init (iter, (gpointer *)(region->sub_regions), region->sub_region_count); else { g_critical ("Invalid child type '%s' for parent of type '%s'", g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); return (FALSE); } return (TRUE); } /** * ipatch_gig_region_new: * * Create a new GigaSampler instrument region. * * Returns: New GigaSampler region with a ref count of 1 which the caller * owns. */ IpatchGigRegion * ipatch_gig_region_new (void) { return (IPATCH_GIG_REGION (g_object_new (IPATCH_TYPE_GIG_REGION, NULL))); } /** * ipatch_gig_region_first: * @iter: Patch item iterator containing #IpatchGigRegion items * * Gets the first item in a region iterator. A convenience * wrapper for ipatch_iter_first(). * * Returns: The first region in @iter or %NULL if empty. */ IpatchGigRegion * ipatch_gig_region_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_GIG_REGION (obj)); else return (NULL); } /** * ipatch_gig_region_next: * @iter: Patch item iterator containing #IpatchGigRegion items * * Gets the next item in a region iterator. A convenience wrapper * for ipatch_iter_next(). * * Returns: The next region in @iter or %NULL if at the end of * the list. */ IpatchGigRegion * ipatch_gig_region_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_GIG_REGION (obj)); else return (NULL); } /** * ipatch_gig_region_set_note_range: * @region: Region to set note range of * @low: Low value of range (MIDI note # between 0 and 127) * @high: High value of range (MIDI note # between 0 and 127) * * Set the MIDI note range that a region is active on. */ void ipatch_gig_region_set_note_range (IpatchGigRegion *region, int low, int high) { GValue titleval = { 0 }; g_return_if_fail (IPATCH_IS_GIG_REGION (region)); g_return_if_fail (low >= 0 && low <= 127); g_return_if_fail (high >= 0 && high <= 127); if (low > high) /* swap if backwards */ { int temp = low; low = high; high = temp; } IPATCH_ITEM_WLOCK (region); region->note_range_low = low; region->note_range_high = high; IPATCH_ITEM_WUNLOCK (region); /* title property notify */ g_value_init (&titleval, G_TYPE_STRING); ipatch_gig_region_get_title (region, &titleval); ipatch_item_prop_notify ((IpatchItem *)region, ipatch_item_pspec_title, &titleval, NULL); g_value_unset (&titleval); } /** * ipatch_gig_region_set_velocity_range: * @region: Region to set velocity range of * @low: Low value of range (MIDI velocity # between 0 and 127) * @high: High value of range (MIDI velocity # between 0 and 127) * * Set the MIDI velocity range that a region is active on. */ void ipatch_gig_region_set_velocity_range (IpatchGigRegion *region, int low, int high) { g_return_if_fail (IPATCH_IS_GIG_REGION (region)); g_return_if_fail (low >= 0 && low <= 127); g_return_if_fail (high >= 0 && high <= 127); if (low > high) /* swap if backwards */ { int temp = low; low = high; high = temp; } IPATCH_ITEM_WLOCK (region); region->velocity_range_low = low; region->velocity_range_high = high; IPATCH_ITEM_WUNLOCK (region); } /** * ipatch_gig_region_new_dimension: * @region: GigaSampler region * @type: Type of dimension to add * @split_count: Split bit count * * Adds a new dimension to a GigaSampler region. The dimension is allocated * @split_count number of dimension bits which means the total number of * sub regions will be multiplied by a factor of 2 to the power of * @split_count. There can be a maximum of 32 sub regions for a total of * 5 used split bits. */ void ipatch_gig_region_new_dimension (IpatchGigRegion *region, IpatchGigDimensionType type, int split_count) { IpatchGigDimension *dimension; int new_sub_region_count; int mask, shift; int i; g_return_if_fail (IPATCH_IS_GIG_REGION (region)); g_return_if_fail (split_count > 0); IPATCH_ITEM_WLOCK (region); new_sub_region_count = region->sub_region_count * (1 << split_count); if (log_if_fail (new_sub_region_count <= 32)) { IPATCH_ITEM_WUNLOCK (region); return; } /* calculate dimension split bit shift value */ for (i = region->sub_region_count, shift = 0; !(i & 1); i >>= 1, shift++); /* calculate unshifted mask for the split bit count */ for (i = 0, mask = 0; i < split_count; i++, mask = (mask << 1) | 1); dimension = ipatch_gig_dimension_new (); dimension->type = type; dimension->split_count = split_count; dimension->split_mask = mask << shift; dimension->split_shift = shift; region->dimensions[region->dimension_count] = dimension; region->dimension_count++; ipatch_item_set_parent (IPATCH_ITEM (dimension), IPATCH_ITEM (region)); for (i = region->sub_region_count; i < new_sub_region_count; i++) { region->sub_regions[i] = ipatch_gig_sub_region_new (); ipatch_item_set_parent (IPATCH_ITEM (region->sub_regions[i]), IPATCH_ITEM (region)); } region->sub_region_count = new_sub_region_count; IPATCH_ITEM_WUNLOCK (region); } /** * ipatch_gig_region_remove_dimension: * @region: GigaSampler region * @dim_index: Index of an existing dimension to remove (0-4) * @split_index: Split index to use in the dimension to remove * * Removes a dimension from a GigaSampler region, including all related * sub regions (except those that correspond to the @split_index), and * re-organizes sub regions for new dimension map. */ void ipatch_gig_region_remove_dimension (IpatchGigRegion *region, int dim_index, int split_index) { IpatchGigSubRegion *new_regions[32] = { NULL }; int new_region_index = 0; guint max_split_index; guint8 index[5]; /* current index for each dimension */ guint8 max[5]; /* max count for each dimension (+1) */ int sub_index, bit_index; int i; g_return_if_fail (IPATCH_IS_GIG_REGION (region)); IPATCH_ITEM_WLOCK (region); if (log_if_fail (dim_index >= 0 && dim_index < region->dimension_count)) { IPATCH_ITEM_WUNLOCK (region); return; } max_split_index = 1 << region->dimensions[dim_index]->split_count; if (log_if_fail (split_index > 0 && split_index < max_split_index)) { IPATCH_ITEM_WUNLOCK (region); return; } /* initialize dimension index and max arrays */ for (i = 0; i < region->dimension_count; i++) { index[i] = 0; max[i] = 1 << region->dimensions[i]->split_count; } index[dim_index] = split_index; /* the split index to use */ /* move pointers of sub regions we want to keep to new_regions array */ while (TRUE) { /* calculate current sub region index */ sub_index = 0; bit_index = 0; for (i = 0; i < region->dimension_count; i++) { sub_index += index[i] << bit_index; bit_index += region->dimensions[i]->split_count; } /* move the sub region pointer to new region array */ new_regions[new_region_index++] = region->sub_regions[sub_index]; region->sub_regions[sub_index] = NULL; /* clear pointer */ /* increment dimension indexes in binary fashion */ i = (dim_index != 0) ? 0 : 1; /* first dimension to increment index of */ while (i < region->dimension_count) { if (++index[i] < max[i]) break; /* carry bit to next dimension? */ index[i] = 0; if (++i == dim_index) i++; /* skip remove dimension */ } if (i == region->dimension_count) break; /* are we done yet? */ } /* free unused sub regions */ for (i = 0; i < region->sub_region_count; i++) if (region->sub_regions[i]) g_object_unref (region->sub_regions[i]); /* copy saved sub region pointers back into region */ for (i = 0; i < new_region_index; i++) region->sub_regions[i] = new_regions[i]; /* shift dimensions down into the deleted slot */ for (i = dim_index; i < region->dimension_count - 1; i++) region->dimensions[i] = region->dimensions[i+1]; region->sub_region_count = new_region_index; region->dimension_count--; IPATCH_ITEM_WUNLOCK (region); } libinstpatch-1.0.0/libinstpatch/IpatchSF2PZone.h0000644000175000017500000000512611461332142016452 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2PZone * @short_description: SoundFont preset zone object * @see_also: #IpatchSF2Preset, #IpatchSF2Inst * @stability: Stable * * Preset zones are children to #IpatchSF2Preset objects and define how * offset generators (effect parameters) for their referenced #IpatchSF2Inst. */ #ifndef __IPATCH_SF2_PZONE_H__ #define __IPATCH_SF2_PZONE_H__ #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchSF2PZone IpatchSF2PZone; typedef struct _IpatchSF2PZoneClass IpatchSF2PZoneClass; #define IPATCH_TYPE_SF2_PZONE (ipatch_sf2_pzone_get_type ()) #define IPATCH_SF2_PZONE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_PZONE, \ IpatchSF2PZone)) #define IPATCH_SF2_PZONE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_PZONE, \ IpatchSF2PZoneClass)) #define IPATCH_IS_SF2_PZONE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_PZONE)) #define IPATCH_IS_SF2_PZONE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SF2_PZONE)) #define IPATCH_SF2_PZONE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SF2_PZONE, \ IpatchSF2PZoneClass)) /* SoundFont pzone item */ struct _IpatchSF2PZone { IpatchSF2Zone parent_instance; }; struct _IpatchSF2PZoneClass { IpatchSF2ZoneClass parent_class; }; GType ipatch_sf2_pzone_get_type (void); IpatchSF2PZone *ipatch_sf2_pzone_new (void); IpatchSF2PZone *ipatch_sf2_pzone_first (IpatchIter *iter); IpatchSF2PZone *ipatch_sf2_pzone_next (IpatchIter *iter); void ipatch_sf2_pzone_set_inst (IpatchSF2PZone *pzone, IpatchSF2Inst *inst); IpatchSF2Inst *ipatch_sf2_pzone_get_inst (IpatchSF2PZone *pzone); #endif libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreVirtual.h0000644000175000017500000000561011461332142020707 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleStoreVirtual * @short_description: Virtual sample storage object * @see_also: #IpatchSampleList * @stability: Stable * * A sample store that does in place sample conversions of other samples * using sample lists (#IpatchSampleList). */ #ifndef __IPATCH_SAMPLE_STORE_VIRTUAL_H__ #define __IPATCH_SAMPLE_STORE_VIRTUAL_H__ #include #include #include #include #include /* forward type declarations */ typedef struct _IpatchSampleStoreVirtual IpatchSampleStoreVirtual; typedef struct _IpatchSampleStoreVirtualClass IpatchSampleStoreVirtualClass; #define IPATCH_TYPE_SAMPLE_STORE_VIRTUAL \ (ipatch_sample_store_virtual_get_type ()) #define IPATCH_SAMPLE_STORE_VIRTUAL(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_STORE_VIRTUAL, \ IpatchSampleStoreVirtual)) #define IPATCH_SAMPLE_STORE_VIRTUAL_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_STORE_VIRTUAL, \ IpatchSampleStoreVirtualClass)) #define IPATCH_IS_SAMPLE_STORE_VIRTUAL(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_STORE_VIRTUAL)) #define IPATCH_IS_SAMPLE_STORE_VIRTUAL_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_STORE_VIRTUAL)) /* Virtual sample store instance */ struct _IpatchSampleStoreVirtual { IpatchSampleStore parent_instance; /*< private >*/ IpatchSampleList *lists[2]; /* Edit lists, one per channel (max = stereo currently) */ int access_speed; /* Cached access speed value (0 if not yet calculated) */ }; /* Virtual sample store class */ struct _IpatchSampleStoreVirtualClass { IpatchSampleStoreClass parent_class; }; GType ipatch_sample_store_virtual_get_type (void); IpatchSample *ipatch_sample_store_virtual_new (void); IpatchSampleList * ipatch_sample_store_virtual_get_list (IpatchSampleStoreVirtual *store, guint chan); void ipatch_sample_store_virtual_set_list (IpatchSampleStoreVirtual *store, guint chan, IpatchSampleList *list); #endif libinstpatch-1.0.0/libinstpatch/IpatchRiff.h0000644000175000017500000001622511461332142015774 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchRiff * @short_description: RIFF file parser/composer object * @see_also: * @stability: Stable * * A RIFF file parser/composer. Used for DLS, SoundFont and GigaSampler files. */ #ifndef __IPATCH_RIFF_H__ #define __IPATCH_RIFF_H__ #include #include typedef struct _IpatchRiff IpatchRiff; typedef struct _IpatchRiffClass IpatchRiffClass; typedef struct _IpatchRiffChunk IpatchRiffChunk; #define IPATCH_TYPE_RIFF (ipatch_riff_get_type ()) #define IPATCH_RIFF(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_RIFF, IpatchRiff)) #define IPATCH_RIFF_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_RIFF, IpatchRiffClass)) #define IPATCH_IS_RIFF(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_RIFF)) #define IPATCH_IS_RIFF_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_RIFF)) typedef enum { IPATCH_RIFF_STATUS_FAIL = 0, /* error occured */ IPATCH_RIFF_STATUS_BEGIN, /* parsing has not yet began */ IPATCH_RIFF_STATUS_FINISHED, /* no more parsing to be done */ IPATCH_RIFF_STATUS_NORMAL, /* normal status */ IPATCH_RIFF_STATUS_CHUNK_END /* end of a chunk */ } IpatchRiffStatus; typedef enum { IPATCH_RIFF_READ, IPATCH_RIFF_WRITE } IpatchRiffMode; /* RIFF object */ struct _IpatchRiff { GObject parent_instance; /* derived from GObject */ IpatchRiffStatus status; /* current status */ IpatchRiffMode mode; /* I/O mode (read/write) */ guint flags; /* some flags */ IpatchFileHandle *handle; /* file object being parsed */ GError *err; /* error information if status == IPATCH_RIFF_FAIL */ char *msg_detail; /* last generated message detail string */ GArray *chunks; /* chunk trail (IpatchRiffChunk structures) */ GList *state_stack; /* saved states (positions) */ }; /* RIFF class */ struct _IpatchRiffClass { GObjectClass parent_class; }; #define IPATCH_RIFF_NEED_SWAP(riff) IPATCH_FILE_NEED_SWAP (riff->handle->file) #define IPATCH_RIFF_BIG_ENDIAN(riff) IPATCH_FILE_BIG_ENDIAN (riff->handle->file) typedef enum { IPATCH_RIFF_CHUNK_RIFF, /* toplevel "RIFF" (or "RIFX") list chunk */ IPATCH_RIFF_CHUNK_LIST, /* a "LIST" chunk */ IPATCH_RIFF_CHUNK_SUB /* a sub chunk */ } IpatchRiffChunkType; /* structure describing a RIFF chunk */ struct _IpatchRiffChunk { IpatchRiffChunkType type; /* type of chunk */ guint32 id; /* chunk ID in integer format for easy comparison */ char idstr[4]; /* four character chunk ID string */ gint32 position; /* current position in chunk (read or write mode) */ guint32 size; /* size of chunk (read mode only) */ guint32 filepos; /* Position in file object of chunk data */ }; /* error domain for g_set_error */ #define IPATCH_RIFF_ERROR ipatch_riff_error_quark() typedef enum { IPATCH_RIFF_ERROR_NOT_RIFF, /* not a RIFF file */ IPATCH_RIFF_ERROR_UNEXPECTED_ID, /* unexpected chunk ID */ IPATCH_RIFF_ERROR_UNEXPECTED_CHUNK_END, /* unexpected LIST chunk end */ IPATCH_RIFF_ERROR_INVALID_ID, /* invalid chunk FOURCC ID */ IPATCH_RIFF_ERROR_ODD_SIZE, /* chunk size is ODD */ IPATCH_RIFF_ERROR_SIZE_EXCEEDED, /* chunk size exceeded */ /* convenience errors - not used by the riff object itself */ IPATCH_RIFF_ERROR_SIZE_MISMATCH, /* chunk size mismatch */ IPATCH_RIFF_ERROR_INVALID_DATA /* generic invalid data error */ } IpatchRiffError; /* macro to convert 4 char RIFF ids to a guint32 integer for comparisons */ #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define IPATCH_FOURCC(c1, c2, c3, c4) \ ((guint32)(c1) | ((guint32)(c2) << 8) | ((guint32)(c3) << 16) \ | ((guint32)(c4) << 24)) #elif G_BYTE_ORDER == G_BIG_ENDIAN #define IPATCH_FOURCC(c1, c2, c3, c4) \ ((guint32)(c4) | ((guint32)(c3) << 8) | ((guint32)(c2) << 16) \ | ((guint32)(c1) << 24)) #else #error Processor not big or little endian? #endif /* RIFF chunk FOURCC guint32 integers */ #define IPATCH_FOURCC_RIFF IPATCH_FOURCC ('R','I','F','F') #define IPATCH_FOURCC_RIFX IPATCH_FOURCC ('R','I','F','X') /* big endian */ #define IPATCH_FOURCC_LIST IPATCH_FOURCC ('L','I','S','T') #define IPATCH_RIFF_HEADER_SIZE 8 /* size of RIFF chunk headers (ID + size) */ #define IPATCH_RIFF_FOURCC_SIZE 4 /* RIFF FOURCC ID size */ /* chunk header + 4 character list type */ #define IPATCH_RIFF_LIST_HEADER_SIZE \ (IPATCH_RIFF_HEADER_SIZE + IPATCH_RIFF_FOURCC_SIZE) /* some RIFF WAVE file specific defines */ #define IPATCH_RIFF_WAVE_FMT_PCM 0x1 #define IPATCH_RIFF_WAVE_FMT_FLOAT 0x3 GType ipatch_riff_get_type (void); GQuark ipatch_riff_error_quark (void); IpatchRiff *ipatch_riff_new (IpatchFileHandle *handle); void ipatch_riff_set_file_handle (IpatchRiff *riff, IpatchFileHandle *handle); IpatchFileHandle *ipatch_riff_get_file_handle (IpatchRiff *riff); int ipatch_riff_get_chunk_level (IpatchRiff *riff); IpatchRiffChunk *ipatch_riff_get_chunk_array (IpatchRiff *riff, int *count); IpatchRiffChunk *ipatch_riff_get_chunk (IpatchRiff *riff, int level); guint32 ipatch_riff_get_total_size (IpatchRiff *riff); guint32 ipatch_riff_get_position (IpatchRiff *riff); void ipatch_riff_push_state (IpatchRiff *riff); gboolean ipatch_riff_pop_state (IpatchRiff *riff, GError **err); IpatchRiffChunk *ipatch_riff_start_read (IpatchRiff *riff, GError **err); IpatchRiffChunk *ipatch_riff_start_read_chunk (IpatchRiff *riff, GError **err); IpatchRiffChunk *ipatch_riff_read_chunk_verify (IpatchRiff *riff, IpatchRiffChunkType type, guint32 id, GError **err); IpatchRiffChunk *ipatch_riff_read_chunk (IpatchRiff *riff, GError **err); #define ipatch_riff_write_list_chunk(parser, id, err) \ ipatch_riff_write_chunk (parser, IPATCH_RIFF_CHUNK_LIST, id, err) #define ipatch_riff_write_sub_chunk(parser, id, err) \ ipatch_riff_write_chunk (parser, IPATCH_RIFF_CHUNK_SUB, id, err) gboolean ipatch_riff_write_chunk (IpatchRiff *riff, IpatchRiffChunkType type, guint32 id, GError **err); #define ipatch_riff_end_chunk(parser, err) \ ipatch_riff_close_chunk (parser, -1, err) gboolean ipatch_riff_close_chunk (IpatchRiff *riff, int level, GError **err); #define ipatch_riff_skip_chunk(parser, err) \ ipatch_riff_skip_chunks (parser, 1, err) gboolean ipatch_riff_skip_chunks (IpatchRiff *riff, guint count, GError **err); gboolean ipatch_riff_get_error (IpatchRiff *riff, GError **err); char *ipatch_riff_message_detail (IpatchRiff *riff, int level, const char *format, ...); #endif libinstpatch-1.0.0/libinstpatch/i18n.h0000644000175000017500000000056311456655761014555 00000000000000#ifndef __I18N_H__ #define __I18N_H__ #include #ifndef _ #if defined(ENABLE_NLS) # include # define _(x) dgettext(PACKAGE, x) # ifdef gettext_noop # define N_(String) gettext_noop (String) # else # define N_(String) (String) # endif #else # define N_(String) (String) # define _(x) (x) # define gettext(x) (x) #endif #endif #endif libinstpatch-1.0.0/libinstpatch/IpatchVirtualContainer_types.h0000644000175000017500000000766111461332142021627 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchVirtualContainer_types * @short_description: Built in virtual container types * @see_also: * @stability: Stable */ #ifndef __IPATCH_VIRTUAL_CONTAINER_TYPES_H__ #define __IPATCH_VIRTUAL_CONTAINER_TYPES_H__ #include #include /* forward type declarations */ #include #define IPATCH_TYPE_VIRTUAL_DLS2_MELODIC \ (ipatch_virtual_dls2_melodic_get_type ()) #define IPATCH_IS_VIRTUAL_DLS2_MELODIC(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_DLS2_MELODIC)) #define IPATCH_TYPE_VIRTUAL_DLS2_PERCUSSION \ (ipatch_virtual_dls2_percussion_get_type ()) #define IPATCH_IS_VIRTUAL_DLS2_PERCUSSION(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_DLS2_PERCUSSION)) #define IPATCH_TYPE_VIRTUAL_DLS2_SAMPLES \ (ipatch_virtual_dls2_samples_get_type ()) #define IPATCH_IS_VIRTUAL_DLS2_SAMPLES(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_DLS2_SAMPLES)) #define IPATCH_TYPE_VIRTUAL_GIG_MELODIC \ (ipatch_virtual_gig_melodic_get_type ()) #define IPATCH_IS_VIRTUAL_GIG_MELODIC(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_GIG_MELODIC)) #define IPATCH_TYPE_VIRTUAL_GIG_PERCUSSION \ (ipatch_virtual_gig_percussion_get_type ()) #define IPATCH_IS_VIRTUAL_GIG_PERCUSSION(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_GIG_PERCUSSION)) #define IPATCH_TYPE_VIRTUAL_GIG_SAMPLES \ (ipatch_virtual_gig_samples_get_type ()) #define IPATCH_IS_VIRTUAL_GIG_SAMPLES(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_GIG_SAMPLES)) #define IPATCH_TYPE_VIRTUAL_SF2_INST \ (ipatch_virtual_sf2_inst_get_type ()) #define IPATCH_IS_VIRTUAL_SF2_INST(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_SF2_INST)) #define IPATCH_TYPE_VIRTUAL_SF2_MELODIC \ (ipatch_virtual_sf2_melodic_get_type ()) #define IPATCH_IS_VIRTUAL_SF2_MELODIC(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_SF2_MELODIC)) #define IPATCH_TYPE_VIRTUAL_SF2_PERCUSSION \ (ipatch_virtual_sf2_percussion_get_type ()) #define IPATCH_IS_VIRTUAL_SF2_PERCUSSION(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_SF2_PERCUSSION)) #define IPATCH_TYPE_VIRTUAL_SF2_SAMPLES \ (ipatch_virtual_sf2_samples_get_type ()) #define IPATCH_IS_VIRTUAL_SF2_SAMPLES(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_SF2_SAMPLES)) #define IPATCH_TYPE_VIRTUAL_SF2_ROM \ (ipatch_virtual_sf2_rom_get_type ()) #define IPATCH_IS_VIRTUAL_SF2_ROM(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VIRTUAL_SF2_ROM)) GType ipatch_virtual_dls2_melodic_get_type (void); GType ipatch_virtual_dls2_percussion_get_type (void); GType ipatch_virtual_dls2_samples_get_type (void); GType ipatch_virtual_gig_melodic_get_type (void); GType ipatch_virtual_gig_percussion_get_type (void); GType ipatch_virtual_gig_samples_get_type (void); GType ipatch_virtual_sf2_inst_get_type (void); GType ipatch_virtual_sf2_melodic_get_type (void); GType ipatch_virtual_sf2_percussion_get_type (void); GType ipatch_virtual_sf2_samples_get_type (void); GType ipatch_virtual_sf2_rom_get_type (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2VoiceCache_Gig.c0000644000175000017500000002115411461332142020170 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchSF2VoiceCache_Gig.h" #include "IpatchSF2VoiceCache.h" #include "IpatchConverter_priv.h" #include "IpatchConverterSF2VoiceCache.h" #include "IpatchDLS2Inst.h" #include "IpatchDLS2Region.h" #include "IpatchDLS2Sample.h" #include "IpatchSF2Mod.h" #include "IpatchGig.h" #include "IpatchGigInst.h" #include "IpatchGigRegion.h" #include "IpatchGigEffects.h" #include "IpatchSample.h" // In IpatchSF2VoiceCache_DLS.c gboolean _dls2_sample_to_sf2_voice_cache_convert (IpatchConverter *converter, GError **err); void _ipatch_sf2_voice_cache_init_gig (void) { g_type_class_ref (IPATCH_TYPE_CONVERTER_GIG_INST_TO_SF2_VOICE_CACHE); g_type_class_ref (IPATCH_TYPE_CONVERTER_GIG_SAMPLE_TO_SF2_VOICE_CACHE); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_GIG_INST_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_GIG_INST, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_GIG_SAMPLE_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_GIG_SAMPLE, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); } static gboolean _gig_inst_to_sf2_voice_cache_convert (IpatchConverter *converter, GError **err) { IpatchSF2VoiceCache *cache; IpatchSF2Voice *voice; IpatchDLS2Inst *inst; IpatchGigRegion *region; IpatchDLS2Region *dls_region; IpatchGigDimension *dimension; IpatchGigSubRegion *sub_region; IpatchDLS2Sample *sample; IpatchDLS2SampleInfo *sample_info; IpatchSF2VoiceSelInfo sel_info[IPATCH_SF2_VOICE_CACHE_MAX_SEL_VALUES]; IpatchSF2VoiceSelInfo *infop; GHashTable *sel_index_hash; /* dimension type -> selection index */ int sel_count = 1; /* 1 for note selection criteria */ int dim_type; int index, sub_count; int i, i2, v; GSList *p; sel_index_hash = g_hash_table_new (NULL, NULL); cache = IPATCH_SF2_VOICE_CACHE (IPATCH_CONVERTER_OUTPUT (converter)); inst = IPATCH_DLS2_INST (IPATCH_CONVERTER_INPUT (converter)); ipatch_sf2_voice_cache_declare_item (cache, (GObject *)inst); sel_info[0].type = IPATCH_SF2_VOICE_SEL_NOTE; /* always have note selection */ infop = &sel_info[1]; IPATCH_ITEM_RLOCK (inst); /* ++ LOCK instrument */ /* determine all selection criteria types */ p = inst->regions; for (; p; p = p->next) /* loop over DLS regions */ { region = (IpatchGigRegion *)(p->data); ipatch_sf2_voice_cache_declare_item (cache, (GObject *)region); /* NOTE: Dimensions and sub regions share the same mutex as region */ IPATCH_ITEM_RLOCK (region); /* ++ LOCK region */ for (i = 0; i < region->dimension_count; i++) /* loop on dimensions */ { ipatch_sf2_voice_cache_declare_item (cache, (GObject *)(region->dimensions[i])); dim_type = region->dimensions[i]->type; /* channel region types don't entail selection criteria, but rather channel audio routing */ if (dim_type == IPATCH_GIG_DIMENSION_CHANNEL) continue; /* already added this region selection type? */ if (g_hash_table_lookup (sel_index_hash, GINT_TO_POINTER (dim_type))) continue; infop->type = -1; switch (dim_type) { case IPATCH_GIG_DIMENSION_VELOCITY: infop->type = IPATCH_SF2_VOICE_SEL_VELOCITY; break; case IPATCH_GIG_DIMENSION_AFTER_TOUCH: infop->type = IPATCH_SF2_VOICE_SEL_AFTER_TOUCH; break; case IPATCH_GIG_DIMENSION_RELEASE_TRIG: break; case IPATCH_GIG_DIMENSION_KEYBOARD: break; case IPATCH_GIG_DIMENSION_ROUND_ROBIN: break; case IPATCH_GIG_DIMENSION_RANDOM: break; default: if (dim_type < 0x80) { infop->type = IPATCH_SF2_VOICE_SEL_MIDI_CC; infop->param1 = dim_type; /* type is MIDI CC # */ } break; } /* advance if selection criteria stored */ if (infop->type != -1) { /* add to dim_type -> index hash + 1 (sel_count already + 1) */ g_hash_table_insert (sel_index_hash, GINT_TO_POINTER(dim_type), GINT_TO_POINTER (sel_count)); infop++; sel_count++; } else g_warning ("Unhandled Gig region type %d", dim_type); /* max number of selection types reached? */ if (infop == &sel_info[IPATCH_SF2_VOICE_CACHE_MAX_SEL_VALUES]) { g_warning ("Max voice selection types reached!"); break; } } /* dimension loop */ IPATCH_ITEM_RUNLOCK (region); /* -- UNLOCK region */ } /* region loop */ p = inst->regions; for (; p; p = p->next) /* loop over DLS regions */ { region = (IpatchGigRegion *)(p->data); dls_region = (IpatchDLS2Region *)region; IPATCH_ITEM_RLOCK (region); /* ++ LOCK region */ /* loop over all sub regions */ for (i = 0; i < region->sub_region_count; i++) { sub_region = region->sub_regions[i]; ipatch_sf2_voice_cache_declare_item (cache, (GObject *)sub_region); voice = ipatch_sf2_voice_cache_add_voice (cache); /* convert GigaSampler effects to SoundFont 2 generator array */ ipatch_gig_effects_to_gen_array (&sub_region->effects, &voice->gen_array); /* set note range */ ipatch_sf2_voice_cache_set_voice_range (cache, voice, 0, dls_region->note_range_low, dls_region->note_range_high); /* loop over dimension splits and set selection ranges */ for (i2 = 0; i2 < region->dimension_count; i2++) { dimension = region->dimensions[i2]; dim_type = dimension->type; /* find selection info index for gig dimension type */ index = GPOINTER_TO_INT (g_hash_table_lookup (sel_index_hash, GINT_TO_POINTER (dim_type))); if (!index) continue; /* not handled (FIXME) */ /* split index for this dimension */ v = (i & dimension->split_mask) >> dimension->split_shift; /* dimension sub region count */ sub_count = (1 << dimension->split_count); /* set range based on dimension split index */ ipatch_sf2_voice_cache_set_voice_range (cache, voice, index, 128 * v / sub_count, 128 * (v + 1) / sub_count - 1); } sample = (IpatchDLS2Sample *)(sub_region->sample); ipatch_sf2_voice_cache_declare_item (cache, (GObject *)sample); if (sub_region->sample_info) sample_info = sub_region->sample_info; else sample_info = sample->sample_info; /* FIXME - what about stereo routing? */ /* Assign sample */ ipatch_sf2_voice_set_sample_data (voice, sample->sample_data); /* copy sample parameters */ voice->rate = sample->rate; if (sample_info) { voice->loop_start = sample_info->loop_start; voice->loop_end = sample_info->loop_end; voice->root_note = sample_info->root_note; voice->fine_tune = sample_info->fine_tune; switch (sample_info->options & IPATCH_DLS2_SAMPLE_LOOP_MASK) { case IPATCH_SAMPLE_LOOP_NONE: v = IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP; break; case IPATCH_SAMPLE_LOOP_RELEASE: v = IPATCH_SF2_GEN_SAMPLE_MODE_LOOP_RELEASE; break; default: /* default to standard loop */ v = IPATCH_SF2_GEN_SAMPLE_MODE_LOOP; break; } /* set loop mode */ voice->gen_array.values[IPATCH_SF2_GEN_SAMPLE_MODES].sword = v; IPATCH_SF2_GEN_ARRAY_SET_FLAG (&voice->gen_array, IPATCH_SF2_GEN_SAMPLE_MODES); } } // sub region loop IPATCH_ITEM_RUNLOCK (region); /* -- UNLOCK region */ } // region loop IPATCH_ITEM_RUNLOCK (inst); /* -- UNLOCK instrument */ g_hash_table_destroy (sel_index_hash); return (TRUE); } /* use DLS sample converter function for Gig samples */ #define _gig_sample_to_sf2_voice_cache_convert \ _dls2_sample_to_sf2_voice_cache_convert CONVERTER_CLASS_INIT(gig_inst_to_sf2_voice_cache); CONVERTER_CLASS_INIT(gig_sample_to_sf2_voice_cache); CONVERTER_SF2_VOICE_CACHE_GET_TYPE(gig_inst_to_sf2_voice_cache, GigInstToSF2VoiceCache); CONVERTER_SF2_VOICE_CACHE_GET_TYPE(gig_sample_to_sf2_voice_cache, GigSampleToSF2VoiceCache); libinstpatch-1.0.0/libinstpatch/IpatchUnit_SF2.c0000644000175000017500000004345311461332142016475 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchUnit_SF2.h" #include "IpatchUnit.h" #include "i18n.h" static void ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_sf2_abs_pitch_to_hertz_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_hertz_to_sf2_abs_pitch_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_sf2_abs_time_to_dls_abs_time_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_dls_abs_time_to_sf2_abs_time_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_sf2_abs_time_to_seconds_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_seconds_to_sf2_abs_time_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_centibels_to_dls_gain_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_dls_gain_to_centibels_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_centibels_to_decibels_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_decibels_to_centibels_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_tenth_percent_to_percent_value (const GValue *src_val, GValue *dest_val); static void ipatch_unit_percent_to_tenth_percent_value (const GValue *src_val, GValue *dest_val); void _ipatch_unit_sf2_init (void) { IpatchUnitInfo *info; info = ipatch_unit_info_new (); info->digits = 0; info->label = NULL; info->descr = NULL; info->value_type = G_TYPE_INT; /* FIXME - SoundFont absolute pitch is the same as cents.. */ info->id = IPATCH_UNIT_TYPE_SF2_ABS_PITCH; info->name = "SF2AbsPitch"; ipatch_unit_register (info); info->id = IPATCH_UNIT_TYPE_SF2_OFS_PITCH; info->name = "SF2OfsPitch"; ipatch_unit_register (info); info->id = IPATCH_UNIT_TYPE_SF2_ABS_TIME; info->name = "SF2AbsTime"; ipatch_unit_register (info); info->id = IPATCH_UNIT_TYPE_SF2_OFS_TIME; info->name = "SF2OfsTime"; ipatch_unit_register (info); info->id = IPATCH_UNIT_TYPE_CENTIBELS; info->flags = IPATCH_UNIT_LOGARITHMIC; info->name = "Centibels"; ipatch_unit_register (info); info->flags = 0; info->id = IPATCH_UNIT_TYPE_32K_SAMPLES; info->name = "32kSamples"; ipatch_unit_register (info); info->id = IPATCH_UNIT_TYPE_TENTH_PERCENT; info->name = "TenthPercent"; ipatch_unit_register (info); ipatch_unit_info_free (info); /* done with info structure, free it */ /* SF2 absolute pitch <==> DLS absolute pitch */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_SF2_ABS_PITCH, IPATCH_UNIT_TYPE_DLS_ABS_PITCH, ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DLS_ABS_PITCH, IPATCH_UNIT_TYPE_SF2_ABS_PITCH, ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch_value); /* SF2 absolute pitch <==> Hertz */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_SF2_ABS_PITCH, IPATCH_UNIT_TYPE_HERTZ, ipatch_unit_sf2_abs_pitch_to_hertz_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_HERTZ, IPATCH_UNIT_TYPE_SF2_ABS_PITCH, ipatch_unit_hertz_to_sf2_abs_pitch_value); /* SF2 offset pitch <==> multiplier (reuse ABS time to seconds - same equation) */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_SF2_OFS_PITCH, IPATCH_UNIT_TYPE_MULTIPLIER, ipatch_unit_sf2_abs_time_to_seconds_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_MULTIPLIER, IPATCH_UNIT_TYPE_SF2_OFS_PITCH, ipatch_unit_seconds_to_sf2_abs_time_value); /* SF2 absolute time <==> DLS absolute time */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_SF2_ABS_TIME, IPATCH_UNIT_TYPE_DLS_ABS_TIME, ipatch_unit_sf2_abs_time_to_dls_abs_time_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DLS_ABS_TIME, IPATCH_UNIT_TYPE_SF2_ABS_TIME, ipatch_unit_dls_abs_time_to_sf2_abs_time_value); /* SF2 absolute time <==> Seconds */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_SF2_ABS_TIME, IPATCH_UNIT_TYPE_SECONDS, ipatch_unit_sf2_abs_time_to_seconds_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_SECONDS, IPATCH_UNIT_TYPE_SF2_ABS_TIME, ipatch_unit_seconds_to_sf2_abs_time_value); /* SF2 offset time <==> multiplier (reuse ABS time to seconds - same equation) */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_SF2_OFS_TIME, IPATCH_UNIT_TYPE_MULTIPLIER, ipatch_unit_sf2_abs_time_to_seconds_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_MULTIPLIER, IPATCH_UNIT_TYPE_SF2_OFS_TIME, ipatch_unit_seconds_to_sf2_abs_time_value); /* Centibels <==> DLS gain */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_CENTIBELS, IPATCH_UNIT_TYPE_DLS_GAIN, ipatch_unit_centibels_to_dls_gain_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DLS_GAIN, IPATCH_UNIT_TYPE_CENTIBELS, ipatch_unit_dls_gain_to_centibels_value); /* Centibels <==> Decibels */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_CENTIBELS, IPATCH_UNIT_TYPE_DECIBELS, ipatch_unit_centibels_to_decibels_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_DECIBELS, IPATCH_UNIT_TYPE_CENTIBELS, ipatch_unit_decibels_to_centibels_value); /* TenthPercent <==> Percent */ ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_TENTH_PERCENT, IPATCH_UNIT_TYPE_PERCENT, ipatch_unit_tenth_percent_to_percent_value); ipatch_unit_conversion_register (IPATCH_UNIT_TYPE_PERCENT, IPATCH_UNIT_TYPE_TENTH_PERCENT, ipatch_unit_percent_to_tenth_percent_value); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_SF2_ABS_PITCH, IPATCH_UNIT_TYPE_HERTZ); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_DLS, IPATCH_UNIT_TYPE_SF2_ABS_PITCH, IPATCH_UNIT_TYPE_DLS_ABS_PITCH); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_SF2_OFS_PITCH, IPATCH_UNIT_TYPE_MULTIPLIER); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_SF2_ABS_TIME, IPATCH_UNIT_TYPE_SECONDS); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_DLS, IPATCH_UNIT_TYPE_SF2_ABS_TIME, IPATCH_UNIT_TYPE_DLS_ABS_TIME); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_SF2_OFS_TIME, IPATCH_UNIT_TYPE_MULTIPLIER); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_CENTIBELS, IPATCH_UNIT_TYPE_DECIBELS); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_DLS, IPATCH_UNIT_TYPE_CENTIBELS, IPATCH_UNIT_TYPE_DLS_GAIN); ipatch_unit_class_register_map (IPATCH_UNIT_CLASS_USER, IPATCH_UNIT_TYPE_TENTH_PERCENT, IPATCH_UNIT_TYPE_PERCENT); } /** * ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch: * @sf2_abs_pitch: Value in SF2 absolute pitch * * Converts a value from SF2 absolute pitch to DLS absolute pitch. * * sf2_abs_pitch = 1200 * log2(f/8.176) * f = 8.176 * 2^(sf2_abs_pitch/1200) * * dls_abs_pitch = (1200 * log2(f/440) + 6900) * 65536 * f = 440 * 2^((dls_abs_pitch / 65536 - 6900) / 1200) * * Returns: Value converted to DLS absolute pitch */ int ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch (int sf2_abs_pitch) { double hz; hz = 8.176 * pow (2.0, ((double)sf2_abs_pitch) / 1200.0); return ((1200.0 * (log (hz / 440.0) / log (2.0)) + 6900.0) * 65536.0 + 0.5); /* +0.5 for rounding */ } /** * ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch: * @dls_abs_pitch: Value in DLS absolute pitch * * Converts a value from DLS absolute pitch to SF2 absolute pitch. * See ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch() * * Returns: Value converted to SF2 absolute pitch */ int ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch (int dls_abs_pitch) { double hz; hz = 440.0 * pow (2.0, (((double)dls_abs_pitch / 65536.0 - 6900.0) / 1200.0)); return (1200.0 * (log (hz / 8.176) / log (2.0)) + 0.5); /* +0.5 to round */ } /** * ipatch_unit_sf2_abs_pitch_to_hertz: * @sf2_abs_pitch: Value in SoundFont absolute pitch * * Convert SoundFont absolute pitch to frequency in Hertz. * * Returns: Value in Hertz (cycles per second) */ double ipatch_unit_sf2_abs_pitch_to_hertz (int sf2_abs_pitch) { return (8.176 * pow (2.0, ((double)sf2_abs_pitch) / 1200.0)); } /** * ipatch_unit_hertz_to_sf2_abs_pitch: * @hz: Hertz (cycles per second) value * * Convert frequency in Hertz to SoundFont absolute pitch. * * Returns: Converted value in SoundFont absolute pitch. */ int ipatch_unit_hertz_to_sf2_abs_pitch (double hz) { return (log (hz / 8.176) / log (2) * 1200 + 0.5); /* +0.5 for rounding */ } /** * ipatch_unit_sf2_ofs_pitch_to_multiplier: * @sf2_ofs_pitch: Value in SoundFont offset pitch * * Convert SoundFont offset pitch (cents) to multiplier factor. * * Returns: Multiplier factor */ double ipatch_unit_sf2_ofs_pitch_to_multiplier (int sf2_ofs_pitch) { return (pow (2.0, ((double)sf2_ofs_pitch) / 1200.0)); } /** * ipatch_unit_multiplier_to_sf2_ofs_pitch: * @multiplier: Multiplier factor * * Convert multiplier factor to SoundFont offset pitch (cents). * * Returns: Converted value in SoundFont offset pitch (cents). */ int ipatch_unit_multiplier_to_sf2_ofs_pitch (double multiplier) { return (log (multiplier) / log (2) * 1200 + 0.5); /* +0.5 for rounding */ } /** * ipatch_unit_sf2_abs_time_to_dls_abs_time: * @sf2_abs_time: Value in SF2 absolute time (timecents) * * Convert a value from SF2 absolute time to DLS absolute time. * * sf2_abs_time = 1200 * log2 (seconds) * seconds = 2^(sf2_abs_time / 1200) * * dls_abs_time = 1200 * log2 (seconds) * 65536 * seconds = 2^(dls_abs_time / (1200 * 65536)) * * Returns: Value converted to DLS absolute time. */ int ipatch_unit_sf2_abs_time_to_dls_abs_time (int sf2_abs_time) { return (sf2_abs_time * 65536); } /** * ipatch_unit_dls_abs_time_to_sf2_abs_time: * @dls_abs_time: Value in DLS absolute time * * Convert a value from DLS absolute time to SF2 absolute time. * See ipatch_unit_sf2_abs_time_to_dls_abs_time() * * Returns: Value converted to SF2 absolute time */ int ipatch_unit_dls_abs_time_to_sf2_abs_time (int dls_abs_time) { return ((dls_abs_time + 32768) / 65536); /* +32768 for rounding */ } /** * ipatch_unit_sf2_abs_time_to_seconds: * @sf2_abs_time: Value in SoundFont absolute time * * Convert a value from SoundFont absolute time (timecents) to seconds. * * Returns: Value in seconds */ double ipatch_unit_sf2_abs_time_to_seconds (int sf2_abs_time) { return (pow (2.0, (double)sf2_abs_time / 1200.0)); } /** * ipatch_unit_seconds_to_sf2_abs_time: * @sec: Value in seconds * * Convert value from seconds to SoundFont absolute time (timecents). * * Returns: Value in SoundFont absolute time */ int ipatch_unit_seconds_to_sf2_abs_time (double sec) { return (log (sec) / log (2) * 1200 + 0.5); /* +0.5 for rounding */ } /** * ipatch_unit_sf2_ofs_time_to_multiplier: * @sf2_ofs_time: Value in SoundFont offset time (timecents) * * Convert a value from SoundFont offset time (timecents) to a multiplier. * * Returns: Multiplier factor */ double ipatch_unit_sf2_ofs_time_to_multiplier (int sf2_ofs_time) { return (pow (2.0, (double)sf2_ofs_time / 1200.0)); } /** * ipatch_unit_multiplier_to_sf2_ofs_time: * @multiplier: Multiplier factor * * Convert value from a multiplier to SoundFont offset time (timecents). * * Returns: Value in SoundFont offset time (timecents) */ int ipatch_unit_multiplier_to_sf2_ofs_time (double multiplier) { return (log (multiplier) / log (2) * 1200 + 0.5); /* +0.5 for rounding */ } /** * ipatch_unit_centibels_to_dls_gain: * @centibel: Value in centibels (10th of a Decibel) * * Convert a value from centibels to DLS gain (1/655360th of a dB). * * V = target amplitude, v = original amplitude * centibel = 200 * log10 (v / V) * dls_gain = 200 * 65536 * log10 (V / v) * * Returns: Value converted to DLS gain */ int ipatch_unit_centibels_to_dls_gain (int centibel) { return (centibel * 65536); } /** * ipatch_unit_dls_gain_to_centibels: * @dls_gain: Value in DLS gain (1/655360th of a dB) * * Convert a value from DLS gain to centibels. * * Returns: Value converted to centibels. */ int ipatch_unit_dls_gain_to_centibels (int dls_gain) { return ((dls_gain + 32768) / 65536); /* +32768 for rounding */ } /** * ipatch_unit_centibels_to_decibels: * @cb: Value in Centibels (10th of a Decibel) * * Convert a value from Centibels to Decibels. * * Returns: Value in Decibels */ double ipatch_unit_centibels_to_decibels (int cb) { return ((double) cb / 10.0); } /** * ipatch_unit_decibels_to_centibels: * @db: Value in Decibels * * Convert Decibels to Centibels (10ths of a dB) * * Returns: Converted value in Centibels (10ths of a Decibel) */ int ipatch_unit_decibels_to_centibels (double db) { return (db * 10.0 + 0.5); /* +0.5 for rounding */ } /** * ipatch_unit_tenth_percent_to_percent: * @tenth_percent: Value in 10ths of a Percent (Percent * 10) * * Convert a value from 10ths of a Percent to Percent. * * Returns: Value in Percent */ double ipatch_unit_tenth_percent_to_percent (int tenth_percent) { return ((double) tenth_percent / 10.0); } /** * ipatch_unit_percent_to_tenth_percent: * @percent: Value in Percent * * Convert Percent to 10ths of a Percent (Percent * 10) * * Returns: Converted value in 10ths of a Percent */ int ipatch_unit_percent_to_tenth_percent (double percent) { return (percent * 10.0 + 0.5); /* +0.5 for rounding */ } /* ================================================= GValue conversion functions, duplicated for speed ================================================= */ static void ipatch_unit_sf2_abs_pitch_to_dls_abs_pitch_value (const GValue *src_val, GValue *dest_val) { int sf2_abs_pitch = g_value_get_int (src_val); int dls_abs_pitch; double hz; hz = 8.176 * pow (2.0, ((double)sf2_abs_pitch) / 1200.0); dls_abs_pitch = (int)((1200.0 * (log (hz / 440.0) / log (2.0)) + 6900.0) * 65536.0 + 0.5); g_value_set_int (dest_val, dls_abs_pitch); } static void ipatch_unit_dls_abs_pitch_to_sf2_abs_pitch_value (const GValue *src_val, GValue *dest_val) { int dls_abs_pitch = g_value_get_int (src_val); int sf2_abs_pitch; double hz; hz = 440.0 * pow (2.0, (((double)dls_abs_pitch / 65536.0 - 6900.0) / 1200.0)); sf2_abs_pitch = (int)(1200.0 * (log (hz / 8.176) / log (2.0)) + 0.5); g_value_set_int (dest_val, sf2_abs_pitch); } static void ipatch_unit_sf2_abs_pitch_to_hertz_value (const GValue *src_val, GValue *dest_val) { int sf2_abs_pitch = g_value_get_int (src_val); g_value_set_double (dest_val, 8.176 * pow (2.0, ((double) sf2_abs_pitch) / 1200.0)); } static void ipatch_unit_hertz_to_sf2_abs_pitch_value (const GValue *src_val, GValue *dest_val) { double hz = g_value_get_double (src_val); g_value_set_int (dest_val, log (hz / 8.176) / log (2) * 1200 + 0.5); } static void ipatch_unit_sf2_abs_time_to_dls_abs_time_value (const GValue *src_val, GValue *dest_val) { int sf2_abs_time = g_value_get_int (src_val); g_value_set_int (dest_val, sf2_abs_time * 65536); } static void ipatch_unit_dls_abs_time_to_sf2_abs_time_value (const GValue *src_val, GValue *dest_val) { int dls_abs_time = g_value_get_int (src_val); g_value_set_int (dest_val, (dls_abs_time + 32768) / 65536); } static void ipatch_unit_sf2_abs_time_to_seconds_value (const GValue *src_val, GValue *dest_val) { int sf2_abs_time = g_value_get_int (src_val); g_value_set_double (dest_val, pow (2.0, (double)sf2_abs_time / 1200.0)); } static void ipatch_unit_seconds_to_sf2_abs_time_value (const GValue *src_val, GValue *dest_val) { double sec = g_value_get_double (src_val); g_value_set_int (dest_val, log (sec) / log (2) * 1200 + 0.5); } static void ipatch_unit_centibels_to_dls_gain_value (const GValue *src_val, GValue *dest_val) { int centibels = g_value_get_int (src_val); g_value_set_int (dest_val, centibels * 65536); } static void ipatch_unit_dls_gain_to_centibels_value (const GValue *src_val, GValue *dest_val) { int dls_gain = g_value_get_int (src_val); g_value_set_int (dest_val, (dls_gain + 32768) / 65536); } static void ipatch_unit_centibels_to_decibels_value (const GValue *src_val, GValue *dest_val) { int cb = g_value_get_int (src_val); g_value_set_double (dest_val, (double)cb / 10.0); } static void ipatch_unit_decibels_to_centibels_value (const GValue *src_val, GValue *dest_val) { double db = g_value_get_double (src_val); g_value_set_int (dest_val, db * 10.0 + 0.5); } static void ipatch_unit_tenth_percent_to_percent_value (const GValue *src_val, GValue *dest_val) { int tenthperc = g_value_get_int (src_val); g_value_set_double (dest_val, (double)tenthperc / 10.0); } static void ipatch_unit_percent_to_tenth_percent_value (const GValue *src_val, GValue *dest_val) { double percent = g_value_get_double (src_val); g_value_set_int (dest_val, percent * 10.0 + 0.5); } libinstpatch-1.0.0/libinstpatch/IpatchSF2GenItem.h0000644000175000017500000001102211461332142016737 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2GenItem * @short_description: SoundFont generator item interface * @see_also: #IpatchSF2Preset, #IpatchSF2Inst, #IpatchSF2PZone, #IpatchSF2IZone * @stability: Stable * * Provides an interface for items which have SoundFont generator properties. * SoundFont generators are synthesis parameters used by #IpatchSF2Preset, * #IpatchSF2Inst, #IpatchSF2PZone and #IpatchSF2IZone objects. */ #ifndef __IPATCH_SF2_GEN_ITEM_H__ #define __IPATCH_SF2_GEN_ITEM_H__ #include #include #include #include /* for generator properties (zones, instruments, and presets) */ #define IPATCH_SF2_GEN_ITEM_FIRST_PROP_ID 1 /* first gen prop */ #define IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID 80 /* first gen-set prop */ #define IPATCH_SF2_GEN_ITEM_FIRST_PROP_USER_ID 160 /* first ID usable for other properties */ /* forward type declarations */ typedef IpatchItem IpatchSF2GenItem; typedef struct _IpatchSF2GenItemIface IpatchSF2GenItemIface; #define IPATCH_TYPE_SF2_GEN_ITEM (ipatch_sf2_gen_item_get_type ()) #define IPATCH_SF2_GEN_ITEM(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SF2_GEN_ITEM, \ IpatchSF2GenItem)) #define IPATCH_SF2_GEN_ITEM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SF2_GEN_ITEM, \ IpatchSF2GenItemIface)) #define IPATCH_IS_SF2_GEN_ITEM(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SF2_GEN_ITEM)) #define IPATCH_SF2_GEN_ITEM_GET_IFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), IPATCH_TYPE_SF2_GEN_ITEM, \ IpatchSF2GenItemIface)) /* generator item interface */ struct _IpatchSF2GenItemIface { GTypeInterface parent_iface; /*< public >*/ IpatchSF2GenPropsType propstype; /* gen properties type for this class */ guint genarray_ofs; /* offset in item instance to generator array pointer */ GParamSpec *specs[IPATCH_SF2_GEN_COUNT]; /* genid -> prop pspec array */ GParamSpec *setspecs[IPATCH_SF2_GEN_COUNT]; /* genid -> "-set" prop pspec array */ }; GType ipatch_sf2_gen_item_get_type (void); gboolean ipatch_sf2_gen_item_get_amount (IpatchSF2GenItem *item, guint genid, IpatchSF2GenAmount *out_amt); void ipatch_sf2_gen_item_set_amount (IpatchSF2GenItem *item, guint genid, IpatchSF2GenAmount *amt); void ipatch_sf2_gen_item_set_gen_flag (IpatchSF2GenItem *item, guint genid, gboolean setflag); guint ipatch_sf2_gen_item_count_set (IpatchSF2GenItem *item); void ipatch_sf2_gen_item_copy_all (IpatchSF2GenItem *item, IpatchSF2GenArray *array); void ipatch_sf2_gen_item_copy_set (IpatchSF2GenItem *item, IpatchSF2GenArray *array); void ipatch_sf2_gen_item_set_note_range (IpatchSF2GenItem *item, int low, int high); void ipatch_sf2_gen_item_set_velocity_range (IpatchSF2GenItem *item, int low, int high); gboolean ipatch_sf2_gen_item_in_range (IpatchSF2GenItem *item, int note, int velocity); gboolean ipatch_sf2_gen_item_intersect_test (IpatchSF2GenItem *item, const IpatchSF2GenArray *genarray); GParamSpec *ipatch_sf2_gen_item_class_get_pspec (GObjectClass *klass, guint genid); GParamSpec *ipatch_sf2_gen_item_class_get_pspec_set (GObjectClass *klass, guint genid); void ipatch_sf2_gen_item_iface_install_properties (GObjectClass *klass, IpatchSF2GenPropsType propstype, GParamSpec ***specs, GParamSpec ***setspecs); gboolean ipatch_sf2_gen_item_iface_set_property (IpatchSF2GenItem *item, guint property_id, const GValue *value); gboolean ipatch_sf2_gen_item_iface_get_property (IpatchSF2GenItem *item, guint property_id, GValue *value); #endif libinstpatch-1.0.0/libinstpatch/IpatchSampleList.h0000644000175000017500000000736411461332142017167 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleList * @short_description: Sample list data types and functions * @see_also: * @stability: Stable * * Sample lists define audio data from concatenated segments of other * audio sources. The lists are always mono (a single channel can be * selected from multi-channel sources). Multi-channel audio can be * created from combining multiple sample lists of the same length. */ #ifndef __IPATCH_SAMPLE_LIST_H__ #define __IPATCH_SAMPLE_LIST_H__ #include #include typedef struct _IpatchSampleList IpatchSampleList; typedef struct _IpatchSampleListItem IpatchSampleListItem; #include /* Boxed type for sample list */ #define IPATCH_TYPE_SAMPLE_LIST (ipatch_sample_list_get_type ()) /** * IpatchSampleList: * * A sample edit list. Allows for non-destructive sample editing by defining * new audio samples from one or more audio sample segments. */ struct _IpatchSampleList { GList *items; /* list of IpatchSampleListItem structs */ guint total_size; /* total size of audio data in frames */ }; /** * IpatchSampleListItem: * * Defines an audio segment in a #IpatchSampleList. */ struct _IpatchSampleListItem { IpatchSample *sample; /* Sample for this segment */ guint ofs; /* Offset in sample of segment start */ guint size; /* Size in frames of audio segment */ guint32 channel : 3; /* Channel to use in sample */ guint32 reserved : 29; }; GType ipatch_sample_list_get_type (void); IpatchSampleList *ipatch_sample_list_new (void); void ipatch_sample_list_free (IpatchSampleList *list); IpatchSampleList *ipatch_sample_list_duplicate (IpatchSampleList *list); IpatchSampleListItem *ipatch_sample_list_item_new (void); IpatchSampleListItem *ipatch_sample_list_item_new_init (IpatchSample *sample, guint ofs, guint size, guint channel); void ipatch_sample_list_item_free (IpatchSampleListItem *item); IpatchSampleListItem *ipatch_sample_list_item_duplicate (IpatchSampleListItem *item); void ipatch_sample_list_append (IpatchSampleList *list, IpatchSample *sample, guint ofs, guint size, guint channel); void ipatch_sample_list_prepend (IpatchSampleList *list, IpatchSample *sample, guint ofs, guint size, guint channel); void ipatch_sample_list_insert_index (IpatchSampleList *list, guint index, IpatchSample *sample, guint ofs, guint size, guint channel); void ipatch_sample_list_insert (IpatchSampleList *list, guint pos, IpatchSample *sample, guint ofs, guint size, guint channel); void ipatch_sample_list_cut (IpatchSampleList *list, guint pos, guint size); gboolean ipatch_sample_list_render (IpatchSampleList *list, gpointer buf, guint pos, guint size, int format, GError **err); #endif libinstpatch-1.0.0/libinstpatch/IpatchRiff.c0000644000175000017500000007235311461332142015773 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchRiff.h" #include "ipatch_priv.h" #include "i18n.h" static void ipatch_riff_finalize (GObject *obj); static void ipatch_riff_update_positions (IpatchRiff *riff); static gboolean verify_chunk_idstr (char idstr[4]); G_DEFINE_TYPE (IpatchRiff, ipatch_riff, G_TYPE_OBJECT); static void ipatch_riff_class_init (IpatchRiffClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); obj_class->finalize = ipatch_riff_finalize; } static void ipatch_riff_init (IpatchRiff *riff) { riff->status = IPATCH_RIFF_STATUS_BEGIN; riff->mode = IPATCH_RIFF_READ; riff->flags = 0; riff->handle = NULL; riff->chunks = g_array_new (FALSE, FALSE, sizeof (IpatchRiffChunk)); riff->state_stack = NULL; } static void ipatch_riff_finalize (GObject *obj) { IpatchRiff *riff = IPATCH_RIFF (obj); GList *p; if (riff->handle) ipatch_file_close (riff->handle); /* -- unref file object */ g_array_free (riff->chunks, TRUE); for (p = riff->state_stack; p; p = g_list_next (p)) g_array_free ((GArray *)(p->data), TRUE); if (G_OBJECT_CLASS (ipatch_riff_parent_class)->finalize) G_OBJECT_CLASS (ipatch_riff_parent_class)->finalize (obj); } GQuark ipatch_riff_error_quark (void) { static GQuark q = 0; if (q == 0) q = g_quark_from_static_string ("riff-error-quark"); return (q); } /** * ipatch_riff_new: * @handle: File object handle to parse or %NULL to set later, the handle will be * taken over by the riff object and closed when finalized. * * Create a new RIFF file riff/composer object * * Returns: The RIFF object */ IpatchRiff * ipatch_riff_new (IpatchFileHandle *handle) { IpatchRiff *riff; g_return_val_if_fail (!handle || IPATCH_IS_FILE_HANDLE (handle), NULL); riff = g_object_new (IPATCH_TYPE_RIFF, NULL); if (handle) ipatch_riff_set_file_handle (riff, handle); return (riff); } /** * ipatch_riff_set_file_handle: * @riff: RIFF object * @handle: File object handle to assign * * Set the file object handle of a RIFF object. The handle is taken over * by the riff object and will be closed when finalized. */ void ipatch_riff_set_file_handle (IpatchRiff *riff, IpatchFileHandle *handle) { g_return_if_fail (IPATCH_IS_RIFF (riff)); g_return_if_fail (IPATCH_IS_FILE_HANDLE (handle)); g_array_set_size (riff->chunks, 0); /* reset chunk state */ /* Close old handle, if any */ if (riff->handle) ipatch_file_close (handle); riff->handle = handle; } /** * ipatch_riff_get_file: * @riff: RIFF object * * Get the file handle from a RIFF object. * * Returns: The file handle or %NULL if not assigned. */ IpatchFileHandle * ipatch_riff_get_file_handle (IpatchRiff *riff) { g_return_val_if_fail (IPATCH_IS_RIFF (riff), NULL); return (riff->handle); } /** * ipatch_riff_get_chunk_level: * @riff: RIFF object * * Gets the current chunk level count (number of embedded chunks) currently * being processed in a RIFF file. * * Returns: Chunk level count (0 = no open chunks) */ int ipatch_riff_get_chunk_level (IpatchRiff *riff) { g_return_val_if_fail (IPATCH_IS_RIFF (riff), 0); return (riff->chunks->len); } /** * ipatch_riff_get_chunk_array: * @riff: RIFF object * @count: Location to store the number of elements in the returned array * * Gets the array of open chunk info structures. * * Returns: Array of #IpatchRiffChunk structures or %NULL if no chunks * being processed (processing hasn't started). The returned array is * internal and should not be modified or freed. Also note that the * array is valid only while the chunk state is unchanged (riff object or file * operations). The number of elements in the array is stored in @count. */ IpatchRiffChunk * ipatch_riff_get_chunk_array (IpatchRiff *riff, int *count) { if (count) *count = 0; /* in case of error */ g_return_val_if_fail (IPATCH_IS_RIFF (riff), NULL); /* Update the chunk positions */ ipatch_riff_update_positions (riff); if (count) *count = riff->chunks->len; if (riff->chunks->len > 0) return (&g_array_index (riff->chunks, IpatchRiffChunk, 0)); else return (NULL); } /** * ipatch_riff_get_chunk: * @riff: RIFF object * @level: Level of chunk to get (-1 for current chunk) * * Get the chunk at the specified @level from a RIFF @riff chunk state * array. * * Returns: Pointer to the chunk or %NULL if invalid level. The returned * chunk is internal and should not be modified or freed. Also note that the * chunk is valid only while the chunk state is unchanged (riff object or file * operations). */ IpatchRiffChunk * ipatch_riff_get_chunk (IpatchRiff *riff, int level) { g_return_val_if_fail (IPATCH_IS_RIFF (riff), NULL); g_return_val_if_fail (riff->chunks->len > 0, NULL); /* Update the chunk positions */ ipatch_riff_update_positions (riff); if (level == -1) level = riff->chunks->len - 1; g_return_val_if_fail (level >= -1 && level < riff->chunks->len, NULL); return (&g_array_index (riff->chunks, IpatchRiffChunk, level)); } /** * ipatch_riff_get_total_size: * @riff: RIFF object * * Get total size of toplevel chunk. This is a convenience function * that just adds the size of the toplevel chunk and its header, the * actual file object size is not checked. * * Returns: Size of toplevel chunk + header size, in bytes. Actual file size * is not checked. */ guint32 ipatch_riff_get_total_size (IpatchRiff *riff) { IpatchRiffChunk *chunk; g_return_val_if_fail (IPATCH_IS_RIFF (riff), 0); /* Update the chunk positions */ ipatch_riff_update_positions (riff); if (riff->chunks->len == 0) return (0); chunk = &g_array_index (riff->chunks, IpatchRiffChunk, 0); return (chunk->size + IPATCH_RIFF_HEADER_SIZE); } /** * ipatch_riff_get_position: * @riff: RIFF object * * Get current position in the toplevel RIFF chunk (including header, * i.e., the file position). * * Returns: The current offset, in bytes, into the toplevel RIFF chunk * (including header). */ guint32 ipatch_riff_get_position (IpatchRiff *riff) { IpatchRiffChunk *chunk; g_return_val_if_fail (IPATCH_IS_RIFF (riff), 0); /* Update the chunk positions */ ipatch_riff_update_positions (riff); if (riff->chunks->len == 0) return (0); chunk = &g_array_index (riff->chunks, IpatchRiffChunk, 0); return (chunk->position + IPATCH_RIFF_HEADER_SIZE); } /** * ipatch_riff_push_state: * @riff: RIFF object * * Pushes the current file position and chunk state onto the state stack. * This state can be later restored to return to the same position in a RIFF * file. */ void ipatch_riff_push_state (IpatchRiff *riff) { GArray *dup_array; g_return_if_fail (IPATCH_IS_RIFF (riff)); /* Update the chunk positions */ ipatch_riff_update_positions (riff); dup_array = g_array_new (FALSE, FALSE, sizeof (IpatchRiffChunk)); if (riff->chunks->len > 0) g_array_append_vals (dup_array, riff->chunks->data, riff->chunks->len); riff->state_stack = g_list_prepend (riff->state_stack, dup_array); } /** * ipatch_riff_pop_state: * @riff: RIFF object * @err: Location to store error info or %NULL * * Pops the most recent state pushed onto the state stack. This causes the * position in the RIFF file stored by the state to be restored. * * Returns: %TRUE on success, %FALSE otherwise which is fatal */ gboolean ipatch_riff_pop_state (IpatchRiff *riff, GError **err) { IpatchRiffChunk *chunk; gboolean retval; guint pos; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (riff->state_stack != NULL, FALSE); g_array_free (riff->chunks, TRUE); riff->chunks = riff->state_stack->data; riff->state_stack = g_list_delete_link (riff->state_stack, riff->state_stack); /* We want the current chunk state position, not the current file position * which we would get from ipatch_riff_get_position() */ if (riff->chunks->len > 0) { chunk = &g_array_index (riff->chunks, IpatchRiffChunk, 0); pos = chunk->position + IPATCH_RIFF_HEADER_SIZE; } else pos = 0; retval = ipatch_file_seek (riff->handle, pos, G_SEEK_SET, err); return (retval); } /* initializes riff object to default state */ static void ipatch_riff_reset (IpatchRiff *riff) { riff->status = IPATCH_RIFF_STATUS_BEGIN; riff->mode = IPATCH_RIFF_READ; riff->flags = 0; g_array_set_size (riff->chunks, 0); } /** * ipatch_riff_start_read: * @riff: RIFF object * @err: Location to store error info or %NULL * * Start parsing the @riff file object as if it were at the * beginning of a RIFF file. Clears any current chunk state, * loads a chunk and ensures that it has the "RIFF" or "RIFX" ID. If this call * is sucessful there will be one chunk on the chunk stack with the * secondary ID of the RIFF chunk. If it is desirable to process a * chunk that is not the beginning of a RIFF file, * ipatch_riff_start_read_chunk() can be used. This function will also * automatically enable byte order swapping if needed. * * Returns: Pointer to the opened RIFF chunk or %NULL on error. The returned * chunk is internal and should not be modified or freed. Also note that the * chunk is valid only while the chunk state is unchanged (riff object or file * operations). */ IpatchRiffChunk * ipatch_riff_start_read (IpatchRiff *riff, GError **err) { IpatchRiffChunk *chunk; g_return_val_if_fail (IPATCH_IS_RIFF (riff), NULL); g_return_val_if_fail (riff->status != IPATCH_RIFF_STATUS_FAIL, NULL); g_return_val_if_fail (!err || !*err, NULL); ipatch_riff_reset (riff); riff->mode = IPATCH_RIFF_READ; if (!(chunk = ipatch_riff_read_chunk (riff, err))) return (NULL); if (chunk->type != IPATCH_RIFF_CHUNK_RIFF) { g_array_set_size (riff->chunks, 0); /* clear non "RIFF" chunk */ riff->status = IPATCH_RIFF_STATUS_FAIL; g_set_error (&riff->err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_NOT_RIFF, _("Not a RIFF file")); if (err) *err = g_error_copy (riff->err); return (NULL); } return (chunk); } /** * ipatch_riff_start_read_chunk: * @riff: RIFF object * @err: Location to store error info or %NULL * * Start parsing the @riff file object at an arbitrary chunk. * Clears any current chunk state and loads a chunk. If this * call is sucessful there will be one chunk on the chunk stack. If it * is desirable to start processing from the beginning of a RIFF file * ipatch_riff_start_read() should be used instead. An end of file * condition is considered an error. Note that it is up to the caller to * ensure byte order swapping is enabled, if needed. * * Returns: Pointer to the opened RIFF chunk or %NULL on error. The returned * chunk is internal and should not be modified or freed. Also note that the * chunk is valid only while the chunk state is unchanged (riff object or file * operations). */ IpatchRiffChunk * ipatch_riff_start_read_chunk (IpatchRiff *riff, GError **err) { IpatchRiffChunk *chunk; g_return_val_if_fail (IPATCH_IS_RIFF (riff), NULL); g_return_val_if_fail (riff->status != IPATCH_RIFF_STATUS_FAIL, NULL); g_return_val_if_fail (!err || !*err, NULL); ipatch_riff_reset (riff); riff->mode = IPATCH_RIFF_READ; chunk = ipatch_riff_read_chunk (riff, err); return (chunk); } /** * ipatch_riff_read_chunk: * @riff: RIFF object * @err: Location to store error info or %NULL * * Parse next RIFF chunk header. The ipatch_riff_close_chunk() * function should be called at the end of parsing a chunk, otherwise this * function will return NULL if the current chunk has ended. When * the first RIFF chunk is read the IPATCH_RIFF_FLAG_BIG_ENDIAN flag * is cleared or set depending on if its RIFF or RIFX respectively, * endian swapping is also enabled if the file uses non-native endian * format to the host. * * Returns: Pointer to new opened chunk or %NULL if current chunk has ended * or on error. Returned chunk pointer is internal and should not be modified * or freed. Also note that the chunk is valid only while the chunk state is * unchanged (riff object or file operations). */ IpatchRiffChunk * ipatch_riff_read_chunk (IpatchRiff *riff, GError **err) { IpatchRiffChunk *chunk; IpatchRiffChunk newchunk; guint32 buf[IPATCH_RIFF_HEADER_SIZE / 4]; guint size; guint32 id; int i, c; g_return_val_if_fail (IPATCH_IS_RIFF (riff), NULL); g_return_val_if_fail (riff->status != IPATCH_RIFF_STATUS_FAIL, NULL); g_return_val_if_fail (riff->mode == IPATCH_RIFF_READ, NULL); g_return_val_if_fail (riff->handle != NULL, NULL); g_return_val_if_fail (!err || !*err, NULL); /* return finished if we already finished */ if (riff->status == IPATCH_RIFF_STATUS_FINISHED || riff->status == IPATCH_RIFF_STATUS_CHUNK_END) return (NULL); if (riff->chunks->len > 0) { /* Update the chunk positions */ ipatch_riff_update_positions (riff); chunk = &g_array_index (riff->chunks, IpatchRiffChunk, riff->chunks->len - 1); /* current chunk is sub chunk, or pos past end? */ if (chunk->type == IPATCH_RIFF_CHUNK_SUB || chunk->position >= chunk->size) { riff->status = IPATCH_RIFF_STATUS_CHUNK_END; return (NULL); } } /* read FOURCC ID and chunk size */ if (!ipatch_file_read (riff->handle, buf, IPATCH_RIFF_HEADER_SIZE, &riff->err)) { riff->status = IPATCH_RIFF_STATUS_FAIL; if (err) *err = g_error_copy (riff->err); return (NULL); } id = buf[0]; /* unexpected "RIFF" chunk? */ if (id == IPATCH_FOURCC_RIFF && riff->chunks->len > 0) { riff->status = IPATCH_RIFF_STATUS_FAIL; g_set_error (&riff->err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_UNEXPECTED_ID, _("Unexpected 'RIFF' chunk")); if (err) *err = g_error_copy (riff->err); return (NULL); } /* Position of chunk data (or LIST secondary chunk ID) */ newchunk.filepos = ipatch_file_get_position (riff->handle); /* is a list chunk (LIST or RIFF)? */ if (id == IPATCH_FOURCC_LIST || id == IPATCH_FOURCC_RIFF || id == IPATCH_FOURCC_RIFX) { if (id == IPATCH_FOURCC_LIST) newchunk.type = IPATCH_RIFF_CHUNK_LIST; else if (id == IPATCH_FOURCC_RIFF) { newchunk.type = IPATCH_RIFF_CHUNK_RIFF; ipatch_file_set_little_endian (riff->handle->file); } else /* RIFX big endian chunk? */ { newchunk.type = IPATCH_RIFF_CHUNK_RIFF; ipatch_file_set_big_endian (riff->handle->file); } /* read secondary chunk ID over old ID */ if (!ipatch_file_read (riff->handle, &buf, IPATCH_RIFF_FOURCC_SIZE, &riff->err)) { riff->status = IPATCH_RIFF_STATUS_FAIL; if (err) *err = g_error_copy (riff->err); return (NULL); } newchunk.position = 4; } else /* sub chunk */ { newchunk.type = IPATCH_RIFF_CHUNK_SUB; newchunk.position = 0; } newchunk.id = buf[0]; memcpy (&newchunk.idstr, &newchunk.id, 4); if (!verify_chunk_idstr (newchunk.idstr)) { riff->status = IPATCH_RIFF_STATUS_FAIL; g_set_error (&riff->err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_INVALID_ID, _("Invalid RIFF chunk id")); if (err) *err = g_error_copy (riff->err); return (NULL); } newchunk.size = IPATCH_FILE_SWAP32 (riff->handle->file, buf + 1); /* list chunk size should be even (sub chunks can be odd) */ if (newchunk.type != IPATCH_RIFF_CHUNK_SUB && newchunk.size % 2) { riff->status = IPATCH_RIFF_STATUS_FAIL; g_set_error (&riff->err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_ODD_SIZE, _("Invalid RIFF LIST chunk size (odd number)")); if (err) *err = g_error_copy (riff->err); return (NULL); } size = (newchunk.size + 1) & ~1; /* round up to even if odd size */ /* Update the chunk positions */ ipatch_riff_update_positions (riff); /* make sure chunk size does not exceed its parent sizes */ c = riff->chunks->len; for (i=0; i < c; i++) { chunk = &g_array_index (riff->chunks, IpatchRiffChunk, i); if (chunk->position + size - newchunk.position > chunk->size) { riff->status = IPATCH_RIFF_STATUS_FAIL; g_set_error (&riff->err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_SIZE_EXCEEDED, _("Child chunk '%.4s' (size = %d, level = %d) exceeds" " parent chunk '%.4s' (size = %d, level = %d)"), newchunk.idstr, newchunk.size, c, chunk->idstr, chunk->size, i); if (err) *err = g_error_copy (riff->err); return (NULL); } } g_array_append_val (riff->chunks, newchunk); riff->status = IPATCH_RIFF_STATUS_NORMAL; return ((IpatchRiffChunk *)&g_array_index (riff->chunks, IpatchRiffChunk, riff->chunks->len - 1)); } /* Update all open chunk positions (called after file position changes) */ static void ipatch_riff_update_positions (IpatchRiff *riff) { IpatchRiffChunk *chunk; gint32 filepos; int size, i; size = riff->chunks->len; if (size == 0) return; filepos = ipatch_file_get_position (riff->handle); for (i = 0; i < size; i++) { chunk = &g_array_index (riff->chunks, IpatchRiffChunk, i); chunk->position = filepos - chunk->filepos; } } /** * ipatch_riff_read_chunk_verify: * @riff: RIFF object * @type: Expected chunk type * @id: Expected chunk ID * @err: Location to store error info or %NULL * * Like ipatch_riff_read_chunk() but ensures that the new chunk matches a * specific type and ID. If the chunk is not the expected chunk or no more * chunks in current list chunk, it is considered an error. * ipatch_riff_close_chunk() should be called when finished parsing the * opened chunk. * * Returns: Pointer to new opened chunk or %NULL if current chunk has ended * or on error. Returned chunk pointer is internal and should not be modified * or freed. Also note that the chunk is valid only while the chunk state is * unchanged (riff object or file operations). */ IpatchRiffChunk * ipatch_riff_read_chunk_verify (IpatchRiff *riff, IpatchRiffChunkType type, guint32 id, GError **err) { IpatchRiffChunk *chunk; char *idstr; g_return_val_if_fail (IPATCH_IS_RIFF (riff), NULL); g_return_val_if_fail (riff->status != IPATCH_RIFF_STATUS_FAIL, NULL); g_return_val_if_fail (type >= IPATCH_RIFF_CHUNK_RIFF && type <= IPATCH_RIFF_CHUNK_SUB, NULL); idstr = (char *)(&id); g_return_val_if_fail (verify_chunk_idstr (idstr), NULL); g_return_val_if_fail (!err || !*err, NULL); if (!(chunk = ipatch_riff_read_chunk (riff, &riff->err))) { if (!riff->err) g_set_error (&riff->err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_UNEXPECTED_CHUNK_END, _("Unexpected end of LIST while looking for chunk '%.4s'"), idstr); if (err) *err = g_error_copy (riff->err); return (NULL); } if (chunk->type != type || chunk->id != id) { riff->status = IPATCH_RIFF_STATUS_FAIL; g_set_error (&riff->err, IPATCH_RIFF_ERROR, IPATCH_RIFF_ERROR_UNEXPECTED_ID, _("Unexpected RIFF chunk with ID '%.4s' (expected '%.4s')"), chunk->idstr, idstr); if (err) *err = g_error_copy (riff->err); return (NULL); } return (chunk); } /* verify the characters of a chunk ID string */ static gboolean verify_chunk_idstr (char idstr[4]) { int i; char c; for (i=0; i < 4; i++) /* chars of FOURCC should be alphanumeric */ { c = idstr[i]; if (!(c >= 'A' && c <= 'Z') && !(c >= 'a' && c <= 'z') && !(c >= '0' && c <= '9')) break; } if (i < 4 && c == ' ' && i > 0) /* can pad with spaces (at least 1 char) */ do { i++; } while (i < 4 && idstr[i] == ' '); return (i == 4); } /** * ipatch_riff_write_chunk: * @riff: RIFF object * @type: Chunk type (RIFF, LIST, or SUB) * @id: Chunk ID (secondary ID for RIFF and LIST chunks) * @err: Location to store error info or %NULL * * Opens a new chunk and writes a chunk header to the file object in @riff. * The size field of the chunk is set to 0 and will be filled in when the * chunk is closed (see ipatch_riff_close_chunk()). * * Returns: %TRUE on success, %FALSE otherwise. */ gboolean ipatch_riff_write_chunk (IpatchRiff *riff, IpatchRiffChunkType type, guint32 id, GError **err) { IpatchRiffChunk chunk; guint32 buf[3]; char *idstr; int size; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (riff->status != IPATCH_RIFF_STATUS_FAIL, FALSE); g_return_val_if_fail (type >= IPATCH_RIFF_CHUNK_RIFF && type <= IPATCH_RIFF_CHUNK_SUB, FALSE); idstr = (char *)(&id); g_return_val_if_fail (verify_chunk_idstr (idstr), FALSE); g_return_val_if_fail (!err || !*err, FALSE); riff->mode = IPATCH_RIFF_WRITE; buf[1] = 0; /* set chunk size to 0 (will seek back later) */ if (type == IPATCH_RIFF_CHUNK_LIST || type == IPATCH_RIFF_CHUNK_RIFF) { if (type == IPATCH_RIFF_CHUNK_LIST) buf[0] = IPATCH_FOURCC_LIST; else { buf[0] = IPATCH_RIFF_BIG_ENDIAN (riff) ? IPATCH_FOURCC_RIFX : IPATCH_FOURCC_RIFF; } buf[2] = id; /* set secondary list chunk ID */ chunk.position = chunk.size = 4; size = 12; } else { buf[0] = id; /* set sub chunk ID */ chunk.position = chunk.size = 0; size = 8; } if (!ipatch_file_write (riff->handle, buf, size, &riff->err)) { riff->status = IPATCH_RIFF_STATUS_FAIL; if (err) *err = g_error_copy (riff->err); return (FALSE); } /* Update the chunk positions */ ipatch_riff_update_positions (riff); chunk.type = type; chunk.id = id; memcpy (&chunk.idstr, &id, 4); chunk.filepos = ipatch_file_get_position (riff->handle) - chunk.position; g_array_append_val (riff->chunks, chunk); return (TRUE); } /** * ipatch_riff_close_chunk: * @riff: RIFF object * @level: Level of chunk to close (-1 for current chunk) * @err: Location to store error info or %NULL * * Closes the chunk specified by @level and all its children (if any). * * In write mode the chunk size is filled in for chunks that get closed and * therefore the file object of @riff must be seekable (anyone need * non-seekable RIFF writing?). The chunk size is padded to an even * number if necessary (by writing a NULL byte). * * Upon successful completion the file position will be where it was prior to * the call (write mode) or at the beginning of the next chunk (read mode). * There will be @level open chunks (or previous chunk count - 1 if * @level == -1). In read mode the status will be * #IPATCH_RIFF_STATUS_NORMAL if open chunks remain or * #IPATCH_RIFF_STATUS_FINISHED if toplevel chunk was closed. The status is * not modified in write mode. * * Returns: %TRUE on success, %FALSE otherwise. */ gboolean ipatch_riff_close_chunk (IpatchRiff *riff, int level, GError **err) { IpatchRiffChunk *chunk; char nul = '\0'; /* null byte to pad odd sized chunks */ gint32 offset = 0; /* current offset from original position */ gint32 seek; guint32 size; int retval = TRUE; int i; g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (riff->status != IPATCH_RIFF_STATUS_FAIL, FALSE); g_return_val_if_fail (riff->chunks->len > 0, FALSE); g_return_val_if_fail (!err || !*err, FALSE); if (level == -1) level = riff->chunks->len - 1; g_return_val_if_fail (level >= -1 && level < riff->chunks->len, FALSE); /* Update the chunk positions */ ipatch_riff_update_positions (riff); if (riff->mode == IPATCH_RIFF_READ) /* read mode? */ { chunk = &g_array_index (riff->chunks, IpatchRiffChunk, level); /* round odd chunk sizes to even */ seek = ((chunk->size + 1) & ~1) - chunk->position; /* close all chunks below and including level */ g_array_set_size (riff->chunks, level); if (seek != 0) { /* seek to the end of the specified chunk */ if (!ipatch_file_seek (riff->handle, seek, G_SEEK_CUR, &riff->err)) { riff->status = IPATCH_RIFF_STATUS_FAIL; if (err) *err = g_error_copy (riff->err); return (FALSE); } /* Update the chunk positions */ ipatch_riff_update_positions (riff); } if (level > 0) riff->status = IPATCH_RIFF_STATUS_NORMAL; else riff->status = IPATCH_RIFF_STATUS_FINISHED; return (TRUE); } else /* write mode */ { for (i = riff->chunks->len - 1; i >= level; i--) { chunk = &g_array_index (riff->chunks, IpatchRiffChunk, i); /* make sure we don't have a negative chunk size! */ if (log_if_fail (chunk->position >= 0)) goto fail; /* we don't include padding (if any) in the size */ size = chunk->position; if (chunk->position % 2) /* need pad to even chunk size? */ { int i2; if (!ipatch_file_write (riff->handle, &nul, 1, &riff->err)) goto fail; /* add pad byte to chunk positions */ for (i2 = i; i2 >= 0; i2--) g_array_index (riff->chunks, IpatchRiffChunk, i2).position++; } /* seek to the chunk size field */ seek = -chunk->position - 4 - offset; if (seek != 0) if (!ipatch_file_seek (riff->handle, seek, G_SEEK_CUR, &riff->err)) goto fail; offset += seek; /* write the chunk size */ if (!ipatch_file_write_u32 (riff->handle, size, &riff->err)) goto fail; offset += 4; } g_array_set_size (riff->chunks, level); /* close chunk(s) */ ret: /* return to the original position */ if (offset && !ipatch_file_seek (riff->handle, -offset, G_SEEK_CUR, retval ? err : NULL)) { riff->status = IPATCH_RIFF_STATUS_FAIL; retval = FALSE; } if (!retval && riff->err && err) *err = g_error_copy (riff->err); return (retval); fail: riff->status = IPATCH_RIFF_STATUS_FAIL; retval = FALSE; goto ret; } /* else - (write mode) */ } /** * ipatch_riff_skip_chunks: * @riff: RIFF object * @count: Number of chunks to skip * @err: Location to store error info or %NULL * * Skips RIFF chunks at the current chunk level (children of the current * chunk). * * Returns: %TRUE on success, %FALSE otherwise */ gboolean ipatch_riff_skip_chunks (IpatchRiff *riff, guint count, GError **err) { guint i; for (i = 0; i < count; i++) { if (!ipatch_riff_read_chunk (riff, err)) return (FALSE); if (!ipatch_riff_close_chunk (riff, -1, err)) return (FALSE); } return (TRUE); } /** * ipatch_riff_get_error: * @riff: RIFF object * @err: Location to store error info * * Gets error information from a RIFF object. * * Returns: %FALSE if status is a #IPATCH_RIFF_STATUS_FAIL condition and info * can be found in @err, %TRUE if no error has occured. */ gboolean ipatch_riff_get_error (IpatchRiff *riff, GError **err) { g_return_val_if_fail (IPATCH_IS_RIFF (riff), FALSE); g_return_val_if_fail (!err || !*err, FALSE); if (riff->status != IPATCH_RIFF_STATUS_FAIL) return (TRUE); if (err) *err = g_error_copy (riff->err); return (FALSE); } /** * ipatch_riff_message_detail: * @riff: RIFF object * @level: Chunk level to generate detail for (-1 for current chunk) * @format: Printf style format string of message to display at beginning * of riff detail * @Varargs: Arguments for @msg string * * Generates a detailed message, including current position in RIFF file * and a chunk trace back. Useful for debugging purposes. * * Returns: Detailed message string which is internal to @riff and should * not be modified or freed. Also note that this string is only valid until * the next call to this function. */ char * ipatch_riff_message_detail (IpatchRiff *riff, int level, const char *format, ...) { va_list args; IpatchRiffChunk *chunk; char *msg, *debug, *traceback = NULL, *s, *s2; int i, riffchunkpos = 0; g_return_val_if_fail (IPATCH_IS_RIFF (riff), NULL); /* Update the chunk positions */ ipatch_riff_update_positions (riff); /* level will be -1 if already -1 and no chunks */ if (level == -1) level = riff->chunks->len - 1; g_return_val_if_fail (level >= -1 && level < riff->chunks->len, NULL); va_start (args, format); msg = g_strdup_vprintf (format, args); va_end (args); if (riff->chunks->len > 0) { chunk = &g_array_index (riff->chunks, IpatchRiffChunk, 0); riffchunkpos = chunk->position; } debug = g_strdup_printf (" (ofs=%x, traceback [", riffchunkpos); if (riff->chunks->len > 0) { i = level; while (i >= 0) { chunk = &g_array_index (riff->chunks, IpatchRiffChunk, i); s = g_strdup_printf ("'%.4s' ofs=0x%X, size=%d%s", chunk->idstr, riffchunkpos - chunk->position, chunk->size, i != 0 ? " <= " : ""); if (traceback) { s2 = g_strconcat (traceback, s, NULL); g_free (s); g_free (traceback); traceback = s2; } else traceback = s; i--; } } else traceback = g_strdup (""); s = g_strconcat (msg, debug, traceback, "])", NULL); g_free (msg); g_free (debug); g_free (traceback); g_free (riff->msg_detail); riff->msg_detail = s; return (s); } libinstpatch-1.0.0/libinstpatch/IpatchSampleData.h0000644000175000017500000001076011461332142017117 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleData * @short_description: Sample data proxy object. * @see_also: #IpatchSampleStore * @stability: Stable * * An object which acts as a proxy for sample data and one or more cached * versions of the same audio but potentially differing in sample format * and/or storage media. #IpatchSampleStore is used instead of the * #IpatchSample interface, for increased performance. */ #ifndef __IPATCH_SAMPLE_DATA_H__ #define __IPATCH_SAMPLE_DATA_H__ #include #include #include /* forward type declarations */ typedef struct _IpatchSampleData IpatchSampleData; typedef struct _IpatchSampleDataClass IpatchSampleDataClass; #include #include #define IPATCH_TYPE_SAMPLE_DATA (ipatch_sample_data_get_type ()) #define IPATCH_SAMPLE_DATA(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_DATA, IpatchSampleData)) #define IPATCH_SAMPLE_DATA_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_DATA, IpatchSampleDataClass)) #define IPATCH_IS_SAMPLE_DATA(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_DATA)) #define IPATCH_IS_SAMPLE_DATA_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_DATA)) #define IPATCH_SAMPLE_DATA_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SAMPLE_DATA, IpatchSampleDataClass)) /* Sample data instance */ struct _IpatchSampleData { IpatchItem parent_instance; GSList *samples; /* list of IpatchSampleStore (1st is native sample) */ }; struct _IpatchSampleDataClass { IpatchItemClass parent_class; }; /* Reserve 3 item flags for expansion */ #define IPATCH_SAMPLE_DATA_UNUSED_FLAG_SHIFT \ (IPATCH_CONTAINER_UNUSED_FLAG_SHIFT + 3) IpatchList *ipatch_get_sample_data_list (void); GType ipatch_sample_data_get_type (void); IpatchSampleData *ipatch_sample_data_new (void); void ipatch_sample_data_add (IpatchSampleData *sampledata, IpatchSampleStore *store); void ipatch_sample_data_remove (IpatchSampleData *sampledata, IpatchSampleStore *store); void ipatch_sample_data_replace_native_sample (IpatchSampleData *sampledata, IpatchSampleStore *store); IpatchList *ipatch_sample_data_get_samples (IpatchSampleData *sampledata); guint ipatch_sample_data_get_size (IpatchSampleData *sampledata); IpatchSampleStore *ipatch_sample_data_get_native_sample (IpatchSampleData *sampledata); int ipatch_sample_data_get_native_format (IpatchSampleData *sampledata); gboolean ipatch_sample_data_open_native_sample (IpatchSampleData *sampledata, IpatchSampleHandle *handle, char mode, int format, guint32 channel_map, GError **err); IpatchSampleStore *ipatch_sample_data_get_cache_sample (IpatchSampleData *sampledata, int format, guint32 channel_map, GError **err); IpatchSampleStore *ipatch_sample_data_lookup_cache_sample (IpatchSampleData *sampledata, int format, guint32 channel_map); gboolean ipatch_sample_data_open_cache_sample (IpatchSampleData *sampledata, IpatchSampleHandle *handle, int format, guint32 channel_map, GError **err); void ipatch_sample_cache_clean (guint64 max_unused_size, guint max_unused_age); IpatchSampleData *ipatch_sample_data_get_blank (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchRange.h0000644000175000017500000000653011461332142016140 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchRange * @short_description: A boxed type which defines a number range * @see_also: * @stability: Stable * * Boxed type used for #GValue and #GParamSpec properties. Consists of a low * and a high integer value defining a range. */ #ifndef __IPATCH_RANGE_H__ #define __IPATCH_RANGE_H__ #include #include typedef struct _IpatchRange IpatchRange; typedef struct _IpatchParamSpecRange IpatchParamSpecRange; #define IPATCH_TYPE_RANGE (ipatch_range_get_type ()) #define IPATCH_VALUE_HOLDS_RANGE(value) \ (G_TYPE_CHECK_VALUE_TYPE ((value), IPATCH_TYPE_RANGE)) /* integer range structure */ struct _IpatchRange { int low; /* low endpoint of range or -1 if undefined */ int high; /* high endpoint of range or -1 if undefined */ }; /* set range value making sure that are in the correct order */ #define IPATCH_RANGE_SET_VALUES(range, val1, val2) G_STMT_START { \ if (val1 <= val2) \ { \ range.low = val1; \ range.high = val2; \ } \ else \ { \ range.low = val2; \ range.high = val1; \ } \ } G_STMT_END /* set a range value to a NULL range (an undefined value) */ #define IPATCH_RANGE_SET_NULL(range) G_STMT_START { \ range.low = range.high = -1; \ } G_STMT_END GType ipatch_range_get_type (void); IpatchRange *ipatch_range_new (int low, int high); IpatchRange *ipatch_range_copy (IpatchRange *range); void ipatch_range_free (IpatchRange *range); void ipatch_value_set_range (GValue *value, const IpatchRange *range); void ipatch_value_set_static_range (GValue *value, IpatchRange *range); IpatchRange *ipatch_value_get_range (const GValue *value); /* range parameter specification */ #define IPATCH_TYPE_PARAM_RANGE (ipatch_param_spec_range_get_type ()) #define IPATCH_IS_PARAM_SPEC_RANGE(pspec) \ (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), IPATCH_TYPE_PARAM_RANGE)) #define IPATCH_PARAM_SPEC_RANGE(pspec) \ (G_TYPE_CHECK_INSTANCE_CAST ((pspec), IPATCH_TYPE_PARAM_RANGE, \ IpatchParamSpecRange)) /* a parameter specification for the integer range type */ struct _IpatchParamSpecRange { GParamSpec parent_instance; /* derived from GParamSpec */ int min, max; /* min and max values for range endpoints */ int default_low, default_high; /* default vals for low and high endpoints */ }; GType ipatch_param_spec_range_get_type (void); GParamSpec *ipatch_param_spec_range (const char *name, const char *nick, const char *blurb, int min, int max, int default_low, int default_high, GParamFlags flags); #endif libinstpatch-1.0.0/libinstpatch/IpatchIter.h0000644000175000017500000001246711461332142016015 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchIter * @short_description: Iterator instance * @see_also: * @stability: Stable * * A boxed type (structure) used for abstracting manipulation of object lists. */ #ifndef __IPATCH_ITER_H__ #define __IPATCH_ITER_H__ #include #include typedef struct _IpatchIter IpatchIter; typedef struct _IpatchIterMethods IpatchIterMethods; /* boxed type for IpatchIter */ #define IPATCH_TYPE_ITER (ipatch_iter_get_type ()) /* list iterator structure */ struct _IpatchIter { /*< private >*/ IpatchIterMethods *methods; /* iterator methods */ gpointer data; /* method defined data */ gpointer data2; /* method defined data */ gpointer data3; /* method defined data */ gpointer data4; /* method defined data */ }; /* iterator methods */ struct _IpatchIterMethods { gpointer (*get)(IpatchIter *iter); /* get item method */ gpointer (*next)(IpatchIter *iter); /* next item method */ gpointer (*first)(IpatchIter *iter); /* first item method */ gpointer (*last)(IpatchIter *iter); /* last item method */ gpointer (*index)(IpatchIter *iter, int index); /* index item method */ void (*insert)(IpatchIter *iter, gpointer item); /* insert item method */ void (*remove)(IpatchIter *iter); /* remove current item method */ int (*count)(IpatchIter *iter); /* count items method */ }; GType ipatch_iter_get_type (void); IpatchIter *ipatch_iter_alloc (void); void ipatch_iter_free (IpatchIter *iter); IpatchIter *ipatch_iter_duplicate (IpatchIter *iter); #define ipatch_iter_get(iter) (((iter)->methods->get)(iter)) #define ipatch_iter_next(iter) (((iter)->methods->next)(iter)) #define ipatch_iter_first(iter) (((iter)->methods->first)(iter)) #define ipatch_iter_last(iter) (((iter)->methods->last)(iter)) #define ipatch_iter_index(iter, pos) (((iter)->methods->index)(iter, pos)) #define ipatch_iter_insert(iter, item) (((iter)->methods->insert)(iter, item)) #define ipatch_iter_remove(iter) (((iter)->methods->remove)(iter)) #define ipatch_iter_count(iter) (((iter)->methods->count)(iter)) #define IPATCH_ITER_GSLIST_GET_LIST(iter) ((GSList **)(iter->data)) #define IPATCH_ITER_GSLIST_GET_POS(iter) ((GSList *)(iter->data2)) #define IPATCH_ITER_GSLIST_SET_LIST(iter, list) (iter->data = list) #define IPATCH_ITER_GSLIST_SET_POS(iter, pos) (iter->data2 = pos) void ipatch_iter_GSList_init (IpatchIter *iter, GSList **list); gpointer ipatch_iter_GSList_get (IpatchIter *iter); gpointer ipatch_iter_GSList_next (IpatchIter *iter); gpointer ipatch_iter_GSList_first (IpatchIter *iter); gpointer ipatch_iter_GSList_last (IpatchIter *iter); gpointer ipatch_iter_GSList_index (IpatchIter *iter, int index); void ipatch_iter_GSList_insert (IpatchIter *iter, gpointer item); void ipatch_iter_GSList_remove (IpatchIter *iter); int ipatch_iter_GSList_count (IpatchIter *iter); #define IPATCH_ITER_GLIST_GET_LIST(iter) ((GList **)(iter->data)) #define IPATCH_ITER_GLIST_GET_POS(iter) ((GList *)(iter->data2)) #define IPATCH_ITER_GLIST_SET_LIST(iter, list) (iter->data = list) #define IPATCH_ITER_GLIST_SET_POS(iter, pos) (iter->data2 = pos) void ipatch_iter_GList_init (IpatchIter *iter, GList **list); gpointer ipatch_iter_GList_get (IpatchIter *iter); gpointer ipatch_iter_GList_next (IpatchIter *iter); gpointer ipatch_iter_GList_first (IpatchIter *iter); gpointer ipatch_iter_GList_last (IpatchIter *iter); gpointer ipatch_iter_GList_index (IpatchIter *iter, int index); void ipatch_iter_GList_insert (IpatchIter *iter, gpointer item); void ipatch_iter_GList_remove (IpatchIter *iter); int ipatch_iter_GList_count (IpatchIter *iter); #define IPATCH_ITER_ARRAY_GET_ARRAY(iter) ((gpointer *)(iter->data)) #define IPATCH_ITER_ARRAY_GET_SIZE(iter) (GPOINTER_TO_UINT (iter->data2)) #define IPATCH_ITER_ARRAY_GET_POS(iter) (GPOINTER_TO_INT (iter->data3)) #define IPATCH_ITER_ARRAY_SET_ARRAY(iter, array) (iter->data = array) #define IPATCH_ITER_ARRAY_SET_SIZE(iter, size) \ (iter->data2 = GUINT_TO_POINTER (size)) #define IPATCH_ITER_ARRAY_SET_POS(iter, pos) \ (iter->data3 = GINT_TO_POINTER (pos)) void ipatch_iter_array_init (IpatchIter *iter, gpointer *array, guint size); gpointer ipatch_iter_array_get (IpatchIter *iter); gpointer ipatch_iter_array_next (IpatchIter *iter); gpointer ipatch_iter_array_first (IpatchIter *iter); gpointer ipatch_iter_array_last (IpatchIter *iter); gpointer ipatch_iter_array_index (IpatchIter *iter, int index); void ipatch_iter_array_insert (IpatchIter *iter, gpointer item); void ipatch_iter_array_remove (IpatchIter *iter); int ipatch_iter_array_count (IpatchIter *iter); #endif libinstpatch-1.0.0/libinstpatch/IpatchDLSReader.h0000644000175000017500000001330211461332142016644 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchDLSReader * @short_description: DLS version 2 file reader * @see_also: #IpatchDLS * @stability: Stable * * Parses a DLS file into an object tree (#IpatchDLS). */ #ifndef __IPATCH_DLS_READER_H__ #define __IPATCH_DLS_READER_H__ #include #include #include #include #include #include #include #include #include typedef struct _IpatchDLSReader IpatchDLSReader; /* private structure */ typedef struct _IpatchDLSReaderClass IpatchDLSReaderClass; #define IPATCH_TYPE_DLS_READER (ipatch_dls_reader_get_type ()) #define IPATCH_DLS_READER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_DLS_READER, \ IpatchDLSReader)) #define IPATCH_DLS_READER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_DLS_READER, \ IpatchDLSReaderClass)) #define IPATCH_IS_DLS_READER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_DLS_READER)) #define IPATCH_IS_DLS_READER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_DLS_READER)) /* error domain for DLS Reader */ #define IPATCH_DLS_READER_ERROR ipatch_dls_reader_error_quark() typedef enum { /* this error is returned if a file originally thought to be a plain DLS file turns out to be a GigaSampler file, in which case loading should be restarted in GigaSampler mode */ IPATCH_DLS_READER_ERROR_GIG } IpatchDLSReaderError; /* DLS reader object */ struct _IpatchDLSReader { IpatchRiff parent_instance; /* derived from IpatchRiff */ IpatchDLS2 *dls; /* DLS or GigaSampler object to load file into */ gboolean is_gig; /* set if dls is a GigaSampler object */ gboolean needs_fixup; /* set if regions in dls need fixup */ GHashTable *wave_hash; /* wave chunk file offset -> sample hash */ guint32 *pool_table; /* wave pool table (index -> wave chunk file offset) */ guint pool_table_size; /* size of pool table (in cue entries) */ }; /* DLS reader class */ struct _IpatchDLSReaderClass { IpatchRiffClass parent_class; }; GType ipatch_dls_reader_get_type (void); IpatchDLSReader *ipatch_dls_reader_new (IpatchFileHandle *handle); IpatchDLS2 *ipatch_dls_reader_load (IpatchDLSReader *reader, GError **err); gboolean ipatch_dls_reader_start (IpatchDLSReader *reader, GError **err); void ipatch_dls_reader_set_pool_table (IpatchDLSReader *reader, const guint32 pool_table[], guint size); gboolean ipatch_dls_reader_fixup (IpatchDLSReader *reader, GError **err); gboolean ipatch_dls_reader_load_level_0 (IpatchDLSReader *reader, GError **err); gboolean ipatch_dls_reader_load_inst_list (IpatchDLSReader *reader, GError **err); gboolean ipatch_dls_reader_load_region_list (IpatchDLSReader *reader, IpatchDLS2Inst *inst, GError **err); gboolean ipatch_gig_reader_load_region_list (IpatchDLSReader *reader, IpatchGigInst *giginst, GError **err); gboolean ipatch_dls_reader_load_art_list (IpatchDLSReader *reader, GSList **conn_list, GError **err); gboolean ipatch_dls_reader_load_wave_pool (IpatchDLSReader *reader, GError **err); gboolean ipatch_gig_reader_load_sub_regions (IpatchDLSReader *reader, IpatchGigRegion *region, GError **err); gboolean ipatch_gig_reader_load_inst_lart (IpatchDLSReader *reader, IpatchGigInst *inst, GError **err); gboolean ipatch_dls_load_info (IpatchRiff *riff, IpatchDLS2Info **info, GError **err); gboolean ipatch_dls_load_region_header (IpatchRiff *riff, IpatchDLS2Region *region, GError **err); gboolean ipatch_gig_load_region_header (IpatchRiff *riff, IpatchGigRegion *region, GError **err); gboolean ipatch_dls_load_wave_link (IpatchRiff *riff, IpatchDLS2Region *region, GError **err); gboolean ipatch_dls_load_sample_info (IpatchRiff *riff, IpatchDLS2SampleInfo *info, GError **err); gboolean ipatch_dls_load_connection (IpatchRiff *riff, GSList **conn_list, GError **err); gboolean ipatch_dls_load_sample_format (IpatchRiff *riff, IpatchDLS2Sample *sample, int *bitwidth, int *channels, GError **err); guint32 *ipatch_dls_load_pool_table (IpatchRiff *riff, guint *size, GError **err); gboolean ipatch_dls_load_dlid (IpatchRiff *riff, guint8 *dlid, GError **err); gboolean ipatch_gig_load_sample_info (IpatchRiff *riff, IpatchDLS2SampleInfo *info, GError **err); gboolean ipatch_gig_load_dimension_info (IpatchRiff *riff, IpatchGigRegion *region, GError **err); gboolean ipatch_gig_load_dimension_names (IpatchRiff *riff, IpatchGigRegion *region, GError **err); gboolean ipatch_gig_load_group_names (IpatchRiff *riff, GSList **name_list, GError **err); #endif libinstpatch-1.0.0/libinstpatch/IpatchIter.c0000644000175000017500000004377511461332142016016 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include "IpatchIter.h" /* IpatchIter methods for GSList type lists */ IpatchIterMethods ipatch_iter_GSList_methods = { ipatch_iter_GSList_get, ipatch_iter_GSList_next, ipatch_iter_GSList_first, ipatch_iter_GSList_last, ipatch_iter_GSList_index, ipatch_iter_GSList_insert, ipatch_iter_GSList_remove, ipatch_iter_GSList_count }; /* IpatchIter methods for GList type lists */ IpatchIterMethods ipatch_iter_GList_methods = { ipatch_iter_GList_get, ipatch_iter_GList_next, ipatch_iter_GList_first, ipatch_iter_GList_last, ipatch_iter_GList_index, ipatch_iter_GList_insert, ipatch_iter_GList_remove, ipatch_iter_GList_count }; /* IpatchIter methods for arrays */ IpatchIterMethods ipatch_iter_array_methods = { ipatch_iter_array_get, ipatch_iter_array_next, ipatch_iter_array_first, ipatch_iter_array_last, ipatch_iter_array_index, ipatch_iter_array_insert, ipatch_iter_array_remove, ipatch_iter_array_count }; /** * ipatch_iter_get_type: * * Gets the GBoxed derived type for #IpatchIter structures. * * Returns: GType of #IpatchIter structures. */ GType ipatch_iter_get_type (void) { static GType type = 0; if (!type) type = g_boxed_type_register_static ("IpatchIter", (GBoxedCopyFunc)ipatch_iter_duplicate, (GBoxedFreeFunc)ipatch_iter_free); return (type); } /** * ipatch_iter_alloc: * * Allocates an item iterator. This function is seldom used since * #IpatchIter structures are usually allocated on the stack. * * Returns: Newly allocated item iterator. Should be freed with * ipatch_iter_free() when finished with it. */ IpatchIter * ipatch_iter_alloc (void) { IpatchIter *iter; iter = g_new0 (IpatchIter, 1); return (iter); } /** * ipatch_iter_free: * @iter: Item iterator * * Frees an item iterator that was allocated with ipatch_iter_alloc(). * Seldom used since #IpatchIter structures are usually allocated on the * stack. */ void ipatch_iter_free (IpatchIter *iter) { g_free (iter); } /** * ipatch_iter_duplicate: * @iter: Patch iterator to duplicate * * Duplicates a patch iterator. Seldom used since #IpatchIter * structures are usually allocated on the stack and can be copied * directly. * * Returns: Newly allocated patch iter identical to @iter. Free it with * ipatch_iter_free() when finished. */ IpatchIter * ipatch_iter_duplicate (IpatchIter *iter) { IpatchIter *newiter; newiter = ipatch_iter_alloc (); *newiter = *iter; return (newiter); } /** * ipatch_iter_GSList_init: * @iter: Iterator to initialize * @list: Pointer to root GSList pointer to initialize iterator to * * Initialize an iterator to iterate over a GSList. */ void ipatch_iter_GSList_init (IpatchIter *iter, GSList **list) { g_return_if_fail (iter != NULL); g_return_if_fail (list != NULL); iter->methods = &ipatch_iter_GSList_methods; IPATCH_ITER_GSLIST_SET_LIST (iter, list); IPATCH_ITER_GSLIST_SET_POS (iter, NULL); } /** * ipatch_iter_GSList_get: * @iter: Item iterator initialized with a GSList * * GSList item iterator method to get the current item. * * Returns: Current item or %NULL if no current item. */ gpointer ipatch_iter_GSList_get (IpatchIter *iter) { GSList *pos; g_return_val_if_fail (iter != NULL, NULL); pos = IPATCH_ITER_GSLIST_GET_POS (iter); return (pos ? (gpointer)(pos->data) : NULL); } /** * ipatch_iter_GSList_next: * @iter: Item iterator initialized with a GSList * * GSList item iterator method to get the next item and advance the * iterator's position. * * Returns: Next item or %NULL if no more items. */ gpointer ipatch_iter_GSList_next (IpatchIter *iter) { GSList *pos; g_return_val_if_fail (iter != NULL, NULL); pos = IPATCH_ITER_GSLIST_GET_POS (iter); if (pos) pos = g_slist_next (pos); IPATCH_ITER_GSLIST_SET_POS (iter, pos); /* set current position */ return (pos ? (gpointer)(pos->data) : NULL); } /** * ipatch_iter_GSList_first: * @iter: Item iterator initialized with a GSList * * GSList item iterator method to get the first item and set the * iterator's position to it. * * Returns: First item or %NULL if GSList is empty. */ gpointer ipatch_iter_GSList_first (IpatchIter *iter) { GSList **list, *pos; g_return_val_if_fail (iter != NULL, NULL); list = IPATCH_ITER_GSLIST_GET_LIST (iter); /* list pointer */ g_return_val_if_fail (list != NULL, NULL); pos = *list; IPATCH_ITER_GSLIST_SET_POS (iter, pos); /* set position */ return (pos ? (gpointer)(pos->data) : NULL); } /** * ipatch_iter_GSList_last: * @iter: Item iterator initialized with a GSList * * GSList item iterator method to get the last item and set the * iterator's position to it. * * Returns: Last item or %NULL if GSList is empty. */ gpointer ipatch_iter_GSList_last (IpatchIter *iter) { GSList **list, *pos; g_return_val_if_fail (iter != NULL, NULL); list = IPATCH_ITER_GSLIST_GET_LIST (iter); g_return_val_if_fail (list != NULL, NULL); pos = g_slist_last (*list); IPATCH_ITER_GSLIST_SET_POS (iter, pos); /* set current position */ return (pos ? (gpointer)(pos->data) : NULL); } /** * ipatch_iter_GSList_index: * @iter: Item iterator initialized with a GSList * @index: Index, from 0, of item to get * * GSList item iterator method to get an item at a given index and set the * iterator's position to it. * * Returns: item at the @index position or %NULL if index is off * the end of the GSList. */ gpointer ipatch_iter_GSList_index (IpatchIter *iter, int index) { GSList **list, *pos; g_return_val_if_fail (iter != NULL, NULL); list = IPATCH_ITER_GSLIST_GET_LIST (iter); g_return_val_if_fail (list != NULL, NULL); pos = g_slist_nth (*list, index); IPATCH_ITER_GSLIST_SET_POS (iter, pos); /* set current position */ return (pos ? (gpointer)(pos->data) : NULL); } /** * ipatch_iter_GSList_insert: * @iter: Item iterator initialized with a GSList * @item: Pointer to insert * * GSList item iterator method to insert an item pointer. */ void ipatch_iter_GSList_insert (IpatchIter *iter, gpointer item) { GSList **list, *pos, *dummy; g_return_if_fail (iter != NULL); if ((pos = IPATCH_ITER_GSLIST_GET_POS (iter))) /* position set? */ { dummy = g_slist_insert (pos, item, 1); /* insert after position */ IPATCH_ITER_GSLIST_SET_POS (iter, g_slist_next (pos)); /* update pos */ } else /* position not set */ { list = IPATCH_ITER_GSLIST_GET_LIST (iter); g_return_if_fail (list != NULL); pos = g_slist_prepend (*list, item); /* prepend */ IPATCH_ITER_GSLIST_SET_POS (iter, pos); /* set current position */ *list = pos; /* set root of list */ } } /** * ipatch_iter_GSList_remove: * @iter: Item iterator initialized with a GSList * * GSList item iterator method to remove the current item and advance * the current position. */ void ipatch_iter_GSList_remove (IpatchIter *iter) { GSList **list, *pos; g_return_if_fail (iter != NULL); list = IPATCH_ITER_GSLIST_GET_LIST (iter); g_return_if_fail (list != NULL); /* advance current position if set */ pos = IPATCH_ITER_GSLIST_GET_POS (iter); if (pos) { IPATCH_ITER_GSLIST_SET_POS (iter, g_slist_next (pos)); *list = g_slist_delete_link (*list, pos); } } /** * ipatch_iter_GSList_count: * @iter: Item iterator initialized with a GSList * * GSList item iterator method to get the count of items. * * Returns: Count of items in GSList iterator. */ int ipatch_iter_GSList_count (IpatchIter *iter) { GSList **list; g_return_val_if_fail (iter != NULL, 0); list = IPATCH_ITER_GSLIST_GET_LIST (iter); g_return_val_if_fail (list != NULL, 0); return (g_slist_length (*list)); } /** * ipatch_iter_GList_init: * @iter: Iterator to initialize * @list: Pointer to root GList pointer to initialize iterator to * * Initialize an iterator to iterate over a GList. */ void ipatch_iter_GList_init (IpatchIter *iter, GList **list) { g_return_if_fail (iter != NULL); iter->methods = &ipatch_iter_GList_methods; IPATCH_ITER_GLIST_SET_LIST (iter, list); IPATCH_ITER_GLIST_SET_POS (iter, NULL); } /** * ipatch_iter_GList_get: * @iter: Item iterator initialized with a GList * * GList item iterator method to get the current item. * * Returns: Current item or %NULL if no current item. */ gpointer ipatch_iter_GList_get (IpatchIter *iter) { GList *pos; g_return_val_if_fail (iter != NULL, NULL); pos = IPATCH_ITER_GLIST_GET_POS (iter); return (pos ? (gpointer)(pos->data) : NULL); } /** * ipatch_iter_GList_next: * @iter: Item iterator initialized with a GList * * GList item iterator method to get the next item and advance the * iterator's position. * * Returns: Next item or %NULL if no more items. */ gpointer ipatch_iter_GList_next (IpatchIter *iter) { GList *pos; g_return_val_if_fail (iter != NULL, NULL); pos = IPATCH_ITER_GLIST_GET_POS (iter); if (pos) pos = g_list_next (pos); IPATCH_ITER_GLIST_SET_POS (iter, pos); /* set current position */ return (pos ? (gpointer)(pos->data) : NULL); } /** * ipatch_iter_GList_first: * @iter: Item iterator initialized with a GList * * GList item iterator method to get the first item and set the * iterator's position to it. * * Returns: First item or %NULL if GList is empty. */ gpointer ipatch_iter_GList_first (IpatchIter *iter) { GList **list, *pos; g_return_val_if_fail (iter != NULL, NULL); list = IPATCH_ITER_GLIST_GET_LIST (iter); /* list pointer */ g_return_val_if_fail (list != NULL, NULL); pos = *list; IPATCH_ITER_GLIST_SET_POS (iter, pos); /* set position */ return (pos ? (gpointer)(pos->data) : NULL); } /** * ipatch_iter_GList_last: * @iter: Item iterator initialized with a GList * * GList item iterator method to get the last item and set the * iterator's position to it. * * Returns: Last item or %NULL if GList is empty. */ gpointer ipatch_iter_GList_last (IpatchIter *iter) { GList **list, *pos; g_return_val_if_fail (iter != NULL, NULL); list = IPATCH_ITER_GLIST_GET_LIST (iter); g_return_val_if_fail (list != NULL, NULL); pos = g_list_last (*list); IPATCH_ITER_GLIST_SET_POS (iter, pos); /* set current position */ return (pos ? (gpointer)(pos->data) : NULL); } /** * ipatch_iter_GList_index: * @iter: Item iterator initialized with a GList * @index: Index, from 0, of item to get * * GList item iterator method to get an item at a given index and set the * iterator's position to it. * * Returns: item at the @index position or %NULL if index is off * the end of the GList. */ gpointer ipatch_iter_GList_index (IpatchIter *iter, int index) { GList **list, *pos; g_return_val_if_fail (iter != NULL, NULL); list = IPATCH_ITER_GLIST_GET_LIST (iter); g_return_val_if_fail (list != NULL, NULL); pos = g_list_nth (*list, index); IPATCH_ITER_GLIST_SET_POS (iter, pos); /* set current position */ return (pos ? (gpointer)(pos->data) : NULL); } /** * ipatch_iter_GList_insert: * @iter: Item iterator initialized with a GList * @item: Pointer to insert * * GList item iterator method to insert an item pointer. */ void ipatch_iter_GList_insert (IpatchIter *iter, gpointer item) { GList **list, *pos, *dummy; g_return_if_fail (iter != NULL); if ((pos = IPATCH_ITER_GLIST_GET_POS (iter))) /* position set? */ { dummy = g_list_insert (pos, item, 1); /* insert after position */ IPATCH_ITER_GLIST_SET_POS (iter, g_list_next (pos)); /* update pos */ } else /* position not set */ { list = IPATCH_ITER_GLIST_GET_LIST (iter); g_return_if_fail (list != NULL); pos = g_list_prepend (*list, item); /* prepend */ IPATCH_ITER_GLIST_SET_POS (iter, pos); /* set current position */ *list = pos; /* set root of list */ } } /** * ipatch_iter_GList_remove: * @iter: Item iterator initialized with a GList * * GList item iterator method to remove the current item and advance * the current position. */ void ipatch_iter_GList_remove (IpatchIter *iter) { GList **list, *pos; g_return_if_fail (iter != NULL); list = IPATCH_ITER_GLIST_GET_LIST (iter); g_return_if_fail (list != NULL); /* advance current position if set */ pos = IPATCH_ITER_GLIST_GET_POS (iter); if (pos) { IPATCH_ITER_GLIST_SET_POS (iter, g_list_next (pos)); *list = g_list_delete_link (*list, pos); } } /** * ipatch_iter_GList_count: * @iter: Item iterator initialized with a GList * * GList item iterator method to get the count of items. * * Returns: Count of items in GList iterator. */ int ipatch_iter_GList_count (IpatchIter *iter) { GList **list; g_return_val_if_fail (iter != NULL, 0); list = IPATCH_ITER_GLIST_GET_LIST (iter); g_return_val_if_fail (list != NULL, 0); return (g_list_length (*list)); } /** * ipatch_iter_array_init: * @iter: Iterator to initialize * @array: Pointer to an array of pointers * @size: Count of elements in @array. * * Initialize an iterator to iterate over an array (read only). */ void ipatch_iter_array_init (IpatchIter *iter, gpointer *array, guint size) { g_return_if_fail (iter != NULL); g_return_if_fail (array != NULL); iter->methods = &ipatch_iter_array_methods; IPATCH_ITER_ARRAY_SET_ARRAY (iter, array); IPATCH_ITER_ARRAY_SET_SIZE (iter, size); IPATCH_ITER_ARRAY_SET_POS (iter, -1); /* init to no position */ } /** * ipatch_iter_array_get: * @iter: Item iterator initialized with an array * * Array item iterator method to get the current item. * * Returns: Current item or %NULL if no current item. */ gpointer ipatch_iter_array_get (IpatchIter *iter) { gpointer *array; int pos; g_return_val_if_fail (iter != NULL, NULL); array = IPATCH_ITER_ARRAY_GET_ARRAY (iter); g_return_val_if_fail (array != NULL, NULL); pos = IPATCH_ITER_ARRAY_GET_POS (iter); return ((pos != -1) ? array[pos] : NULL); } /** * ipatch_iter_array_next: * @iter: Item iterator initialized with an array * * Array item iterator method to get the next item and advance the * iterator's position. * * Returns: Next item or %NULL if no more items. */ gpointer ipatch_iter_array_next (IpatchIter *iter) { gpointer *array; int pos; guint size; g_return_val_if_fail (iter != NULL, NULL); array = IPATCH_ITER_ARRAY_GET_ARRAY (iter); g_return_val_if_fail (array != NULL, NULL); pos = IPATCH_ITER_ARRAY_GET_POS (iter); size = IPATCH_ITER_ARRAY_GET_SIZE (iter); if (pos >= 0 && (pos + 1) < size) pos++; else pos = -1; IPATCH_ITER_ARRAY_SET_POS (iter, pos); /* update position */ return ((pos != -1) ? array[pos] : NULL); } /** * ipatch_iter_array_first: * @iter: Item iterator initialized with an array * * Array item iterator method to get the first item and set the * iterator's position to it. * * Returns: First item or %NULL if array is empty. */ gpointer ipatch_iter_array_first (IpatchIter *iter) { gpointer *array; int pos = 0; guint size; g_return_val_if_fail (iter != NULL, NULL); array = IPATCH_ITER_ARRAY_GET_ARRAY (iter); g_return_val_if_fail (array != NULL, NULL); size = IPATCH_ITER_ARRAY_GET_SIZE (iter); if (size == 0) pos = -1; IPATCH_ITER_ARRAY_SET_POS (iter, pos); return ((pos != -1) ? array[pos] : NULL); } /** * ipatch_iter_array_last: * @iter: Item iterator initialized with an array * * Array item iterator method to get the last item and set the * iterator's position to it. * * Returns: Last item or %NULL if array is empty. */ gpointer ipatch_iter_array_last (IpatchIter *iter) { gpointer *array; int pos; guint size; g_return_val_if_fail (iter != NULL, NULL); array = IPATCH_ITER_ARRAY_GET_ARRAY (iter); g_return_val_if_fail (array != NULL, NULL); size = IPATCH_ITER_ARRAY_GET_SIZE (iter); if (size > 0) pos = size - 1; else pos = -1; IPATCH_ITER_ARRAY_SET_POS (iter, pos); return ((pos != -1) ? array[pos] : NULL); } /** * ipatch_iter_array_index: * @iter: Item iterator initialized with an array * @index: Index, from 0, of item to get * * Array item iterator method to get an item at a given index and set the * iterator's position to it. * * Returns: item at the @index position or %NULL if index is off * the end of the array. */ gpointer ipatch_iter_array_index (IpatchIter *iter, int index) { gpointer *array; guint size; g_return_val_if_fail (iter != NULL, NULL); array = IPATCH_ITER_ARRAY_GET_ARRAY (iter); g_return_val_if_fail (array != NULL, NULL); size = IPATCH_ITER_ARRAY_GET_SIZE (iter); if (index < 0 || index >= size) index = -1; IPATCH_ITER_ARRAY_SET_POS (iter, index); return ((index != -1) ? array[index] : NULL); } /** * ipatch_iter_array_insert: * @iter: Item iterator initialized with a array * @item: Pointer to insert * * array item iterator method to insert an item pointer. */ void ipatch_iter_array_insert (IpatchIter *iter, gpointer item) { g_return_if_reached (); } /** * ipatch_iter_array_remove: * @iter: Item iterator initialized with a array * * array item iterator method to remove the current item and advance * the current position. */ void ipatch_iter_array_remove (IpatchIter *iter) { g_return_if_reached (); } /** * ipatch_iter_array_count: * @iter: Item iterator initialized with a array * * array item iterator method to get the count of items. * * Returns: Count of items in array iterator. */ int ipatch_iter_array_count (IpatchIter *iter) { guint size; g_return_val_if_fail (iter != NULL, 0); size = IPATCH_ITER_ARRAY_GET_SIZE (iter); return (size); } libinstpatch-1.0.0/libinstpatch/IpatchSF2Gen.h0000644000175000017500000002344411461332142016133 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSF2Gen * @short_description: SoundFont generator functions and definitions * @see_also: * @stability: Stable * * SoundFont generators are synthesis parameters used by #IpatchSF2Preset, * #IpatchSF2Inst, #IpatchSF2PZone and #IpatchSF2IZone objects. */ #ifndef __IPATCH_SF2_GEN_H__ #define __IPATCH_SF2_GEN_H__ #include #include #include /* total number of generators */ #define IPATCH_SF2_GEN_COUNT 59 /* forward type declarations */ typedef union _IpatchSF2GenAmount IpatchSF2GenAmount; typedef struct _IpatchSF2GenArray IpatchSF2GenArray; typedef struct _IpatchSF2GenInfo IpatchSF2GenInfo; /* IpatchSF2GenArray has a glib boxed type */ #define IPATCH_TYPE_SF2_GEN_ARRAY (ipatch_sf2_gen_array_get_type ()) /** * IpatchSF2GenPropsType: * * Generator property type (defines which gens are valid and their ranges). * Note that TRUE/FALSE can be used to designate PRESET/INST (backwards * compatible with previous function). Also note that global properties can * be treated as a flag: #IPATCH_SF2_GEN_PROPS_GLOBAL_FLAG. */ typedef enum { IPATCH_SF2_GEN_PROPS_INST = 0, /* instrument "absolute" properties */ IPATCH_SF2_GEN_PROPS_PRESET = 1, /* preset "offset" properties */ IPATCH_SF2_GEN_PROPS_INST_GLOBAL = 2, /* inst properties with no sample link */ IPATCH_SF2_GEN_PROPS_PRESET_GLOBAL = 3 /* preset props with no inst link */ } IpatchSF2GenPropsType; /* can treat GLOBAL enums from IpatchSF2GenPropsType as a flag */ #define IPATCH_SF2_GEN_PROPS_GLOBAL_FLAG 0x02 /* mask of props type without global flag */ #define IPATCH_SF2_GEN_PROPS_MASK 0x01 /* Generator amount (effect parameter amount) */ union _IpatchSF2GenAmount { /*< public >*/ gint16 sword; /* signed 16 bit value */ guint16 uword; /* unsigned 16 bit value */ struct { guint8 low; /* low value of range */ guint8 high; /* high value of range */ } range; /* range values, low - high */ }; /* Generator (effect parameter) */ struct _IpatchSF2Gen { /*< public >*/ guint16 id; /* generator #IPGenType ID */ IpatchSF2GenAmount amount; /* generator value */ }; /* generator array */ struct _IpatchSF2GenArray { /*< public >*/ guint64 flags; /* 1 bit for each generator indicating if it is set */ IpatchSF2GenAmount values[IPATCH_SF2_GEN_COUNT]; /* gen values */ }; /* calculate the set bit value for a given generator ID */ #define IPATCH_SF2_GENID_SET(genid) ((guint64)0x1 << (genid)) /* macros for manipulating individual set flag bits in a generator array Note: These macros don't take into account multi-thread locking. */ #define IPATCH_SF2_GEN_ARRAY_TEST_FLAG(array, genid) \ (((array)->flags & ((guint64)0x1 << (genid))) != 0) #define IPATCH_SF2_GEN_ARRAY_SET_FLAG(array, genid) \ ((array)->flags |= ((guint64)0x1 << (genid))) #define IPATCH_SF2_GEN_ARRAY_CLEAR_FLAG(array, genid) \ ((array)->flags &= ~((guint64)0x1 << (genid))) /* generator (effect parameter) types */ typedef enum { IPATCH_SF2_GEN_SAMPLE_START = 0, /* sample start offset */ IPATCH_SF2_GEN_SAMPLE_END = 1, /* sample end offset */ IPATCH_SF2_GEN_SAMPLE_LOOP_START = 2,/* sample loop start offset */ IPATCH_SF2_GEN_SAMPLE_LOOP_END = 3, /* sample loop end offset */ IPATCH_SF2_GEN_SAMPLE_COARSE_START = 4, /* sample start coarse offset */ IPATCH_SF2_GEN_MOD_LFO_TO_PITCH = 5, /* modulation LFO to pitch */ IPATCH_SF2_GEN_VIB_LFO_TO_PITCH = 6, /* vibrato LFO to pitch */ IPATCH_SF2_GEN_MOD_ENV_TO_PITCH = 7, /* modulation envelope to pitch */ IPATCH_SF2_GEN_FILTER_CUTOFF = 8, /* initial filter cutoff */ IPATCH_SF2_GEN_FILTER_Q = 9, /* filter Q */ IPATCH_SF2_GEN_MOD_LFO_TO_FILTER_CUTOFF = 10, /* mod LFO to filter cutoff */ IPATCH_SF2_GEN_MOD_ENV_TO_FILTER_CUTOFF = 11, /* mod envelope to filter cutoff */ IPATCH_SF2_GEN_SAMPLE_COARSE_END = 12, /* sample end course offset */ IPATCH_SF2_GEN_MOD_LFO_TO_VOLUME = 13, /* modulation LFO to volume */ IPATCH_SF2_GEN_UNUSED1 = 14, IPATCH_SF2_GEN_CHORUS = 15, /* chorus */ IPATCH_SF2_GEN_REVERB = 16, /* reverb */ IPATCH_SF2_GEN_PAN = 17, /* panning */ IPATCH_SF2_GEN_UNUSED2 = 18, IPATCH_SF2_GEN_UNUSED3 = 19, IPATCH_SF2_GEN_UNUSED4 = 20, IPATCH_SF2_GEN_MOD_LFO_DELAY = 21, /* modulation LFO delay */ IPATCH_SF2_GEN_MOD_LFO_FREQ = 22, /* modulation LFO frequency */ IPATCH_SF2_GEN_VIB_LFO_DELAY = 23, /* vibrato LFO delay */ IPATCH_SF2_GEN_VIB_LFO_FREQ = 24, /* vibrato LFO frequency */ IPATCH_SF2_GEN_MOD_ENV_DELAY = 25, /* modulation envelope delay */ IPATCH_SF2_GEN_MOD_ENV_ATTACK = 26, /* modulation envelope attack */ IPATCH_SF2_GEN_MOD_ENV_HOLD = 27, /* modulation envelope hold */ IPATCH_SF2_GEN_MOD_ENV_DECAY = 28, /* modulation envelope decay */ IPATCH_SF2_GEN_MOD_ENV_SUSTAIN = 29, /* modulation envelope sustain */ IPATCH_SF2_GEN_MOD_ENV_RELEASE = 30, /* modulation envelope release */ IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_HOLD = 31, /* MIDI note to mod envelope hold */ IPATCH_SF2_GEN_NOTE_TO_MOD_ENV_DECAY = 32, /* MIDI note to mod env decay */ IPATCH_SF2_GEN_VOL_ENV_DELAY = 33, /* volume envelope delay */ IPATCH_SF2_GEN_VOL_ENV_ATTACK = 34, /* volume envelope attack */ IPATCH_SF2_GEN_VOL_ENV_HOLD = 35, /* volume envelope hold */ IPATCH_SF2_GEN_VOL_ENV_DECAY = 36, /* volume envelope decay */ IPATCH_SF2_GEN_VOL_ENV_SUSTAIN = 37, /* volume envelope sustain */ IPATCH_SF2_GEN_VOL_ENV_RELEASE = 38, /* volume envelope release */ IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_HOLD = 39, /* MIDI note to vol envelope hold */ IPATCH_SF2_GEN_NOTE_TO_VOL_ENV_DECAY = 40, /* MIDI note to volume env decay */ IPATCH_SF2_GEN_INSTRUMENT_ID = 41, /* instrument ID */ IPATCH_SF2_GEN_RESERVED1 = 42, IPATCH_SF2_GEN_NOTE_RANGE = 43, /* note range */ IPATCH_SF2_GEN_VELOCITY_RANGE = 44, /* note on velocity range */ IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_START = 45, /* sample coarse loop start */ IPATCH_SF2_GEN_FIXED_NOTE = 46, /* MIDI fixed note */ IPATCH_SF2_GEN_FIXED_VELOCITY = 47, /* MIDI fixed velocity */ IPATCH_SF2_GEN_ATTENUATION = 48, /* initial volume attenuation */ IPATCH_SF2_GEN_RESERVED2 = 49, IPATCH_SF2_GEN_SAMPLE_COARSE_LOOP_END = 50, /* sample end loop course ofs */ IPATCH_SF2_GEN_COARSE_TUNE = 51, /* course tuning */ IPATCH_SF2_GEN_FINE_TUNE_OVERRIDE = 52, /* fine tune override */ IPATCH_SF2_GEN_SAMPLE_ID = 53, /* sample ID */ IPATCH_SF2_GEN_SAMPLE_MODES = 54, /* sample flags (IpatchSF2GenSampleModes)*/ IPATCH_SF2_GEN_RESERVED3 = 55, IPATCH_SF2_GEN_SCALE_TUNE = 56, /* scale tuning (tuning per MIDI note) */ IPATCH_SF2_GEN_EXCLUSIVE_CLASS = 57, /* exclusive class (only 1 at a time) */ IPATCH_SF2_GEN_ROOT_NOTE_OVERRIDE = 58 /* root note override */ } IpatchSF2GenType; /* Flags for IPATCH_SF2_GEN_SAMPLE_MODES generator */ typedef enum { IPATCH_SF2_GEN_SAMPLE_MODE_NOLOOP = 0, IPATCH_SF2_GEN_SAMPLE_MODE_LOOP = 1 << 0, IPATCH_SF2_GEN_SAMPLE_MODE_LOOP_RELEASE = 1 << 1 } IpatchSF2GenSampleModes; /* generator info and constraints structure */ struct _IpatchSF2GenInfo { /*< public >*/ IpatchSF2GenAmount min; /* minimum value allowed */ IpatchSF2GenAmount max; /* maximum value allowed */ IpatchSF2GenAmount def; /* default value */ gint16 unit; /* #IpatchUnitType type */ char *label; /* short descriptive label */ char *descr; /* more complete description */ }; extern IpatchSF2GenArray *ipatch_sf2_gen_ofs_array; extern IpatchSF2GenArray *ipatch_sf2_gen_abs_array; extern guint64 ipatch_sf2_gen_ofs_valid_mask; extern guint64 ipatch_sf2_gen_abs_valid_mask; extern guint64 ipatch_sf2_gen_add_mask; extern const IpatchSF2GenInfo ipatch_sf2_gen_info[]; /* IpatchSF2Gen_tables.c */ gboolean ipatch_sf2_gen_is_valid (guint genid, IpatchSF2GenPropsType propstype); GType ipatch_sf2_gen_array_get_type (void); IpatchSF2GenArray *ipatch_sf2_gen_array_new (gboolean clear); void ipatch_sf2_gen_array_free (IpatchSF2GenArray *genarray); IpatchSF2GenArray * ipatch_sf2_gen_array_duplicate (const IpatchSF2GenArray *array); void ipatch_sf2_gen_array_init (IpatchSF2GenArray *array, gboolean offset, gboolean set); gboolean ipatch_sf2_gen_array_offset (IpatchSF2GenArray *abs_array, const IpatchSF2GenArray *ofs_array); gboolean ipatch_sf2_gen_array_intersect_test (const IpatchSF2GenArray *array1, const IpatchSF2GenArray *array2); guint ipatch_sf2_gen_array_count_set (IpatchSF2GenArray *array); void ipatch_sf2_gen_amount_to_value (guint genid, const IpatchSF2GenAmount *amt, GValue *value); void ipatch_sf2_gen_default_value (guint genid, gboolean ispreset, IpatchSF2GenAmount *out_amt); gboolean ipatch_sf2_gen_offset (guint genid, IpatchSF2GenAmount *dst, const IpatchSF2GenAmount *ofs); void ipatch_sf2_gen_clamp (guint genid, int *sfval, gboolean ispreset); gboolean ipatch_sf2_gen_range_intersect (IpatchSF2GenAmount *dst, const IpatchSF2GenAmount *src); gboolean ipatch_sf2_gen_range_intersect_test (const IpatchSF2GenAmount *amt1, const IpatchSF2GenAmount *amt2); G_CONST_RETURN char *ipatch_sf2_gen_get_prop_name (guint genid); #endif libinstpatch-1.0.0/libinstpatch/IpatchConvert_Gig.c0000644000175000017500000000777211461332142017316 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "misc.h" #include "IpatchConverter_priv.h" #include "IpatchConvert_Gig.h" #include "IpatchGig.h" #include "IpatchGigFile.h" #include "IpatchDLSReader.h" #include "IpatchDLSWriter.h" #include "IpatchBase.h" #include "IpatchSampleData.h" #include "IpatchSndFile.h" #include "IpatchSampleStoreSndFile.h" #include "i18n.h" /* * GigaSampler conversion handlers (DLS is master format): * IpatchGig <==> IpatchGigFile * IpatchSampleFile => IpatchGigSample * IpatchGig <==> IpatchDLS2 * IpatchGigInst <==> IpatchDLS2Inst * IpatchGigRegion <==> IpatchDLS2Region */ /* defined in IpatchConvert_DLS2.c */ gboolean _file_to_dls2_sample_convert (IpatchConverter *converter, GError **err); /* init routine for GigaSampler conversion types */ void _ipatch_convert_gig_init (void) { g_type_class_ref (IPATCH_TYPE_CONVERTER_GIG_TO_FILE); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_GIG_TO_FILE, 0, IPATCH_TYPE_GIG, 0, 1, IPATCH_TYPE_GIG_FILE, IPATCH_TYPE_FILE, 1); g_type_class_ref (IPATCH_TYPE_CONVERTER_FILE_TO_GIG); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_FILE_TO_GIG, 0, IPATCH_TYPE_GIG_FILE, IPATCH_TYPE_FILE, 1, IPATCH_TYPE_GIG, IPATCH_TYPE_BASE, 0); g_type_class_ref (IPATCH_TYPE_CONVERTER_FILE_TO_GIG_SAMPLE); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_FILE_TO_GIG_SAMPLE, 0, IPATCH_TYPE_SND_FILE, IPATCH_TYPE_FILE, 1, IPATCH_TYPE_GIG_SAMPLE, 0, 1); } /* =============== * Convert methods * =============== */ static gboolean _gig_to_file_convert (IpatchConverter *converter, GError **err) { IpatchGig *gig; IpatchGigFile *file; IpatchFileHandle *handle; IpatchDLSWriter *writer; int retval; gig = IPATCH_GIG (IPATCH_CONVERTER_INPUT (converter)); file = IPATCH_GIG_FILE (IPATCH_CONVERTER_OUTPUT (converter)); handle = ipatch_file_open (IPATCH_FILE (file), NULL, "w", err); if (!handle) return (FALSE); /* ++ ref new writer */ writer = ipatch_dls_writer_new (handle, IPATCH_DLS2 (gig)); retval = ipatch_dls_writer_save (writer, err); g_object_unref (writer); /* -- unref writer */ return (retval); } static gboolean _file_to_gig_convert (IpatchConverter *converter, GError **err) { IpatchDLS2 *dls; IpatchGigFile *file; IpatchFileHandle *handle; IpatchDLSReader *reader; file = IPATCH_GIG_FILE (IPATCH_CONVERTER_INPUT (converter)); handle = ipatch_file_open (IPATCH_FILE (file), NULL, "r", err); if (!handle) return (FALSE); /* ++ ref new reader */ reader = ipatch_dls_reader_new (handle); dls = ipatch_dls_reader_load (reader, err); /* ++ ref loaded DLS object */ g_object_unref (reader); /* -- unref reader */ if (dls) { ipatch_converter_add_output (converter, G_OBJECT (dls)); g_object_unref (dls); /* -- unref loaded Gig object */ return (TRUE); } else return (FALSE); } #define _file_to_gig_sample_convert _file_to_dls2_sample_convert; CONVERTER_CLASS_INIT(gig_to_file); CONVERTER_GET_TYPE(gig_to_file, GigToFile); CONVERTER_CLASS_INIT(file_to_gig); CONVERTER_GET_TYPE(file_to_gig, FileToGig); CONVERTER_CLASS_INIT(file_to_gig_sample); CONVERTER_GET_TYPE(file_to_gig_sample, FileToGigSample); libinstpatch-1.0.0/libinstpatch/IpatchSampleStoreRam.h0000644000175000017500000000552011461332142020000 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchSampleStoreRam * @short_description: Sample store object for audio data in RAM * @see_also: * @stability: Stable */ #ifndef __IPATCH_SAMPLE_STORE_RAM_H__ #define __IPATCH_SAMPLE_STORE_RAM_H__ #include #include #include /* forward type declarations */ typedef struct _IpatchSampleStoreRam IpatchSampleStoreRam; typedef struct _IpatchSampleStoreRamClass IpatchSampleStoreRamClass; #define IPATCH_TYPE_SAMPLE_STORE_RAM (ipatch_sample_store_ram_get_type ()) #define IPATCH_SAMPLE_STORE_RAM(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_STORE_RAM, \ IpatchSampleStoreRam)) #define IPATCH_SAMPLE_STORE_RAM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_STORE_RAM, \ IpatchSampleStoreRamClass)) #define IPATCH_IS_SAMPLE_STORE_RAM(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_STORE_RAM)) #define IPATCH_IS_SAMPLE_STORE_RAM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_STORE_RAM)) /* RAM sample store instance */ struct _IpatchSampleStoreRam { IpatchSampleStore parent_instance; gpointer location; /* Pointer to the sample data in memory */ }; /* RAM sample store class */ struct _IpatchSampleStoreRamClass { IpatchSampleStoreClass parent_class; }; /** * IpatchSampleStoreRamFlags: * @IPATCH_SAMPLE_STORE_RAM_ALLOCATED: Indicates if sample data was allocated * and therefore should be freed when finalized. * * Flags crammed into #IpatchItem flags field. */ typedef enum { IPATCH_SAMPLE_STORE_RAM_ALLOCATED = 1 << IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT } IpatchSampleStoreRamFlags; /* we reserve 1 bits for defined flags above and 3 bits for future expansion */ #define IPATCH_SAMPLE_STORE_RAM_UNUSED_FLAG_SHIFT \ (IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT + 4) GType ipatch_sample_store_ram_get_type (void); IpatchSample *ipatch_sample_store_ram_new (gpointer location, gboolean free_data); IpatchSample *ipatch_sample_store_ram_get_blank (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchDLS2Conn.c0000644000175000017500000001402611461332142016420 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * connify it under the terms of the GNU Conneral Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Conneral Public License for more details. * * You should have received a copy of the GNU Conneral Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchDLS2Conn.h" #include "ipatch_priv.h" /** * ipatch_dls2_conn_get_type: * * Get the #IpatchDLS2Conn boxed type * * Returns: Boxed GType of the #IpatchDLS2Conn structure */ GType ipatch_dls2_conn_get_type (void) { static GType type = 0; if (!type) type = g_boxed_type_register_static ("IpatchDLS2Conn", (GBoxedCopyFunc)ipatch_dls2_conn_duplicate, (GBoxedFreeFunc)ipatch_dls2_conn_free); return (type); } /** * ipatch_dls2_conn_new: * * Create a new connection * * Returns: New connection */ IpatchDLS2Conn * ipatch_dls2_conn_new (void) { return (g_slice_new0 (IpatchDLS2Conn)); } /** * ipatch_dls2_conn_free: * @conn: Connection to free, should not be referenced by any zones. * * Free an #IpatchDLS2Conn structure */ void ipatch_dls2_conn_free (IpatchDLS2Conn *conn) { g_slice_free (IpatchDLS2Conn, conn); } /** * ipatch_dls2_conn_duplicate: * @conn: DLS connection to duplicate * * Duplicate a connection * * Returns: New duplicate connection */ IpatchDLS2Conn * ipatch_dls2_conn_duplicate (const IpatchDLS2Conn *conn) { IpatchDLS2Conn *newconn; g_return_val_if_fail (conn != NULL, NULL); newconn = ipatch_dls2_conn_new (); newconn->src = conn->src; newconn->ctrlsrc = conn->ctrlsrc; newconn->dest = conn->dest; newconn->trans = conn->trans; newconn->scale = conn->scale; return (newconn); } /** * ipatch_dls2_conn_list_set: * @list: Pointer to the root pointer of a connection list * @conn: DLS connection to set in @list * * Set a connection in a connection list. The connection list is searched for * any existing identical connection (same source, control and destination). * If an identical connection is found, its values are overwritten with the * new values, otherwise a new connection is added to the list and the values * copied to it. */ void ipatch_dls2_conn_list_set (GSList **list, const IpatchDLS2Conn *conn) { GSList *p, *last = NULL; IpatchDLS2Conn *c; g_return_if_fail (list != NULL); g_return_if_fail (conn != NULL); p = *list; while (p) { c = (IpatchDLS2Conn *)(p->data); if (IPATCH_DLS2_CONN_ARE_IDENTICAL (c, conn)) break; last = p; p = g_slist_next (p); } if (!p) /* duplicate not found? */ { c = ipatch_dls2_conn_duplicate (conn); if (last) last = g_slist_append (last, c); /* assign to supress gcc warning */ else *list = g_slist_append (NULL, c); } else *c = *conn; /* overwrite old connection values */ } /** * ipatch_dls2_conn_list_unset: * @list: Pointer to the root pointer of a connection list * @conn: DLS connection to remove from @list * * Remove a connection from a connection list. The connection list is * searched for an identical connection to @conn (same source, * control and destination). If a match is found, it is removed, otherwise * nothing. This essentially sets a connection to its default value, for * those connections which are defined. */ void ipatch_dls2_conn_list_unset (GSList **list, const IpatchDLS2Conn *conn) { IpatchDLS2Conn *c; GSList *p, *prev = NULL; g_return_if_fail (list != NULL); g_return_if_fail (conn != NULL); p = *list; while (p) { c = (IpatchDLS2Conn *)(p->data); if (IPATCH_DLS2_CONN_ARE_IDENTICAL (c, conn)) { /* free and remove connection */ ipatch_dls2_conn_free (c); if (!prev) *list = p->next; else prev->next = p->next; g_slist_free_1 (p); return; } prev = p; p = g_slist_next (p); } } /** * ipatch_dls2_conn_list_duplicate: * @list: GSList of #IpatchDLS2Conn structures to duplicate * * Duplicates a connection list (GSList and connection data). * * Returns: New duplicate connection list which should be freed with * ipatch_dls2_conn_list_free() when finished with it. */ GSList * ipatch_dls2_conn_list_duplicate (const GSList *list) { GSList *newlist = NULL; while (list) { newlist = g_slist_prepend (newlist, ipatch_dls2_conn_duplicate ((IpatchDLS2Conn *)(list->data))); list = list->next; } return (g_slist_reverse (newlist)); } /** * ipatch_dls2_conn_list_duplicate: * @list: GSList of #IpatchDLS2Conn structures to duplicate * * Like ipatch_dls2_conn_list_duplicate() but optimized for speed, new list * is backwards from original. * * Returns: New duplicate connection list which should be freed with * ipatch_dls2_conn_list_free() when finished with it. */ GSList * ipatch_dls2_conn_list_duplicate_fast (const GSList *list) { GSList *newlist = NULL; while (list) { newlist = g_slist_prepend (newlist, ipatch_dls2_conn_duplicate ((IpatchDLS2Conn *)(list->data))); list = list->next; } return (newlist); } /** * ipatch_dls2_conn_list_free: * @list: Connection list to free * @free_conns: If %TRUE then the connections themselves are freed, %FALSE * makes this function act just like g_slist_free() (only the list is * freed not the connections). * * Free a list of connections */ void ipatch_dls2_conn_list_free (GSList *list, gboolean free_conns) { GSList *p; if (free_conns) { p = list; while (p) { ipatch_dls2_conn_free ((IpatchDLS2Conn *)(p->data)); p = g_slist_delete_link (p, p); } } else g_slist_free (list); } libinstpatch-1.0.0/libinstpatch/IpatchDLS2Info.h0000644000175000017500000000675311461332142016433 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchDLS2Info * @short_description: DLS version 2 info functions and structure * @see_also: * @stability: Stable * * Structure and functions used for storing DLS informational properties at * many levels of the format. */ #ifndef __IPATCH_DLS2_INFO_H__ #define __IPATCH_DLS2_INFO_H__ #include #include #include #include typedef GSList IpatchDLS2Info; typedef struct _IpatchDLS2InfoBag IpatchDLS2InfoBag; /* a container for a INFO ID and value (generally not accessed directly) */ struct _IpatchDLS2InfoBag { guint32 fourcc; /* FOURCC int ID */ char *value; /* info string value */ }; /* known DLS2 INFO FOURCC IDs */ typedef enum { IPATCH_DLS2_ARCHIVE_LOCATION = IPATCH_DLS_FOURCC_IARL, IPATCH_DLS2_ARTIST = IPATCH_DLS_FOURCC_IART, IPATCH_DLS2_COMMISSIONED = IPATCH_DLS_FOURCC_ICMS, IPATCH_DLS2_COMMENT = IPATCH_DLS_FOURCC_ICMT, IPATCH_DLS2_COPYRIGHT = IPATCH_DLS_FOURCC_ICOP, IPATCH_DLS2_DATE = IPATCH_DLS_FOURCC_ICRD, IPATCH_DLS2_ENGINEER = IPATCH_DLS_FOURCC_IENG, IPATCH_DLS2_GENRE = IPATCH_DLS_FOURCC_IGNR, IPATCH_DLS2_KEYWORDS = IPATCH_DLS_FOURCC_IKEY, IPATCH_DLS2_MEDIUM = IPATCH_DLS_FOURCC_IMED, IPATCH_DLS2_NAME = IPATCH_DLS_FOURCC_INAM, IPATCH_DLS2_PRODUCT = IPATCH_DLS_FOURCC_IPRD, IPATCH_DLS2_SUBJECT = IPATCH_DLS_FOURCC_ISBJ, IPATCH_DLS2_SOFTWARE = IPATCH_DLS_FOURCC_ISFT, IPATCH_DLS2_SOURCE = IPATCH_DLS_FOURCC_ISRC, IPATCH_DLS2_SOURCE_FORM = IPATCH_DLS_FOURCC_ISRF, IPATCH_DLS2_TECHNICIAN = IPATCH_DLS_FOURCC_ITCH } IpatchDLS2InfoType; char *ipatch_dls2_info_get (IpatchDLS2Info *info, guint32 fourcc); G_CONST_RETURN char *ipatch_dls2_info_peek (IpatchDLS2Info *info, guint32 fourcc); void ipatch_dls2_info_set (IpatchDLS2Info **info, guint32 fourcc, const char *value); void ipatch_dls2_info_free (IpatchDLS2Info *info); IpatchDLS2Info *ipatch_dls2_info_duplicate (IpatchDLS2Info *info); gboolean ipatch_dls2_info_is_defined (guint32 fourcc); void ipatch_dls2_info_install_class_properties (GObjectClass *obj_class); gboolean ipatch_dls2_info_set_property (IpatchDLS2Info **info_list, guint property_id, const GValue *value); gboolean ipatch_dls2_info_get_property (IpatchDLS2Info *info_list, guint property_id, GValue *value); void ipatch_dls2_info_notify (IpatchItem *item, guint32 fourcc, const GValue *new_value, const GValue *old_value); IpatchDLS2InfoBag *ipatch_dls2_info_bag_new (void); void ipatch_dls2_info_bag_free (IpatchDLS2InfoBag *bag); #endif libinstpatch-1.0.0/libinstpatch/libinstpatch.h.in0000644000175000017500000001012511461354200017036 00000000000000/* * libinstpatch.h - Main public header file for libInstPatch * * libInstPatch - MIDI instrument patch library * Copyright (C) 1999-2007 Josh Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * 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., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA or point your web browser to http://www.gnu.org. */ #ifndef __LIB_INST_PATCH_H__ #define __LIB_INST_PATCH_H__ #include G_BEGIN_DECLS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include G_END_DECLS #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2VoiceCache_DLS.h0000644000175000017500000000417011461332142020110 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #ifndef __IPATCH_SF2_VOICE_CACHE_DLS_H__ #define __IPATCH_SF2_VOICE_CACHE_DLS_H__ #include #include #include #include typedef IpatchConverterSF2VoiceCache IpatchConverterDLS2InstToSF2VoiceCache; typedef IpatchConverterSF2VoiceCacheClass IpatchConverterDLS2InstToSF2VoiceCacheClass; typedef IpatchConverterSF2VoiceCache IpatchConverterDLS2RegionToSF2VoiceCache; typedef IpatchConverterSF2VoiceCacheClass IpatchConverterDLS2RegionToSF2VoiceCacheClass; typedef IpatchConverterSF2VoiceCache IpatchConverterDLS2SampleToSF2VoiceCache; typedef IpatchConverterSF2VoiceCacheClass IpatchConverterDLS2SampleToSF2VoiceCacheClass; #define IPATCH_TYPE_CONVERTER_DLS2_INST_TO_SF2_VOICE_CACHE \ (ipatch_converter_dls2_inst_to_sf2_voice_cache_get_type ()) #define IPATCH_TYPE_CONVERTER_DLS2_REGION_TO_SF2_VOICE_CACHE \ (ipatch_converter_dls2_region_to_sf2_voice_cache_get_type ()) #define IPATCH_TYPE_CONVERTER_DLS2_SAMPLE_TO_SF2_VOICE_CACHE \ (ipatch_converter_dls2_sample_to_sf2_voice_cache_get_type ()) GType ipatch_converter_dls2_inst_to_sf2_voice_cache_get_type (void); GType ipatch_converter_dls2_region_to_sf2_voice_cache_get_type (void); GType ipatch_converter_dls2_sample_to_sf2_voice_cache_get_type (void); #endif libinstpatch-1.0.0/libinstpatch/IpatchGigRegion.h0000644000175000017500000001072611461332142016760 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchGigRegion * @short_description: GigaSampler region object * @see_also: #IpatchGigInst, #IpatchGig * @stability: Stable * * GigaSampler region objects are children of #IpatchGigInst objects. */ #ifndef __IPATCH_GIG_REGION_H__ #define __IPATCH_GIG_REGION_H__ #include #include #include /* forward type declarations */ typedef struct _IpatchGigRegion IpatchGigRegion; typedef struct _IpatchGigRegionClass IpatchGigRegionClass; #include #include #include #include #include #define IPATCH_TYPE_GIG_REGION (ipatch_gig_region_get_type ()) #define IPATCH_GIG_REGION(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_GIG_REGION, \ IpatchGigRegion)) #define IPATCH_GIG_REGION_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_GIG_REGION, \ IpatchGigRegionClass)) #define IPATCH_IS_GIG_REGION(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_GIG_REGION)) #define IPATCH_IS_GIG_REGION_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_GIG_REGION)) #define IPATCH_GIG_REGION_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_GIG_REGION, \ IpatchGigRegionClass)) /* GigaSampler region object */ struct _IpatchGigRegion { IpatchContainer parent_instance; /*< private >*/ guint8 note_range_low; /* MIDI note range low value */ guint8 note_range_high; /* MIDI note range high value */ guint8 velocity_range_low; /* MIDI velocity range low value */ guint8 velocity_range_high; /* MIDI velocity range high value */ guint16 key_group; /* Exclusive key group number or 0 */ guint16 layer_group; /* layer group (descriptive only) */ guint16 phase_group; /* Phase locked group number or 0 */ guint16 channel; /* channel ID (IpatchDLS2RegionChannelType) */ IpatchDLS2Info *info; /* info string values */ guint8 dimension_count; /* dimension count (0-5) */ guint8 sub_region_count; /* 2 ^ sum (dimensions[].split_count) (1-32) */ IpatchGigDimension *dimensions[5]; /* [dimension_count] */ IpatchGigSubRegion *sub_regions[32]; /* [sub_region_count] */ guint8 chunk_3ddp[10]; /* FIXME - what is it? (16 bits / dimension?) */ }; /* GigaSampler region class */ struct _IpatchGigRegionClass { IpatchContainerClass parent_class; }; /* Flags crammed into IpatchItem flags (ditched 2 - 16 bit flag fields) */ /* FIXME - Are these used in GigaSampler files? */ typedef enum { IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE = 1 << IPATCH_CONTAINER_UNUSED_FLAG_SHIFT, IPATCH_GIG_REGION_PHASE_MASTER = 1 << (IPATCH_CONTAINER_UNUSED_FLAG_SHIFT + 1), IPATCH_GIG_REGION_MULTI_CHANNEL = 1 << (IPATCH_CONTAINER_UNUSED_FLAG_SHIFT + 2) } IpatchGigRegionFlags; #define IPATCH_GIG_REGION_FLAG_MASK (0x0F << IPATCH_CONTAINER_UNUSED_FLAG_SHIFT) /* 3 flags + 1 for expansion */ #define IPATCH_GIG_REGION_UNUSED_FLAG_SHIFT \ (IPATCH_CONTAINER_UNUSED_FLAG_SHIFT + 4) GType ipatch_gig_region_get_type (void); IpatchGigRegion *ipatch_gig_region_new (void); IpatchGigRegion *ipatch_gig_region_first (IpatchIter *iter); IpatchGigRegion *ipatch_gig_region_next (IpatchIter *iter); void ipatch_gig_region_set_note_range (IpatchGigRegion *region, int low, int high); void ipatch_gig_region_set_velocity_range (IpatchGigRegion *region, int low, int high); void ipatch_gig_region_new_dimension (IpatchGigRegion *region, IpatchGigDimensionType type, int split_count); void ipatch_gig_region_remove_dimension (IpatchGigRegion *region, int dim_index, int split_index); #endif libinstpatch-1.0.0/libinstpatch/IpatchSF2VoiceCache_VBank.c0000644000175000017500000001626011461332142020465 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchSF2VoiceCache_VBank.h" #include "IpatchConverter.h" #include "IpatchConverter_priv.h" #include "IpatchSF2VoiceCache.h" #include "IpatchVBankInst.h" #include "IpatchVBankRegion.h" #include "misc.h" #include "i18n.h" void _ipatch_sf2_voice_cache_init_VBank (void) { g_type_class_ref (IPATCH_TYPE_CONVERTER_VBANK_INST_TO_SF2_VOICE_CACHE); g_type_class_ref (IPATCH_TYPE_CONVERTER_VBANK_REGION_TO_SF2_VOICE_CACHE); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_VBANK_INST_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_VBANK_INST, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); ipatch_register_converter_map (IPATCH_TYPE_CONVERTER_VBANK_REGION_TO_SF2_VOICE_CACHE, 0, IPATCH_TYPE_VBANK_REGION, 0, 1, IPATCH_TYPE_SF2_VOICE_CACHE, 0, 1); } static gboolean _vbank_inst_to_sf2_voice_cache_convert (IpatchConverter *converter, GError **err) { IpatchVBankInst *inst; IpatchSF2VoiceCache *cache, *item_vcache; IpatchVBankRegion *region; IpatchConverter *itemconv; IpatchSF2Voice *voice, *item_voice; GObject *obj; GSList *p; int note_index; int *note_range; int note_low, note_high; GError *localerr = NULL; int voicendx; int root_note; obj = IPATCH_CONVERTER_INPUT (converter); cache = IPATCH_SF2_VOICE_CACHE (IPATCH_CONVERTER_OUTPUT (converter)); /* find which selection index is the MIDI note range */ for (note_index = 0; note_index < cache->sel_count; note_index++) if (cache->sel_info[note_index].type == IPATCH_SF2_VOICE_SEL_NOTE) break; if (note_index == cache->sel_count) note_index = -1; else note_index *= 2; /* convert to integer pair offset in ranges array */ /* check if its a vbank instrument or region */ if (IPATCH_IS_VBANK_REGION (obj)) /* ++ ref parent instrument */ inst = IPATCH_VBANK_INST (ipatch_item_get_parent (IPATCH_ITEM (obj))); else inst = IPATCH_VBANK_INST (obj); /* declare the instrument as a dependent item */ ipatch_sf2_voice_cache_declare_item (cache, (GObject *)inst); IPATCH_ITEM_RLOCK (inst); /* ++ lock instrument */ for (p = inst->regions; p; p = p->next) { region = (IpatchVBankRegion *)(p->data); IPATCH_ITEM_RLOCK (region); /* ++ lock region */ /* ++ ref new converter for region's item */ itemconv = ipatch_create_converter (G_OBJECT_TYPE (region->item), IPATCH_TYPE_SF2_VOICE_CACHE); /* skip any regions with un-synthesizable items - and log a warning */ if (!itemconv) { IPATCH_ITEM_RUNLOCK (region); /* -- unlock region */ ipatch_converter_log (converter, G_OBJECT (region), IPATCH_CONVERTER_LOG_WARN, _("No voice handler for region item")); continue; } /* ++ ref - create voice cache for region's referenced item */ item_vcache = ipatch_sf2_voice_cache_new (cache->sel_info, cache->sel_count); ipatch_converter_add_input (itemconv, (GObject *)(region->item)); ipatch_converter_add_output (itemconv, (GObject *)item_vcache); if (!ipatch_converter_convert (itemconv, &localerr)) { IPATCH_ITEM_RUNLOCK (region); /* -- unlock region */ ipatch_converter_log_printf (converter, G_OBJECT (region), IPATCH_CONVERTER_LOG_WARN, _("Failed to convert region item to voices: %s"), ipatch_gerror_message (localerr)); g_clear_error (&localerr); g_object_unref (itemconv); /* -- unref */ g_object_unref (item_vcache); /* -- unref */ continue; } g_object_unref (itemconv); /* -- unref item converter */ note_low = region->note_range.low; note_high = region->note_range.high; /* loop over voices in item's voice cache */ for (voicendx = 0; voicendx < item_vcache->voices->len; voicendx++) { item_voice = IPATCH_SF2_VOICE_CACHE_GET_VOICE (item_vcache, voicendx); if (note_index >= 0) note_range = &g_array_index (item_vcache->ranges, int, item_voice->range_index + note_index); else note_range = NULL; /* if intersect note range mode.. */ if (region->note_range_mode == IPATCH_VBANK_REGION_NOTE_RANGE_MODE_INTERSECT && note_range) { /* note ranges are exclusive? - skip voice */ if (note_range[0] != IPATCH_SF2_VOICE_SEL_WILDCARD && note_range[1] != IPATCH_SF2_VOICE_SEL_WILDCARD && ((note_low < note_range[0] && note_high < note_range[0]) || (note_low > note_range[1] && note_high > note_range[1]))) continue; } voice = ipatch_sf2_voice_cache_add_voice (cache); ipatch_sf2_voice_copy (voice, item_voice); /* copy voice selection criteria */ memcpy (&g_array_index (cache->ranges, int, voice->range_index), &g_array_index (item_vcache->ranges, int, item_voice->range_index), 2 * cache->sel_count * sizeof (int)); /* modify note range depending on mode */ if (note_index >= 0) { note_range = &g_array_index (cache->ranges, int, voice->range_index + note_index); if (region->note_range_mode == IPATCH_VBANK_REGION_NOTE_RANGE_MODE_INTERSECT) { note_range[0] = MAX (note_low, note_range[0]); note_range[1] = MIN (note_high, note_range[1]); } else /* IPATCH_VBANK_REGION_NOTE_RANGE_MODE_OVERRIDE */ { note_range[0] = note_low; note_range[1] = note_high; } } /* modify root note tuning depending on mode */ if (region->root_note_mode == IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OFFSET) { root_note = voice->root_note + region->root_note; voice->root_note = CLAMP (root_note, 0, 127); } /* IPATCH_VBANK_REGION_ROOT_NOTE_MODE_OVERRIDE */ else voice->root_note = region->root_note; } /* for voicendx in item_vcache->voices */ IPATCH_ITEM_RUNLOCK (region); /* -- unlock region */ g_object_unref (item_vcache); /* -- unref item voice cache */ } /* for p in regions */ IPATCH_ITEM_RUNLOCK (inst); /* -- unlock instrument */ /* if convert object was vbank region, unref parent instrument */ if ((void *)obj != (void *)inst) g_object_unref (inst); /* -- unref parent instrument */ return (TRUE); } #define _vbank_region_to_sf2_voice_cache_convert \ _vbank_inst_to_sf2_voice_cache_convert CONVERTER_CLASS_INIT(vbank_inst_to_sf2_voice_cache); CONVERTER_CLASS_INIT(vbank_region_to_sf2_voice_cache); CONVERTER_GET_TYPE(vbank_inst_to_sf2_voice_cache, VBankInstToSF2VoiceCache); CONVERTER_GET_TYPE(vbank_region_to_sf2_voice_cache, VBankRegionToSF2VoiceCache); libinstpatch-1.0.0/libinstpatch/IpatchSF2ModItem.c0000644000175000017500000002142711461332142016752 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Moderal Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Moderal Public License for more details. * * You should have received a copy of the GNU Moderal Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include "IpatchSF2ModItem.h" #include "IpatchSF2Gen.h" #include "ipatch_priv.h" static void ipatch_sf2_mod_item_iface_init (IpatchSF2ModItemIface *iface); GType ipatch_sf2_mod_item_get_type (void) { static GType itype = 0; if (!itype) { static const GTypeInfo info = { sizeof (IpatchSF2ModItemIface), NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc) ipatch_sf2_mod_item_iface_init, (GClassFinalizeFunc) NULL }; itype = g_type_register_static (G_TYPE_INTERFACE, "IpatchSF2ModItemIface", &info, 0); /* IpatchSF2ModItemIface types must be IpatchItem objects (for locking) */ g_type_interface_add_prerequisite (itype, IPATCH_TYPE_ITEM); } return (itype); } static void ipatch_sf2_mod_item_iface_init (IpatchSF2ModItemIface *iface) { g_object_interface_install_property (iface, g_param_spec_boxed ("modulators", _("Modulators"), _("Modulators"), IPATCH_TYPE_SF2_MOD_LIST, G_PARAM_READWRITE)); } /** * ipatch_sf2_mod_item_get_mods: * @item: Item with modulators * * Gets a list of modulators from an item with modulators. List should be freed * with ipatch_sf2_mod_list_free() (free_mods set to %TRUE) when finished * with it. * * Returns: New list of modulators (#IpatchSF2Mod) in @item or %NULL if no * modulators. Remember to free it with ipatch_sf2_mod_list_free() when finished. */ GSList * ipatch_sf2_mod_item_get_mods (IpatchSF2ModItem *item) { IpatchSF2ModItemIface *iface; GSList **pmods, *newlist = NULL; IpatchSF2Mod *mod; GSList *p; g_return_val_if_fail (IPATCH_IS_SF2_MOD_ITEM (item), NULL); /* get pointer to GSList from IpatchSF2ModItemIface->modlist_ofs */ iface = IPATCH_SF2_MOD_ITEM_GET_IFACE (item); g_return_val_if_fail (iface->modlist_ofs != 0, NULL); pmods = (GSList **)G_STRUCT_MEMBER_P (item, iface->modlist_ofs); IPATCH_ITEM_RLOCK (item); p = *pmods; while (p) { mod = ipatch_sf2_mod_duplicate ((IpatchSF2Mod *)(p->data)); newlist = g_slist_prepend (newlist, mod); p = p->next; } IPATCH_ITEM_RUNLOCK (item); newlist = g_slist_reverse (newlist); return (newlist); } /** * ipatch_sf2_mod_item_set_mods: * @item: Item with modulators * @mod_list: Modulator list to assign to zone. * @flags: Flags for controlling list duplication and item property * notification (#IpatchSF2ModFlags). If #IPATCH_SF2_MOD_NO_DUPLICATE * is set then ownership of @mod_list is taken over (not duplicated). * If #IPATCH_SF2_MOD_NO_NOTIFY is set, then item property notify will not * be done. * * Sets the complete modulator list of an item with modulators. * If #IPATCH_SF2_MOD_NO_NOTIFY is not in @flags then #IpatchItem property * notify is done. */ void ipatch_sf2_mod_item_set_mods (IpatchSF2ModItem *item, GSList *mod_list, int flags) { GValue old_value = { 0 }, new_value = { 0 }; GSList **pmods, *oldlist, *newlist; IpatchSF2ModItemIface *iface; g_return_if_fail (IPATCH_IS_SF2_MOD_ITEM (item)); /* get pointer to GSList from IpatchSF2ModItemIface->modlist_ofs */ iface = IPATCH_SF2_MOD_ITEM_GET_IFACE (item); g_return_if_fail (iface->modlist_ofs != 0); pmods = (GSList **)G_STRUCT_MEMBER_P (item, iface->modlist_ofs); /* duplicate list if NO_DUPLICATE flag not set */ if (!(flags & IPATCH_SF2_MOD_NO_DUPLICATE)) newlist = ipatch_sf2_mod_list_duplicate (mod_list); else newlist = mod_list; IPATCH_ITEM_RLOCK (item); oldlist = *pmods; *pmods = newlist; IPATCH_ITEM_RUNLOCK (item); /* do property notify if NO_NOTIFY flag not set */ if (!(flags & IPATCH_SF2_MOD_NO_NOTIFY)) { /* old notify value takes over old list */ g_value_init (&old_value, IPATCH_TYPE_SF2_MOD_LIST); g_value_take_boxed (&old_value, oldlist); g_value_init (&new_value, IPATCH_TYPE_SF2_MOD_LIST); g_value_set_static_boxed (&new_value, mod_list); ipatch_item_prop_notify (item, iface->mod_pspec, &new_value, &old_value); g_value_unset (&new_value); g_value_unset (&old_value); } else ipatch_sf2_mod_list_free (oldlist, TRUE); /* free old list if no notify */ } /** * ipatch_sf2_mod_item_insert: * @item: Item with modulators * @mod: Modulator to insert (a new modulator is created and the * values are copied to it) * @pos: Index position in zone's modulator list to insert * (0 = first, < 0 = last) * * Inserts a modulator into an item's modulator list. Does not check for * duplicates! The modulator is not used directly, a new one is created and * the values in @mod are copied to it. * An #IpatchItem property notify is done. */ void ipatch_sf2_mod_item_insert (IpatchSF2ModItem *item, const IpatchSF2Mod *mod, int pos) { IpatchSF2Mod *newmod; GSList *newlist; g_return_if_fail (IPATCH_IS_SF2_MOD_ITEM (item)); g_return_if_fail (mod != NULL); /* get the current MOD list */ newlist = ipatch_sf2_mod_item_get_mods (item); newmod = ipatch_sf2_mod_duplicate (mod); /* duplicate the modulator vals */ newlist = g_slist_insert (newlist, newmod, pos); /* insert mod */ /* assign the new modulator list (item takes it over, no duplicating) */ ipatch_sf2_mod_item_set_mods (item, newlist, IPATCH_SF2_MOD_NO_DUPLICATE); } /** * ipatch_sf2_mod_item_remove: * @item: Item with modulators * @mod: Matching values of modulator to remove * * Remove a modulator from an item with modulators. The modulator values in @mod * are used to search the modulator list. The first modulator * that matches all fields in @mod is removed. * An #IpatchItem property notify is done. */ void ipatch_sf2_mod_item_remove (IpatchSF2ModItem *item, const IpatchSF2Mod *mod) { GSList *newlist; gboolean changed; g_return_if_fail (IPATCH_IS_SF2_MOD_ITEM (item)); g_return_if_fail (mod != NULL); /* get the current MOD list */ newlist = ipatch_sf2_mod_item_get_mods (item); /* remove the modulator */ newlist = ipatch_sf2_mod_list_remove (newlist, mod, &changed); /* assign the new modulator list (item takes it over, no duplicating) */ if (changed) ipatch_sf2_mod_item_set_mods (item, newlist, IPATCH_SF2_MOD_NO_DUPLICATE); else ipatch_sf2_mod_list_free (newlist, TRUE); /* not changed, free list */ } /** * ipatch_sf2_mod_item_change: * @item: Item with modulators * @oldmod: Current values of modulator to set * @newmod: New modulator values * * Sets the values of an existing modulator in an item with modulators. The * modulator list in item is searched for a modulator that matches the values in * @oldmod. If a modulator is found its values are set to those in @newmod. * If it is not found, nothing is done. * If change occurs #IpatchItem property notify is done. */ void ipatch_sf2_mod_item_change (IpatchItem *item, const IpatchSF2Mod *oldmod, const IpatchSF2Mod *newmod) { GSList *newlist; gboolean changed; g_return_if_fail (IPATCH_IS_SF2_MOD_ITEM (item)); g_return_if_fail (oldmod != NULL); g_return_if_fail (newmod != NULL); /* get the current MOD list */ newlist = ipatch_sf2_mod_item_get_mods (item); /* change the modulator */ changed = ipatch_sf2_mod_list_change (newlist, oldmod, newmod); /* if changed - assign the new modulator list (item takes it over) */ if (changed) ipatch_sf2_mod_item_set_mods (item, newlist, IPATCH_SF2_MOD_NO_DUPLICATE); else ipatch_sf2_mod_list_free (newlist, TRUE); /* not changed, free list */ } /** * ipatch_sf2_mod_item_count: * @item: Item with modulators * * Count number of modulators in an item with modulators. * * Returns: Count of modulators */ guint ipatch_sf2_mod_item_count (IpatchSF2ModItem *item) { IpatchSF2ModItemIface *iface; GSList **pmods; guint i; g_return_val_if_fail (IPATCH_IS_SF2_MOD_ITEM (item), 0); /* get pointer to GSList from IpatchSF2ModItemIface->modlist_ofs */ iface = IPATCH_SF2_MOD_ITEM_GET_IFACE (item); g_return_val_if_fail (iface->modlist_ofs != 0, 0); pmods = (GSList **)G_STRUCT_MEMBER_P (item, iface->modlist_ofs); IPATCH_ITEM_RLOCK (item); i = g_slist_length (*pmods); IPATCH_ITEM_RUNLOCK (item); return (i); } libinstpatch-1.0.0/libinstpatch/IpatchDLS2Info.c0000644000175000017500000003131211461332142016413 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include #include "IpatchDLS2Info.h" #include "IpatchParamProp.h" #include "ipatch_priv.h" /* list bag for associating a hash with an object class that has IpatchDLS2Info properties */ typedef struct { GObjectClass *obj_class; GHashTable *prop_hash; } HashListBag; static void install_prop_helper (GObjectClass *obj_class, guint property_id, GParamSpec *pspec, GHashTable *hash); /* list of GHashTable (property_id -> GParamSpec *) to speed up info property notifies */ static GSList *info_hash_list = NULL; /** * ipatch_dls2_info_get: * @info: DLS2 info list * @fourcc: FOURCC info ID * * Gets the value of the info specified by the @fourcc ID from an @info list. * * Returns: Newly allocated info string value or %NULL if the specified info * is not set. Should be freed when no longer needed. */ char * ipatch_dls2_info_get (IpatchDLS2Info *info, guint32 fourcc) { const char *value; value = ipatch_dls2_info_peek (info, fourcc); if (value) return (g_strdup (value)); else return (NULL); } /** * ipatch_dls2_info_peek: * @info: DLS2 info list * @fourcc: FOURCC info ID * * Gets the value of the info specified by the @fourcc ID from an @info list. * Like ipatch_dls2_info_get but returns the string value without duplicating * it. * * Returns: Info string value or %NULL if the specified info is not * set. Value is internal and should not be modified or freed. */ G_CONST_RETURN char * ipatch_dls2_info_peek (IpatchDLS2Info *info, guint32 fourcc) { GSList *p = info; IpatchDLS2InfoBag *bag; while (p) { bag = (IpatchDLS2InfoBag *)(p->data); if (bag->fourcc == fourcc) return (bag->value); p = g_slist_next (p); } return (NULL); } /** * ipatch_dls2_info_set: * @info: DLS2 info list * @fourcc: FOURCC info ID * @value: String value to set info to or %NULL to unset * * Sets the info specified by the @fourcc ID in an @info list to a * string @value. */ void ipatch_dls2_info_set (IpatchDLS2Info **info, guint32 fourcc, const char *value) { GSList *p, *last = NULL; IpatchDLS2InfoBag *bag; p = *info; while (p) /* search for existing info with fourcc ID */ { bag = (IpatchDLS2InfoBag *)(p->data); if (bag->fourcc == fourcc) { /* found the info by foucc ID */ g_free (bag->value); if (!value) /* unset the value? */ { *info = g_slist_delete_link (*info, p); ipatch_dls2_info_bag_free (bag); } else bag->value = g_strdup (value); /* set the value */ return; } last = p; p = g_slist_next (p); } if (!value) return; /* no value to unset */ bag = ipatch_dls2_info_bag_new (); bag->fourcc = fourcc; bag->value = g_strdup (value); if (last) last = g_slist_append (last, bag); /* info list not empty? assign to keep gcc happy */ else *info = g_slist_append (NULL, bag); } /** * ipatch_dls2_info_free: * @info: DLS2 info list * * Free a DLS info list. */ void ipatch_dls2_info_free (IpatchDLS2Info *info) { GSList *p = info; IpatchDLS2InfoBag *bag; while (p) { bag = (IpatchDLS2InfoBag *)(p->data); g_free (bag->value); ipatch_dls2_info_bag_free (bag); p = g_slist_delete_link (p, p); } } /** * ipatch_dls2_info_duplicate: * @info: DLS2 info list to duplicate * * Duplicate a DLS2 info list. * * Returns: Newly created info list or %NULL if @info was NULL. Free it with * ipatch_dls2_info_free() when finished with it. */ IpatchDLS2Info * ipatch_dls2_info_duplicate (IpatchDLS2Info *info) { GSList *newinfo = NULL, *p = info; IpatchDLS2InfoBag *newbag, *bag; while (p) { bag = (IpatchDLS2InfoBag *)(p->data); newbag = ipatch_dls2_info_bag_new (); newbag->fourcc = bag->fourcc; newbag->value = g_strdup (bag->value); newinfo = g_slist_prepend (newinfo, bag); p = g_slist_next (p); } return (g_slist_reverse (newinfo)); } /** * ipatch_dls2_info_is_defined: * @fourcc: FOURCC INFO id to check if defined * * Checks if a FOURCC INFO id is a defined INFO id. * * Returns: %TRUE if @fourcc INFO id is defined, %FALSE otherwise */ gboolean ipatch_dls2_info_is_defined (guint32 fourcc) { switch (fourcc) { case IPATCH_DLS2_NAME: case IPATCH_DLS2_DATE: case IPATCH_DLS2_ENGINEER: case IPATCH_DLS2_PRODUCT: case IPATCH_DLS2_COPYRIGHT: case IPATCH_DLS2_COMMENT: case IPATCH_DLS2_SOFTWARE: case IPATCH_DLS2_ARCHIVE_LOCATION: case IPATCH_DLS2_ARTIST: case IPATCH_DLS2_COMMISSIONED: case IPATCH_DLS2_GENRE: case IPATCH_DLS2_KEYWORDS: case IPATCH_DLS2_MEDIUM: case IPATCH_DLS2_SUBJECT: case IPATCH_DLS2_SOURCE: case IPATCH_DLS2_SOURCE_FORM: case IPATCH_DLS2_TECHNICIAN: return (TRUE); default: return (FALSE); } } /** * ipatch_dls2_info_install_class_properties: * @obj_class: GObjectClass to install INFO properties on * * Installs INFO properties for the supplied @obj_class. Used for * class construction of objects implementing IpatchDLS2InfoType * properties. */ void ipatch_dls2_info_install_class_properties (GObjectClass *obj_class) { HashListBag *bag; GHashTable *hash; hash = g_hash_table_new (NULL, NULL); bag = g_new (HashListBag, 1); bag->obj_class = obj_class; bag->prop_hash = hash; info_hash_list = g_slist_prepend (info_hash_list, bag); install_prop_helper (obj_class, IPATCH_DLS2_NAME, g_param_spec_string ("name", _("Name"), _("Name"), _("untitled"), G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE), hash); install_prop_helper (obj_class, IPATCH_DLS2_DATE, g_param_spec_string ("date", _("Date"), _("Creation date (YYYY-MM-DD)"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_ENGINEER, g_param_spec_string ("engineer", _("Engineer"), _("Engineers separated by \"; \""), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_PRODUCT, g_param_spec_string ("product", _("Product"), _("Product intended for"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_COPYRIGHT, g_param_spec_string ("copyright", _("Copyright"), _("Copyright"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_COMMENT, g_param_spec_string ("comment", _("Comments"), _("Comments"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_SOFTWARE, g_param_spec_string ("software", _("Software"), _("Editor software used"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_ARCHIVE_LOCATION, g_param_spec_string ("archive-location", _("Archive Location"), _("Location where subject is archived"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_ARTIST, g_param_spec_string ("artist", _("Artist"), _("Original artist"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_COMMISSIONED, g_param_spec_string ("commissioned", _("Commissioned"), _("Who commissioned the material"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_GENRE, g_param_spec_string ("genre", _("Genre"), _("Genre"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_KEYWORDS, g_param_spec_string ("keywords", _("Keywords"), _("Keywords (separated by \"; \")"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_MEDIUM, g_param_spec_string ("medium", _("Medium"), _("Original medium of the material (record, CD, etc)"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_SUBJECT, g_param_spec_string ("subject", _("Subject"), _("Subject of the material"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_SOURCE, g_param_spec_string ("source", _("Source"), _("Source of the original material"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_SOURCE_FORM, g_param_spec_string ("source-form", _("Source form"), _("Original source that was digitized"), NULL, G_PARAM_READWRITE), hash); install_prop_helper (obj_class, IPATCH_DLS2_TECHNICIAN, g_param_spec_string ("technician", _("Technician"), _("Technician who sampled the material"), NULL, G_PARAM_READWRITE), hash); } /* helper function to hash property_id->pspec and install the property also */ static void install_prop_helper (GObjectClass *obj_class, guint property_id, GParamSpec *pspec, GHashTable *hash) { g_hash_table_insert (hash, GUINT_TO_POINTER (property_id), pspec); g_object_class_install_property (obj_class, property_id, pspec); } /** * ipatch_dls2_info_set_property: * @info_list: Pointer to a list of #IpatchDLS2Info structures * @property_id: FOURCC INFO property id to set value of * @value: A string GValue to set INFO value to * * A function used by object set_property methods that implement a * #IpatchDLS2Info list to set an INFO property. * * Returns: %TRUE if @property_id is a valid INFO id, %FALSE otherwise */ gboolean ipatch_dls2_info_set_property (GSList **info_list, guint property_id, const GValue *value) { if (ipatch_dls2_info_is_defined (property_id)) { ipatch_dls2_info_set (info_list, property_id, g_value_get_string (value)); return (TRUE); } else return (FALSE); } /** * ipatch_dls2_info_get_property: * @info_list: A list of #IpatchDLS2Info structures * @property_id: FOURCC INFO property id to get value of * @value: A string GValue to store the value of the info to * * A function used by object set_property methods that implement a * #IpatchDLS2Info list to get an INFO property. * * Returns: %TRUE if @property_id is a valid INFO id, %FALSE otherwise */ gboolean ipatch_dls2_info_get_property (GSList *info_list, guint property_id, GValue *value) { if (ipatch_dls2_info_is_defined (property_id)) { g_value_set_string (value, ipatch_dls2_info_get (info_list, property_id)); return (TRUE); } else return (FALSE); } /** * ipatch_dls2_info_notify: * @item: Item with INFO properties to notify property change on * @fourcc: FOURCC property ID of info that has changed * @new_value: New value assigned to the property * @old_value: Old value of property * * Notify a changed INFO property on @item for the given fourcc ID. * A convenience function to objects that implement a #IpatchDLS2Info list. */ void ipatch_dls2_info_notify (IpatchItem *item, guint32 fourcc, const GValue *new_value, const GValue *old_value) { GHashTable *found_prop_hash = NULL; GObjectClass *obj_class; GParamSpec *found_pspec = NULL; GSList *p; g_return_if_fail (IPATCH_IS_ITEM (item)); g_return_if_fail (G_IS_VALUE (new_value)); g_return_if_fail (G_IS_VALUE (old_value)); obj_class = G_OBJECT_GET_CLASS (item); /* search for property hash table for the object's class */ for (p = info_hash_list; p; p = p->next) { if (((HashListBag *)(p->data))->obj_class == obj_class) { found_prop_hash = ((HashListBag *)(p->data))->prop_hash; break; } } g_return_if_fail (found_prop_hash); found_pspec = g_hash_table_lookup (found_prop_hash, GUINT_TO_POINTER (fourcc)); g_return_if_fail (found_pspec != NULL); ipatch_item_prop_notify (item, found_pspec, new_value, old_value); } /** * ipatch_dls2_info_bag_new: * * Create a new DLS info bag structure. * * Returns: Newly allocated info bag. */ IpatchDLS2InfoBag * ipatch_dls2_info_bag_new (void) { return (g_slice_new0 (IpatchDLS2InfoBag)); } /** * ipatch_dls2_info_bag_free: * @bag: Info bag structure to free * * Free a DLS info bag allocated with ipatch_dls2_info_bag_new(). */ void ipatch_dls2_info_bag_free (IpatchDLS2InfoBag *bag) { g_return_if_fail (bag != NULL); g_slice_free (IpatchDLS2InfoBag, bag); } libinstpatch-1.0.0/libinstpatch/IpatchGigFile.h0000644000175000017500000001351411461332142016412 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ /** * SECTION: IpatchGigFile * @short_description: GigaSampler file object * @see_also: * @stability: Stable * * File type for GigaSampler files. */ #ifndef __IPATCH_GIG_FILE_H__ #define __IPATCH_GIG_FILE_H__ #include #include #include #include /* * A GigaSampler file is based on DLS2 with many proprietary extensions. * Descriptions of chunks below that start with DLS are part of the DLS * standard, while the "Gig" ones are GigaSampler specific. * Extensions and quirks for the GigaSampler format: * * Toplevel file chunk is rather specific. * Sub chunks are listed in this order: * IARL IART ICMS ICMT ICOP ICRD IENG IGNR IKEY IMED INAM IPRD ISBJ ISFT * ISRC ISRF ITCH * The IARL chunk is always 256 bytes long and padded with spaces ' ' ???? * The ICMT chunk is 1024 bytes and padded with NULLs * All other chunks are 128 bytes and padded with NULLs * * * lins->ins: DLS instrument * INFO - DLS INFO LIST * INAM - Name always 64 bytes "GigaSampler Instrument Editor 2.0", etc * ISFT - Software always 12 bytes "Endless Wave" * dlid - DLS unique ID * insh - DLS instrument header * lrgn - DLS Region LIST * rgn - DLS instrument region (LIST) * rgnh - DLS region header * wsmp - DLS sample parameters * wlnk - DLS wave link parameters * 3lnk - Gig dimension info * 3prg - Gig LIST chunk * 3ewl - Gig LIST chunk (one for each sub region) * wsmp - DLS sample parameters (tuning, gain and loop) * 3ewa - Gig Envelop/LFO/Filter parameters (IpatchGigEffects) * 3ewl * wsmp * 3ewa * ... * 3dnl - Gig dimension names (up to 5 zero terminated strings) * 3ddp - Gig ???? (size 10, 2 byte words for each dimension?) * rgn - next DLS region * ... * lart - DLS Articulation LIST * 3ewg - Gig global instrument parameters * 3gri - Gig LIST * 3gnl - Gig LIST * 3gnm - Gig sample group names * ptbl - DLS pool table * wvpl - DLS wave pool LIST * wave - DLS RIFF wave file * fmt - DLS WAVE format * INFO - DLS INFO list * INAM - Name always 64 bytes * data - DLS WAVE sample data * smpl - Gig sample parameters * 3gix - Gig sample group number * einf - Unknown (perhaps to speed up loading?) */ typedef struct _IpatchGigFile IpatchGigFile; typedef struct _IpatchGigFileClass IpatchGigFileClass; #define IPATCH_TYPE_GIG_FILE (ipatch_gig_file_get_type ()) #define IPATCH_GIG_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_GIG_FILE, IpatchGigFile)) #define IPATCH_GIG_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_GIG_FILE, IpatchGigFileClass)) #define IPATCH_IS_GIG_FILE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_GIG_FILE)) #define IPATCH_IS_GIG_FILE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_GIG_FILE)) #define IPATCH_GIG_FILE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_GIG_FILE, \ IpatchGigFileClass)) /* GigaSampler file object (derived from IpatchDLSFile) */ struct _IpatchGigFile { IpatchDLSFile parent_instance; }; /* GigaSampler file class (derived from IpatchDLSFile) */ struct _IpatchGigFileClass { IpatchDLSFileClass parent_class; }; /* RIFF chunk FOURCC guint32 integers - list chunks*/ #define IPATCH_GIG_FOURCC_3PRG IPATCH_FOURCC ('3','p','r','g') #define IPATCH_GIG_FOURCC_3EWL IPATCH_FOURCC ('3','e','w','l') #define IPATCH_GIG_FOURCC_3DNL IPATCH_FOURCC ('3','d','n','l') #define IPATCH_GIG_FOURCC_3GNL IPATCH_FOURCC ('3','g','n','l') #define IPATCH_GIG_FOURCC_3GRI IPATCH_FOURCC ('3','g','r','i') /* sub chunks */ #define IPATCH_GIG_FOURCC_SMPL IPATCH_FOURCC ('s','m','p','l') #define IPATCH_GIG_FOURCC_3DDP IPATCH_FOURCC ('3','d','d','p') #define IPATCH_GIG_FOURCC_3EWA IPATCH_FOURCC ('3','e','w','a') #define IPATCH_GIG_FOURCC_3EWG IPATCH_FOURCC ('3','e','w','g') #define IPATCH_GIG_FOURCC_3GIX IPATCH_FOURCC ('3','g','i','x') #define IPATCH_GIG_FOURCC_3GNM IPATCH_FOURCC ('3','g','n','m') #define IPATCH_GIG_FOURCC_3LNK IPATCH_FOURCC ('3','l','n','k') #define IPATCH_GIG_FOURCC_EINF IPATCH_FOURCC ('e','i','n','f') /* file chunk sizes */ #define IPATCH_GIG_SMPL_SIZE 60 #define IPATCH_GIG_3DDP_SIZE 10 #define IPATCH_GIG_3EWA_SIZE 140 #define IPATCH_GIG_3EWG_SIZE 12 #define IPATCH_GIG_3GIX_SIZE 4 #define IPATCH_GIG_3GNM_SIZE 64 #define IPATCH_GIG_3LNK_SIZE 172 /* size of instrument and sample name INFO chunk sizes */ #define IPATCH_GIG_ITEM_INAM_SIZE 64 /* fixed sizes for toplevel file INFO chunks */ #define IPATCH_GIG_MOST_INFO_SIZE 128 /* size of all chunks except 2 below */ #define IPATCH_GIG_IARL_INFO_SIZE 256 /* this one is padded with spaces ' ' */ #define IPATCH_GIG_ICMT_INFO_SIZE 1024 /* Software INFO value for GigaSampler instruments */ /* FIXME - Should we put something else there? */ #define IPATCH_GIG_INST_ISFT_VAL "Endless Wave" GType ipatch_gig_file_get_type (void); IpatchGigFile *ipatch_gig_file_new (void); #endif libinstpatch-1.0.0/libinstpatch/misc.c0000644000175000017500000005302311461403703014702 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #include #include #include /* for mkdir */ #include #include #include "libinstpatch.h" #include "ipatch_priv.h" #include "i18n.h" /* private initializers in other source files */ void _ipatch_sf2_gen_init (void); /* IpatchSF2Gen.c */ void _ipatch_param_init (void); /* IpatchParam.c */ void _ipatch_type_prop_init (void); /* IpatchTypeProp.c */ void _ipatch_util_init (void); /* util.c */ void _ipatch_unit_init (void); /* unit.c */ void _ipatch_xml_object_init (void); /* IpatchXmlObject.c */ void _ipatch_range_init (void); /* IpatchRange.c */ void _ipatch_converter_init (void); /* IpatchConverter.c */ void _ipatch_convert_SF2_init (void); void _ipatch_convert_gig_init (void); void _ipatch_convert_DLS2_init (void); void _ipatch_sf2_voice_cache_init_DLS (void); void _ipatch_sf2_voice_cache_init_SF2 (void); void _ipatch_sf2_voice_cache_init_gig (void); void _ipatch_sf2_voice_cache_init_VBank (void); static gboolean ipatch_strv_xml_encode (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); static gboolean ipatch_strv_xml_decode (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err); static void virtual_parent_dls2_inst (GType type, GParamSpec *spec, GValue *value, GObject *object); static void virtual_parent_gig_inst (GType type, GParamSpec *spec, GValue *value, GObject *object); static void virtual_parent_sf2_preset (GType type, GParamSpec *spec, GValue *value, GObject *object); static void virtual_parent_sf2_sample (GType type, GParamSpec *spec, GValue *value, GObject *object); static void conform_percussion (GObject *object); static void conform_melodic (GObject *object); static void dump_recursive (GObject *object, char *indent, FILE *file); static void dump_object_info (GObject *object, char *indent, FILE *file); typedef struct { char *type_name; char *name; char *blurb; int category; } TypePropInit; /* info to initialize type properties */ static TypePropInit type_props[] = { { "IpatchSampleStoreSndFile", N_("Sample file"), NULL, IPATCH_CATEGORY_SAMPLE }, { "IpatchDLS2", N_("DLS"), N_("Down Loadable Sounds"), IPATCH_CATEGORY_BASE }, { "IpatchDLS2Inst", N_("Instrument"), N_("DLS Instrument"), IPATCH_CATEGORY_PROGRAM }, { "IpatchDLS2Region", N_("Region"), N_("DLS Region"), IPATCH_CATEGORY_SAMPLE_REF }, { "IpatchDLS2Sample", N_("Sample"), N_("DLS Sample"), IPATCH_CATEGORY_SAMPLE }, { "IpatchGig", N_("GigaSampler"), NULL, IPATCH_CATEGORY_BASE }, { "IpatchGigDimension", N_("Dimension"), N_("GigaSampler Dimension"), IPATCH_CATEGORY_NONE }, { "IpatchGigInst", N_("Instrument"), N_("GigaSampler Instrument"), IPATCH_CATEGORY_PROGRAM }, { "IpatchGigRegion", N_("Region"), N_("GigaSampler Region"), IPATCH_CATEGORY_NONE }, { "IpatchGigSample", N_("Sample"), N_("GigaSampler Sample"), IPATCH_CATEGORY_SAMPLE }, { "IpatchGigSubRegion", N_("Sub Region"), N_("GigaSampler Sub Region"), IPATCH_CATEGORY_SAMPLE_REF }, { "IpatchSF2", N_("SoundFont"), NULL, IPATCH_CATEGORY_BASE }, { "IpatchSF2Inst", N_("Instrument"), N_("SoundFont Instrument"), IPATCH_CATEGORY_INSTRUMENT }, { "IpatchSF2IZone", N_("Zone"), N_("SoundFont Instrument Zone"), IPATCH_CATEGORY_SAMPLE_REF }, { "IpatchSF2Preset", N_("Preset"), N_("SoundFont Preset"), IPATCH_CATEGORY_PROGRAM }, { "IpatchSF2PZone", N_("Zone"), N_("SoundFont Preset Zone"), IPATCH_CATEGORY_INSTRUMENT_REF }, { "IpatchSF2Sample", N_("Sample"), N_("SoundFont Sample"), IPATCH_CATEGORY_SAMPLE }, { "IpatchVBank", N_("VBank"), N_("Virtual Bank"), IPATCH_CATEGORY_BASE }, { "IpatchVBankInst", N_("Instrument"), N_("VBank Instrument"), IPATCH_CATEGORY_PROGRAM }, { "IpatchVBankRegion", N_("Region"), N_("VBank Region"), IPATCH_CATEGORY_INSTRUMENT_REF } }; /* name of application using libInstPatch (for saving to files) */ char *ipatch_application_name = NULL; /** * ipatch_init: * * Initialize libInstPatch library. Should be called before any other * libInstPatch related functions. */ void ipatch_init (void) { static gboolean initialized = FALSE; TypePropInit *prop_info; GType type; int i; if (initialized) return; initialized = TRUE; g_type_init (); if (!g_thread_supported ()) g_thread_init (NULL); /* bind the gettext domain */ #if defined(ENABLE_NLS) bindtextdomain (PACKAGE, LOCALEDIR); #endif /* Must be done before other types since they may be dependent */ _ipatch_param_init (); _ipatch_type_prop_init (); _ipatch_unit_init (); _ipatch_xml_object_init (); _ipatch_util_init (); _ipatch_converter_init (); /* init converter system */ _ipatch_sf2_gen_init (); /* initialize interfaces before objects */ ipatch_sample_get_type (); /* declares property types which other types may use */ g_type_class_ref (IPATCH_TYPE_SF2_VOICE_CACHE); g_type_class_ref (IPATCH_TYPE_BASE); g_type_class_ref (IPATCH_TYPE_CONTAINER); g_type_class_ref (IPATCH_TYPE_CONVERTER); g_type_class_ref (IPATCH_TYPE_DLS2); ipatch_dls2_conn_get_type (); g_type_class_ref (IPATCH_TYPE_DLS2_INST); g_type_class_ref (IPATCH_TYPE_DLS2_REGION); g_type_class_ref (IPATCH_TYPE_DLS2_SAMPLE); g_type_class_ref (IPATCH_TYPE_DLS_FILE); g_type_class_ref (IPATCH_TYPE_DLS_READER); g_type_class_ref (IPATCH_TYPE_DLS_WRITER); g_type_class_ref (IPATCH_TYPE_FILE); g_type_class_ref (IPATCH_TYPE_GIG_FILE); g_type_class_ref (IPATCH_TYPE_GIG); g_type_class_ref (IPATCH_TYPE_GIG_DIMENSION); g_type_class_ref (IPATCH_TYPE_GIG_INST); g_type_class_ref (IPATCH_TYPE_GIG_REGION); g_type_class_ref (IPATCH_TYPE_GIG_SAMPLE); g_type_class_ref (IPATCH_TYPE_GIG_SUB_REGION); g_type_class_ref (IPATCH_TYPE_ITEM); ipatch_iter_get_type (); g_type_class_ref (IPATCH_TYPE_LIST); ipatch_param_spec_range_get_type (); g_type_class_ref (IPATCH_TYPE_PASTE); ipatch_range_get_type (); g_type_class_ref (IPATCH_TYPE_RIFF); g_type_class_ref (IPATCH_TYPE_SAMPLE_DATA); g_type_class_ref (IPATCH_TYPE_SAMPLE_STORE); g_type_class_ref (IPATCH_TYPE_SAMPLE_STORE_FILE); g_type_class_ref (IPATCH_TYPE_SAMPLE_STORE_RAM); g_type_class_ref (IPATCH_TYPE_SAMPLE_STORE_ROM); g_type_class_ref (IPATCH_TYPE_SAMPLE_STORE_SND_FILE); g_type_class_ref (IPATCH_TYPE_SAMPLE_STORE_SPLIT24); g_type_class_ref (IPATCH_TYPE_SAMPLE_STORE_SWAP); g_type_class_ref (IPATCH_TYPE_SAMPLE_STORE_VIRTUAL); g_type_class_ref (IPATCH_TYPE_SF2_FILE); ipatch_sf2_gen_array_get_type (); g_type_class_ref (IPATCH_TYPE_SF2); g_type_class_ref (IPATCH_TYPE_SF2_INST); g_type_class_ref (IPATCH_TYPE_SF2_IZONE); g_type_class_ref (IPATCH_TYPE_SF2_READER); ipatch_sf2_mod_get_type (); ipatch_sf2_mod_list_get_type (); g_type_class_ref (IPATCH_TYPE_SF2_PRESET); g_type_class_ref (IPATCH_TYPE_SF2_PZONE); g_type_class_ref (IPATCH_TYPE_SF2_SAMPLE); g_type_class_ref (IPATCH_TYPE_VBANK); g_type_class_ref (IPATCH_TYPE_VBANK_INST); g_type_class_ref (IPATCH_TYPE_VBANK_REGION); g_type_class_ref (IPATCH_TYPE_SF2_WRITER); g_type_class_ref (IPATCH_TYPE_SF2_ZONE); g_type_class_ref (IPATCH_TYPE_SND_FILE); _ipatch_convert_SF2_init (); _ipatch_convert_gig_init (); _ipatch_convert_DLS2_init (); _ipatch_sf2_voice_cache_init_DLS (); _ipatch_sf2_voice_cache_init_SF2 (); _ipatch_sf2_voice_cache_init_gig (); _ipatch_sf2_voice_cache_init_VBank (); _ipatch_range_init (); /* Register XML encode/decode handlers */ /* GLib string array boxed type encode/decode */ ipatch_xml_register_handler (G_TYPE_STRV, NULL, ipatch_strv_xml_encode, ipatch_strv_xml_decode); /* set type properties */ for (i = 0; i < G_N_ELEMENTS (type_props); i++) { type = g_type_from_name (type_props[i].type_name); if (log_if_fail (type != 0)) continue; prop_info = &type_props[i]; if (prop_info->name) ipatch_type_set (type, "name", prop_info->name, NULL); if (prop_info->blurb) ipatch_type_set (type, "blurb", prop_info->blurb, NULL); if (prop_info->category != IPATCH_CATEGORY_NONE) ipatch_type_set (type, "category", prop_info->category, NULL); } /* link types */ ipatch_type_set (IPATCH_TYPE_DLS2_REGION, "link-type", IPATCH_TYPE_DLS2_SAMPLE, NULL); ipatch_type_set (IPATCH_TYPE_GIG_SUB_REGION, "link-type", IPATCH_TYPE_GIG_SAMPLE, NULL); ipatch_type_set (IPATCH_TYPE_SF2_PZONE, "link-type", IPATCH_TYPE_SF2_INST, NULL); ipatch_type_set (IPATCH_TYPE_SF2_IZONE, "link-type", IPATCH_TYPE_SF2_SAMPLE, NULL); ipatch_type_set (IPATCH_TYPE_VBANK_REGION, "link-type", IPATCH_TYPE_ITEM, NULL); /* virtual container parent type properties */ ipatch_type_set (IPATCH_TYPE_DLS2_SAMPLE, "virtual-parent-type", IPATCH_TYPE_VIRTUAL_DLS2_SAMPLES, NULL); ipatch_type_set (IPATCH_TYPE_GIG_SAMPLE, "virtual-parent-type", IPATCH_TYPE_VIRTUAL_GIG_SAMPLES, NULL); ipatch_type_set (IPATCH_TYPE_SF2_INST, "virtual-parent-type", IPATCH_TYPE_VIRTUAL_SF2_INST, NULL); /* dynamic virtual container properties (determined by object instance) */ ipatch_type_set_dynamic_func (IPATCH_TYPE_DLS2_INST, "virtual-parent-type", virtual_parent_dls2_inst); ipatch_type_set_dynamic_func (IPATCH_TYPE_GIG_INST, "virtual-parent-type", virtual_parent_gig_inst); ipatch_type_set_dynamic_func (IPATCH_TYPE_SF2_PRESET, "virtual-parent-type", virtual_parent_sf2_preset); ipatch_type_set_dynamic_func (IPATCH_TYPE_SF2_SAMPLE, "virtual-parent-type", virtual_parent_sf2_sample); /* child object conform functions (for making a child object conform to a * specific virtual container) */ ipatch_type_set (IPATCH_TYPE_VIRTUAL_DLS2_PERCUSSION, "virtual-child-conform-func", conform_percussion, NULL); ipatch_type_set (IPATCH_TYPE_VIRTUAL_DLS2_MELODIC, "virtual-child-conform-func", conform_melodic, NULL); ipatch_type_set (IPATCH_TYPE_VIRTUAL_GIG_PERCUSSION, "virtual-child-conform-func", conform_percussion, NULL); ipatch_type_set (IPATCH_TYPE_VIRTUAL_GIG_MELODIC, "virtual-child-conform-func", conform_melodic, NULL); ipatch_type_set (IPATCH_TYPE_VIRTUAL_SF2_PERCUSSION, "virtual-child-conform-func", conform_percussion, NULL); ipatch_type_set (IPATCH_TYPE_VIRTUAL_SF2_MELODIC, "virtual-child-conform-func", conform_melodic, NULL); /* container child sorting */ ipatch_type_set (IPATCH_TYPE_VIRTUAL_DLS2_MELODIC, "sort-children", TRUE, NULL); ipatch_type_set (IPATCH_TYPE_VIRTUAL_DLS2_PERCUSSION, "sort-children", TRUE, NULL); ipatch_type_set (IPATCH_TYPE_VIRTUAL_GIG_MELODIC, "sort-children", TRUE, NULL); ipatch_type_set (IPATCH_TYPE_VIRTUAL_GIG_PERCUSSION, "sort-children", TRUE, NULL); ipatch_type_set (IPATCH_TYPE_VIRTUAL_SF2_MELODIC, "sort-children", TRUE, NULL); ipatch_type_set (IPATCH_TYPE_VIRTUAL_SF2_PERCUSSION, "sort-children", TRUE, NULL); ipatch_type_set (IPATCH_TYPE_VBANK, "sort-children", TRUE, NULL); /* set "splits-type" properties */ ipatch_type_set (IPATCH_TYPE_SF2_PRESET, "splits-type", IPATCH_SPLITS_NORMAL, NULL); ipatch_type_set (IPATCH_TYPE_SF2_INST, "splits-type", IPATCH_SPLITS_NORMAL, NULL); ipatch_type_set (IPATCH_TYPE_DLS2_INST, "splits-type", IPATCH_SPLITS_NORMAL, NULL); ipatch_type_set (IPATCH_TYPE_GIG_INST, "splits-type", IPATCH_SPLITS_NO_OVERLAP, NULL); ipatch_type_set (IPATCH_TYPE_VBANK_INST, "splits-type", IPATCH_SPLITS_NORMAL, NULL); } static gboolean ipatch_strv_xml_encode (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err) { GStrv strv; g_return_val_if_fail (G_VALUE_HOLDS (value, G_TYPE_STRV), FALSE); strv = g_value_get_boxed (value); if (!strv) { ipatch_xml_set_attribute (node, "null", "1"); return (TRUE); } for (; *strv; strv++) ipatch_xml_new_node (node, "value", *strv, NULL); return (TRUE); } static gboolean ipatch_strv_xml_decode (GNode *node, GObject *object, GParamSpec *pspec, GValue *value, GError **err) { GStrv strv; GNode *n; int i; g_return_val_if_fail (G_VALUE_HOLDS (value, G_TYPE_STRV), FALSE); if (ipatch_xml_test_attribute (node, "null", "1")) { g_value_set_boxed (value, NULL); return (TRUE); } /* Count "value" child nodes */ for (i = 0, n = node->children; n; n = n->next) if (ipatch_xml_test_name (n, "value")) i++; strv = g_new (char *, i + 1); /* ++ alloc new strv array */ for (i = 0, n = node->children; n; n = n->next) { if (!ipatch_xml_test_name (n, "value")) continue; strv[i] = ipatch_xml_dup_value (n); i++; } strv[i] = NULL; g_value_take_boxed (value, strv); return (TRUE); } static void virtual_parent_dls2_inst (GType type, GParamSpec *spec, GValue *value, GObject *object) { gboolean percuss = FALSE; if (object) g_object_get (object, "percussion", &percuss, NULL); if (percuss) g_value_set_gtype (value, IPATCH_TYPE_VIRTUAL_DLS2_PERCUSSION); else g_value_set_gtype (value, IPATCH_TYPE_VIRTUAL_DLS2_MELODIC); } static void virtual_parent_gig_inst (GType type, GParamSpec *spec, GValue *value, GObject *object) { gboolean percuss = FALSE; if (object) g_object_get (object, "percussion", &percuss, NULL); if (percuss) g_value_set_gtype (value, IPATCH_TYPE_VIRTUAL_GIG_PERCUSSION); else g_value_set_gtype (value, IPATCH_TYPE_VIRTUAL_GIG_MELODIC); } static void virtual_parent_sf2_preset (GType type, GParamSpec *spec, GValue *value, GObject *object) { gboolean percuss = FALSE; if (object) g_object_get (object, "percussion", &percuss, NULL); if (percuss) g_value_set_gtype (value, IPATCH_TYPE_VIRTUAL_SF2_PERCUSSION); else g_value_set_gtype (value, IPATCH_TYPE_VIRTUAL_SF2_MELODIC); } static void virtual_parent_sf2_sample (GType type, GParamSpec *spec, GValue *value, GObject *object) { gboolean rom = FALSE; if (object) g_object_get (object, "rom", &rom, NULL); if (rom) g_value_set_gtype (value, IPATCH_TYPE_VIRTUAL_SF2_ROM); else g_value_set_gtype (value, IPATCH_TYPE_VIRTUAL_SF2_SAMPLES); } static void conform_percussion (GObject *object) { g_object_set (object, "percussion", TRUE, NULL); } static void conform_melodic (GObject *object) { g_object_set (object, "percussion", FALSE, NULL); } /** * ipatch_set_application_name: * @name: Application name and version (example: "swami 1.0") or %NULL to * unset application name * * Set the global application name string which is used as the * software string written to patch files. This string should contain * the name of the application, and its version, that is using * libInstPatch. The libInstPatch version will also be output where * appropriate, so the software string written to a SoundFont for * example would look something like "swami 1.0 (libInstPatch 1.0)". */ void ipatch_set_application_name (const char *name) { if (ipatch_application_name) g_free (ipatch_application_name); if (name) ipatch_application_name = g_strdup (name); else ipatch_application_name = NULL; } /** * ipatch_version: * @major: Pointer to store major version or %NULL * @minor: Pointer to store minor version or %NULL * @micro: Pointer to store micro version or %NULL * * Fetch the runtime version of the libInstPatch library. */ void ipatch_version (guint *major, guint *minor, guint *micro) { if (major) *major = IPATCH_VERSION_MAJOR; if (minor) *minor = IPATCH_VERSION_MINOR; if (micro) *micro = IPATCH_VERSION_MICRO; } GQuark ipatch_error_quark (void) { static GQuark q = 0; if (q == 0) q = g_quark_from_static_string ("libInstPatch-error-quark"); return (q); } int _ret_g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...) { va_list args; va_start (args, format); g_logv (log_domain, log_level, format, args); va_end (args); return (TRUE); } /** * ipatch_gerror_message: * @err: A GError object or %NULL * * A utility function to check if a GError is set and return the * GError's message field if it is, or a string explaining that there * isn't any error info if @err is %NULL. * * Returns: The GError's message or a "<No detailed error information>" string. */ G_CONST_RETURN char * ipatch_gerror_message (GError *err) { return ((err) ? (err)->message : _("")); } /* internal function used by ipatch_code_error macros */ void _ipatch_code_error (const char *file, guint line, const char *func, GError **err, const char *format, ...) { va_list args; va_start (args, format); _ipatch_code_errorv (file, line, func, err, format, args); va_end (args); } /* internal function used by ipatch_code_error macros */ void _ipatch_code_errorv (const char *file, guint line, const char *func, GError **err, const char *format, va_list args) { char *msg, *loc, *temp; if (file && func) loc = g_strdup_printf ("%s:%d:%s()", file, line, func); else if (file) loc = g_strdup_printf ("%s:%d", file, line); else loc = NULL; temp = g_strdup_vprintf (format, args); msg = g_strdup_printf ("%s - %s", loc, temp); g_free (loc); g_free (temp); g_critical ("%s", msg); g_set_error (err, IPATCH_ERROR, IPATCH_ERROR_PROGRAM, "Programmer error! (%s)", msg); g_free (msg); } /** * ipatch_strconcat_num: * @src: Source string * @num: Number to concatenate * @dest: Destination buffer * @size: Size of destination buffer * * Creates a string with a number appended to it but ensures that it is * of the specified @size (including NULL termination). Characters in the * middle of the string are removed and a ".." is inserted, if necessary. */ void ipatch_strconcat_num (const char *src, int num, char *dest, int size) { char numstr[16]; int numlen, srclen, newlen, len1; int remove; sprintf (numstr, "%d", num); numlen = strlen (numstr); srclen = strlen (src); remove = (srclen + numlen) - (size - 1); if (remove > 0) /* any characters need to be removed? */ { remove += 2; /* for ".." */ newlen = srclen - remove; /* new length of non numeric string */ len1 = (newlen + 1) / 2; /* length of first part before ".." */ sprintf (dest, "%.*s..%.*s%s", len1, src, newlen - len1, src + (srclen - (newlen - len1)), numstr); } else g_stpcpy (g_stpcpy (dest, src), numstr); } /** * ipatch_dump_object: * @object: Object to dump * @recursive: Set to %TRUE to recurse the @object children (if its a * #IpatchContainer derived object). * @file: File to dump to or %NULL for stdout * * Dumps object info to a file for debugging purposes. */ void ipatch_dump_object (GObject *object, gboolean recursive, FILE *file) { char indent_buf[64] = ""; g_return_if_fail (G_IS_OBJECT (object)); if (!file) file = stdout; if (!recursive) { dump_object_info (object, indent_buf, file); fprintf (file, "\n", g_type_name (G_TYPE_FROM_INSTANCE (object)), object); } else dump_recursive (object, indent_buf, file); } static void dump_recursive (GObject *object, char *indent, FILE *file) { dump_object_info (object, indent, file); strcat (indent, " "); /* increase indent */ if (IPATCH_IS_CONTAINER (object)) { /* iterate over children if its an IpatchContainer */ IpatchList *list; IpatchIter iter; GObject *obj; list = ipatch_container_get_children (IPATCH_CONTAINER (object), G_TYPE_OBJECT); /* ++ ref list */ ipatch_list_init_iter (list, &iter); obj = ipatch_iter_first (&iter); if (obj) fprintf (file, "\n"); while (obj) { dump_recursive (obj, indent, file); obj = ipatch_iter_next (&iter); } g_object_unref (list); /* -- unref list */ } indent[strlen (indent) - 2] = '\0'; /* decrease indent */ fprintf (file, "%s\n", indent, g_type_name (G_TYPE_FROM_INSTANCE (object))); } static void dump_object_info (GObject *object, char *indent, FILE *file) { GParamSpec **pspecs, **pspec; GValue value = { 0 }; char *contents; fprintf (file, "%s<%s addr=%p>\n", indent, g_type_name (G_TYPE_FROM_INSTANCE (object)), object); fprintf (file, "%s refcount = %u\n", indent, object->ref_count); pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (object), NULL); pspec = pspecs; while (*pspec) /* write out property values */ { if ((*pspec)->flags & G_PARAM_READABLE) { g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (*pspec)); g_object_get_property (object, g_param_spec_get_name (*pspec), &value); contents = g_strdup_value_contents (&value); g_value_unset (&value); fprintf (file, "%s %s = %s\n", indent, g_param_spec_get_name (*pspec), contents); g_free (contents); } pspec++; } g_free (pspecs); } libinstpatch-1.0.0/libinstpatch/IpatchGigSample.c0000644000175000017500000001277211461332142016754 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchGigSample.h" #include "i18n.h" enum { PROP_0, PROP_GROUP_NUMBER }; static void ipatch_gig_sample_class_init (IpatchGigSampleClass *klass); static void ipatch_gig_sample_init (IpatchGigSample *sample); static void ipatch_gig_sample_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_gig_sample_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_gig_sample_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static gpointer parent_class = NULL; GType ipatch_gig_sample_get_type (void) { static GType item_type = 0; if (!item_type) { static const GTypeInfo item_info = { sizeof (IpatchGigSampleClass), NULL, NULL, (GClassInitFunc)ipatch_gig_sample_class_init, NULL, NULL, sizeof (IpatchGigSample), 0, (GInstanceInitFunc)ipatch_gig_sample_init, }; item_type = g_type_register_static (IPATCH_TYPE_DLS2_SAMPLE, "IpatchGigSample", &item_info, 0); } return (item_type); } static void ipatch_gig_sample_class_init (IpatchGigSampleClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); parent_class = g_type_class_peek_parent (klass); obj_class->get_property = ipatch_gig_sample_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_gig_sample_set_property; item_class->copy = ipatch_gig_sample_item_copy; g_object_class_install_property (obj_class, PROP_GROUP_NUMBER, g_param_spec_uint ("group-number", _("Group number"), _("Sample group index"), 0, G_MAXUINT, 0, G_PARAM_READWRITE)); } static void ipatch_gig_sample_init (IpatchGigSample *sample) { sample->group_number = 0; } static void ipatch_gig_sample_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchGigSample *sample = IPATCH_GIG_SAMPLE (object); switch (property_id) { case PROP_GROUP_NUMBER: sample->group_number = g_value_get_uint (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } } static void ipatch_gig_sample_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchGigSample *sample = IPATCH_GIG_SAMPLE (object); switch (property_id) { case PROP_GROUP_NUMBER: g_value_set_uint (value, sample->group_number); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_gig_sample_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchGigSample *src_sample, *dest_sample; src_sample = IPATCH_GIG_SAMPLE (src); dest_sample = IPATCH_GIG_SAMPLE (dest); /* call IpatchDLS2Sample class copy function */ IPATCH_ITEM_CLASS (parent_class)->copy (dest, src, link_func, user_data); /* don't need to lock for this stuff */ dest_sample->group_number = src_sample->group_number; } /** * ipatch_gig_sample_new: * * Create a new GigaSampler sample object. * * Returns: New GigaSampler sample with a reference count of 1. Caller * owns the reference and removing it will destroy the item, unless another * reference is added (if its parented for example). */ IpatchGigSample * ipatch_gig_sample_new (void) { return (IPATCH_GIG_SAMPLE (g_object_new (IPATCH_TYPE_GIG_SAMPLE, NULL))); } /** * ipatch_gig_sample_first: * @iter: Patch item iterator containing #IpatchGigSample items * * Gets the first item in a GigaSampler sample iterator. A convenience * wrapper for ipatch_iter_first(). * * Returns: The first GigaSampler sample in @iter or %NULL if empty. */ IpatchGigSample * ipatch_gig_sample_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_GIG_SAMPLE (obj)); else return (NULL); } /** * ipatch_gig_sample_next: * @iter: Patch item iterator containing #IpatchGigSample items * * Gets the next item in a GigaSampler sample iterator. A convenience * wrapper for ipatch_iter_next(). * * Returns: The next GigaSampler sample in @iter or %NULL if at * the end of the list. */ IpatchGigSample * ipatch_gig_sample_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_GIG_SAMPLE (obj)); else return (NULL); } libinstpatch-1.0.0/libinstpatch/IpatchVBankInst.c0000644000175000017500000002646211461332142016744 00000000000000/* * libInstPatch * Copyright (C) 1999-2010 Joshua "Element" Green * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License only. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA or on the web at http://www.gnu.org. */ #include #include #include #include "IpatchVBankInst.h" #include "IpatchVBankRegion.h" #include "IpatchParamProp.h" #include "IpatchTypeProp.h" #include "ipatch_priv.h" /* properties */ enum { PROP_0, PROP_TITLE, PROP_NAME, PROP_BANK, PROP_PROGRAM }; static void ipatch_vbank_inst_finalize (GObject *gobject); static void ipatch_vbank_inst_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void ipatch_vbank_inst_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); static void ipatch_vbank_inst_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data); static const GType *ipatch_vbank_inst_container_child_types (void); static gboolean ipatch_vbank_inst_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type); G_DEFINE_TYPE (IpatchVBankInst, ipatch_vbank_inst, IPATCH_TYPE_CONTAINER); static GType inst_child_types[2] = { 0 }; static GParamSpec *name_pspec, *bank_pspec, *program_pspec; static void ipatch_vbank_inst_class_init (IpatchVBankInstClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); IpatchItemClass *item_class = IPATCH_ITEM_CLASS (klass); IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS (klass); obj_class->finalize = ipatch_vbank_inst_finalize; obj_class->get_property = ipatch_vbank_inst_get_property; /* we use the IpatchItem item_set_property method */ item_class->item_set_property = ipatch_vbank_inst_set_property; item_class->copy = ipatch_vbank_inst_item_copy; container_class->child_types = ipatch_vbank_inst_container_child_types; container_class->init_iter = ipatch_vbank_inst_container_init_iter; g_object_class_override_property (obj_class, PROP_TITLE, "title"); name_pspec = ipatch_param_set (g_param_spec_string ("name", _("Name"), _("Name"), NULL, G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE), "string-max-length", IPATCH_VBANK_INST_NAME_SIZE, NULL); g_object_class_install_property (obj_class, PROP_NAME, name_pspec); /* bank/program are grouped unique (siblings with same bank/program are considered conflicting) */ bank_pspec = g_param_spec_int ("bank", _("Bank"), _("MIDI bank number"), 0, 128, 0, G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE); ipatch_param_set (bank_pspec, "unique-group-id", 1, NULL); g_object_class_install_property (obj_class, PROP_BANK, bank_pspec); program_pspec = g_param_spec_int ("program", _("Program"), _("MIDI program number"), 0, 127, 0, G_PARAM_READWRITE | IPATCH_PARAM_UNIQUE); ipatch_param_set (program_pspec, "unique-group-id", 1, NULL); g_object_class_install_property (obj_class, PROP_PROGRAM, program_pspec); inst_child_types[0] = IPATCH_TYPE_VBANK_REGION; } static void ipatch_vbank_inst_init (IpatchVBankInst *inst) { } static void ipatch_vbank_inst_finalize (GObject *gobject) { IpatchVBankInst *inst = IPATCH_VBANK_INST (gobject); IPATCH_ITEM_WLOCK (inst); g_free (inst->name); inst->name = NULL; IPATCH_ITEM_WUNLOCK (inst); if (G_OBJECT_CLASS (ipatch_vbank_inst_parent_class)->finalize) G_OBJECT_CLASS (ipatch_vbank_inst_parent_class)->finalize (gobject); } static void ipatch_vbank_inst_get_title (IpatchVBankInst *inst, GValue *value) { int bank, program; char *name, *s; g_object_get (inst, "bank", &bank, "program", &program, "name", &name, NULL); s = g_strdup_printf ("%03d-%03d %s", bank, program, name); g_free (name); g_value_take_string (value, s); } static void ipatch_vbank_inst_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { IpatchVBankInst *inst = IPATCH_VBANK_INST (object); switch (property_id) { case PROP_NAME: IPATCH_ITEM_WLOCK (inst); g_free (inst->name); inst->name = g_value_dup_string (value); IPATCH_ITEM_WUNLOCK (inst); break; case PROP_BANK: inst->bank = g_value_get_int (value); break; case PROP_PROGRAM: inst->program = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); return; } /* need to do title notify? */ if (property_id == PROP_NAME || property_id == PROP_BANK || property_id == PROP_PROGRAM) { GValue titleval = { 0 }; g_value_init (&titleval, G_TYPE_STRING); ipatch_vbank_inst_get_title (inst, &titleval); ipatch_item_prop_notify ((IpatchItem *)inst, ipatch_item_pspec_title, &titleval, NULL); g_value_unset (&titleval); } } static void ipatch_vbank_inst_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { IpatchVBankInst *inst = IPATCH_VBANK_INST (object); switch (property_id) { case PROP_TITLE: ipatch_vbank_inst_get_title (inst, value); break; case PROP_NAME: IPATCH_ITEM_RLOCK (inst); g_value_set_string (value, inst->name); IPATCH_ITEM_RUNLOCK (inst); break; case PROP_BANK: g_value_set_int (value, inst->bank); break; case PROP_PROGRAM: g_value_set_int (value, inst->program); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ipatch_vbank_inst_item_copy (IpatchItem *dest, IpatchItem *src, IpatchItemCopyLinkFunc link_func, gpointer user_data) { IpatchVBankInst *src_inst, *dest_inst; IpatchItem *region; GSList *p; src_inst = IPATCH_VBANK_INST (src); dest_inst = IPATCH_VBANK_INST (dest); IPATCH_ITEM_RLOCK (src_inst); dest_inst->name = g_strdup (src_inst->name); dest_inst->program = src_inst->program; dest_inst->bank = src_inst->bank; for (p = src_inst->regions; p; p = p->next) { region = ipatch_item_duplicate (IPATCH_ITEM (p->data)); dest_inst->regions = g_slist_prepend (dest_inst->regions, region); ipatch_item_set_parent (region, IPATCH_ITEM (dest_inst)); } IPATCH_ITEM_RUNLOCK (src_inst); dest_inst->regions = g_slist_reverse (dest_inst->regions); } static const GType * ipatch_vbank_inst_container_child_types (void) { return (inst_child_types); } /* container is locked by caller */ static gboolean ipatch_vbank_inst_container_init_iter (IpatchContainer *container, IpatchIter *iter, GType type) { IpatchVBankInst *inst = IPATCH_VBANK_INST (container); if (!g_type_is_a (type, IPATCH_TYPE_VBANK_REGION)) { g_critical ("Invalid child type '%s' for parent of type '%s'", g_type_name (type), g_type_name (G_OBJECT_TYPE (container))); return (FALSE); } ipatch_iter_GSList_init (iter, &inst->regions); return (TRUE); } /** * ipatch_vbank_inst_new: * * Create a new virtual bank instrument object. * * Returns: New VBank instrument with a reference count of 1. Caller * owns the reference and removing it will destroy the item. */ IpatchVBankInst * ipatch_vbank_inst_new (void) { return (IPATCH_VBANK_INST (g_object_new (IPATCH_TYPE_VBANK_INST, NULL))); } /** * ipatch_vbank_inst_first: * @iter: Patch item iterator containing #IpatchVBankInst items * * Gets the first item in an instrument iterator. A convenience wrapper for * ipatch_iter_first(). * * Returns: The first instrument in @iter or %NULL if empty. */ IpatchVBankInst * ipatch_vbank_inst_first (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_first (iter); if (obj) return (IPATCH_VBANK_INST (obj)); else return (NULL); } /** * ipatch_vbank_inst_next: * @iter: Patch item iterator containing #IpatchVBankInst items * * Gets the next item in an instrument iterator. A convenience wrapper for * ipatch_iter_next(). * * Returns: The next instrument in @iter or %NULL if at the end of the list. */ IpatchVBankInst * ipatch_vbank_inst_next (IpatchIter *iter) { GObject *obj; g_return_val_if_fail (iter != NULL, NULL); obj = ipatch_iter_next (iter); if (obj) return (IPATCH_VBANK_INST (obj)); else return (NULL); } /** * ipatch_vbank_inst_new_region: * @inst: VBank instrument * @item: Referenced item for new region * * A convenience function for creating a new virtual bank region, adding it * to @inst and setting the region's referenced item to @item. */ void ipatch_vbank_inst_new_region (IpatchVBankInst *inst, IpatchItem *item) { IpatchVBankRegion *region; g_return_if_fail (IPATCH_IS_VBANK_INST (inst)); g_return_if_fail (IPATCH_IS_ITEM (item)); region = ipatch_vbank_region_new (); /* ++ ref new region */ g_object_set (region, "link-item", item, NULL); ipatch_container_append (IPATCH_CONTAINER (inst), IPATCH_ITEM (region)); g_object_unref (region); /* -- unref vbank region */ } /** * ipatch_vbank_inst_set_midi_locale: * @inst: Virtual bank instrument to set MIDI locale of * @bank: MIDI bank number to assign to instrument * @program: MIDI program number to assign to instrument * * Sets the MIDI locale of an instrument (bank and program numbers). */ void ipatch_vbank_inst_set_midi_locale (IpatchVBankInst *inst, int bank, int program) { g_object_set (inst, "bank", bank, "program", program, NULL); } /** * ipatch_vbank_inst_get_midi_locale: * @inst: Virtual bank instrument to get MIDI locale from * @bank: Location to store instrument's MIDI bank number or %NULL * @program: Location to store instrument's MIDI program number or %NULL * * Gets the MIDI locale of a virtual bank instrument (bank and program numbers). */ void ipatch_vbank_inst_get_midi_locale (IpatchVBankInst *inst, int *bank, int *program) { g_return_if_fail (IPATCH_IS_VBANK_INST (inst)); IPATCH_ITEM_RLOCK (inst); if (bank) *bank = inst->bank; if (program) *program = inst->program; IPATCH_ITEM_RUNLOCK (inst); } /** * ipatch_vbank_inst_compare: * @p1: First instrument in comparison * @p2: Second instrument in comparison * * Virtual bank instrument comparison function for sorting. Compare two * instruments by their MIDI bank:program numbers. Note that this function is * compatible with GCompareFunc and can therefore be used with g_list_sort, etc. * * Returns: Comparison result that is less than, equal to, or greater than zero * if @p1 is found, respectively, to be less than, to match, or be greater * than @p2. */ int ipatch_vbank_inst_compare (const IpatchVBankInst *p1, const IpatchVBankInst *p2) { gint32 aval, bval; aval = ((gint32)(p1->bank) << 16) | p1->program; bval = ((gint32)(p2->bank) << 16) | p2->program; return (aval - bval); } libinstpatch-1.0.0/config.rpath0000755000175000017500000003521311456655763013453 00000000000000#! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2003 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # # The first argument passed to this file is the canonical host specification, # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld # should be set by the caller. # # The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer # than 256 bytes, otherwise the compiler driver will dump core. The only # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. # All known linkers require a `.a' archive for static linking (except M$VC, # which needs '.lib'). libext=a shrext=.so host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. wl= if test "$GCC" = yes; then wl='-Wl,' else case "$host_os" in aix*) wl='-Wl,' ;; mingw* | pw32* | os2*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' ;; irix5* | irix6* | nonstopux*) wl='-Wl,' ;; newsos6) ;; linux*) case $CC in icc|ecc) wl='-Wl,' ;; ccc) wl='-Wl,' ;; esac ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; sco3.2v5*) ;; solaris*) wl='-Wl,' ;; sunos4*) wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) wl='-Wl,' ;; sysv4*MP*) ;; uts4*) ;; esac fi # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no case "$host_os" in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then case "$host_os" in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then : else ld_shlibs=no fi ;; netbsd*) ;; solaris* | sysv5*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; sunos4*) hardcode_direct=yes ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = yes; then # Unlike libtool, we use -rpath here, not --rpath, since the documented # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' fi else case "$host_os" in aix3*) # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done esac fi hardcode_direct=yes hardcode_libdir_separator=':' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi esac fi # Begin _LT_AC_SYS_LIBPATH_AIX. echo 'int main () { return 0; }' > conftest.c ${CC} ${LDFLAGS} conftest.c -o conftest aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` fi if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib" fi rm -f conftest.c conftest # End _LT_AC_SYS_LIBPATH_AIX. if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" fi fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi4*) ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' libext=lib ;; darwin* | rhapsody*) if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then hardcode_direct=no fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; freebsd1*) ld_shlibs=no ;; freebsd2.2*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; freebsd2*) hardcode_direct=yes hardcode_minus_L=yes ;; freebsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; hpux9*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; hpux10* | hpux11*) if test "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=no ;; ia64*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=no # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; *) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; newsos6) hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; openbsd*) hardcode_direct=yes if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then hardcode_libdir_flag_spec='${wl}-rpath,$libdir' else case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) hardcode_libdir_flag_spec='-R$libdir' ;; *) hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; osf3*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) if test "$GCC" = yes; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else # Both cc and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; sco3.2v5*) ;; solaris*) hardcode_libdir_flag_spec='-R$libdir' ;; sunos4*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; sysv4) case $host_vendor in sni) hardcode_direct=yes # is this really true??? ;; siemens) hardcode_direct=no ;; motorola) hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac ;; sysv4.3*) ;; sysv4*MP*) if test -d /usr/nec; then ld_shlibs=yes fi ;; sysv4.2uw2*) hardcode_direct=yes hardcode_minus_L=no ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) ;; sysv5*) hardcode_libdir_flag_spec= ;; uts4*) hardcode_libdir_flag_spec='-L$libdir' ;; *) ld_shlibs=no ;; esac fi # Check dynamic linker characteristics # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. libname_spec='lib$name' case "$host_os" in aix3*) ;; aix4* | aix5*) ;; amigaos*) ;; beos*) ;; bsdi4*) ;; cygwin* | mingw* | pw32*) shrext=.dll ;; darwin* | rhapsody*) shrext=.dylib ;; dgux*) ;; freebsd1*) ;; freebsd*) ;; gnu*) ;; hpux9* | hpux10* | hpux11*) case "$host_cpu" in ia64*) shrext=.so ;; hppa*64*) shrext=.sl ;; *) shrext=.sl ;; esac ;; irix5* | irix6* | nonstopux*) case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; *) libsuff= shlibsuff= ;; esac ;; esac ;; linux*oldld* | linux*aout* | linux*coff*) ;; linux*) ;; netbsd*) ;; newsos6) ;; nto-qnx) ;; openbsd*) ;; os2*) libname_spec='$name' shrext=.dll ;; osf3* | osf4* | osf5*) ;; sco3.2v5*) ;; solaris*) ;; sunos4*) ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; sysv4*MP*) ;; uts4*) ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' < * Makefile.in.in: New file, from gettext-0.11.5. * boldquot.sed: New file, from gettext-0.11.5. * en@boldquot.header: New file, from gettext-0.11.5. * en@quot.header: New file, from gettext-0.11.5. * insert-header.sin: New file, from gettext-0.11.5. * quot.sed: New file, from gettext-0.11.5. * remove-potcdate.sin: New file, from gettext-0.11.5. * Rules-quot: New file, from gettext-0.11.5. libinstpatch-1.0.0/po/POTFILES.in0000644000175000017500000000214711456655763013336 00000000000000# List of source files containing translatable strings. # Each source file that has gettext translatable strings should be listed here libinstpatch/IpatchCram.c libinstpatch/IpatchCramDecoder.c libinstpatch/IpatchCram_DLS.c libinstpatch/IpatchCramEncoder.c libinstpatch/IpatchCramFile.c libinstpatch/IpatchCram_SF2.c libinstpatch/IpatchBase.c libinstpatch/IpatchConverter.c libinstpatch/IpatchConvert_SF2.c libinstpatch/IpatchDLS2.c libinstpatch/IpatchDLS2Info.c libinstpatch/IpatchDLS2Inst.c libinstpatch/IpatchDLS2Region.c libinstpatch/IpatchDLS2Sample.c libinstpatch/IpatchDLSFile.c libinstpatch/IpatchDLSReader.c libinstpatch/IpatchFile.c libinstpatch/IpatchGigFile.c libinstpatch/IpatchRiffParser.c libinstpatch/IpatchSampleFile.c libinstpatch/IpatchSampleStore.c libinstpatch/IpatchSampleStoreRAM.c libinstpatch/IpatchSampleStoreSwap.c libinstpatch/IpatchSF2.c libinstpatch/IpatchSF2File.c libinstpatch/IpatchSF2Gen.c libinstpatch/IpatchSF2Gen_tables.c libinstpatch/IpatchSF2Reader.c libinstpatch/IpatchSF2Preset.c libinstpatch/IpatchSF2Writer.c libinstpatch/IpatchSF2Zone.c libinstpatch/IpatchUnit.c libinstpatch/misc.c libinstpatch-1.0.0/po/Makefile.in.in0000644000175000017500000001537711456655763014244 00000000000000# Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper # Copyright (C) 2004-2008 Rodney Dawes # # This file may be copied and used freely without restrictions. It may # be used in projects which are not available under a GNU Public License, # but which still want to provide support for the GNU gettext functionality. # # - Modified by Owen Taylor to use GETTEXT_PACKAGE # instead of PACKAGE and to look for po2tbl in ./ not in intl/ # # - Modified by jacob berkman to install # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize # # - Modified by Rodney Dawes for use with intltool # # We have the following line for use by intltoolize: # INTLTOOL_MAKEFILE GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datadir = @datadir@ datarootdir = @datarootdir@ libdir = @libdir@ DATADIRNAME = @DATADIRNAME@ itlocaledir = $(prefix)/$(DATADIRNAME)/locale subdir = po install_sh = @install_sh@ # Automake >= 1.8 provides @mkdir_p@. # Until it can be supposed, use the safe fallback: mkdir_p = $(install_sh) -d INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ GMSGFMT = @GMSGFMT@ MSGFMT = @MSGFMT@ XGETTEXT = @XGETTEXT@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot ALL_LINGUAS = @ALL_LINGUAS@ PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi) USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi) USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done) POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done) DISTFILES = Makefile.in.in POTFILES.in $(POFILES) EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS POTFILES = \ # This comment gets stripped out CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done) .SUFFIXES: .SUFFIXES: .po .pox .gmo .mo .msg .cat .po.pox: $(MAKE) $(GETTEXT_PACKAGE).pot $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox .po.mo: $(MSGFMT) -o $@ $< .po.gmo: file=`echo $* | sed 's,.*/,,'`.gmo \ && rm -f $$file && $(GMSGFMT) -o $$file $< .po.cat: sed -f ../intl/po2msg.sed < $< > $*.msg \ && rm -f $@ && gencat $@ $*.msg all: all-@USE_NLS@ all-yes: $(CATALOGS) all-no: $(GETTEXT_PACKAGE).pot: $(POTFILES) $(GENPOT) install: install-data install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all linguas="$(USE_LINGUAS)"; \ for lang in $$linguas; do \ dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \ $(mkdir_p) $$dir; \ if test -r $$lang.gmo; then \ $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \ else \ $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ echo "installing $(srcdir)/$$lang.gmo as" \ "$$dir/$(GETTEXT_PACKAGE).mo"; \ fi; \ if test -r $$lang.gmo.m; then \ $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \ echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \ else \ if test -r $(srcdir)/$$lang.gmo.m ; then \ $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \ $$dir/$(GETTEXT_PACKAGE).mo.m; \ echo "installing $(srcdir)/$$lang.gmo.m as" \ "$$dir/$(GETTEXT_PACKAGE).mo.m"; \ else \ true; \ fi; \ fi; \ done # Empty stubs to satisfy archaic automake needs dvi info ctags tags CTAGS TAGS ID: # Define this as empty until I found a useful application. install-exec installcheck: uninstall: linguas="$(USE_LINGUAS)"; \ for lang in $$linguas; do \ rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \ done check: all $(GETTEXT_PACKAGE).pot rm -f missing notexist srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m if [ -r missing -o -r notexist ]; then \ exit 1; \ fi mostlyclean: rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp rm -f .intltool-merge-cache clean: mostlyclean distclean: clean rm -f Makefile Makefile.in POTFILES stamp-it rm -f *.mo *.msg *.cat *.cat.m *.gmo maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." rm -f Makefile.in.in distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) dist distdir: $(DISTFILES) dists="$(DISTFILES)"; \ extra_dists="$(EXTRA_DISTFILES)"; \ for file in $$extra_dists; do \ test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \ done; \ for file in $$dists; do \ test -f $$file || file="$(srcdir)/$$file"; \ ln $$file $(distdir) 2> /dev/null \ || cp -p $$file $(distdir); \ done update-po: Makefile $(MAKE) $(GETTEXT_PACKAGE).pot tmpdir=`pwd`; \ linguas="$(USE_LINGUAS)"; \ for lang in $$linguas; do \ echo "$$lang:"; \ result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \ if $$result; then \ if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ exit 1; \ fi; \ fi; \ else \ echo "msgmerge for $$lang.gmo failed!"; \ rm -f $$tmpdir/$$lang.new.po; \ fi; \ done Makefile POTFILES: stamp-it @if test ! -f $@; then \ rm -f stamp-it; \ $(MAKE) stamp-it; \ fi stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \ $(SHELL) ./config.status # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: libinstpatch-1.0.0/po/Makevars0000644000175000017500000000350311456655763013252 00000000000000# Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = $(PACKAGE) # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Josh Green # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: # - Strings which are not entire sentences, see the maintainer guidelines # in the GNU gettext documentation, section 'Preparing Strings'. # - Strings which use unclear terms or require additional context to be # understood. # - Strings which make invalid assumptions about notation of date, time or # money. # - Pluralisation problems. # - Incorrect English spelling. # - Incorrect formatting. # It can be your email address, or a mailing list address where translators # can write to without being subscribed, or the URL of a web page through # which the translators can contact you. MSGID_BUGS_ADDRESS = Josh Green # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = libinstpatch-1.0.0/Makefile.am0000644000175000017500000000074211456655763013176 00000000000000## Process this file with automake to produce Makefile.in SUBDIRS = m4 libinstpatch python utils examples po docs tests EXTRA_DIST = \ autogen.sh \ ABOUT-NLS \ config.guess \ config.sub \ CVS-HOWTO \ intltool-extract.in \ intltool-merge.in \ intltool-update.in pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libinstpatch-1.0.pc rpms: dist cd package && ./rpmpkg.sh ../${PACKAGE}-${VERSION}.tar.gz ACLOCAL_AMFLAGS = -I m4 DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc libinstpatch-1.0.0/examples/0000777000175000017500000000000011461404254013020 500000000000000libinstpatch-1.0.0/examples/create_sf2.py0000644000175000017500000000325711456655763015353 00000000000000#!/usr/bin/python # Python example of creating a SoundFont from multiple audio samples # # Updated on July 22, 2006 # Now uses more convenient converter functions. # # Josh Green - Sep 13, 2004 # Use this example as you please (public domain) # # Note that the Python binding API is not stable yet and may change # import ipatch import gobject, sys if len (sys.argv[1:]) == 0: print "Usage: create_sf2.py sample1.wav [sample2.wav sample3.aiff ...]" sys.exit () sf2 = ipatch.SF2 () # Create new SoundFont object # For each file specified on command line.. for fname in sys.argv[1:]: # Identify and open the file f = ipatch.ipatch_file_identify_open (fname, "r") if not f: print "Failed to identify file '%s'" % fname continue # Convert sample file to SF2Sample object sample = ipatch.ipatch_convert_object_to_type (f, ipatch.SF2Sample) if not sample: continue sf2.add_unique (sample) # Add sample and ensure name is unique name = sample.get_property ("name") # Get the sample name inst = ipatch.SF2Inst () # Create new SoundFont instrument inst.set_property ("name", name) # Set the instrument name = sample name inst.new_zone (sample) # Add new zone to inst => sample sf2.add_unique (inst) # Add inst and ensure name is unique preset = ipatch.SF2Preset () # Create new preset preset.set_property ("name", name) # Set preset name = sample name preset.new_zone (inst) # Add zone to preset => inst sf2.add_unique (preset) # Add preset, name/bank/preset # unique # Create SoundFont file object, set its name and open for writing sffile = ipatch.SF2File () sffile.open ("output.sf2", "w") ipatch.ipatch_convert_objects (sf2, sffile) sffile.close () libinstpatch-1.0.0/examples/Makefile.in0000644000175000017500000003764311461360570015020 00000000000000# Makefile.in generated by automake 1.11 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@ noinst_PROGRAMS = create_sf2$(EXEEXT) subdir = examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/python.m4 \ $(top_srcdir)/acinclude.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)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_create_sf2_OBJECTS = create_sf2.$(OBJEXT) create_sf2_OBJECTS = $(am_create_sf2_OBJECTS) create_sf2_DEPENDENCIES = \ $(top_srcdir)/libinstpatch/libinstpatch-1.0.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) 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 = $(create_sf2_SOURCES) DIST_SOURCES = $(create_sf2_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ IPATCH_BINARY_AGE = @IPATCH_BINARY_AGE@ IPATCH_INTERFACE_AGE = @IPATCH_INTERFACE_AGE@ IPATCH_VERSION = @IPATCH_VERSION@ IPATCH_VERSION_MAJOR = @IPATCH_VERSION_MAJOR@ IPATCH_VERSION_MICRO = @IPATCH_VERSION_MICRO@ IPATCH_VERSION_MINOR = @IPATCH_VERSION_MINOR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ 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@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ PYGTK_CODEGEN_DIR = @PYGTK_CODEGEN_DIR@ PYGTK_LIBS = @PYGTK_LIBS@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ SNDFILE_LIBS = @SNDFILE_LIBS@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ 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@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ 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@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = create_sf2.py create_sf2_SOURCES = create_sf2.c create_sf2_LDADD = $(top_srcdir)/libinstpatch/libinstpatch-1.0.la INCLUDES = -I$(top_srcdir) @GOBJECT_CFLAGS@ MAINTAINERCLEANFILES = Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(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 examples/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu examples/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list create_sf2$(EXEEXT): $(create_sf2_OBJECTS) $(create_sf2_DEPENDENCIES) @rm -f create_sf2$(EXEEXT) $(LINK) $(create_sf2_OBJECTS) $(create_sf2_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/create_sf2.Po@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 distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: 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." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ 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-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: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir 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-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 # 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: libinstpatch-1.0.0/examples/create_sf2.c0000644000175000017500000000720011461332551015114 00000000000000/* * Example of creating a SoundFont from multiple audio samples * * Updated on Oct 14, 2010 * Some API changes and additional comments in code. * * Updated on Nov 12, 2004 * Now uses more convenient converter functions. * * Joshua "Element" Green - Sep 14, 2004 * Use this example as you please (public domain) */ #include #include int main (int argc, char *argv[]) { IpatchSF2 *sf2; IpatchFileHandle *fhandle; IpatchSF2File *sffile; GObject *sample; /* IpatchSF2Sample */ IpatchSF2Inst *inst; IpatchSF2Preset *preset; GError *err = NULL; char *fname, *name; int i; if (argc < 2) { fprintf (stderr, "Usage: create_sf2 sample1.wav [sample2.wav sample3.aiff ..]\n"); return (1); } /* initialize libInstPatch */ ipatch_init (); sf2 = ipatch_sf2_new (); /* ++ ref new SoundFont object */ /* loop over file names (command line args) */ for (i = 1; i < argc; i++) { fname = argv[i]; /* ++ identify file type and open handle to file object */ fhandle = ipatch_file_identify_open (fname, &err); if (!fhandle) { fprintf (stderr, "Failed to identify file '%s': %s\n", fname, ipatch_gerror_message (err)); g_clear_error (&err); continue; } /* try to convert file to a SoundFont sample */ sample = ipatch_convert_object_to_type (G_OBJECT (fhandle->file), IPATCH_TYPE_SF2_SAMPLE, &err); if (!sample) { fprintf (stderr, "Failed to convert file '%s' to SoundFont sample: %s\n", fname, ipatch_gerror_message (err)); g_clear_error (&err); ipatch_file_close (fhandle); /* -- close file */ continue; } /* append sample to SoundFont (ensure that its name is unique) */ ipatch_container_add_unique (IPATCH_CONTAINER (sf2), IPATCH_ITEM (sample)); g_object_get (sample, "name", &name, NULL); /* get the sample's name */ /* create new SoundFont instrument (++ ref) */ inst = ipatch_sf2_inst_new (); g_object_set (inst, "name", name, NULL); /* set instrument name */ /* create new instrument zone and link sample to it */ ipatch_sf2_inst_new_zone (inst, IPATCH_SF2_SAMPLE (sample)); g_object_unref (sample); /* -- unref SoundFont sample */ /* append instrument to SoundFont (ensure that its name is unique) */ ipatch_container_add_unique (IPATCH_CONTAINER (sf2), IPATCH_ITEM (inst)); /* create new SoundFont preset (++ ref) */ preset = ipatch_sf2_preset_new (); g_object_set (preset, "name", name, NULL); /* set preset name */ /* create new preset zone and link instrument to it */ ipatch_sf2_preset_new_zone (preset, inst); g_object_unref (inst); /* -- unref SoundFont instrument */ /* append preset to SoundFont (ensure name/bank/preset # are unique) */ ipatch_container_add_unique (IPATCH_CONTAINER (sf2), IPATCH_ITEM (preset)); g_object_unref (preset); g_free (name); /* free the name (returned from g_object_get) */ ipatch_file_close (fhandle); /* -- close file */ } /* create SoundFont file object, set its name and open for writing */ sffile = ipatch_sf2_file_new (); ipatch_file_set_name (IPATCH_FILE (sffile), "output.sf2"); /* Save SoundFont to file using converter system */ if (!ipatch_convert_objects (G_OBJECT (sf2), G_OBJECT (sffile), &err)) { fprintf (stderr, "Failed to save SoundFont to file: %s\n", ipatch_gerror_message (err)); g_clear_error (&err); } g_object_unref (sffile); /* -- unref SoundFont file */ g_object_unref (sf2); /* -- unref SoundFont object */ return (0); /* we done, yeah! :) */ } libinstpatch-1.0.0/examples/Makefile.am0000644000175000017500000000045111456655763015011 00000000000000## Process this file with automake to produce Makefile.in EXTRA_DIST = create_sf2.py noinst_PROGRAMS = create_sf2 create_sf2_SOURCES = create_sf2.c create_sf2_LDADD = $(top_srcdir)/libinstpatch/libinstpatch-1.0.la INCLUDES = -I$(top_srcdir) @GOBJECT_CFLAGS@ MAINTAINERCLEANFILES = Makefile.in libinstpatch-1.0.0/README0000644000175000017500000000524411456655763012024 00000000000000+-------------------------------------------------------+ + libInstPatch - README + + Copyright (C) 1999-2007 Josh Green + + Email: jgreen@users.sourceforge.net + + libInstPatch site: http://swami.resonance.org + +-------------------------------------------------------+ ===================================== 1. What is libInstPatch? 2. License 3. Requirements 4. Features 5. Trademark Acknowledgement ===================================== 1. What is libInstPatch? ------------------------------------- libInstPatch stands for lib-Instrument-Patch and is a library for processing digital sample based MIDI instrument "patch" files. The types of files libInstPatch supports are used for creating instrument sounds for wavetable synthesis. libInstPatch provides an object framework (based on GObject) to load patch files into, which can then be edited, converted, compressed and saved. More information can be found on the libInstPatch Wiki pages on the Project Swami website. http://swami.resonance.org/trac/wiki/libInstPatch 2. License ------------------------------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1 of the License only. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or point your web browser to http://www.gnu.org. 3. Requirements ------------------------------------- Look at the INSTALL file for instructions on compiling and installing libInstPatch and for more details on software requirements. libInstPatch has the following requirements: - Just about anywhere glib/GObject can be found. This includes many *nix like operating systems such as Linux, *BSD, and Mac OS X and it should also be possible to run on win32 systems. - glib/gobject 2.x - libaudiofile glib/gobject homepage: http://www.gtk.org audiofile homepage: http://www.68k.org/~michael/audiofile/ 4. Features ------------------------------------- - Supports SoundFont 2 - Incomplete support for DLS 1/2 and GigaSampler - CRAM reference implementation for instrument compression 5. Trademark Acknowledgement ------------------------------------- SoundFont is a registered trademark of E-mu Systems, Inc. All other trademarks are property of their respective holders. libinstpatch-1.0.0/aclocal.m40000644000175000017500000016067411461360566013003 00000000000000# generated automatically by aclocal 1.11 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file 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. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],, [m4_warning([this file was generated for autoconf 2.64. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml]) # serial 40 IT_PROG_INTLTOOL AC_DEFUN([IT_PROG_INTLTOOL], [ AC_PREREQ([2.50])dnl AC_REQUIRE([AM_NLS])dnl case "$am__api_version" in 1.[01234]) AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool]) ;; *) ;; esac if test -n "$1"; then AC_MSG_CHECKING([for intltool >= $1]) INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` ] AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.]) fi AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update]) AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge]) AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract]) if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.]) fi INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< [$]@' INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< [$]@' INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' _IT_SUBST(INTLTOOL_DESKTOP_RULE) _IT_SUBST(INTLTOOL_DIRECTORY_RULE) _IT_SUBST(INTLTOOL_KEYS_RULE) _IT_SUBST(INTLTOOL_PROP_RULE) _IT_SUBST(INTLTOOL_OAF_RULE) _IT_SUBST(INTLTOOL_PONG_RULE) _IT_SUBST(INTLTOOL_SERVER_RULE) _IT_SUBST(INTLTOOL_SHEET_RULE) _IT_SUBST(INTLTOOL_SOUNDLIST_RULE) _IT_SUBST(INTLTOOL_UI_RULE) _IT_SUBST(INTLTOOL_XAM_RULE) _IT_SUBST(INTLTOOL_KBD_RULE) _IT_SUBST(INTLTOOL_XML_RULE) _IT_SUBST(INTLTOOL_XML_NOMERGE_RULE) _IT_SUBST(INTLTOOL_CAVES_RULE) _IT_SUBST(INTLTOOL_SCHEMAS_RULE) _IT_SUBST(INTLTOOL_THEME_RULE) _IT_SUBST(INTLTOOL_SERVICE_RULE) _IT_SUBST(INTLTOOL_POLICY_RULE) # Check the gettext tools to make sure they are GNU AC_PATH_PROG(XGETTEXT, xgettext) AC_PATH_PROG(MSGMERGE, msgmerge) AC_PATH_PROG(MSGFMT, msgfmt) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) fi xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`" mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`" mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`" if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) fi AC_PATH_PROG(INTLTOOL_PERL, perl) if test -z "$INTLTOOL_PERL"; then AC_MSG_ERROR([perl not found]) fi AC_MSG_CHECKING([for perl >= 5.8.1]) $INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1 if test $? -ne 0; then AC_MSG_ERROR([perl 5.8.1 is required for intltool]) else IT_PERL_VERSION="`$INTLTOOL_PERL -e \"printf '%vd', $^V\"`" AC_MSG_RESULT([$IT_PERL_VERSION]) fi if test "x$2" != "xno-xml"; then AC_MSG_CHECKING([for XML::Parser]) if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then AC_MSG_RESULT([ok]) else AC_MSG_ERROR([XML::Parser perl module is required for intltool]) fi fi # Substitute ALL_LINGUAS so we can use it in po/Makefile AC_SUBST(ALL_LINGUAS) # Set DATADIRNAME correctly if it is not set yet # (copied from glib-gettext.m4) if test -z "$DATADIRNAME"; then AC_LINK_IFELSE( [AC_LANG_PROGRAM([[]], [[extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr]])], [DATADIRNAME=share], [case $host in *-*-solaris*) dnl On Solaris, if bind_textdomain_codeset is in libc, dnl GNU format message catalog is always supported, dnl since both are added to the libc all together. dnl Hence, we'd like to go with DATADIRNAME=share dnl in this case. AC_CHECK_FUNC(bind_textdomain_codeset, [DATADIRNAME=share], [DATADIRNAME=lib]) ;; *) [DATADIRNAME=lib] ;; esac]) fi AC_SUBST(DATADIRNAME) IT_PO_SUBDIR([po]) ]) # IT_PO_SUBDIR(DIRNAME) # --------------------- # All po subdirs have to be declared with this macro; the subdir "po" is # declared by IT_PROG_INTLTOOL. # AC_DEFUN([IT_PO_SUBDIR], [AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS. dnl dnl The following CONFIG_COMMANDS should be exetuted at the very end dnl of config.status. AC_CONFIG_COMMANDS_PRE([ AC_CONFIG_COMMANDS([$1/stamp-it], [ if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ]; then AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.]) fi rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp" >"$1/stamp-it.tmp" [sed '/^#/d s/^[[].*] *// /^[ ]*$/d '"s|^| $ac_top_srcdir/|" \ "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES" ] [sed '/^POTFILES =/,/[^\\]$/ { /^POTFILES =/!d r $1/POTFILES } ' "$1/Makefile.in" >"$1/Makefile"] rm -f "$1/Makefile.tmp" mv "$1/stamp-it.tmp" "$1/stamp-it" ]) ])dnl ]) # _IT_SUBST(VARIABLE) # ------------------- # Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST # AC_DEFUN([_IT_SUBST], [ AC_SUBST([$1]) m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])]) ] ) # deprecated macros AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL]) # A hint is needed for aclocal from Automake <= 1.9.4: # AC_DEFUN([AC_PROG_INTLTOOL], ...) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # # Similar to PKG_CHECK_MODULES, make sure that the first instance of # this or PKG_CHECK_MODULES is called, or make sure to call # PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_ifval([$2], [$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$PKG_CONFIG"; then if test -n "$$1"; then pkg_cv_[]$1="$$1" else PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) fi else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` else $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ifelse([$4], , [AC_MSG_ERROR(dnl [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT ])], [AC_MSG_RESULT([no]) $4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) ifelse([$3], , :, [$3]) fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file 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. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file 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. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file 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. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file 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. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file 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. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file 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. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file 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. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 # Free Software Foundation, Inc. # # This file 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. # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # --------------------------------------------------------------------------- # Adds support for distributing Python modules and packages. To # install modules, copy them to $(pythondir), using the python_PYTHON # automake variable. To install a package with the same name as the # automake package, install to $(pkgpythondir), or use the # pkgpython_PYTHON automake variable. # # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as # locations to install python extension modules (shared libraries). # Another macro is required to find the appropriate flags to compile # extension modules. # # If your package is configured with a different prefix to python, # users will have to add the install directory to the PYTHONPATH # environment variable, or create a .pth file (see the python # documentation for details). # # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will # cause an error if the version of python installed on the system # doesn't meet the requirement. MINIMUM-VERSION should consist of # numbers and dots only. AC_DEFUN([AM_PATH_PYTHON], [ dnl Find a Python interpreter. Python versions prior to 2.0 are not dnl supported. (2.0 was released on October 16, 2000). m4_define_default([_AM_PYTHON_INTERPRETER_LIST], [python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 dnl python2.1 python2.0]) m4_if([$1],[],[ dnl No version check is needed. # Find any Python interpreter. if test -z "$PYTHON"; then AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) fi am_display_PYTHON=python ], [ dnl A version check is needed. if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. AC_MSG_CHECKING([whether $PYTHON version >= $1]) AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], [AC_MSG_RESULT(yes)], [AC_MSG_ERROR(too old)]) am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. AC_CACHE_CHECK([for a Python interpreter with version >= $1], [am_cv_pathless_PYTHON],[ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do test "$am_cv_pathless_PYTHON" = none && break AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) done]) # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) fi am_display_PYTHON=$am_cv_pathless_PYTHON fi ]) if test "$PYTHON" = :; then dnl Run any user-specified action, or abort. m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) else dnl Query Python for its version number. Getting [:3] seems to be dnl the best way to do this; it's what "site.py" does in the standard dnl library. AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) dnl Use the values of $prefix and $exec_prefix for the corresponding dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made dnl distinct variables so they can be overridden if need be. However, dnl general consensus is that you shouldn't need this ability. AC_SUBST([PYTHON_PREFIX], ['${prefix}']) AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) dnl At times (like when building shared libraries) you may want dnl to know which OS platform Python thinks this is. AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) dnl Set up 4 directories: dnl pythondir -- where to install python scripts. This is the dnl site-packages directory, not the python standard library dnl directory like in previous automake betas. This behavior dnl is more consistent with lispdir.m4 for example. dnl Query distutils for this directory. distutils does not exist in dnl Python 1.5, so we fall back to the hardcoded directory if it dnl doesn't work. AC_CACHE_CHECK([for $am_display_PYTHON script directory], [am_cv_python_pythondir], [if test "x$prefix" = xNONE then am_py_prefix=$ac_default_prefix else am_py_prefix=$prefix fi am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` ;; esac ]) AC_SUBST([pythondir], [$am_cv_python_pythondir]) dnl pkgpythondir -- $PACKAGE directory under pythondir. Was dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is dnl more consistent with the rest of automake. AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) dnl pyexecdir -- directory for installing python extension modules dnl (shared libraries) dnl Query distutils for this directory. distutils does not exist in dnl Python 1.5, so we fall back to the hardcoded directory if it dnl doesn't work. AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], [am_cv_python_pyexecdir], [if test "x$exec_prefix" = xNONE then am_py_exec_prefix=$am_py_prefix else am_py_exec_prefix=$exec_prefix fi am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` ;; esac ]) AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) dnl Run any user-specified action. $2 fi ]) # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # --------------------------------------------------------------------------- # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. # Run ACTION-IF-FALSE otherwise. # This test uses sys.hexversion instead of the string equivalent (first # word of sys.version), in order to cope with versions such as 2.2c1. # This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). AC_DEFUN([AM_PYTHON_CHECK_VERSION], [prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] sys.exit(sys.hexversion < minverhex)" AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file 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. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/gettext.m4]) m4_include([m4/gtk-doc.m4]) m4_include([m4/iconv.m4]) m4_include([m4/lib-ld.m4]) m4_include([m4/lib-link.m4]) m4_include([m4/lib-prefix.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([m4/nls.m4]) m4_include([m4/po.m4]) m4_include([m4/progtest.m4]) m4_include([m4/python.m4]) m4_include([acinclude.m4]) libinstpatch-1.0.0/mkinstalldirs0000755000175000017500000000672211456655763013754 00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2009-04-28.21; # UTC # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' IFS=" "" $nl" errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp=$pathcomp/ done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libinstpatch-1.0.0/config.h.in0000644000175000017500000000420711461363141013143 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS /* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT /* Define if you have the iconv() function. */ #undef HAVE_ICONV /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to enable debugging */ #undef IPATCH_DEBUG /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define if using the mingw environment */ #undef MINGW32 /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to build Python binding */ #undef PYTHON_SUPPORT /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION libinstpatch-1.0.0/config.sub0000755000175000017500000010224011456655763013121 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2009-04-17' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: libinstpatch-1.0.0/AUTHORS0000644000175000017500000000233711456655763012214 00000000000000Josh Green Ebrahim Mayat for Mac OS X testing, support and build HOWTO documentation Keishi Suenaga for Win32 patches and build HOWTO documentation Thanks to the following for reporting bugs: Henry Kroll for reporting bugs with 64 bit platform Frédéric Fournier for reporting a crash bug in SF2 writer libwavpack code --------------- libWavPack 4.40.0 Copyright (c) 1998 - 2006 Conifer Software. License: BSD Software License libFLAC code ------------ libFLAC - Free Lossless Audio Codec library Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson License: Free to use but must retain copyright notice and conditions Information on the GigaSampler format (no code used though) ----------------------------------------------------------- libgig - C++ cross-platform Gigasampler format file loader library Copyright (C) 2003-2005 by Christian Schoenebeck LinuxSampler - modular, streaming capable sampler Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck Copyright (C) 2005 Christian Schoenebeck Additional credits and thanks ----------------------------- Apple Computer, Inc. for loaning me a G5 development machine for Mac OS X testing and debugging.