From 8a2c2824a59d7644e13bc52c9a0ecbd641f21f95 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Wed, 13 Oct 2010 19:34:22 +0000 Subject: new branch muse2, first checkin --- muse2/synti/fluid/Makefile.am | 16 + muse2/synti/fluid/Makefile.in | 649 ++++++++++++++++++++++++++++++++++++++ muse2/synti/fluid/fluid.cpp | 588 ++++++++++++++++++++++++++++++++++ muse2/synti/fluid/fluid.h | 84 +++++ muse2/synti/fluid/fluidgui.cpp | 82 +++++ muse2/synti/fluid/fluidgui.h | 31 ++ muse2/synti/fluid/fluidguibase.ui | 166 ++++++++++ 7 files changed, 1616 insertions(+) create mode 100644 muse2/synti/fluid/Makefile.am create mode 100644 muse2/synti/fluid/Makefile.in create mode 100644 muse2/synti/fluid/fluid.cpp create mode 100644 muse2/synti/fluid/fluid.h create mode 100644 muse2/synti/fluid/fluidgui.cpp create mode 100644 muse2/synti/fluid/fluidgui.h create mode 100644 muse2/synti/fluid/fluidguibase.ui (limited to 'muse2/synti/fluid') diff --git a/muse2/synti/fluid/Makefile.am b/muse2/synti/fluid/Makefile.am new file mode 100644 index 00000000..7e641a85 --- /dev/null +++ b/muse2/synti/fluid/Makefile.am @@ -0,0 +1,16 @@ +include $(top_srcdir)/common.am +include $(top_srcdir)/synti/synti-install.am + +AM_CXXFLAGS += -fPIC -O3 -ffast-math -fno-exceptions -fno-rtti + +synthi_LTLIBRARIES = fluid.la + +fluid_la_SOURCES = fluid.cpp fluid.h \ + fluidgui.cpp fluidgui.h \ + fluidguibase.ui + +nodist_fluid_la_SOURCES = moc_fluidgui.cpp + +fluid_la_LIBADD = ../libsynti/libsynti.la -lfluidsynth +fluid_la_LDFLAGS = -module -avoid-version + diff --git a/muse2/synti/fluid/Makefile.in b/muse2/synti/fluid/Makefile.in new file mode 100644 index 00000000..a9f97135 --- /dev/null +++ b/muse2/synti/fluid/Makefile.in @@ -0,0 +1,649 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/common.am $(top_srcdir)/synti/synti-install.am +subdir = synti/fluid +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \ + $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.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)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +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)$(synthidir)" +LTLIBRARIES = $(synthi_LTLIBRARIES) +fluid_la_DEPENDENCIES = ../libsynti/libsynti.la +am_fluid_la_OBJECTS = fluid.lo fluidgui.lo fluidguibase.lo +nodist_fluid_la_OBJECTS = moc_fluidgui.lo +fluid_la_OBJECTS = $(am_fluid_la_OBJECTS) $(nodist_fluid_la_OBJECTS) +fluid_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(fluid_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 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +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 = $(fluid_la_SOURCES) $(nodist_fluid_la_SOURCES) +DIST_SOURCES = $(fluid_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOKSTYLE = @DOCBOOKSTYLE@ +DOCBOOKTARGETS = @DOCBOOKTARGETS@ +DOT = @DOT@ +DOTPATH = @DOTPATH@ +DOXYGEN = @DOXYGEN@ +DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@ +FST_CFLAGS = @FST_CFLAGS@ +FST_LIBS = @FST_LIBS@ +Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@ +Fluidsynth_LIBS = @Fluidsynth_LIBS@ +GIVERTCAP = @GIVERTCAP@ +GREP = @GREP@ +HAVEDOT = @HAVEDOT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JACK_CFLAGS = @JACK_CFLAGS@ +JACK_LIBS = @JACK_LIBS@ +JADE = @JADE@ +LASH_CFLAGS = @LASH_CFLAGS@ +LASH_LIBS = @LASH_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LO_CFLAGS = @LO_CFLAGS@ +LO_LIBS = @LO_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MUSECXXFLAGS = @MUSECXXFLAGS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSGMLS = @NSGMLS@ +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@ +PCH = @PCH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIB = @PYTHON_LIB@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +QTDIR_BIN = @QTDIR_BIN@ +QTDIR_INC = @QTDIR_INC@ +QT_LIBS = @QT_LIBS@ +RANLIB = @RANLIB@ +SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@ +SAMPLERATE_LIBS = @SAMPLERATE_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ +SNDFILE_LIBS = @SNDFILE_LIBS@ +STRIP = @STRIP@ +SUIDBUILD = @SUIDBUILD@ +SUIDINSTALL = @SUIDINSTALL@ +USE_SSE = @USE_SSE@ +UUID_CFLAGS = @UUID_CFLAGS@ +UUID_LIBS = @UUID_LIBS@ +VERSION = @VERSION@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +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_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_docbook = @have_docbook@ +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@ +synth_fluid = @synth_fluid@ +synth_fluidsynth = @synth_fluidsynth@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \ + -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \ + -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT -fPIC -O3 -ffast-math \ + -fno-exceptions -fno-rtti +AM_CPPFLAGS = +MOC = $(QTDIR_BIN)/moc +#UIC = $(QTDIR_BIN)/uic3 +UIC = /usr/bin/uic3 +UIFILES = $(wildcard *.ui) +MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \ + if grep -q Q_OBJECT $$h; then \ + echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \ + fi; \ + done) + +BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h) +MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h) +SUFFIXES = .ui .h.gch +synthidir = $(pkglibdir)/synthi +synthi_LTLIBRARIES = fluid.la +fluid_la_SOURCES = fluid.cpp fluid.h \ + fluidgui.cpp fluidgui.h \ + fluidguibase.ui + +nodist_fluid_la_SOURCES = moc_fluidgui.cpp +fluid_la_LIBADD = ../libsynti/libsynti.la -lfluidsynth +fluid_la_LDFLAGS = -module -avoid-version +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .ui .h.gch .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(top_srcdir)/synti/synti-install.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 synti/fluid/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu synti/fluid/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-synthiLTLIBRARIES: $(synthi_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(synthidir)" || $(MKDIR_P) "$(DESTDIR)$(synthidir)" + @list='$(synthi_LTLIBRARIES)'; test -n "$(synthidir)" || 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)$(synthidir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(synthidir)"; \ + } + +uninstall-synthiLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(synthi_LTLIBRARIES)'; test -n "$(synthidir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(synthidir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(synthidir)/$$f"; \ + done + +clean-synthiLTLIBRARIES: + -test -z "$(synthi_LTLIBRARIES)" || rm -f $(synthi_LTLIBRARIES) + @list='$(synthi_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 +fluid.la: $(fluid_la_OBJECTS) $(fluid_la_DEPENDENCIES) + $(fluid_la_LINK) -rpath $(synthidir) $(fluid_la_OBJECTS) $(fluid_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fluid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fluidgui.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_fluidgui.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(synthidir)"; 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: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +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 "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-synthiLTLIBRARIES \ + 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-synthiLTLIBRARIES + +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: uninstall-synthiLTLIBRARIES + +.MAKE: all check install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-synthiLTLIBRARIES 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 install-synthiLTLIBRARIES 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-synthiLTLIBRARIES + + +de: + @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done + +nde: + @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done + +.ui.o: %.h + $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui + $(MOC) $*.h >> $*.cpp + $(CXXCOMPILE) -c $*.cpp -o $*.o + $(RM) $*.cpp moc_$*.cpp moc_$*.o + +.ui.lo: %.h + $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui + $(MOC) $*.h >> $*.cpp + $(LTCXXCOMPILE) -c $*.cpp -o $*.lo + $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o + +moc_%.cpp: %.h + $(MOC) $< -o $@ + +%.h: %.ui + $(UIC) -o $@ $< +# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $< + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/muse2/synti/fluid/fluid.cpp b/muse2/synti/fluid/fluid.cpp new file mode 100644 index 00000000..a03be4de --- /dev/null +++ b/muse2/synti/fluid/fluid.cpp @@ -0,0 +1,588 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: fluid.cpp,v 1.18.2.8 2009/12/06 10:05:00 terminator356 Exp $ +// +// This file is derived from fluid Synth and modified +// for MusE. +// Parts of fluid are derived from Smurf Sound Font Editor. +// Parts of Smurf Sound Font Editor are derived from +// awesfx utilities +// Smurf: Copyright (C) 1999-2000 Josh Green +// fluid: Copyright (C) 2001 Peter Hanappe +// MusE: Copyright (C) 2001 Werner Schweer +// awesfx: Copyright (C) 1996-1999 Takashi Iwai +//========================================================= + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "muse/midictrl.h" + +#include "muse/midi.h" +#include "fluid.h" +#include "fluidgui.h" + +//--------------------------------------------------------- +// instantiate +//--------------------------------------------------------- + +class QWidget; + +static Mess* instantiate(int sr, QWidget*, QString *projectPathPtr, const char* name) + { + ISynth* synth = new ISynth(); + synth->setSampleRate(sr); + if (synth->init(name)) { + delete synth; + synth = 0; + } + return synth; + } + +//--------------------------------------------------------- +// MESS +//--------------------------------------------------------- + +extern "C" { + static MESS descriptor = { + "fluid", + "fluid soundfont loader by Werner Schweer", + "0.1", // fluid version string + MESS_MAJOR_VERSION, MESS_MINOR_VERSION, + instantiate, + }; + const MESS* mess_descriptor() { return &descriptor; } + } + +//--------------------------------------------------------- +// ISynth +//--------------------------------------------------------- + +ISynth::ISynth() + : Mess(2) + { + _busy = false; + sfont = 0; + _gmMode = false; // General Midi Mode + _fluidsynth = 0; + initBuffer = 0; + initLen = 0; + fontId = -1; + } + +//--------------------------------------------------------- +// playNote +// return true if busy +//--------------------------------------------------------- + +bool ISynth::playNote(int channel, int pitch, int velo) + { + if (_busy) { +// printf("fluid: playNote(): busy!\n"); + return true; + } + if (velo) { + int err = fluid_synth_noteon(_fluidsynth, channel, pitch, velo); + if (err) { + printf("ISynth: noteon error, channel %d pitch %d<%s>\n", + channel, pitch, fluid_synth_error(_fluidsynth)); + } + } + else + fluid_synth_noteoff(_fluidsynth, channel, pitch); + return false; + } + +//--------------------------------------------------------- +// setController +// return true if busy +//--------------------------------------------------------- + +bool ISynth::setController(int ch, int ctrl, int val) + { + if (_busy) { +// printf("fluid: setController(): busy!\n"); + return true; + } + switch(ctrl) { + case CTRL_PROGRAM: + { + int hbank = (val & 0xff0000) >> 16; + int lbank = (val & 0xff00) >> 8; + if (hbank > 127) // map "dont care" to 0 + hbank = 0; + if (lbank > 127) + lbank = 0; + if (lbank == 127 || ch == 9) // drum HACK + lbank = 128; + int prog = val & 0x7f; + fluid_synth_program_select(_fluidsynth, ch, + hbank, lbank, prog); + } + break; + + case CTRL_PITCH: + fluid_synth_pitch_bend (_fluidsynth, ch, val); + break; + + default: +// printf("controller %x val %x\n", ctrl & 0x3fff, val); + fluid_synth_cc(_fluidsynth, ch, ctrl & 0x3fff, val); + break; + } + return false; + } + +//--------------------------------------------------------- +// sysex +// 7e 7f 09 01 GM on +// 7e 7f 09 02 GM off +// 7f 7f 04 01 ll hh Master Volume (ll-low byte, hh-high byte) +// 7c 00 01 nn ... replace Soundfont (nn-ascii char of path +// 7c 00 02 nn ... add Soundfont +// 7c 00 03 nn ... remove Soundfont +// +// return true if busy +//--------------------------------------------------------- + +bool ISynth::sysex(int len, const unsigned char* data) + { + if (_busy) { +// printf("fluid: sysex(): busy!\n"); + return true; + } + if (len >= 4) { + //--------------------------------------------- + // Universal Non Realtime + //--------------------------------------------- + + if (data[0] == 0x7e) { + if (data[1] == 0x7f) { // device Id + if (data[2] == 0x9) { // GM + if (data[3] == 0x1) { + gmOn(true); + return false; + } + else if (data[3] == 0x2) { + gmOn(false); + return false; + } + } + } + } + + //--------------------------------------------- + // Universal Realtime + //--------------------------------------------- + + else if (data[0] == 0x7f) { + if (data[1] == 0x7f) { // device Id + if ((data[2] == 0x4) && (data[3] == 0x1)) { + float v = (data[5]*128 + data[4])/32767.0; + fluid_synth_set_gain(_fluidsynth, v); + return false; + } + } + } + + //--------------------------------------------- + // MusE Soft Synth + //--------------------------------------------- + + else if (data[0] == 0x7c) { + int n = len - 3; + if (n < 1) { + printf("fluid: bad sysEx:\n"); + return false; + } + char buffer[n+1]; + memcpy(buffer, (char*)data+3, n); + buffer[n] = 0; + if (data[1] == 0) { // fluid + if (data[2] == 1) { // load sound font + sysexSoundFont(SF_REPLACE, buffer); + return false; + } + else if (data[2] == 2) { // load sound font + sysexSoundFont(SF_ADD, buffer); + return false; + } + else if (data[2] == 3) { // load sound font + sysexSoundFont(SF_REMOVE, buffer); + return false; + } + } + } + else if (data[0] == 0x41) { // roland + if (data[1] == 0x10 && data[2] == 0x42 && data[3] == 0x12 + && data[4] == 0x40 && data[5] == 00 && data[6] == 0x7f + && data[7] == 0x41) { + // gs on + gmOn(true); + return false; + } + } + } + printf("fluid: unknown sysex received, len %d:\n", len); + for (int i = 0; i < len; ++i) + printf("%02x ", data[i]); + printf("\n"); + return false; + } + +//--------------------------------------------------------- +// gmOn +//--------------------------------------------------------- + +void ISynth::gmOn(bool flag) + { + _gmMode = flag; + allNotesOff(); + } + +//--------------------------------------------------------- +// allNotesOff +// stop all notes +//--------------------------------------------------------- + +void ISynth::allNotesOff() + { + for (int ch = 0; ch < 16; ++ch) { + fluid_synth_cc(_fluidsynth, ch, 0x7b, 0); // all notes off + } + } + +//--------------------------------------------------------- +// guiVisible +//--------------------------------------------------------- + +bool ISynth::guiVisible() const + { + return gui->isVisible(); + } + +//--------------------------------------------------------- +// showGui +//--------------------------------------------------------- + +void ISynth::showGui(bool flag) + { + gui->setShown(flag); + } + +//--------------------------------------------------------- +// ~ISynth +//--------------------------------------------------------- + +ISynth::~ISynth() + { + // TODO delete settings + if (_fluidsynth) + delete_fluid_synth(_fluidsynth); + if (initBuffer) + delete [] initBuffer; + } + +//--------------------------------------------------------- +// processMessages +// Called from host always, even if output path is unconnected. +//--------------------------------------------------------- + +void ISynth::processMessages() +{ + //Process messages from the gui + if (!_busy) + { + // + // get and process all pending events from the + // synthesizer GUI + // + while (gui->fifoSize()) + processEvent(gui->readEvent()); + } +} + +//--------------------------------------------------------- +// process +// Called from host, ONLY if output path is connected. +//--------------------------------------------------------- + +void ISynth::process(float** ports, int offset, int n) + { + if (!_busy) { + /* + // + // get and process all pending events from the + // synthesizer GUI + // + while (gui->fifoSize()) + processEvent(gui->readEvent()); + */ + fluid_synth_write_float(_fluidsynth, n, ports[0], + offset, 1, ports[1], offset, 1); + } + // printf("%f %f\n", *ports[0], *(ports[0]+1)); + } + +//--------------------------------------------------------- +// processEvent +// All events from the sequencer go here +//--------------------------------------------------------- +bool ISynth::processEvent(const MidiPlayEvent& ev) + { + switch(ev.type()) { + case ME_CONTROLLER: + setController(ev.channel(), ev.dataA(), ev.dataB()); + return true; + case ME_NOTEON: + return playNote(ev.channel(), ev.dataA(), ev.dataB()); + case ME_NOTEOFF: + return playNote(ev.channel(), ev.dataA(), 0); + case ME_SYSEX: + return sysex(ev.len(), ev.data()); + case ME_PITCHBEND: + setController(ev.channel(), CTRL_PITCH, ev.dataA()); + break; + case ME_PROGRAM: + setController(ev.channel(), CTRL_PROGRAM, ev.dataA()); + break; + default: + break; + } + return false; + } + +//--------------------------------------------------------- +// getPatchName +//--------------------------------------------------------- + +const char* ISynth::getPatchName(int /*ch*/, int val, int, bool /*drum*/) const + { + int prog = val & 0xff; + if(val == CTRL_VAL_UNKNOWN || prog == 0xff) + return ""; + prog &= 0x7f; + + int hbank = (val & 0xff0000) >> 16; + int lbank = (val & 0xff00) >> 8; + if (hbank > 127) + hbank = 0; + if (lbank > 127) + lbank = 0; + if (lbank == 127) // drum HACK + lbank = 128; + const char* name = ""; + + if (_busy) { + printf("fluid: getPatchName(): busy!\n"); + return name; + } + fluid_font = fluid_synth_get_sfont_by_id(_fluidsynth, hbank); + if (fluid_font) { + fluid_preset_t* preset = (*fluid_font->get_preset)(fluid_font, lbank, prog); + if (preset) + name = (*preset->get_name)(preset); + else + fprintf(stderr, "no fluid preset for bank %d prog %d\n", + lbank, prog); + } + else + fprintf(stderr, "ISynth::getPatchName(): no fluid font id=%d found\n", hbank); + return name; + } + +//--------------------------------------------------------- +// getNextPatch +//--------------------------------------------------------- + +const MidiPatch* ISynth::getPatchInfo(int ch, const MidiPatch* p) const + { + if (_busy) { + printf("fluid: getPatchInfo(): busy!\n"); + return 0; + } + if (p == 0) { + // get font at font stack index 0 + fluid_font = fluid_synth_get_sfont(_fluidsynth, 0); + if (fluid_font == 0) + return 0; + (*fluid_font->iteration_start)(fluid_font); + } + fluid_preset_t preset; + + while ((*fluid_font->iteration_next)(fluid_font, &preset)) { + patch.hbank = fluid_sfont_get_id(fluid_font); + int bank = (*preset.get_banknum)(&preset); + if (ch == 9 && bank != 128) // show only drums for channel 10 + continue; + if (bank == 128) + bank = 127; + patch.typ = 0; + patch.name = (*preset.get_name)(&preset); + patch.lbank = bank; + patch.prog = (*preset.get_num)(&preset); + return &patch; + } + return 0; + } + +//--------------------------------------------------------- +// getInitData +// construct an initialization string which can be used +// as a sysex to restore current state +//--------------------------------------------------------- + +void ISynth::getInitData(int* len, const unsigned char** data) + { + if (sfont == 0) { + *len = 0; + return; + } + int n = 4 + strlen(sfont); + if (n > initLen) { + if (initBuffer) + delete [] initBuffer; + initBuffer = new unsigned char[n]; + } + initBuffer[0] = 0x7c; + initBuffer[1] = 0x00; + initBuffer[2] = SF_REPLACE; + strcpy((char*)(initBuffer+3), sfont); + *len = n; + *data = initBuffer; + } + +//--------------------------------------------------------- +// sysexSoftfont +//--------------------------------------------------------- + +void ISynth::sysexSoundFont(SfOp op, const char* data) + { + char c = 'x'; + allNotesOff(); + switch(op) { + case SF_REMOVE: + break; + case SF_REPLACE: + case SF_ADD: + if (sfont && (strcmp(sfont, data) == 0)) { + fprintf(stderr, "fluid: font already loaded\n"); + break; + } + if (_busy) { + fprintf(stderr, "fluid: busy!\n"); + break; + } + _busy = true; + if (sfont) + delete[] sfont; + sfont = new char[strlen(data)+1]; + strcpy(sfont, data); + _busy = true; + write(writeFd, &c, 1); + break; + } + } + +//--------------------------------------------------------- +// fontLoad +// helper thread to load soundfont in the +// background +//--------------------------------------------------------- + +static void* helper(void* t) + { + ISynth* is = (ISynth*) t; + is->noRTHelper(); + pthread_exit(0); + } + +//------------------------------------ +// noRTHelper +//--------------------------------------------------------- + +void ISynth::noRTHelper() + { + for (;;) { + char c; + int n = read(readFd, &c, 1); + if (n != 1) { + perror("ISynth::read ipc failed\n"); + continue; + } + int id = getFontId(); + if (id != -1) { + fprintf(stderr, "ISynth: unload old font\n"); + fluid_synth_sfunload(synth(), (unsigned)id, true); + } + int rv = fluid_synth_sfload(synth(), getFont(), true); + if (rv == -1) { + fprintf(stderr, "ISynth: sfload %s failed\n", + fluid_synth_error(synth())); + } + else { + setFontId(rv); + fprintf(stderr, "ISynth: sfont %s loaded as %d\n ", + getFont(), rv); + } + fluid_synth_set_gain(synth(), 1.0); //? + _busy = false; + } + } + +//--------------------------------------------------------- +// init +// return true on error +//--------------------------------------------------------- + +bool ISynth::init(const char* name) + { + fluid_settings_t* settings; + settings = new_fluid_settings(); + fluid_settings_setnum(settings, (char*) "synth.sample-rate", float(sampleRate())); + + _fluidsynth = new_fluid_synth(settings); + + //--------------------------------------- + // create non realtime helper thread + // create message channels + // + int filedes[2]; // 0 - reading 1 - writing + if (pipe(filedes) == -1) { + perror("ISynth::thread:creating pipe"); + return true; + } + readFd = filedes[0]; + writeFd = filedes[1]; + + pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t)); + pthread_attr_init(attributes); + if (pthread_create(&helperThread, attributes, ::helper, this)) + perror("creating thread failed:"); + pthread_attr_destroy(attributes); + + char* p = getenv("DEFAULT_SOUNDFONT"); + if (p) { + sfont = new char[strlen(p)+1]; + strcpy(sfont, p); + char c = 'x'; + _busy = true; + write(writeFd, &c, 1); + } + + gui = new FLUIDGui; + gui->setCaption(QString(name)); + gui->show(); + return false; + } + diff --git a/muse2/synti/fluid/fluid.h b/muse2/synti/fluid/fluid.h new file mode 100644 index 00000000..c1669846 --- /dev/null +++ b/muse2/synti/fluid/fluid.h @@ -0,0 +1,84 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: fluid.h,v 1.7.2.4 2009/11/19 04:20:33 terminator356 Exp $ +// +// This file is derived from fluid Synth and modified +// for MusE. +// Parts of fluid are derived from Smurf Sound Font Editor. +// Parts of Smurf Sound Font Editor are derived from +// awesfx utilities +// Smurf: Copyright (C) 1999-2000 Josh Green +// fluid: Copyright (C) 2001 Peter Hanappe +// MusE: Copyright (C) 2001 Werner Schweer +// awesfx: Copyright (C) 1996-1999 Takashi Iwai +//========================================================= + +#ifndef _SYNTH_H +#define _SYNTH_H + +#include +#include +#include "libsynti/mess.h" + +enum SfOp { SF_REPLACE = 1, SF_ADD, SF_REMOVE }; +class FLUIDGui; + +//--------------------------------------------------------- +// ISynth +//--------------------------------------------------------- + +class ISynth : public Mess { + bool _busy; + bool _gmMode; + + unsigned char* initBuffer; + int initLen; + + fluid_synth_t* _fluidsynth; + char* sfont; + mutable fluid_sfont_t* fluid_font; + int fontId; + + int readFd, writeFd; + + mutable MidiPatch patch; + + pthread_t helperThread; + FLUIDGui* gui; + + void gmOn(bool); + void sysexSoundFont(SfOp op, const char* data); + + void allNotesOff(); + void resetAllController(int); + + virtual void processMessages(); + virtual void process(float**, int, int); + virtual bool playNote(int channel, int pitch, int velo); + virtual bool setController(int, int, int); + virtual bool sysex(int len, const unsigned char* p); + + virtual bool processEvent(const MidiPlayEvent&); + virtual const char* getPatchName (int, int, int, bool) const; + virtual const MidiPatch* getPatchInfo(int, const MidiPatch *) const; + virtual void getInitData(int*, const unsigned char**); + + virtual bool guiVisible() const; + virtual void showGui(bool); + virtual bool hasGui() const { return true; } + + public: + ISynth(); + ~ISynth(); + + fluid_synth_t* synth() { return _fluidsynth; } + const fluid_synth_t* synth() const { return _fluidsynth; } + char* getFont() const { return sfont; } + void setFontId(int id) { fontId = id; } + int getFontId() const { return fontId; } + bool init(const char* name); + void noRTHelper(); + }; + +#endif /* _SYNTH_H */ diff --git a/muse2/synti/fluid/fluidgui.cpp b/muse2/synti/fluid/fluidgui.cpp new file mode 100644 index 00000000..e5677bcb --- /dev/null +++ b/muse2/synti/fluid/fluidgui.cpp @@ -0,0 +1,82 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: fluidgui.cpp,v 1.6.2.1 2009/08/12 20:47:01 spamatica Exp $ +// +// This is a simple GUI implemented with QT for +// fluid software synthesizer. +// +// (C) Copyright 2001-2004 Werner Schweer (ws@seh.de) +//========================================================= + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fluidgui.h" +#include "muse/midi.h" + +//--------------------------------------------------------- +// FLUIDGui +//--------------------------------------------------------- + +FLUIDGui::FLUIDGui() + : FLUIDGuiBase(0, "fluidgui", Qt::WType_TopLevel), MessGui() + { + connect(fdialogButton, SIGNAL(clicked()), SLOT(soundFontFileDialog())); + connect(loadButton, SIGNAL(clicked()), SLOT(loadFont())); + + // work around for probable QT/WM interaction bug. + // for certain window managers, e.g xfce, this window is + // is displayed although not specifically set to show(); + // bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others) + show(); + hide(); + } + +//--------------------------------------------------------- +// loadFont +// sysex f0 lenH lenM lenL 7c 00 01 name +//--------------------------------------------------------- + +void FLUIDGui::loadFont() + { + if (pathEntry->text().isEmpty()) + return; + QFileInfo fi(pathEntry->text()); + if (!fi.exists()) { + QString s = QString("SoundFont ") + pathEntry->text() + QString(" does not exists"); + QMessageBox::critical(this, tr("FLUID: open Soundfile"), s); + return; + } + const char* path = pathEntry->text().latin1(); + int len = strlen(path) + 1 + 3; + unsigned char buffer[len]; + int k = 0; + buffer[k++] = 0x7c; + buffer[k++] = 0x00; // fluid + buffer[k++] = 0x01; // load sound font + strcpy((char*)(&buffer[k]), path); + sendSysex(buffer, len); + } + +//--------------------------------------------------------- +// soundFontFileDialog +//--------------------------------------------------------- + +void FLUIDGui::soundFontFileDialog() + { + QString s = Q3FileDialog::getOpenFileName(QString::null, QString("*.[Ss][Ff]2"), this); + if (!s.isEmpty()) { + pathEntry->setText(s); + } + } + diff --git a/muse2/synti/fluid/fluidgui.h b/muse2/synti/fluid/fluidgui.h new file mode 100644 index 00000000..9aeaa73b --- /dev/null +++ b/muse2/synti/fluid/fluidgui.h @@ -0,0 +1,31 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: fluidgui.h,v 1.2 2004/02/12 17:32:29 wschweer Exp $ +// +// (C) Copyright 2001 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __GUI_H__ +#define __GUI_H + +#include "fluidguibase.h" +#include "libsynti/gui.h" + +//--------------------------------------------------------- +// FLUIDGui +//--------------------------------------------------------- + +class FLUIDGui : public FLUIDGuiBase, public MessGui { + + Q_OBJECT + + private slots: + void soundFontFileDialog(); + void loadFont(); + + public: + FLUIDGui(); + }; + +#endif diff --git a/muse2/synti/fluid/fluidguibase.ui b/muse2/synti/fluid/fluidguibase.ui new file mode 100644 index 00000000..80f79e7b --- /dev/null +++ b/muse2/synti/fluid/fluidguibase.ui @@ -0,0 +1,166 @@ + +FLUIDGuiBase + + QDialog + + name + FLUIDGuiBase + + + geometry + + 0 + 0 + 248 + 94 + + + + caption + Form1 + + + + margin + 11 + + + spacing + 6 + + + QLayoutWidget + + name + Layout1 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel1 + + + text + Soundfont + + + + QLineEdit + + name + pathEntry + + + + QToolButton + + name + fdialogButton + + + text + + + + pixmap + image0 + + + + + + + name + Spacer2 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLayoutWidget + + name + Layout2 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + loadButton + + + sizePolicy + + 5 + 0 + + + + text + Load + + + + + name + Spacer1 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + + + + image0 + 789c5d8fb10ac2301040f77c45e86d45ac955607f1131447411c2e97141daaa07510f1dfcd256992fadae1de23e9d1aa94c7c34e9695780e385c49d2051fb2d4afbe7f9fcedb8f28ea95b4ef5ad6c54c147349727fbf199ec1ceb070b01a566cb0c68655b3524b4b6a5989551b7e5891b5eb105b64555eb541725b1c60f1536c36b80aa9417636dd1de37fcbcea5cfc71d804a2178625316f4406a90e31b02254203d216f7db06c20ed77c1adb34a516526cd314ce6570fb6ec40ff56a68fe + + + -- cgit v1.2.3