OSDN Git Service

Add portmidi Server config files
authorKeishi Suenaga <s_keishi@mutt.freemail.ne.jp>
Fri, 27 Jun 2003 05:25:05 +0000 (05:25 +0000)
committerKeishi Suenaga <s_keishi@mutt.freemail.ne.jp>
Fri, 27 Jun 2003 05:25:05 +0000 (05:25 +0000)
PortMIDI server merged

22 files changed:
doc/C/Makefile.in
doc/Makefile.in
doc/ja_JP.ujis/Makefile.in
interface/Makefile.am
interface/Makefile.in
interface/bitmaps/Makefile.in
interface/motif_bitmaps/Makefile.in
interface/pixmaps/Makefile.in
interface/rtsyn.h [new file with mode: 0644]
interface/rtsyn_common.c [new file with mode: 0644]
interface/rtsyn_portmidi.c [new file with mode: 0644]
interface/rtsyn_winmm.c [new file with mode: 0644]
interface/w32g_syn.c
interface/winsyn_c.c
libarc/Makefile.in
libunimod/Makefile.in
script/Makefile.in
timidity/Makefile.in
timidity/controls.c
timidity/portaudio_a.c
timidity/timidity.c
utils/Makefile.in

index d660da6..9d32f73 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -102,6 +102,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -114,6 +116,8 @@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@
 ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@
 ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@
 ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@
+ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@
+ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@
 ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@
 ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@
 ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@
@@ -159,6 +163,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -187,7 +192,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -249,7 +253,6 @@ EXTRA_DIST = \
        README.alsaseq
 
 subdir = doc/C
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -307,6 +310,7 @@ check: check-am
 all-am: Makefile
 
 installdirs:
+
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
index ac2ba66..d55765b 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -126,6 +126,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -138,6 +140,8 @@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@
 ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@
 ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@
 ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@
+ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@
+ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@
 ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@
 ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@
 ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@
@@ -183,6 +187,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -212,7 +217,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -301,7 +305,6 @@ man_MANS = \
 
 EXTRA_DIST = m2m.txt
 subdir = doc
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -364,10 +367,6 @@ uninstall-man1:
        done; \
        for i in $$list; do \
          ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-         case "$$ext" in \
-           1*) ;; \
-           *) ext='1' ;; \
-         esac; \
          inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
          inst=`echo $$inst | sed -e 's/^.*\///'`; \
          inst=`echo $$inst | sed '$(transform)'`.$$ext; \
@@ -411,10 +410,6 @@ uninstall-man5:
        done; \
        for i in $$list; do \
          ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-         case "$$ext" in \
-           5*) ;; \
-           *) ext='5' ;; \
-         esac; \
          inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
          inst=`echo $$inst | sed -e 's/^.*\///'`; \
          inst=`echo $$inst | sed '$(transform)'`.$$ext; \
@@ -502,15 +497,9 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
        here=`pwd`; \
-       if (etags --etags-include --version) >/dev/null 2>&1; then \
-         include_option=--etags-include; \
-       else \
-         include_option=--include; \
-       fi; \
        list='$(SUBDIRS)'; for subdir in $$list; do \
          if test "$$subdir" = .; then :; else \
-           test -f $$subdir/TAGS && \
-             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+           test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
          fi; \
        done; \
        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
index 01e6b00..d32dbe1 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -102,6 +102,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -114,6 +116,8 @@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@
 ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@
 ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@
 ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@
+ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@
+ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@
 ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@
 ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@
 ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@
@@ -159,6 +163,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -187,7 +192,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -246,7 +250,6 @@ EXTRA_DIST = \
        README.xaw
 
 subdir = doc/ja_JP.ujis
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -304,6 +307,7 @@ check: check-am
 all-am: Makefile
 
 installdirs:
+
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
index ffc5b99..ce8de10 100644 (file)
@@ -120,7 +120,11 @@ EXTRA_libinterface_a_SOURCES = \
        w32g_mag.h \
        w32g_dib.c \
        w32g_dib.h \
-       winsyn_c.c
+       winsyn_c.c \
+       rtsyn.h \
+       rtsyn_common.c \
+       rtsyn_winmm.c \
+       rtsyn_portmidi.c
 
 if ENABLE_WRD
 WRD_OBJS = \
index ac71590..196a25c 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -126,6 +126,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -185,6 +187,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -214,7 +217,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -395,7 +397,11 @@ EXTRA_libinterface_a_SOURCES = \
        w32g_mag.h \
        w32g_dib.c \
        w32g_dib.h \
-       winsyn_c.c
+       winsyn_c.c \
+       rtsyn.h \
+       rtsyn_common.c \
+       rtsyn_winmm.c \
+       rtsyn_portmidi.c
 
 
 @ENABLE_WRD_TRUE@WRD_OBJS = \
@@ -483,7 +489,6 @@ EXTRA_DIST = \
 # dynamic_targets = @dynamic_targets@ # autoconf already define this
 @NEEDDLOPEN_TRUE@install_dynamics = install.dynamics
 subdir = interface
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -585,7 +590,9 @@ am__depfiles_maybe = depfiles
 @AMDEP_TRUE@   ./$(DEPDIR)/mac_trace.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/mac_wrdwindow.Po ./$(DEPDIR)/motif_c.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/motif_i.Po ./$(DEPDIR)/motif_p.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/ncurs_c.Po ./$(DEPDIR)/server_c.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/ncurs_c.Po ./$(DEPDIR)/rtsyn_common.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/rtsyn_portmidi.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/rtsyn_winmm.Po ./$(DEPDIR)/server_c.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/slang_c.Po ./$(DEPDIR)/soundspec.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/tk_c.Po ./$(DEPDIR)/vt100.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/vt100_c.Po ./$(DEPDIR)/w32g_c.Po \
@@ -657,6 +664,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motif_i.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motif_p.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ncurs_c.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtsyn_common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtsyn_portmidi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtsyn_winmm.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server_c.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slang_c.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/soundspec.Po@am__quote@
@@ -700,7 +710,7 @@ distclean-depend:
 .c.o:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
 @am__fastdepCC_TRUE@     -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@   then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
 @am__fastdepCC_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
 @am__fastdepCC_TRUE@   fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@@ -710,14 +720,14 @@ distclean-depend:
 
 .c.obj:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \
+@am__fastdepCC_TRUE@   then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
 @am__fastdepCC_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
 @am__fastdepCC_TRUE@   fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+@am__fastdepCC_FALSE@  $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`
 uninstall-info-am:
 
 # This directory's subdirectories are mostly independent; you can cd
@@ -800,15 +810,9 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
        here=`pwd`; \
-       if (etags --etags-include --version) >/dev/null 2>&1; then \
-         include_option=--etags-include; \
-       else \
-         include_option=--include; \
-       fi; \
        list='$(SUBDIRS)'; for subdir in $$list; do \
          if test "$$subdir" = .; then :; else \
-           test -f $$subdir/TAGS && \
-             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+           test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
          fi; \
        done; \
        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
index 0acaa4c..e21dd45 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -126,6 +126,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -138,6 +140,8 @@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@
 ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@
 ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@
 ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@
+ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@
+ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@
 ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@
 ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@
 ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@
@@ -183,6 +187,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -212,7 +217,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -305,7 +309,6 @@ BITMAPS = \
 
 EXTRA_DIST = $(BITMAPS)
 subdir = interface/bitmaps
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -364,6 +367,7 @@ check: check-am
 all-am: Makefile
 
 installdirs:
+
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
index c1e734b..6cf6280 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -108,6 +108,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -120,6 +122,8 @@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@
 ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@
 ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@
 ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@
+ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@
+ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@
 ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@
 ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@
 ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@
@@ -165,6 +169,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -194,7 +199,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -302,7 +306,6 @@ BITMAPS = \
 
 EXTRA_DIST = $(BITMAPS)
 subdir = interface/motif_bitmaps
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -361,6 +364,7 @@ check: check-am
 all-am: Makefile
 
 installdirs:
+
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
index f14bdc0..37d679c 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -108,6 +108,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -120,6 +122,8 @@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@
 ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@
 ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@
 ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@
+ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@
+ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@
 ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@
 ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@
 ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@
@@ -165,6 +169,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -194,7 +199,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -312,7 +316,6 @@ PIXMAPS = \
 
 EXTRA_DIST = $(PIXMAPS)
 subdir = interface/pixmaps
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -371,6 +374,7 @@ check: check-am
 all-am: Makefile
 
 installdirs:
+
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
diff --git a/interface/rtsyn.h b/interface/rtsyn.h
new file mode 100644 (file)
index 0000000..f89827d
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+    TiMidity++ -- MIDI to WAVE converter and player
+    Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
+    Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+    rtsyn.h
+        Copyright (c) 2003  Keishi Suenaga <s_keishi@mutt.freemail.ne.jp>
+
+    I referenced following sources.
+        alsaseq_c.c - ALSA sequencer server interface
+            Copyright (c) 2000  Takashi Iwai <tiwai@suse.de>
+        readmidi.c
+*/
+#include "interface.h"
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#endif
+#ifndef NO_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <math.h>
+#include <signal.h>
+
+#include "server_defs.h"
+
+#ifdef __W32__
+#include <windows.h>
+#include <mmsystem.h>
+#endif
+
+#include "timidity.h"
+#include "common.h"
+#include "controls.h"
+#include "instrum.h"
+#include "playmidi.h"
+#include "readmidi.h"
+#include "recache.h"
+#include "output.h"
+#include "aq.h"
+#include "timer.h"
+
+
+
+/******************************************************************************/
+/*                                                                            */
+/*  Interface independent functions (see rtsyn_common.c)                      */
+/*                                                                            */
+/******************************************************************************/
+
+/* peek playmidi.c */
+extern int32 current_sample;
+extern FLOAT_T midi_time_ratio;
+
+/* How often play data. */
+#define TICKTIME_HZ 50
+
+
+extern double rtsyn_reachtime;
+extern int rtsyn_system_mode;
+
+/* reset synth    */
+void rtsyn_gm_reset(void);
+void rtsyn_gs_reset(void);
+void rtsyn_xg_reset(void);
+void rtsyn_normal_reset(void);
+
+/* mode change                                            *
+ * only in nomalmode program can accept reset(sysex) data */
+void rtsyn_gm_modeset(void);
+void rtsyn_gs_modeset(void);
+void rtsyn_xg_modeset(void);
+void rtsyn_normal_modeset(void);
+
+void rtsyn_init(void);
+void rtsyn_play_event(MidiEvent *ev);
+void rtsyn_server_reset(void);
+void rtsyn_reset(void);
+void rtsyn_stop_playing(void);
+int rtsyn_play_one_data (int port, int32 dwParam1);
+void rtsyn_play_one_sysex (char *sysexbuffer, int exlen );
+void rtsyn_play_calculate(void);
+
+
+
+/******************************************************************************/
+/*                                                                            */
+/*  Interface dependent functions (see rtsyn_winmm.c rtsyn_portmidi.c)        */
+/*                                                                            */
+/******************************************************************************/
+#define MAX_PORT 4
+extern int rtsyn_portnumber;
+extern unsigned int portID[MAX_PORT];
+extern char  rtsyn_portlist[32][80];
+extern int rtsyn_nportlist;
+
+void rtsyn_get_port_list(void);
+int rtsyn_synth_start(void);
+void rtsyn_synth_stop(void);
+int rtsyn_play_some_data (void);
+
+#if defined(IA_WINSYN) || defined(IA_W32G_SYN)
+int rtsyn_buf_check(void);
+#endif
+
diff --git a/interface/rtsyn_common.c b/interface/rtsyn_common.c
new file mode 100644 (file)
index 0000000..93e6de1
--- /dev/null
@@ -0,0 +1,424 @@
+
+/*
+    TiMidity++ -- MIDI to WAVE converter and player
+    Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
+    Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+    rtsyn_common.c
+        Copyright (c) 2003  Keishi Suenaga <s_keishi@mutt.freemail.ne.jp>
+
+    I referenced following sources.
+        alsaseq_c.c - ALSA sequencer server interface
+            Copyright (c) 2000  Takashi Iwai <tiwai@suse.de>
+        readmidi.c
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+#include "interface.h"
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#endif
+#ifndef NO_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <math.h>
+#include <signal.h>
+
+#include "server_defs.h"
+
+#ifdef __W32__
+#include <windows.h>
+#endif
+
+#include "timidity.h"
+#include "common.h"
+#include "controls.h"
+#include "instrum.h"
+#include "playmidi.h"
+#include "readmidi.h"
+#include "recache.h"
+#include "output.h"
+#include "aq.h"
+#include "timer.h"
+
+#include "rtsyn.h"
+
+//int seq_quit;
+
+int rtsyn_system_mode=DEFAULT_SYSTEM_MODE;
+
+static int32 event_time_offset;
+static double starttime;
+double rtsyn_reachtime;
+static int time_advance;
+
+//acitive sensing
+static int active_sensing_flag=0;
+static double active_sensing_time=0;
+
+
+#define EX_RESET_NO 7
+static char sysex_resets[EX_RESET_NO][11]={
+               '\xf0','\x7e','\x7f','\x09','\x00','\xf7','\x00','\x00','\x00','\x00','\x00',
+               '\xf0','\x7e','\x7f','\x09','\x01','\xf7','\x00','\x00','\x00','\x00','\x00',
+               '\xf0','\x7e','\x7f','\x09','\x03','\xf7','\x00','\x00','\x00','\x00','\x00',
+               '\xf0','\x41','\x10','\x42','\x12','\x40','\x00','\x7f','\x00','\x41','\xf7',
+               '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x00','\x01','\xf7',
+               '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x01','\x00','\xf7',
+               '\xf0','\x43','\x10','\x4c','\x00','\x00','\x7E','\x00','\xf7','\x00','\x00' };
+/*
+#define EX_RESET_NO 9
+static char sysex_resets[EX_RESET_NO][11]={
+       '\xf0','\x7e','\x7f','\x09','\x00','\xf7','\x00','\x00','\x00','\x00','\x00', //gm off
+       '\xf0','\x7e','\x7f','\x09','\x01','\xf7','\x00','\x00','\x00','\x00','\x00', //gm1
+       '\xf0','\x7e','\x7f','\x09','\x02','\xf7','\x00','\x00','\x00','\x00','\x00', //gm off
+       '\xf0','\x7e','\x7f','\x09','\x03','\xf7','\x00','\x00','\x00','\x00','\x00', //gm2
+       '\xf0','\x41','\x10','\x42','\x12','\x40','\x00','\x7f','\x00','\x41','\xf7', //GS
+       '\xf0','\x41','\x10','\x42','\x12','\x40','\x00','\x7f','\x7f','\x41','\xf7', //GS off
+       '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x00','\x01','\xf7', //88
+       '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x01','\x00','\xf7', //88
+       '\xf0','\x43','\x10','\x4c','\x00','\x00','\x7E','\x00','\xf7','\x00','\x00'  //XG on
+       };
+*/
+
+
+void rtsyn_gm_reset(){
+       MidiEvent ev;
+
+       rtsyn_server_reset();
+       ev.type=ME_RESET;
+       ev.a=GM_SYSTEM_MODE;
+       rtsyn_play_event(&ev);
+}
+void rtsyn_gs_reset(){
+       MidiEvent ev;
+
+       rtsyn_server_reset();
+       ev.type=ME_RESET;
+       ev.a=GS_SYSTEM_MODE;
+       rtsyn_play_event(&ev);
+}
+void rtsyn_xg_reset(){
+       MidiEvent ev;
+
+       rtsyn_server_reset();
+       ev.type=ME_RESET;
+       ev.a=XG_SYSTEM_MODE;
+       ev.time=0;
+       rtsyn_play_event(&ev);
+}
+void rtsyn_normal_reset(){
+       MidiEvent ev;
+
+       rtsyn_server_reset();
+       ev.type=ME_RESET;
+       ev.a=rtsyn_system_mode;
+       rtsyn_play_event(&ev);
+}
+void rtsyn_gm_modeset(){
+       MidiEvent ev;
+
+       rtsyn_server_reset();
+       rtsyn_system_mode=GM_SYSTEM_MODE;
+       ev.type=ME_RESET;
+       ev.a=GM_SYSTEM_MODE;
+       rtsyn_play_event(&ev);
+       change_system_mode(rtsyn_system_mode);
+}
+void rtsyn_gs_modeset(){
+       MidiEvent ev;
+
+       rtsyn_server_reset();
+       rtsyn_system_mode=GS_SYSTEM_MODE;
+       ev.type=ME_RESET;
+       ev.a=GS_SYSTEM_MODE;
+       rtsyn_play_event(&ev);
+       change_system_mode(rtsyn_system_mode);
+}
+void rtsyn_xg_modeset(){
+       MidiEvent ev;
+
+       rtsyn_server_reset();
+       rtsyn_system_mode=XG_SYSTEM_MODE;
+       ev.type=ME_RESET;
+       ev.a=XG_SYSTEM_MODE;
+       rtsyn_play_event(&ev);
+       change_system_mode(rtsyn_system_mode);
+}
+void rtsyn_normal_modeset(){
+       MidiEvent ev;
+
+       rtsyn_server_reset();
+       rtsyn_system_mode=DEFAULT_SYSTEM_MODE;
+       ev.type=ME_RESET;
+       ev.a=GS_SYSTEM_MODE;
+       rtsyn_play_event(&ev);
+       change_system_mode(rtsyn_system_mode);
+}
+
+void rtsyn_init(void){
+       int i,j;
+               /* set constants */
+       opt_realtime_playing = 2; /* Enable loading patch while playing */
+       allocate_cache_size = 0; /* Don't use pre-calclated samples */
+       auto_reduce_polyphony = 0;
+       current_keysig = current_temper_keysig = opt_init_keysig;
+       note_key_offset = 0;
+       time_advance=play_mode->rate/TICKTIME_HZ*2;
+       if (!(play_mode->encoding & PE_MONO))
+               time_advance >>= 1;
+       if (play_mode->encoding & PE_16BIT)
+               time_advance >>= 1;
+
+       if (opt_force_keysig != 8) {
+               i = current_keysig + ((current_keysig < 8) ? 7 : -6);
+               j = opt_force_keysig + ((current_keysig < 8) ? 7 : 10);
+               while (i != j && i != j + 12) {
+                       if (++note_key_offset > 6)
+                               note_key_offset -= 12;
+                       i += (i > 10) ? -5 : 7;
+               }
+       }
+       i = current_keysig + ((current_keysig < 8) ? 7 : -9), j = 0;
+       while (i != 7 && i != 19)
+               i += (i < 7) ? 5 : -7, j++;
+       j += note_key_offset, j -= floor(j / 12.0) * 12;
+       current_freq_table = j;
+}
+
+void rtsyn_play_event(MidiEvent *ev)
+{
+  int gch;
+  int32 cet;
+       gch = GLOBAL_CHANNEL_EVENT_TYPE(ev->type);
+       if(gch || !IS_SET_CHANNELMASK(quietchannels, ev->channel) ){
+//    if ( !seq_quit ) {
+                       ev->time=0;
+                       play_event(ev);
+//             }
+       }
+}
+
+void rtsyn_reset(void){
+               rtsyn_stop_playing();
+               free_instruments(0);        //also in rtsyn_server_reset
+               free_global_mblock();
+               rtsyn_server_reset();
+//             printf("system reseted\n");
+}
+
+void rtsyn_server_reset(void){
+       play_mode->close_output();      // PM_REQ_PLAY_START wlll called in playmidi_stream_init()
+       play_mode->open_output();       // but w32_a.c does not have it.
+       readmidi_read_init();
+       playmidi_stream_init();
+       starttime=get_current_calender_time();
+       reduce_voice_threshold = 0; // * Disable auto reduction voice *
+       auto_reduce_polyphony = 0;
+       event_time_offset = 0;
+}
+
+void rtsyn_stop_playing(void)
+{
+       if(upper_voices) {
+               MidiEvent ev;
+               ev.type = ME_EOT;
+               ev.a = 0;
+               ev.b = 0;
+               rtsyn_play_event(&ev);
+               aq_flush(1);
+       }
+}
+extern int32 current_sample;
+extern FLOAT_T midi_time_ratio;
+
+static void seq_set_time(MidiEvent *ev)
+{
+       double past_time,btime;
+       past_time = get_current_calender_time() - starttime;
+       ev->time = (int32)((past_time) * play_mode->rate);
+       ev->time += (int32)event_time_offset;
+       rtsyn_reachtime=get_current_calender_time()+(double)time_advance/play_mode->rate;
+
+#if 0
+       btime = (double)((ev->time-current_sample/midi_time_ratio)/play_mode->rate);
+       btime *= 1.01; /* to be sure */
+       aq_set_soft_queue(btime, 0.0);
+#endif
+}
+
+void rtsyn_play_calculate(){
+       MidiEvent ev;
+       
+       ev.type = ME_NONE;
+       seq_set_time(&ev);
+       play_event(&ev);
+       aq_fill_nonblocking();
+       
+       if(active_sensing_flag==~0 && (get_current_calender_time() > active_sensing_time+0.5)){
+//normaly acitive sensing expiering time is 330ms(>300ms) but this loop is heavy
+               play_mode->close_output();
+               play_mode->open_output();
+               ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"Active Sensing Expired\n");
+               active_sensing_flag=0;
+       }
+}
+       
+int rtsyn_play_one_data (int port, int32 dwParam1){
+       MidiEvent ev;
+       
+       ev.type = ME_NONE;
+       ev.channel = dwParam1 & 0x0000000f;
+       ev.channel = ev.channel+port*16;
+       ev.a = (dwParam1 >> 8) & 0xff;
+       ev.b = (dwParam1 >> 16) & 0xff;
+       switch ((int) (dwParam1 & 0x000000f0)) {
+       case 0x80:
+               ev.type = ME_NOTEOFF;
+//             rtsyn_play_event(&ev);
+               break;
+       case 0x90:
+               ev.type = (ev.b) ? ME_NOTEON : ME_NOTEOFF;
+//             rtsyn_play_event(&ev);
+               break;
+       case 0xa0:
+               ev.type = ME_KEYPRESSURE;
+//             rtsyn_play_event(&ev);
+               break;
+       case 0xb0:
+               if (! convert_midi_control_change(ev.channel, ev.a, ev.b, &ev))
+               ev.type = ME_NONE;
+               break;
+       case 0xc0:
+               ev.type = ME_PROGRAM;
+//             rtsyn_play_event(&ev);
+               break;
+       case 0xd0:
+               ev.type = ME_CHANNEL_PRESSURE;
+//             rtsyn_play_event(&ev);
+               break;
+       case 0xe0:
+               ev.type = ME_PITCHWHEEL;
+//             rtsyn_play_event(&ev);
+               break;
+       case 0xf0:
+#ifdef USE_PORTMIDI
+               if ( (dwParam1 & 0x000000ff) == 0xf0) {
+                       //SysEx
+                       return 1;
+               }
+#endif
+               if ((dwParam1 & 0x000000ff) == 0xf2) {
+                       ev.type = ME_PROGRAM;
+//                     rtsyn_play_event(&ev);
+               }
+#if 0
+               if ((dwParam1 & 0x000000ff) == 0xf1)
+                       //MIDI Time Code Qtr. Frame (not need)
+                       printf("MIDI Time Code Qtr\n");
+               if ((dwParam1 & 0x000000ff) == 0xf3)
+                       //Song Select(Song #) (not need)
+               if ((dwParam1 & 0x000000ff) == 0xf6)
+                       //Tune request (not need)
+                       printf("Tune request\n");
+               if ((dwParam1 & 0x000000ff) == 0xf8)
+                       //Timing Clock (not need)
+                       printf("Timing Clock\n");
+               if ((dwParam1&0x000000ff)==0xfa)
+                       //Start
+               if ((dwParam1 & 0x000000ff) == 0xfb)
+                       //Continue
+               if ((dwParam1 & 0x000000ff) == 0xfc) {
+                       //Stop
+                       printf("Stop\n");
+               }
+#endif
+               if ((dwParam1 & 0x000000ff) == 0xfe) {
+                       //Active Sensing
+//                     printf("Active Sensing\n");
+                       active_sensing_flag = ~0;
+                       active_sensing_time = get_current_calender_time();
+               }
+               if ((dwParam1 & 0x000000ff) == 0xff) {
+                       //System Reset
+                       printf("System Reset\n");
+               }
+               break;
+       default:
+//             printf("Unsup/ed event %d\n", aevp->type);
+               break;
+       }
+       if (ev.type != ME_NONE) {
+               rtsyn_play_event(&ev);
+       }
+       return 0;
+}
+
+
+void rtsyn_play_one_sysex (char *sysexbuffer, int exlen ){
+       int i,j,chk,ne;
+       MidiEvent ev;
+       MidiEvent evm[16];
+       
+       if(sysexbuffer[exlen-1] == '\xf7'){            // I don't konw why this need
+               for(i=0;i<EX_RESET_NO;i++){
+                       chk=0;
+                       for(j=0;(j<exlen)&&(j<11);j++){
+                               if(chk==0 && sysex_resets[i][j]!=sysexbuffer[j]){
+                                       chk=~0;
+                               }
+                       }
+                       if(chk==0){
+                                rtsyn_server_reset();
+                       }
+               }
+/*
+               printf("SyeEx length=%x bytes \n", exlen);
+               for(i=0;i<exlen;i++){
+                       printf("%x ",sysexbuffer[i]);
+               }
+               printf("\n");
+*/
+               if(parse_sysex_event(sysexbuffer+1,exlen-1,&ev)){
+                       if(ev.type==ME_RESET && rtsyn_system_mode!=DEFAULT_SYSTEM_MODE){
+                               ev.a=rtsyn_system_mode;
+                               change_system_mode(rtsyn_system_mode);
+                               rtsyn_play_event(&ev);
+                       }else{
+                               rtsyn_play_event(&ev);
+                       }
+               }
+               if(ne=parse_sysex_event_multi(sysexbuffer+1,exlen-1, evm)){
+                       for (i = 0; i < ne; i++){
+                                       rtsyn_play_event(&evm[i]);
+                       }
+               }
+       }
+}
diff --git a/interface/rtsyn_portmidi.c b/interface/rtsyn_portmidi.c
new file mode 100644 (file)
index 0000000..eaab6aa
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+    TiMidity++ -- MIDI to WAVE converter and player
+    Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
+    Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+    rtsyn_portmidi.c
+        Copyright (c) 2003 Keishi Suenaga <s_keishi@mutt.freemail.ne.jp>
+
+    I referenced following sources.
+        alsaseq_c.c - ALSA sequencer server interface
+            Copyright (c) 2000  Takashi Iwai <tiwai@suse.de>
+        readmidi.c
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+#include "interface.h"
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#endif
+#ifndef NO_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <math.h>
+#include <signal.h>
+
+#include "server_defs.h"
+
+#ifdef __W32__
+#include <windows.h>
+#endif
+
+#include <portmidi.h>
+#include <porttime.h>
+
+#include "timidity.h"
+#include "common.h"
+#include "controls.h"
+#include "instrum.h"
+#include "playmidi.h"
+#include "readmidi.h"
+#include "recache.h"
+#include "output.h"
+#include "aq.h"
+#include "timer.h"
+
+#include "rtsyn.h"
+
+int rtsyn_portnumber=1;
+unsigned int portID[MAX_PORT];
+char rtsyn_portlist[32][80];
+int rtsyn_nportlist;
+
+#define MAX_EXBUF 20
+#define BUFF_SIZE 512
+
+
+PmError pmerr;
+static unsigned int InNum;
+struct midistream_t{
+       PortMidiStream* stream;
+};
+static struct midistream_t  midistream[MAX_PORT];
+//static PmDeviceID portID[MAX_PORT];
+#define PMBUFF_SIZE 8192
+#define EXBUFF_SIZE 512
+static PmEvent pmbuffer[PMBUFF_SIZE];
+static char    sysexbuffer[EXBUFF_SIZE];
+
+void rtsyn_get_port_list(){
+       int i,j;
+       PmDeviceInfo *deviceinfo;
+       
+       pmerr=Pm_Initialize();
+       if( pmerr != pmNoError ) goto pmerror;
+
+       InNum = Pm_CountDevices();
+       j=0;
+       for (i=1;i <=InNum && i<=32;i++){
+               deviceinfo=(PmDeviceInfo *)Pm_GetDeviceInfo(i-1);
+               if(TRUE==deviceinfo->input){
+                       sprintf(rtsyn_portlist[j],"%d:%s",i,deviceinfo->name);
+                       j++;
+               }
+       }
+       rtsyn_nportlist=j;
+       Pm_Terminate();
+       
+       return;
+pmerror:
+               Pm_Terminate();
+       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL, "PortMIDI error: %s\n", Pm_GetErrorText( pmerr ) );
+       return;
+}
+
+int rtsyn_synth_start(){
+       int i;
+       unsigned int port;
+       MidiEvent ev;
+
+       rtsyn_reset();
+       rtsyn_system_mode=DEFAULT_SYSTEM_MODE;
+       change_system_mode(rtsyn_system_mode);
+       ev.type=ME_RESET;
+       ev.a=GS_SYSTEM_MODE; //GM is mor better ???
+       rtsyn_play_event(&ev);
+       
+       port=0;
+       pmerr=Pm_Initialize();
+       if( pmerr != pmNoError ) goto pmerror;
+       for(port=0;port<rtsyn_portnumber;port++){
+                               PortMidiStream* stream;
+                               void* timeinfo;
+
+                               pmerr=Pm_OpenInput( &stream,
+                               portID[port],
+                               NULL,
+                               (PMBUFF_SIZE),
+                               NULL,
+                               Pt_Time,
+                               NULL);
+               midistream[port].stream=stream;
+               if( pmerr != pmNoError ) goto pmerror;
+               pmerr=Pm_SetFilter(midistream[port].stream,PM_FILT_CLOCK);
+               if( pmerr != pmNoError ) goto pmerror;
+       }
+
+       return ~0;
+
+pmerror:
+               Pm_Terminate();
+       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL, "PortMIDI error: %s\n", Pm_GetErrorText( pmerr ) );
+       return 0;
+
+}
+
+
+void rtsyn_synth_stop(){
+unsigned int port;
+
+rtsyn_stop_playing();
+//     play_mode->close_output();
+       for(port=0;port<rtsyn_portnumber;port++){
+               pmerr=Pm_Abort(midistream[port].stream);
+//             if( pmerr != pmNoError ) goto pmerror;
+       }
+       Pm_Terminate();
+       return;
+pmerror:
+               Pm_Terminate();
+       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL, "PortMIDI error: %s\n", Pm_GetErrorText( pmerr ) );
+       return ;
+}
+
+
+int rtsyn_play_some_data (void){
+       PmMessage pmmsg;
+       int played;     
+       int j,port,exlen,data,shift;
+       long pmlength,pmbpoint;
+       
+       played=0;
+       {
+               sleep(0);
+               for(port=0;port<rtsyn_portnumber;port++){
+                       pmerr=Pm_Read(midistream[port].stream, pmbuffer, PMBUFF_SIZE);
+                       if(pmerr<0) goto pmerror;
+                       pmlength=pmerr;
+                       pmbpoint=0;
+                       while(pmbpoint<pmlength){
+                               played=~0;
+                               pmmsg=pmbuffer[pmbpoint].message;
+                               pmbpoint++;
+                               if( 1==rtsyn_play_one_data (port, pmmsg) ){     
+
+                                       j=0;
+                                       sysexbuffer[j++] = 0xf0;
+                                       for (shift = 8,data=0; shift < 32 && (data != 0x0f7); shift += 8) {
+                                       data= (pmmsg >> shift) & 0x0FF;
+                                               sysexbuffer[j++]=data;
+                                       }
+                                       if(data!=0x0f7){
+                                               if(pmbpoint>=pmlength){
+                                                       {
+                                                               pmerr=Pm_Read(midistream[port].stream, pmbuffer, PMBUFF_SIZE);
+                                                               if(pmerr<0){goto pmerror; }
+                                                               sleep(0);
+                                                       }while(pmerr==8);
+                                                       pmlength=pmerr;
+                                                       pmbpoint=0;
+                                               }
+                                               while(j<EXBUFF_SIZE-4){
+                                                       for (shift=0,data=0; shift < 32 && (data != 0x0f7); shift += 8) {
+                                               data= (pmbuffer[pmbpoint].message >> shift) & 0x0FF;
+                                                               sysexbuffer[j++]=data;
+                                                       }
+                                                       pmbpoint++;
+                                                       if(data==0x0f7) break;
+                                                       if( pmbpoint>=pmlength ){
+                                                               {
+                                                                       pmerr=Pm_Read(midistream[port].stream, pmbuffer, PMBUFF_SIZE);
+                                                                       if(pmerr<0){goto pmerror;}
+                                                                       sleep(0);
+                                                               }while(pmerr==0);
+                                                               pmlength=pmerr;
+                                                               pmbpoint=0;
+                                                       }
+                                               }
+                                       }
+                                       exlen=j;
+                                       rtsyn_play_one_sysex (sysexbuffer,exlen );
+                               }
+
+                       }
+               }
+       }while(rtsyn_reachtime>get_current_calender_time());
+       return played;
+pmerror:
+       Pm_Terminate();
+       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL, "PortMIDI error: %s\n", Pm_GetErrorText( pmerr ) );
+       return 0;
+}
+
diff --git a/interface/rtsyn_winmm.c b/interface/rtsyn_winmm.c
new file mode 100644 (file)
index 0000000..67eee1c
--- /dev/null
@@ -0,0 +1,290 @@
+
+/*
+    TiMidity++ -- MIDI to WAVE converter and player
+    Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
+    Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+    rtsyn_winmm.c
+        Copyright (c) 2003 Keishi Suenaga <s_keishi@mutt.freemail.ne.jp>
+
+    I referenced following sources.
+        alsaseq_c.c - ALSA sequencer server interface
+            Copyright (c) 2000  Takashi Iwai <tiwai@suse.de>
+        readmidi.c
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+#include "interface.h"
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#endif
+#ifndef NO_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <math.h>
+#include <signal.h>
+
+#include "server_defs.h"
+
+#ifdef __W32__
+#include <windows.h>
+#include <mmsystem.h>
+#endif
+
+#include "timidity.h"
+#include "common.h"
+#include "controls.h"
+#include "instrum.h"
+#include "playmidi.h"
+#include "readmidi.h"
+#include "recache.h"
+#include "output.h"
+#include "aq.h"
+#include "timer.h"
+
+#include "rtsyn.h"
+
+int rtsyn_portnumber=1;
+unsigned int portID[MAX_PORT];
+char rtsyn_portlist[32][80];
+int rtsyn_nportlist;
+
+#define MAX_EXBUF 20
+#define BUFF_SIZE 512
+
+UINT InNum;
+HMIDIIN  hMidiIn[MAX_PORT];
+HMIDIOUT hMidiOut[MAX_PORT];
+MIDIHDR *IMidiHdr[MAX_PORT][MAX_EXBUF];
+
+char sIMidiHdr[MAX_PORT][MAX_EXBUF][sizeof(MIDIHDR)];
+char sImidiHdr_data[MAX_PORT][MAX_EXBUF][BUFF_SIZE];
+
+struct evbuf_t{
+       int status;
+       UINT wMsg;
+       DWORD   dwInstance;
+       DWORD   dwParam1;
+       DWORD   dwParam2;
+};
+#define EVBUFF_SIZE 512
+struct evbuf_t evbuf[EVBUFF_SIZE];
+UINT  evbwpoint=0;
+UINT  evbrpoint=0;
+UINT evbsysexpoint;
+UINT  mvbuse=0;
+enum{B_OK, B_WORK, B_END};
+
+void CALLBACK MidiInProc(HMIDIIN,UINT,DWORD,DWORD,DWORD);
+
+void rtsyn_get_port_list(){
+       int i;
+       MIDIINCAPS InCaps;
+       InNum = midiInGetNumDevs();
+       for (i=1;i <=InNum && i<=32;i++){
+               midiInGetDevCaps(i-1,(LPMIDIINCAPSA) &InCaps,sizeof(InCaps));
+               sprintf(rtsyn_portlist[i-1],"%d:%s",i,(LPSTR)InCaps.szPname);
+       }
+       rtsyn_nportlist=i-1;
+}
+
+int rtsyn_synth_start(){
+       int i;
+       UINT port;
+       MidiEvent ev;
+
+       rtsyn_reset();
+       rtsyn_system_mode=DEFAULT_SYSTEM_MODE;
+       change_system_mode(rtsyn_system_mode);
+       ev.type=ME_RESET;
+       ev.a=GS_SYSTEM_MODE; //GM is mor better ???
+       rtsyn_play_event(&ev);
+       
+       port=0;
+
+       for(port=0;port<rtsyn_portnumber;port++){
+               for (i=0;i<MAX_EXBUF;i++){
+                       IMidiHdr[port][i] = (MIDIHDR *)sIMidiHdr[port][i];
+                       memset(IMidiHdr[port][i],0,sizeof(MIDIHDR));
+                       IMidiHdr[port][i]->lpData = sImidiHdr_data[port][i];
+                       memset((IMidiHdr[port][i]->lpData),0,BUFF_SIZE);
+                       IMidiHdr[port][i]->dwBufferLength = BUFF_SIZE;
+               }
+       }
+       evbuf[0].status=B_END;
+       evbwpoint=0;
+       evbrpoint=0;
+       mvbuse=0;
+
+       for(port=0;port<rtsyn_portnumber;port++){
+               midiInOpen(&hMidiIn[port],portID[port],(DWORD)MidiInProc,(DWORD)port,CALLBACK_FUNCTION);
+               for (i=0;i<MAX_EXBUF;i++){
+                       midiInUnprepareHeader(hMidiIn[port],IMidiHdr[port][i],sizeof(MIDIHDR));
+                       midiInPrepareHeader(hMidiIn[port],IMidiHdr[port][i],sizeof(MIDIHDR));
+                       midiInAddBuffer(hMidiIn[port],IMidiHdr[port][i],sizeof(MIDIHDR));
+               }
+       }
+       for(port=0;port<rtsyn_portnumber;port++){
+               if(MMSYSERR_NOERROR !=midiInStart(hMidiIn[port])){
+                       int i;
+                       for(i=0;i<port;i++){
+                               midiInStop(hMidiIn[i]);
+                               midiInReset(hMidiIn[i]);
+                               midiInClose(hMidiIn[i]);
+                       }
+                       goto winmmerror;
+               }
+       }
+
+       return ~0;
+
+winmmerror:
+       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL, "midiInStarterror\n" );
+       return 0;
+}
+
+void rtsyn_synth_stop(){
+UINT port;
+
+rtsyn_stop_playing();
+       //      play_mode->close_output();
+       for(port=0;port<rtsyn_portnumber;port++){
+               if( MMSYSERR_NOERROR!=midiInStop(hMidiIn[port]) )
+                       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"MIDI Stop Error\n");
+               if( MMSYSERR_NOERROR!=midiInReset(hMidiIn[port]) ) 
+                       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"MIDI Rest Error\n");
+               if( MMSYSERR_NOERROR!=midiInClose(hMidiIn[port]) ) 
+                       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"MIDI Close Error\n");
+       }
+       return;
+}
+
+int rtsyn_buf_check(void){
+       if( (evbuf[evbrpoint].status==B_OK)&&(evbrpoint!=evbwpoint) ){
+               return ~0;
+       }else{
+               return 0;
+       }
+}
+
+int rtsyn_play_some_data(void){
+       UINT wMsg;
+       DWORD   dwInstance;
+       DWORD   dwParam1;
+       DWORD   dwParam2;
+       MidiEvent ev;
+       MidiEvent evm[16];
+       int port;
+       UINT evbpoint;
+       MIDIHDR *IIMidiHdr;
+       int exlen;
+       char *sysexbuffer;
+       int ne,i,j,chk,played;
+       
+       played=0;
+       {
+               sleep(0);
+               if( !(evbuf[evbrpoint].status==B_OK)&&(evbrpoint!=evbwpoint) ) played=~0;
+               while( (evbuf[evbrpoint].status==B_OK)&&(evbrpoint!=evbwpoint) ){
+
+                       evbpoint=evbrpoint;
+                       if (++evbrpoint >= EVBUFF_SIZE)
+                                       evbrpoint -= EVBUFF_SIZE;
+
+                       wMsg=evbuf[evbpoint].wMsg;
+                       dwInstance=evbuf[evbpoint].dwInstance;
+                       dwParam1=evbuf[evbpoint].dwParam1;
+                       dwParam2=evbuf[evbpoint].dwParam2;
+
+                       port=(UINT)dwInstance;
+                       switch (wMsg) {
+                       case MIM_DATA:
+                               rtsyn_play_one_data (port, dwParam1);
+                               break;
+                       case MIM_LONGDATA:
+                               IIMidiHdr = (MIDIHDR *) dwParam1;
+                               exlen=(int)IIMidiHdr->dwBytesRecorded;
+                               sysexbuffer=IIMidiHdr->lpData;
+                               rtsyn_play_one_sysex (sysexbuffer,exlen );
+                               if (MMSYSERR_NOERROR != midiInUnprepareHeader(
+                                               hMidiIn[port], IIMidiHdr, sizeof(MIDIHDR)))
+                                       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"error1\n");
+                               if (MMSYSERR_NOERROR != midiInPrepareHeader(
+                                               hMidiIn[port], IIMidiHdr, sizeof(MIDIHDR)))
+                                       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"error5\n");
+                               if (MMSYSERR_NOERROR != midiInAddBuffer(
+                                               hMidiIn[port], IIMidiHdr, sizeof(MIDIHDR)))
+                                       ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"error6\n");
+                               break;
+                       }
+               }       
+       }while(rtsyn_reachtime>get_current_calender_time());
+       return played;
+}
+
+void CALLBACK MidiInProc(HMIDIIN hMidiInL, UINT wMsg, DWORD dwInstance,
+               DWORD dwParam1, DWORD dwParam2)
+{
+       UINT evbpoint;
+       UINT port;
+       
+       port=(UINT)dwInstance;
+       switch (wMsg) {
+       case MIM_DATA:
+       case MIM_LONGDATA:
+               evbpoint = evbwpoint;
+               if (++evbwpoint >= EVBUFF_SIZE)
+                       evbwpoint -= EVBUFF_SIZE;
+               evbuf[evbwpoint].status = B_END;
+               evbuf[evbpoint].status = B_WORK;
+               evbuf[evbpoint].wMsg = wMsg;
+               evbuf[evbpoint].dwInstance = dwInstance;
+               evbuf[evbpoint].dwParam1 = dwParam1;
+               evbuf[evbpoint].dwParam2 = dwParam2;
+               evbuf[evbpoint].status = B_OK;
+               break;
+       case MIM_OPEN:
+//             ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"MIM_OPEN\n");
+               break;
+       case MIM_CLOSE:
+//             ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"MIM_CLOSE\n");
+               break;
+       case MIM_LONGERROR:
+               ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"MIM_LONGERROR\n");
+               break;
+       case MIM_ERROR:
+               ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"MIM_ERROR\n");
+               break;
+       case MIM_MOREDATA:
+               ctl->cmsg(  CMSG_ERROR, VERB_NORMAL,"MIM_MOREDATA\n");
+               break;
+       }
+}
index 0654ac5..e9d3a85 100755 (executable)
@@ -198,7 +198,7 @@ extern void winplaymidi(void);
 w32g_syn_message_t msg_loopbuf[W32G_SYN_MESSAGE_MAX];
 int msg_loopbuf_start = -1;
 int msg_loopbuf_end = -1;
-extern int system_mode;
+extern int rtsyn_system_mode;
 HANDLE msg_loopbuf_hMutex = NULL; // \94r\91¼\8f\88\97\9d\97p
 int syn_ThreadPriority;        // \83V\83\93\83Z\83X\83\8c\83b\83h\82ÃŒ\83v\83\89\83C\83I\83\8a\83e\83B
 
@@ -424,7 +424,7 @@ SynWinProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam)
                                                AppendMenu ( hMenu, MF_STRING | MF_GRAYED, IDM_START, "\8fI\97¹\92\86\81c\81c");
                                        }
                                        AppendMenu ( hMenu, MF_STRING, IDM_SYSTEM_RESET, "\83V\83X\83e\83\80\83\8a\83Z\83b\83g");
-                                       switch ( system_mode ) {
+                                       switch ( rtsyn_system_mode ) {
                                        case GM_SYSTEM_MODE:
                                                AppendMenu ( hMenuReset, MF_STRING | MF_CHECKED, IDM_GM_SYSTEM_RESET, "GM \83\8a\83Z\83b\83g");
                                                AppendMenu ( hMenuReset, MF_STRING, IDM_GS_SYSTEM_RESET, "GS \83\8a\83Z\83b\83g");
@@ -489,7 +489,7 @@ SynWinProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam)
                                                AppendMenu ( hMenu, MF_STRING | MF_GRAYED, IDM_START, "Quitting...");
                                        }
                                        AppendMenu ( hMenu, MF_STRING, IDM_SYSTEM_RESET, "System Reset");
-                                       switch ( system_mode ) {
+                                       switch ( rtsyn_system_mode ) {
                                        case GM_SYSTEM_MODE:
                                                AppendMenu ( hMenuReset, MF_STRING | MF_CHECKED, IDM_GM_SYSTEM_RESET, "GM Reset");
                                                AppendMenu ( hMenuReset, MF_STRING, IDM_GS_SYSTEM_RESET, "GS Reset");
@@ -782,14 +782,12 @@ int w32g_message_get ( w32g_syn_message_t *msg )
 }
 
 extern int seq_quit;
-extern int playdone;
-extern void seq_play_event(MidiEvent *);
+extern void rtsyn_play_event(MidiEvent *);
 void w32g_syn_doit(void)
 {
        w32g_syn_message_t msg;
        MidiEvent ev;
        DWORD sleep_time;
-       playdone=0;
        while(seq_quit==0) {
                int have_msg = 0;
                sleep_time = 0;
@@ -812,67 +810,67 @@ void w32g_syn_doit(void)
                                sleep_time = 100;
                                break;
                        case W32G_SYN_GM_SYSTEM_RESET:
-                                       server_reset();
+                                       rtsyn_server_reset();
                                        ev.type=ME_RESET;
                                        ev.a=GM_SYSTEM_MODE;
-                                       seq_play_event(&ev);
+                                       rtsyn_play_event(&ev);
                                        sleep_time = 100;
                                break;
                        case W32G_SYN_GS_SYSTEM_RESET:
-                               server_reset();
+                               rtsyn_server_reset();
                                ev.type=ME_RESET;
                                ev.a=GS_SYSTEM_MODE;
-                               seq_play_event(&ev);
+                               rtsyn_play_event(&ev);
                                sleep_time = 100;
                                break;
                        case W32G_SYN_XG_SYSTEM_RESET:
-                               server_reset();
+                               rtsyn_server_reset();
                                ev.type=ME_RESET;
                                ev.a=XG_SYSTEM_MODE;
-                               seq_play_event(&ev);
+                               rtsyn_play_event(&ev);
                                sleep_time = 100;
                                break;
                        case W32G_SYN_SYSTEM_RESET:
-                               server_reset();
+                               rtsyn_server_reset();
                                ev.type=ME_RESET;
-                               ev.a=system_mode;
-                               seq_play_event(&ev);
+                               ev.a=rtsyn_system_mode;
+                               rtsyn_play_event(&ev);
                                sleep_time = 100;
                                break;
                        case W32G_SYN_CHANGE_GM_SYSTEM:
-                               system_mode=GM_SYSTEM_MODE;
-                               server_reset();
+                               rtsyn_system_mode=GM_SYSTEM_MODE;
+                               rtsyn_server_reset();
                                ev.type=ME_RESET;
                                ev.a=GM_SYSTEM_MODE;
-                               seq_play_event(&ev);
-                               change_system_mode(system_mode);
+                               rtsyn_play_event(&ev);
+                               change_system_mode(rtsyn_system_mode);
                                sleep_time = 100;
                                break;
                        case W32G_SYN_CHANGE_GS_SYSTEM:
-                               system_mode=GS_SYSTEM_MODE;
-                               server_reset();
+                               rtsyn_system_mode=GS_SYSTEM_MODE;
+                               rtsyn_server_reset();
                                ev.type=ME_RESET;
                                ev.a=GS_SYSTEM_MODE;
-                               seq_play_event(&ev);
-                               change_system_mode(system_mode);
+                               rtsyn_play_event(&ev);
+                               change_system_mode(rtsyn_system_mode);
                                sleep_time = 100;
                                break;
                        case W32G_SYN_CHANGE_XG_SYSTEM:
-                               system_mode=XG_SYSTEM_MODE;
-                               server_reset();
+                               rtsyn_system_mode=XG_SYSTEM_MODE;
+                               rtsyn_server_reset();
                                ev.type=ME_RESET;
                                ev.a=XG_SYSTEM_MODE;
-                               seq_play_event(&ev);
-                               change_system_mode(system_mode);
+                               rtsyn_play_event(&ev);
+                               change_system_mode(rtsyn_system_mode);
                                sleep_time = 100;
                                break;
                        case W32G_SYN_CHANGE_DEFAULT_SYSTEM:
-                               system_mode=DEFAULT_SYSTEM_MODE;
-                               server_reset();
+                               rtsyn_system_mode=DEFAULT_SYSTEM_MODE;
+                               rtsyn_server_reset();
                                ev.type=ME_RESET;
                                ev.a=GS_SYSTEM_MODE;
-                               seq_play_event(&ev);
-                               change_system_mode(system_mode);
+                               rtsyn_play_event(&ev);
+                               change_system_mode(rtsyn_system_mode);
                                sleep_time = 100;
                                break;
                        default:
index d2d9cbf..c90ec14 100755 (executable)
@@ -20,7 +20,7 @@
 
 
     winsyn_c.c - Windows synthesizer interface
-        Copyright (c) 2002  Keishi Suenaga <s_keishi@mutt.freemail.ne.jp>
+        Copyright (c) 2002 2003 Keishi Suenaga <s_keishi@mutt.freemail.ne.jp>
 
     I referenced following sources.
         alsaseq_c.c - ALSA sequencer server interface
     (http://www.midiox.com).
 */
 //#define  USE_PORTMIDI 1
-//#undef USE_CURSES 1
+//#define USE_GTK_GUI 1
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
-#include "interface.h"
-
-#include <stdio.h>
-
-#if defined(__MINGW32__) && defined(USE_PDCURSES)
-#define _NO_OLDNAMES 1 /* avoid type mismatch of beep() */
-#ifndef sleep
-extern void sleep(unsigned long);
-#endif /* sleep */
-#include <stdlib.h>
-#undef _NO_OLDNAMES
-#else /* USE_PDCURSES */
-#include <stdlib.h>
-#endif
-
-#include <stdarg.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/types.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#endif
-#ifndef NO_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#include <math.h>
-#include <signal.h>
-
-#include "server_defs.h"
-
-#ifdef __W32__
-#include <windows.h>
-#include <mmsystem.h>
-#endif
-#ifdef USE_CURSES
-
-#ifdef __W32__
-#undef MOUSE_MOVED
-#endif
-#ifdef HAVE_NCURSES_H
-#      include <ncurses.h>
-#elif defined(HAVE_NCURSES_CURSES_H)
-#      include <ncurses/curses.h>
-#else
-#      include <curses.h>
-#endif
-
-#ifdef __W32__
-#undef MOUSE_MOVED
-#define MOUSE_MOVED  1                 //see windows.h
-#endif
 
 
+#include "rtsyn.h"
+#ifdef USE_GTK_GUI
+#include "wsgtk_main.h"
 #endif
 
-#ifdef USE_PORTMIDI
-#include <portmidi.h>
-#include <porttime.h>
-#endif
-
-#include "timidity.h"
-#include "common.h"
-#include "controls.h"
-#include "instrum.h"
-#include "playmidi.h"
-#include "readmidi.h"
-#include "recache.h"
-#include "output.h"
-#include "aq.h"
-#include "timer.h"
-
 #ifndef __W32__
 #include <stdio.h>
 #include <termios.h>
-#include <term.h>
+//#include <term.h>
 #include <unistd.h>
 #endif
 
-extern char *opt_aq_max_buff,*opt_aq_fill_buff;
-extern  int midi_port_number;
-extern int32 current_sample;
-extern FLOAT_T midi_time_ratio;
 
 #ifndef __W32__
-#define UINT unsigned int
 static struct termios initial_settings, new_settings;
 static int peek_character = -1;
 #endif
 
 extern int volatile stream_max_compute;        // play_event() \82ÃŒ compute_data() \82Ã…\8cv\8eZ\82ð\8b\96\82·\8dÃ…\91Ã¥\8e\9e\8aÔ
-int playdone;
-int seq_playing;
 int seq_quit;
 
-int system_mode=DEFAULT_SYSTEM_MODE;
-
-#define MAX_PORT 4
-int portnumber=1;
-
-#define MAX_EXBUF 20
-#define BUFF_SIZE 512
-
-
-#ifndef USE_PORTMIDI
-UINT InNum,portID[MAX_PORT];
-HMIDIIN  hMidiIn[MAX_PORT];
-HMIDIOUT hMidiOut[MAX_PORT];
-MIDIHDR *IMidiHdr[MAX_PORT][MAX_EXBUF];
-
-char sIMidiHdr[MAX_PORT][MAX_EXBUF][sizeof(MIDIHDR)];
-char sImidiHdr_data[MAX_PORT][MAX_EXBUF][BUFF_SIZE];
-
-struct evbuf_t{
-       int status;
-       UINT wMsg;
-       DWORD   dwInstance;
-       DWORD   dwParam1;
-       DWORD   dwParam2;
-};
-#define EVBUFF_SIZE 512
-struct evbuf_t evbuf[EVBUFF_SIZE];
-UINT  evbwpoint=0;
-UINT  evbrpoint=0;
-UINT evbsysexpoint;
-UINT  mvbuse=0;
-enum{B_OK, B_WORK, B_END};
-#else
-PmError pmerr;
-static UINT InNum;
-struct midistream_t{
-       PortMidiStream* stream;
-};
-static struct midistream_t  midistream[MAX_PORT];
-static PmDeviceID portID[MAX_PORT];
-#define PMBUFF_SIZE 8192
-#define EXBUFF_SIZE 512
-static PmEvent pmbuffer[PMBUFF_SIZE];
-static char    sysexbuffer[EXBUFF_SIZE];
-#endif
-
-
-double starttime;
-static int time_advance;
-extern double play_start_time;
-double lastdintime;
-
-//acitive sensing
-static int active_sensing_flag=0;
-static double active_sensing_time=0;
-
-
-#define EX_RESET_NO 7
-static char sysex_resets[EX_RESET_NO][11]={
-               '\xf0','\x7e','\x7f','\x09','\x00','\xf7','\x00','\x00','\x00','\x00','\x00',
-               '\xf0','\x7e','\x7f','\x09','\x01','\xf7','\x00','\x00','\x00','\x00','\x00',
-               '\xf0','\x7e','\x7f','\x09','\x03','\xf7','\x00','\x00','\x00','\x00','\x00',
-               '\xf0','\x41','\x10','\x42','\x12','\x40','\x00','\x7f','\x00','\x41','\xf7',
-               '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x00','\x01','\xf7',
-               '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x01','\x00','\xf7',
-               '\xf0','\x43','\x10','\x4c','\x00','\x00','\x7E','\x00','\xf7','\x00','\x00' };
-/*
-#define EX_RESET_NO 9
-static char sysex_resets[EX_RESET_NO][11]={
-       '\xf0','\x7e','\x7f','\x09','\x00','\xf7','\x00','\x00','\x00','\x00','\x00', //gm off
-       '\xf0','\x7e','\x7f','\x09','\x01','\xf7','\x00','\x00','\x00','\x00','\x00', //gm1
-       '\xf0','\x7e','\x7f','\x09','\x02','\xf7','\x00','\x00','\x00','\x00','\x00', //gm off
-       '\xf0','\x7e','\x7f','\x09','\x03','\xf7','\x00','\x00','\x00','\x00','\x00', //gm2
-       '\xf0','\x41','\x10','\x42','\x12','\x40','\x00','\x7f','\x00','\x41','\xf7', //GS
-       '\xf0','\x41','\x10','\x42','\x12','\x40','\x00','\x7f','\x7f','\x41','\xf7', //GS off
-       '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x00','\x01','\xf7', //88
-       '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x01','\x00','\xf7', //88
-       '\xf0','\x43','\x10','\x4c','\x00','\x00','\x7E','\x00','\xf7','\x00','\x00'  //XG on
-       };
-*/
-#define TICKTIME_HZ 50
 
 static int ctl_open(int using_stdin, int using_stdout);
 static void ctl_close(void);
@@ -245,6 +89,7 @@ static int ctl_read(int32 *valp);
 static int cmsg(int type, int verbosity_level, char *fmt, ...);
 static void ctl_event(CtlEvent *e);
 static void ctl_pass_playing_list(int n, char *args[]);
+
 #ifndef __W32__
 static void init_keybord(void);
 static void close_keybord(void);
@@ -353,21 +198,13 @@ static void ctl_event(CtlEvent *e)
 {
 }
 
-static void seq_reset(void);
-void seq_play_event(MidiEvent *);
-void seq_set_time(MidiEvent *);
-static void stop_playing(void);
 static void doit(void);
-void server_reset(void);
-void play_some_data (void);
-void winplaymidi(void);
-#ifndef USE_PORTMIDI
-void CALLBACK MidiInProc(HMIDIIN,UINT,DWORD,DWORD,DWORD);
-#endif
 
 #ifdef IA_W32G_SYN
 extern void w32g_syn_doit(void);
 extern void w32g_syn_ctl_pass_playing_list(int n_, char *args_[]);
+
+
 static void ctl_pass_playing_list(int n, char *args[])
 {
        w32g_syn_ctl_pass_playing_list ( n, args );
@@ -381,36 +218,16 @@ static void ctl_pass_playing_list(int n, char *args[])
 int ctl_pass_playing_list2(int n, char *args[])
 #endif
 {
-       int i, j;
-       MidiEvent ev;
-       UINT port=0 ;
-#ifdef USE_PORTMIDI
-       PmDeviceInfo *deviceinfo;
-#endif
-#ifdef USE_CURSES
-       int wlaw;
-#endif
-
-#ifdef USE_CURSES
-       initscr();
-       cbreak();
-       noecho();
-#endif
+       int i, j,devnum,devok;
+       unsigned int port=0 ;
+       int started;
+       char cbuf[80];
 
+rtsyn_get_port_list();
 
-#ifdef USE_PORTMIDI
-       pmerr=Pm_Initialize();
-       if( pmerr != pmNoError ) goto pmerror;
-#endif
 #ifndef IA_W32G_SYN
        if(n > MAX_PORT ){
-#ifndef USE_CURSES
                printf( "Usage: timidity -iW [Midi interface No s]\n");
-#else 
-               move(0,0);
-               printw( "Usage: timidity -iW [Midi interface No s]");
-               refresh();
-#endif
                return;
        }
 #endif
@@ -421,15 +238,12 @@ int ctl_pass_playing_list2(int n, char *args[])
                        if( (portID[port] = atoi(args[port]))==0 ){
                                n=0;
                        }else{
-#ifdef USE_PORTMIDI
-                               deviceinfo=(PmDeviceInfo *)Pm_GetDeviceInfo(portID[port]-1);
-                               if(TRUE==(deviceinfo)->input) {
-#else
-                               if(MMSYSERR_NOERROR==midiInOpen(&hMidiIn[port],portID[port]-1,(DWORD)NULL,(DWORD)0L,CALLBACK_NULL)){
-                                       midiInReset(hMidiIn[port]);
-                                       midiInClose(hMidiIn[port]);
-#endif
-                               }else{
+                               devok=0;
+                               for(i=0;i<rtsyn_nportlist;i++){
+                                       sscanf( rtsyn_portlist[i],"%d:%s",&devnum,cbuf);
+                                       if(devnum==portID[port]) devok=1;
+                               }
+                               if(devok==0){
                                        n=0;
 #ifdef IA_W32G_SYN
                                        {
@@ -443,308 +257,94 @@ int ctl_pass_playing_list2(int n, char *args[])
                        }
                port++;
                }
-               portnumber=port;
        }
-#ifndef IA_W32G_SYN
+       if(n==0){
+               rtsyn_portnumber=0;
+       }else{
+               rtsyn_portnumber=port;
+       }
+
+#if !defined(IA_W32G_SYN) && !defined(USE_GTK_GUI)
        if(n==0){
                char cbuf[80];
-#ifndef USE_PORTMIDI
-               MIDIINCAPS InCaps;
-#endif
-#ifndef USE_CURSES
                printf("Whow many ports do you use?(max %d)\n",MAX_PORT);
                do{
-                       if (0==scanf("%u",&portnumber)) scanf("%s",cbuf);
-               }while(portnumber == 0 ||portnumber > MAX_PORT);
+                       if (0==scanf("%u",&rtsyn_portnumber)) scanf("%s",cbuf);
+               }while(rtsyn_portnumber == 0 ||rtsyn_portnumber > MAX_PORT);
                printf("\n");
                printf("Opening Device drivers:");
                printf("Available Midi Input devices:\n");
-#else 
-               move(0,0);
-               printw("Whow many ports do you use?(max %d)\n",MAX_PORT);
-               refresh();
-               do{
-#ifdef USE_PDCURSES
-                       getstr(cbuf);
-#else
-                       getnstr(cbuf,80);
-#endif
-                       sscanf(cbuf,"%u",&portnumber);
-               }while(portnumber == 0 ||portnumber > MAX_PORT);
-               clear();
-               refresh();
-               wlaw=0;
-               move(wlaw++,0);
-               printw("Opening Device drivers:");
-               printw("Available Midi Input devices:");
-#endif
-#if USE_PORTMIDI
-               InNum = Pm_CountDevices();
-               for (portID[port]=1;portID[port] <=InNum;portID[port]++){
-                       deviceinfo=(PmDeviceInfo *)Pm_GetDeviceInfo(portID[port]-1);
-#ifndef USE_CURSES
-                       if(TRUE==deviceinfo->input){
-                               printf("%d:%s\n",portID[port],deviceinfo->name);
-                       }
-#else
-                       if(TRUE==deviceinfo->input){
-                               move (wlaw++,0);
-                               printw("%d:%s",portID[port],deviceinfo->name);
-                       }
-#endif                 
-               }
 
-#else
-               InNum = midiInGetNumDevs();
-               for (portID[port]=1;portID[port] <=InNum;portID[port]++){
-                       midiInGetDevCaps(portID[port]-1,(LPMIDIINCAPSA) &InCaps,sizeof(InCaps));
-#ifndef USE_CURSES
-                       printf("%d:%s\n",portID[port],(LPSTR)InCaps.szPname);
-#else
-                       move (wlaw++,0);
-                       printw("%d:%s",portID[port],(LPSTR)InCaps.szPname);
-#endif                 
+               for(i=0;i<rtsyn_nportlist;i++){
+                       printf("%s\n",rtsyn_portlist[i]);
                }
-#endif
-
-#ifndef USE_CURSES
-               for(port=0;port<portnumber;port++){
+               for(port=0;port<rtsyn_portnumber;port++){
                        printf("Keyin Input Device Number of port%d\n",port+1);
                        do{
+                               devok=0;
                                if (0==scanf("%u",&portID[port])) scanf("%s",cbuf);
-                       }while(portID[port] == 0 ||(portID[port] > InNum));
-                       printf("\n");                   
-               }
-#else
-               for(port=0;port<portnumber;port++){
-                       move(wlaw++,0);
-                       printw("Keyin Input Device Number of port%d",port+1);
-                       refresh();
-                       do{
-#ifdef USE_PDCURSES
-                               getstr(cbuf);
-#else
-                               getnstr(cbuf,80);
-#endif
-                               sscanf(cbuf,"%u",&portID[port]); 
-                       }while(portID[port] == 0 ||(portID[port] > InNum));
+                               for(i=0;i<rtsyn_nportlist;i++){
+                                       sscanf( rtsyn_portlist[i],"%d:%s",&devnum,cbuf);
+                                       if(devnum==portID[port]) devok=1;
+                               }
+                       }while(devok==0);
                        printf("\n");                   
                }
-               clear();
-               refresh();
-#endif         
        }
 #endif
 
-       for(port=0;port<portnumber;port++){
+       for(port=0;port<rtsyn_portnumber;port++){
                portID[port]=portID[port]-1;
        }
 
-#ifndef IA_W32G_SYN
-#ifndef USE_CURSES
+
+#if !defined(IA_W32G_SYN) && !defined(USE_GTK_GUI)
        printf("TiMidity starting in Windows Synthesizer mode\n");
        printf("Usage: timidity -iW [Midi interface No]\n");
        printf("\n");
-//     printf("Please wait for piano 'C' sound\n");
-       printf("\n");
        printf("N (Normal mode) M(GM mode) S(GS mode) X(XG mode) \n");
        printf("(Only in Normal mode, Mode can be changed by MIDI data)\n");
        printf("m(GM reset) s(GS reset) x(XG reset)\n");
        printf("\n");
        printf("Press 'q' key to stop\n");
-#else
-       move(0,0);
-       printw("TiMidity starting in Windows Synthesizer mode\n");
-       printw("Usage: timidity -iW [Midi interface No]\n");
-       printw("\n");
-//     printw("Please wait for piano 'C' sound\n");
-       printw("\n");
-       printw("N (Normal mode) M(GM mode) S(GS mode) X(XG mode) \n");
-       printw("(Only in Normal mode, Mode can be changed by MIDI data)\n");
-       printw("m(GM reset) s(GS reset) x(XG reset)\n");
-       printw("\n");
-       printw("Press 'q' key to stop\n");
-       refresh();
 #endif
-#endif
-/*
-       for(port=0;port<portnumber;port++){             //trick for MIDI Yoke
-               midiInOpen(&hMidiIn[port],portID[port],(DWORD)NULL,(DWORD)0L,CALLBACK_NULL);
-               midiInStart(hMidiIn[port]);
-               midiOutOpen(&hMidiOut[port],portID[port],(DWORD)NULL,(DWORD)0L,CALLBACK_NULL);
-               midiOutShortMsg(hMidiOut[port], 0x007f3c90);
-               midiOutShortMsg(hMidiOut[port], 0x00003c80);
-               midiOutReset(hMidiOut[port]);
-               midiOutClose(hMidiOut[port]);
-               midiInReset(hMidiIn[port]);
-               midiInClose(hMidiIn[port]);
-       }
-*/
-       opt_realtime_playing = 2; /* Enable loading patch while playing */
-       allocate_cache_size = 0; /* Don't use pre-calclated samples */
-       auto_reduce_polyphony = 0;
-       current_keysig = current_temper_keysig = opt_init_keysig;
-       note_key_offset = 0;
-       time_advance=play_mode->rate/TICKTIME_HZ*2;
-       if (!(play_mode->encoding & PE_MONO))
-               time_advance >>= 1;
-       if (play_mode->encoding & PE_16BIT)
-               time_advance >>= 1;
-
-       if (opt_force_keysig != 8) {
-               i = current_keysig + ((current_keysig < 8) ? 7 : -6);
-               j = opt_force_keysig + ((current_keysig < 8) ? 7 : 10);
-               while (i != j && i != j + 12) {
-                       if (++note_key_offset > 6)
-                               note_key_offset -= 12;
-                       i += (i > 10) ? -5 : 7;
-               }
-       }
-       i = current_keysig + ((current_keysig < 8) ? 7 : -9), j = 0;
-       while (i != 7 && i != 19)
-               i += (i < 7) ? 5 : -7, j++;
-       j += note_key_offset, j -= floor(j / 12.0) * 12;
-       current_freq_table = j;
 
-       seq_reset();
+       rtsyn_init();
 
-/*
-       for(port=0;port<portnumber;port++){
-               for (i=0;i<MAX_EXBUF;i++){
-                       IMidiHdr[port][i] = (MIDIHDR*)safe_malloc(sizeof(MIDIHDR));
-                       memset(IMidiHdr[port][i],0,sizeof(MIDIHDR));
-                       IMidiHdr[port][i]->lpData = (char*)safe_malloc(BUFF_SIZE);
-                       memset((IMidiHdr[port][i]->lpData),0,BUFF_SIZE);
-                       IMidiHdr[port][i]->dwBufferLength = BUFF_SIZE;
-               }
-       }
-*/
-#ifndef USE_PORTMIDI
-       for(port=0;port<portnumber;port++){
-               for (i=0;i<MAX_EXBUF;i++){
-                       IMidiHdr[port][i] = sIMidiHdr[port][i];
-                       memset(IMidiHdr[port][i],0,sizeof(MIDIHDR));
-                       IMidiHdr[port][i]->lpData = sImidiHdr_data[port][i];
-                       memset((IMidiHdr[port][i]->lpData),0,BUFF_SIZE);
-                       IMidiHdr[port][i]->dwBufferLength = BUFF_SIZE;
+#ifdef USE_GTK_GUI
+       twgtk_main();
+#else 
+#ifdef IA_W32G_SYN
+       if(0!=rtsyn_synth_start()){
+               seq_quit=0;
+               while(seq_quit==0) {
+                       w32g_syn_doit();
                }
-       }
-       evbuf[0].status=B_END;
-       evbwpoint=0;
-       evbrpoint=0;
-       mvbuse=0;
-#endif
-
-       seq_quit=0;
-               
-#ifdef USE_PORTMIDI
-       for(port=0;port<portnumber;port++){
-               PortMidiStream* stream;
-               void* timeinfo;
-               pmerr=Pm_OpenInput( &stream,
-               portID[port],\r
-                NULL,\r
-                               (PMBUFF_SIZE),\r
-                NULL,\r
-                Pt_Time,\r
-                NULL);
-               midistream[port].stream=stream;
-               if( pmerr != pmNoError ) goto pmerror;
-                       pmerr=Pm_SetFilter(midistream[port].stream,PM_FILT_CLOCK);
-               if( pmerr != pmNoError ) goto pmerror;
+               rtsyn_synth_stop();
        }
 #else
-       for(port=0;port<portnumber;port++){
-               midiInOpen(&hMidiIn[port],portID[port],(DWORD)MidiInProc,(DWORD)port,CALLBACK_FUNCTION);
-               for (i=0;i<MAX_EXBUF;i++){
-                       midiInPrepareHeader(hMidiIn[port],IMidiHdr[port][i],sizeof(MIDIHDR));
-                       midiInAddBuffer(hMidiIn[port],IMidiHdr[port][i],sizeof(MIDIHDR));
+       if(0!=rtsyn_synth_start()){
+               seq_quit=0;
+               while(seq_quit==0) {
+                       doit();
                }
+               rtsyn_synth_stop();
        }
-               for(port=0;port<portnumber;port++){
-       if(MMSYSERR_NOERROR !=midiInStart(hMidiIn[port]))
-               printf("midiInStarterror\n");
-       }
-#endif
-//     seq_reset();
-
-       system_mode=DEFAULT_SYSTEM_MODE;
-       change_system_mode(system_mode);
-
-       ev.type=ME_RESET;
-       ev.a=GS_SYSTEM_MODE; //GM is mor better ???
-       seq_play_event(&ev);
-
-/*
-       ev.channel=0x00;
-       ev.a=0x3c;
-       ev.b=0x7f;
-       ev.type = ME_NOTEON;
-       seq_play_event(&ev);
-       ev.type = ME_NOTEOFF;
-       seq_play_event(&ev);
-
-       for(i=0;i<0.4*TICKTIME_HZ;i++){
-                       ev.type = ME_NONE;
-                       seq_set_time(&ev);
-                       play_event(&ev);
-                       aq_fill_nonblocking();
+#endif /* IA_W32G_SYN */
+#endif /* USE_GTK_GUI */
 
-       }
-*/
-       while(seq_quit==0) {
 
-#ifndef IA_W32G_SYN
-               doit();
-#else
-               w32g_syn_doit();
-#endif
-       }
-       for(port=0;port<portnumber;port++){
-#ifdef USE_PORTMIDI
-               pmerr=Pm_Abort(midistream[port].stream);
-//             if( pmerr != pmNoError ) goto pmerror;
-#else
-               midiInStop(hMidiIn[port]);
-#endif
-       }
-       stop_playing();
-//     play_mode->close_output();
-#ifdef USE_PORTMIDI
-       Pm_Terminate();
-#else
-       for(port=0;port<portnumber;port++){
-               midiInReset(hMidiIn[port]);
-               for (i=0;i<MAX_EXBUF;i++){
-                       midiInUnprepareHeader(hMidiIn[port],IMidiHdr[port][i],sizeof(MIDIHDR));
-               }
-               midiInClose(hMidiIn[port]);
-/*
-               for (i=0;i<MAX_EXBUF;i++){
-                       free(IMidiHdr[port][i]->lpData);
-                       free(IMidiHdr[port][i]);
-               }
-*/
-       }
-#endif
-
-#ifdef USE_CURSES
-               clear();
-               refresh();
-               endwin();
-#endif
 #ifdef IA_W32G_SYN
        return 0;
-#endif
+#else
        return;
-#ifdef USE_PORTMIDI
-pmerror:
-               Pm_Terminate();
-       ctl.cmsg(  CMSG_ERROR, VERB_NORMAL, "PortMIDI error: %s\n", Pm_GetErrorText( pmerr ) );
-       return ;
 #endif
 }
 
+
+#ifndef IA_W32G_SYN
+
+
 #ifndef __W32__
 static void init_keybord(void){
        tcgetattr(0,&initial_settings);
@@ -793,68 +393,18 @@ static char readch(void){
 }
 #endif         
 
-static void seq_reset(void){
-               stop_playing();
-               free_instruments(0);        //also in server_reset
-               free_global_mblock();
-               server_reset();
-//             printf("system reseted\n");
-}
-
-void seq_play_event(MidiEvent *ev)
-{
-  int gch;
-  int32 cet;
-       gch = GLOBAL_CHANNEL_EVENT_TYPE(ev->type);
-       if(gch || !IS_SET_CHANNELMASK(quietchannels, ev->channel) ){
-    if ( !seq_quit ) {
-                       ev->time=0;
-                       play_event(ev);
-               }
-       }
-}
-
-void seq_set_time(MidiEvent *ev)
-{
-       double past_time,btime;
-       event_time_offset = (int32)time_advance;
-       past_time = get_current_calender_time() - starttime;
-       ev->time = (int32)((past_time) * play_mode->rate);
-       ev->time += (int32)event_time_offset;
-
-#if 0
-       btime = (double)((ev->time-current_sample/midi_time_ratio)/play_mode->rate);
-       btime *= 1.01; /* to be sure */
-       aq_set_soft_queue(btime, 0.0);
-#endif
-}
-
-static void stop_playing(void)
-{
-       if(upper_voices) {
-               MidiEvent ev;
-               ev.type = ME_EOT;
-               ev.a = 0;
-               ev.b = 0;
-               seq_play_event(&ev);
-               aq_flush(1);
-       }
-}
 
-#ifndef IA_W32G_SYN
 static void doit(void)
 {
-       MidiEvent ev;
 #ifndef __W32__
                init_keybord();
 #endif
 
-       playdone=0;
        while(seq_quit==0){
-#ifdef __W32__
+#if __W32__
                if(kbhit()){
                        switch(getch()){
-#else          
+#else                  
                if(kbhit()){
                        switch(readch()){
 #endif
@@ -862,115 +412,58 @@ static void doit(void)
                                case 'q':
                                        seq_quit=~0;
                                break;
-
                                case 'm':
-                                       server_reset();
-                                       ev.type=ME_RESET;
-                                       ev.a=GM_SYSTEM_MODE;
-                                       seq_play_event(&ev);
+                                       rtsyn_gm_reset();
                                break;
-
                                case 's':
-                                       server_reset();
-                                       ev.type=ME_RESET;
-                                       ev.a=GS_SYSTEM_MODE;
-                                       seq_play_event(&ev);
+                                       rtsyn_gs_reset();
                                break;
-
                                case 'x':
-                                       server_reset();
-                                       ev.type=ME_RESET;
-                                       ev.a=XG_SYSTEM_MODE;
-                                       ev.time=0;
-                                       seq_play_event(&ev);
+                                       rtsyn_xg_reset();
                                break;
-
                                case 'c':
-                                       server_reset();
-                                       ev.type=ME_RESET;
-                                       ev.a=system_mode;
-                                       seq_play_event(&ev);
+                                       rtsyn_normal_reset();
                                break;
-
                                case 'M':
-                                       server_reset();
-                                       system_mode=GM_SYSTEM_MODE;
-                                       ev.type=ME_RESET;
-                                       ev.a=GM_SYSTEM_MODE;
-                                       seq_play_event(&ev);
-                                       change_system_mode(system_mode);
+                                       rtsyn_gm_modeset();
                                break;
-
                                case 'S':
-                                       server_reset();
-                                       system_mode=GS_SYSTEM_MODE;
-                                       ev.type=ME_RESET;
-                                       ev.a=GS_SYSTEM_MODE;
-                                       seq_play_event(&ev);
-                                       change_system_mode(system_mode);
+                                       rtsyn_gs_modeset();
                                break;
-
                                case 'X':
-                                       server_reset();
-                                       system_mode=XG_SYSTEM_MODE;
-                                       ev.type=ME_RESET;
-                                       ev.a=XG_SYSTEM_MODE;
-                                       seq_play_event(&ev);
-                                       change_system_mode(system_mode);
+                                       rtsyn_xg_modeset();
                                break;
-
                                case 'N':
-                                       server_reset();
-                                       system_mode=DEFAULT_SYSTEM_MODE;
-                                       ev.type=ME_RESET;
-                                       ev.a=GS_SYSTEM_MODE;
-                                       seq_play_event(&ev);
-                                       change_system_mode(system_mode);
+                                       rtsyn_normal_modeset();
                                break;
-
                        }
                }
-               winplaymidi();
+               rtsyn_play_some_data();
+               rtsyn_play_calculate();
                sleep(0);
        }
 #ifndef __W32__
        close_keybord();
 #endif
 }
-#endif
 
-void server_reset(void)
-{
-       play_mode->close_output();      // PM_REQ_PLAY_START wlll called in playmidi_stream_init()
-       play_mode->open_output();       // but w32_a.c does not have it.
-       readmidi_read_init();
-       playmidi_stream_init();
-       starttime=get_current_calender_time();
-       reduce_voice_threshold = 0; // * Disable auto reduction voice *
-       auto_reduce_polyphony = 0;
-       event_time_offset = 0;
-}
+#endif /* !IA_W32G_SYN */
+
 
 #ifdef IA_W32G_SYN
 static int winplaymidi_sleep_level = 2;
 static DWORD winplaymidi_active_start_time = 0;
-#endif
+
 
 void winplaymidi(void){
-       MidiEvent ev;
 
-#ifdef IA_W32G_SYN
        if ( winplaymidi_sleep_level < 1 ) {
                winplaymidi_sleep_level = 1;
        }
-#endif
-#if defined(IA_W32G_SYN) && !defined(USE_PORTMIDI)
-       if( (evbuf[evbrpoint].status==B_OK)&&(evbrpoint!=evbwpoint) ){ //playdata exist
-               winplaymidi_sleep_level = 0;
+       if( 0 != rtsyn_buf_check() ){
+                       winplaymidi_sleep_level =0;
        }
-#endif
-       play_some_data();
-#ifdef IA_W32G_SYN
+       rtsyn_play_some_data();
        if ( winplaymidi_sleep_level == 1 ) {
                DWORD ct = GetCurrentTime ();
                if ( winplaymidi_active_start_time == 0 || ct < winplaymidi_active_start_time ) {
@@ -981,406 +474,18 @@ void winplaymidi(void){
        } else if ( winplaymidi_sleep_level == 0 ) {
                winplaymidi_active_start_time = 0;
        }
-#endif
-       ev.type = ME_NONE;
-       seq_set_time(&ev);
-       play_event(&ev);
-       aq_fill_nonblocking();
-
-       if(active_sensing_flag==~0 && (get_current_calender_time() > active_sensing_time+0.5)){
-//normaly acitive sensing expiering time is 330ms(>300ms) but this loop is heavy
-               play_mode->close_output();
-               play_mode->open_output();
-               printf ("Active Sensing Expired\n");
-               active_sensing_flag=0;
-       }
-#ifdef IA_W32G_SYN
+       
+       rtsyn_play_calculate();
+       
        if ( winplaymidi_sleep_level >= 2) {
                Sleep ( 100 );
        } else if ( winplaymidi_sleep_level > 0 ) {
                Sleep ( 1 );
        }
-#endif
-
 }
-
-#ifdef USE_PORTMIDI
-void play_some_data (void){
-       PmMessage pmmsg;
-       MidiEvent ev;
-       MidiEvent evm[16];
-       int i,j,ii,port,exlen,data,shift,chk,ne;
-       long pmlength;
-       for(port=0;port<portnumber;port++){
-               pmerr=Pm_Read(midistream[port].stream, pmbuffer, PMBUFF_SIZE);
-               if(pmerr==pmBufferOverflow){
-                       ctl.cmsg(  CMSG_ERROR, VERB_NORMAL, "PortMIDI buffer overflow: %s\n", Pm_GetErrorText( pmerr ) );
-               }else{
-                       if(pmerr<0) goto pmerror;
-               }
-               pmlength=pmerr;
-               i=0;
-               while(i<pmlength){
-                       pmmsg=pmbuffer[i].message;
-                       i++;
-                       ev.type = ME_NONE;
-                       ev.channel = Pm_MessageStatus(pmmsg) & 0x0000000f;
-                       ev.channel = ev.channel+port*16;
-                       ev.a = Pm_MessageData1(pmmsg);
-                       ev.b = Pm_MessageData2(pmmsg);
-                       switch ((int) (Pm_MessageStatus(pmmsg) & 0x000000f0)) {
-                       case 0x80:
-                               ev.type = ME_NOTEOFF;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0x90:
-                               ev.type = (ev.b) ? ME_NOTEON : ME_NOTEOFF;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0xa0:
-                               ev.type = ME_KEYPRESSURE;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0xb0:
-                               if (! convert_midi_control_change(ev.channel, ev.a, ev.b, &ev))
-                                       ev.type = ME_NONE;
-                               break;
-                       case 0xc0:
-                               ev.type = ME_PROGRAM;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0xd0:
-                               ev.type = ME_CHANNEL_PRESSURE;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0xe0:
-                               ev.type = ME_PITCHWHEEL;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0x0f0:
-                               if ( (Pm_MessageStatus(pmmsg) & 0x000000ff) == 0xf0) {
-                                       // SysEx
-                                       j=0;
-                                       sysexbuffer[j++] = 0xf0;
-                                       sysexbuffer[j++]=Pm_MessageData1(pmmsg);
-                                       sysexbuffer[j++]=Pm_MessageData2(pmmsg);
-                                       sysexbuffer[j++]=(pmmsg>> 24) & 0x0FF;
-                                       if(i>=pmlength){
-                                               {
-                                                       pmerr=Pm_Read(midistream[port].stream, pmbuffer, 1);
-                                                       if(pmerr<0){ printf("guha1\n");goto pmerror; }
-                                                       sleep(0);
-                                               }while(pmerr==8);
-                                               pmlength=pmerr;
-                                               i=0;
-                                       }
-                                       data=0;
-                                       while(j<EXBUFF_SIZE-4){
-                                               for (shift = 0; shift < 32 && (data != 0x0f7); shift += 8) {\r
-                                       data= (pmbuffer[i].message >> shift) & 0x0FF;
-                                                       sysexbuffer[j++]=data;
-                                               }
-                                               if(data==0x0f7) break;
-                                               i++;
-                                               if( i>=pmlength ){
-                                                       {
-                                                               pmerr=Pm_Read(midistream[port].stream, pmbuffer, 1);
-                                                               if(pmerr<0){ printf("guha2\n"); goto pmerror;}
-                                                               sleep(0);
-                                                       }while(pmerr==0);
-                                                       pmlength=pmerr;
-                                                       i=0;
-                                               }
-                                       }
-
-                                       exlen=j;
-                                       for(ii=0;ii<EX_RESET_NO;ii++){
-                                               chk=0;
-                                               for(j=0;(j<exlen)&&(j<11);j++){
-                                                       if(chk==0 && sysex_resets[ii][j]!=sysexbuffer[j]){
-                                                               chk=~0;
-                                                       }
-                                               }
-                                               if(chk==0){
-                                                        server_reset();
-                                               }
-                                       }
-/*
-                                       printf("SyeEx length=%x bytes \n", exlen);
-                                       for(ii=0;ii<exlen;ii++){
-                                               printf("%x ",sysexbuffer[ii]);
-                                       }
-                                       printf("\n");
-*/
-                                       if(parse_sysex_event(sysexbuffer+1,exlen-1,&ev)){
-                                               if(ev.type==ME_RESET && system_mode!=DEFAULT_SYSTEM_MODE)
-                                               ev.a=system_mode;
-                                               change_system_mode(system_mode);
-                                               seq_play_event(&ev);
-                                       }
-                                       if(ne=parse_sysex_event_multi(sysexbuffer+1,exlen-1, evm)){
-                                               for (ii = 0; ii < ne; ii++){
-                                                       seq_play_event(&evm[ii]);
-                                               }
-                                       }
-                                               
-                               }
-
-                               if ((Pm_MessageStatus(pmmsg) & 0x000000ff) == 0xf2) {
-                                       ev.type = ME_PROGRAM;
-//                                     seq_play_event(&ev);
-                               }
-#if 0
-                               if ((Pm_MessageStatus(pmmsg)  & 0x000000ff) == 0xf1)
-                                       //MIDI Time Code Qtr. Frame (not need)
-                                       printf("MIDI Time Code Qtr\n");
-                               if ((Pm_MessageStatus(pmmsg)  & 0x000000ff) == 0xf3)
-                                       //Song Select(Song #) (not need)
-                               if ((Pm_MessageStatus(pmmsg)  & 0x000000ff) == 0xf6)
-                                       //Tune request (not need)
-                                       printf("Tune request\n");
-                               if ((Pm_MessageStatus(pmmsg)  & 0x000000ff) == 0xf8)
-                                       //Timing Clock (not need)
-                                       printf("Timing Clock\n");
-                               if ((Pm_MessageStatus(pmmsg) &0x000000ff)==0xfa)
-                                       //Start
-                               if ((Pm_MessageStatus(pmmsg)  & 0x000000ff) == 0xfb)
-                                       //Continue
-                               if ((Pm_MessageStatus(pmmsg)  & 0x000000ff) == 0xfc) {
-                                       //Stop
-                                       printf("Stop\n");
-                                       playdone = ~0;
-                               }
 #endif
-                               if ((Pm_MessageStatus(pmmsg)  & 0x000000ff) == 0xfe) {
-                                       //Active Sensing
-//                                     printf("Active Sensing\n");
-                                       active_sensing_flag = ~0;
-                                       active_sensing_time = get_current_calender_time();
-                               }
-                               if ((Pm_MessageStatus(pmmsg)  & 0x000000ff) == 0xff) {
-                                       //System Reset
-                                       printf("System Reset\n");
-                                       playdone = ~0;
-                               }
-//                             break;
-                       default:
-//                             printf("Unsup/ed event %d\n", aevp->type);
-                               break;
-                       }
-                       if (ev.type != ME_NONE) {
-                               seq_play_event(&ev);
-                               seq_playing=~0;
-                       }
-               }
-       }
-       return;
-pmerror:
-       Pm_Terminate();
-       ctl.cmsg(  CMSG_ERROR, VERB_NORMAL, "PortMIDI error: %s\n", Pm_GetErrorText( pmerr ) );
-       return;
-}
-
-#else
-void play_some_data (void){
-       UINT wMsg;
-       DWORD   dwInstance;
-       DWORD   dwParam1;
-       DWORD   dwParam2;
-       MidiEvent ev;
-       MidiEvent evm[16];
-       int port;
-       UINT evbpoint;
-       MIDIHDR *IIMidiHdr;
-       int exlen;
-       char *sysexbuffer;
-       int ne,i,j,chk;
-
-       while( (evbuf[evbrpoint].status==B_OK)&&(evbrpoint!=evbwpoint) ){
-
-               evbpoint=evbrpoint;
-               if (++evbrpoint >= EVBUFF_SIZE)
-                               evbrpoint -= EVBUFF_SIZE;
-
-               wMsg=evbuf[evbpoint].wMsg;
-               dwInstance=evbuf[evbpoint].dwInstance;
-               dwParam1=evbuf[evbpoint].dwParam1;
-               dwParam2=evbuf[evbpoint].dwParam2;
-
-               port=(UINT)dwInstance;
-               switch (wMsg) {
-               case MIM_DATA:
-                       ev.type = ME_NONE;
-                       ev.channel = dwParam1 & 0x0000000f;
-                       ev.channel = ev.channel+port*16;
-                       ev.a = (dwParam1 >> 8) & 0xff;
-                       ev.b = (dwParam1 >> 16) & 0xff;
-                       switch ((int) (dwParam1 & 0x000000f0)) {
-                       case 0x80:
-                               ev.type = ME_NOTEOFF;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0x90:
-                       ev.type = (ev.b) ? ME_NOTEON : ME_NOTEOFF;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0xa0:
-                               ev.type = ME_KEYPRESSURE;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0xb0:
-                               if (! convert_midi_control_change(ev.channel, ev.a, ev.b, &ev))
-                               ev.type = ME_NONE;
-                               break;
-                       case 0xc0:
-                               ev.type = ME_PROGRAM;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0xd0:
-                               ev.type = ME_CHANNEL_PRESSURE;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0xe0:
-                               ev.type = ME_PITCHWHEEL;
-//                             seq_play_event(&ev);
-                               break;
-                       case 0xf0:
-                               if ((dwParam1 & 0x000000ff) == 0xf2) {
-                                       ev.type = ME_PROGRAM;
-//                                     seq_play_event(&ev);
-                               }
-#if 0
-                               if ((dwParam1 & 0x000000ff) == 0xf1)
-                                       //MIDI Time Code Qtr. Frame (not need)
-                                       printf("MIDI Time Code Qtr\n");
-                               if ((dwParam1 & 0x000000ff) == 0xf3)
-                                       //Song Select(Song #) (not need)
-                               if ((dwParam1 & 0x000000ff) == 0xf6)
-                                       //Tune request (not need)
-                                       printf("Tune request\n");
-                               if ((dwParam1 & 0x000000ff) == 0xf8)
-                                       //Timing Clock (not need)
-                                       printf("Timing Clock\n");
-                               if ((dwParam1&0x000000ff)==0xfa)
-                                       //Start
-                               if ((dwParam1 & 0x000000ff) == 0xfb)
-                                       //Continue
-                               if ((dwParam1 & 0x000000ff) == 0xfc) {
-                                       //Stop
-                                       printf("Stop\n");
-                                       playdone = ~0;
-                               }
-#endif
-                               if ((dwParam1 & 0x000000ff) == 0xfe) {
-                                       //Active Sensing
-//                                     printf("Active Sensing\n");
-                                       active_sensing_flag = ~0;
-                                       active_sensing_time = get_current_calender_time();
-                               }
-                               if ((dwParam1 & 0x000000ff) == 0xff) {
-                                       //System Reset
-                                       printf("System Reset\n");
-                                       playdone = ~0;
-                               }
-                               break;
-                       default:
-//                             printf("Unsup/ed event %d\n", aevp->type);
-                               break;
-                       }
-                       if (ev.type != ME_NONE) {
-                               seq_play_event(&ev);
-                               seq_playing=~0;
-                       }
-                       break;
-               case MIM_LONGDATA:
-                       IIMidiHdr = (MIDIHDR *) dwParam1;
-                       exlen=(int)IIMidiHdr->dwBytesRecorded;
-                       sysexbuffer=IIMidiHdr->lpData;
-                       if(sysexbuffer[exlen-1]=='\xf7'){            // I don't konw why this need
-                               for(i=0;i<EX_RESET_NO;i++){
-                                       chk=0;
-                                       for(j=0;(j<exlen)&&(j<11);j++){
-                                               if(chk==0 && sysex_resets[i][j]!=sysexbuffer[j]){
-                                                       chk=~0;
-                                               }
-                                       }
-                                       if(chk==0){
-                                                server_reset();
-                                       }
-                               }
-
-                               printf("SyeEx length=%x bytes \n", exlen);
-                               for(i=0;i<exlen;i++){
-                                       printf("%x ",sysexbuffer[i]);
-                               }
-                               printf("\n");
-
-                               if(parse_sysex_event(sysexbuffer+1,exlen-1,&ev)){
-                                       if(ev.type==ME_RESET && system_mode!=DEFAULT_SYSTEM_MODE)
-                                               ev.a=system_mode;
-                                       change_system_mode(system_mode);
-                                       seq_play_event(&ev);
-                               }
-                               if(ne=parse_sysex_event_multi(sysexbuffer+1,exlen-1, evm)){
-                                       for (i = 0; i < ne; i++){
-                                               seq_play_event(&evm[i]);
-                                       }
-                               }
-                       }
-                       if (MMSYSERR_NOERROR != midiInUnprepareHeader(
-                                       hMidiIn[port], IIMidiHdr, sizeof(MIDIHDR)))
-                               printf("error1\n");
-                       if (MMSYSERR_NOERROR != midiInPrepareHeader(
-                                       hMidiIn[port], IIMidiHdr, sizeof(MIDIHDR)))
-                               printf("error5\n");
-                       if (MMSYSERR_NOERROR != midiInAddBuffer(
-                                       hMidiIn[port], IIMidiHdr, sizeof(MIDIHDR)))
-                               printf("error6\n");
-                       break;
-               }
-       }
-}
+               
 
-void CALLBACK MidiInProc(HMIDIIN hMidiInL, UINT wMsg, DWORD dwInstance,
-               DWORD dwParam1, DWORD dwParam2)
-{
-       UINT evbpoint;
-       UINT port;
-       
-       port=(UINT)dwInstance;
-       lastdintime = get_current_calender_time();
-       switch (wMsg) {
-       case MIM_DATA:
-       case MIM_LONGDATA:
-               evbpoint = evbwpoint;
-               if (++evbwpoint >= EVBUFF_SIZE)
-                       evbwpoint -= EVBUFF_SIZE;
-               evbuf[evbwpoint].status = B_END;
-               evbuf[evbpoint].status = B_WORK;
-               evbuf[evbpoint].wMsg = wMsg;
-               evbuf[evbpoint].dwInstance = dwInstance;
-               evbuf[evbpoint].dwParam1 = dwParam1;
-               evbuf[evbpoint].dwParam2 = dwParam2;
-               evbuf[evbpoint].status = B_OK;
-               break;
-       case MIM_OPEN:
-//             printf("MIM_OPEN\n");
-               break;
-       case MIM_CLOSE:
-//             printf("MIM_CLOSE\n");
-               break;
-       case MIM_LONGERROR:
-               printf("MIM_LONGERROR\n");
-               break;
-       case MIM_ERROR:
-               printf("MIM_ERROR\n");
-               break;
-       case MIM_MOREDATA:
-               printf("MIM_MOREDATA\n");
-               break;
-       }
-}
-#endif
 /*
  * interface_<id>_loader();
  */
index 9398296..fd84478 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -126,6 +126,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -138,6 +140,8 @@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@
 ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@
 ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@
 ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@
+ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@
+ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@
 ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@
 ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@
 ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@
@@ -183,6 +187,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -212,7 +217,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -342,7 +346,6 @@ EXTRA_libarc_a_SOURCES = \
 
 libarc_a_LIBADD = $(NET_OBJS)
 subdir = libarc
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -444,7 +447,7 @@ distclean-depend:
 .c.o:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
 @am__fastdepCC_TRUE@     -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@   then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
 @am__fastdepCC_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
 @am__fastdepCC_TRUE@   fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@@ -454,14 +457,14 @@ distclean-depend:
 
 .c.obj:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \
+@am__fastdepCC_TRUE@   then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
 @am__fastdepCC_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
 @am__fastdepCC_TRUE@   fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+@am__fastdepCC_FALSE@  $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`
 uninstall-info-am:
 
 ETAGS = etags
@@ -555,6 +558,7 @@ check: check-am
 all-am: Makefile $(LIBRARIES)
 
 installdirs:
+
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
index 2dac12d..afa09e7 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -126,6 +126,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -138,6 +140,8 @@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@
 ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@
 ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@
 ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@
+ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@
+ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@
 ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@
 ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@
 ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@
@@ -183,6 +187,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -212,7 +217,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -326,7 +330,6 @@ libunimod_a_SOURCES = \
        unimod_priv.h
 
 subdir = libunimod
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -421,7 +424,7 @@ distclean-depend:
 .c.o:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
 @am__fastdepCC_TRUE@     -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@   then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
 @am__fastdepCC_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
 @am__fastdepCC_TRUE@   fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@@ -431,14 +434,14 @@ distclean-depend:
 
 .c.obj:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \
+@am__fastdepCC_TRUE@   then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
 @am__fastdepCC_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
 @am__fastdepCC_TRUE@   fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+@am__fastdepCC_FALSE@  $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`
 uninstall-info-am:
 
 ETAGS = etags
@@ -532,6 +535,7 @@ check: check-am
 all-am: Makefile $(LIBRARIES)
 
 installdirs:
+
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
index f6f2bd2..02ae519 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -84,6 +84,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -96,6 +98,8 @@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@
 ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@
 ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@
 ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@
+ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@
+ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@
 ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@
 ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@
 ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@
@@ -141,6 +145,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -169,7 +174,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -219,7 +223,6 @@ timidity_LDFLAGS = @timidity_LDFLAGS@
 w_so_libs = @w_so_libs@
 EXTRA_DIST = dllutl.rb readme.txt
 subdir = script
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -277,6 +280,7 @@ check: check-am
 all-am: Makefile
 
 installdirs:
+
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
index 0425bbc..50d93ce 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -126,6 +126,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -185,6 +187,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -214,7 +217,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -443,7 +445,6 @@ timidity_dep = $(SYSEXTRAS:.c=.o) \
        $(W32GUI_RES)
 
 subdir = timidity
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -664,7 +665,7 @@ distclean-depend:
 .c.o:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
 @am__fastdepCC_TRUE@     -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@   then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
 @am__fastdepCC_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
 @am__fastdepCC_TRUE@   fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@@ -674,14 +675,14 @@ distclean-depend:
 
 .c.obj:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \
+@am__fastdepCC_TRUE@   then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
 @am__fastdepCC_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
 @am__fastdepCC_TRUE@   fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+@am__fastdepCC_FALSE@  $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`
 uninstall-info-am:
 
 ETAGS = etags
@@ -776,6 +777,7 @@ all-am: Makefile $(PROGRAMS)
 
 installdirs:
        $(mkinstalldirs) $(DESTDIR)$(bindir)
+
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
index d1ed4a9..59c97a3 100644 (file)
@@ -146,6 +146,10 @@ extern ControlMode alsaseq_control_mode;
 extern ControlMode winsyn_control_mode;
 #endif /* IA_WINSYN */
 
+#ifdef IA_PORTMIDISYN
+extern ControlMode portmidisyn_control_mode;
+#endif /* IA_PORTMIDISYN */
+
 #ifdef IA_MACOSX
 extern ControlMode macosx_control_mode;
 #endif /* IA_MACOSX */
@@ -220,6 +224,9 @@ ControlMode *ctl_list[]={
 #ifdef IA_WINSYN
   &winsyn_control_mode,
 #endif
+#ifdef IA_PORTMIDISYN
+  &portmidisyn_control_mode,
+#endif
   0
 };
 
index 641c2d9..78bf4da 100644 (file)
@@ -67,9 +67,10 @@ static int stereo=2;
 static int data_nbyte;
 static int numBuffers;
 static unsigned int framesPerInBuffer;
-static unsigned int bytesPerInBuffer;
-static int  firsttime;
+static unsigned int bytesPerInBuffer=0;
+//static int  firsttime;
 static int pa_active=0;
+static int first=1;
 PaDeviceID DeviceID;
 PaDeviceInfo *DeviceInfo;
 PortAudioStream *stream;
@@ -148,58 +149,55 @@ static int open_output(void)
 {
        double rate;
        int n, nrates;
+       if(pa_active==0){
+               err = Pa_Initialize();
+               if( err != paNoError ) goto error;
+               pa_active=1;
+       }
+       if(first==1){
+               atexit(close_output);
+               first=0;
+       }
+
        dpm.encoding = dpm.encoding  & !((int32)PE_ULAW) & !((int32)PE_ALAW) & !((int32)PE_BYTESWAP);
        dpm.encoding = dpm.encoding|PE_SIGNED;
        stereo=(dpm.encoding & PE_MONO)?1:2;
        data_nbyte=(dpm.encoding & PE_16BIT)?sizeof(int16):sizeof(int8);
-       
-       DeviceID=Pa_GetDefaultInputDeviceID();
+
+       DeviceID=Pa_GetDefaultOutputDeviceID();
        DeviceInfo=Pa_GetDeviceInfo( DeviceID);
        nrates=DeviceInfo->numSampleRates;
-
        if(nrates!=-1){
                rate=DeviceInfo->sampleRates[nrates-1];
                for(n=nrates-1;n>=0;n--){
-                       if(dpm.rate < DeviceInfo->sampleRates[n]) rate=DeviceInfo->sampleRates[n];
+                       if(dpm.rate <= DeviceInfo->sampleRates[n]) rate=DeviceInfo->sampleRates[n];
                }
-               dpm.rate=rate;
        }else{
-               if(dpm.rate < DeviceInfo->sampleRates[0]) dpm.rate=DeviceInfo->sampleRates[0];
-               if(dpm.rate > DeviceInfo->sampleRates[1]) dpm.rate=DeviceInfo->sampleRates[1];
+               rate=dpm.rate;
+               if(dpm.rate < DeviceInfo->sampleRates[0]) rate=DeviceInfo->sampleRates[0];
+               if(dpm.rate > DeviceInfo->sampleRates[1]) rate=DeviceInfo->sampleRates[1];
        }
+       dpm.rate=(int32)rate;
 
        pa_data.samplesToGo=0;
        pa_data.bufpoint=pa_data.buf;
        pa_data.bufepoint=pa_data.buf;
-       firsttime=1;
+//     firsttime=1;
        numBuffers=Pa_GetMinNumBuffers( framesPerBuffer, dpm.rate );
        framesPerInBuffer=numBuffers*framesPerBuffer;
        if(framesPerInBuffer<4096) framesPerInBuffer=4096;
        bytesPerInBuffer=framesPerInBuffer*data_nbyte*stereo;
 //     printf("%d\n",framesPerInBuffer);
-
-       err = Pa_Initialize();
-       pa_active=1;
-
-       if( err != paNoError ) goto error;
+//     printf("%d\n",dpm.rate);
        err = Pa_OpenDefaultStream(
-
        &stream,        /* passes back stream pointer */
-
        0,              /* no input channels */
-
        stereo,              /* 2:stereo 1:mono output */
-
        (dpm.encoding & PE_16BIT)?paInt16:paInt8,      /* 16 bit 8bit output */
-
-               dpm.rate,          /* sample rate */
-
+               (double)dpm.rate,          /* sample rate */
        framesPerBuffer,            /* frames per buffer */
-
        numBuffers,              /* number of buffers, if zero then use default minimum */
-
        paCallback, /* specify our custom callback */
-
        &pa_data);   /* pass our data through to callback */
        if( err != paNoError ) goto error;
        return 0;
@@ -212,7 +210,7 @@ error:
 static int output_data(char *buf, int32 nbytes)
 {
        unsigned int i;
-       
+
 
 //     if(pa_data.samplesToGo > DATA_BLOCK_SIZE){ 
 //             Sleep(  (pa_data.samplesToGo - DATA_BLOCK_SIZE)/dpm.rate/4  );
@@ -224,6 +222,7 @@ static int output_data(char *buf, int32 nbytes)
                }
        }
        pa_data.samplesToGo += nbytes;
+
 /*
        if(firsttime==1){
                err = Pa_StartStream( stream );
@@ -237,7 +236,7 @@ static int output_data(char *buf, int32 nbytes)
 
                if( err != paNoError ) goto error;
        }
-       while(pa_data.samplesToGo > bytesPerInBuffer){ Pa_Sleep(1);};
+    while(pa_data.samplesToGo > bytesPerInBuffer){ Pa_Sleep(1);};
 //     Pa_Sleep( (pa_data.samplesToGo - bytesPerInBuffer)/dpm.rate * 1000);
        return 0;
 
@@ -250,16 +249,15 @@ error:
 static void close_output(void)
 {      
        if( pa_active==0) return;
-       if( 1==Pa_StreamActive(stream)){
+       if(Pa_StreamActive(stream)){
                Pa_Sleep(  bytesPerInBuffer/dpm.rate*1000  );
-       }
+       }       
        err = Pa_StopStream( stream );
-
-       if( err != paNoError ) goto error;
+//     if( err != paNoError ) goto error;
        err = Pa_CloseStream( stream );
-
-       if( err != paNoError ) goto error;
-       Pa_Terminate(); pa_active=0;
+//     if( err != paNoError ) goto error;
+       Pa_Terminate(); 
+       pa_active=0;
        return;
 
 error:
index 0a9be20..a3d0e06 100644 (file)
@@ -90,7 +90,7 @@ extern char *optarg;
 #endif
 
 #define OPTCOMMANDS "4A:aB:b:C:c:D:d:E:eFfg:H:hI:i:jK:k:L:M:m:N:n:O:o:P:p:Q:q:R:rS:s:t:T:UW:w:x:Z:"    /* Only GJluVvXz are remain... */
-#define INTERACTIVE_INTERFACE_IDS "kmqagrwAW"
+#define INTERACTIVE_INTERFACE_IDS "kmqagrwAWP"
 
 /* main interfaces (To be used another main) */
 #if defined(main) || defined(ANOTHER_MAIN)
@@ -3989,7 +3989,7 @@ int main(int argc, char **argv)
 
     nfiles = argc - optind;
     files  = argv + optind;
-    if(nfiles > 0 && ctl->id_character != 'r' && ctl->id_character != 'A' && ctl->id_character != 'W')
+    if(nfiles > 0 && ctl->id_character != 'r' && ctl->id_character != 'A' && ctl->id_character != 'W' && ctl->id_character != 'P')
        files = expand_file_archives(files, &nfiles);
     if(dumb_error_count)
        sleep(1);
index c034169..41a6252 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -126,6 +126,8 @@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@
 ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@
 ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@
 ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@
+ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@
+ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@
 ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@
 ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@
 ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@
@@ -138,6 +140,8 @@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@
 ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@
 ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@
 ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@
+ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@
+ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@
 ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@
 ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@
 ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@
@@ -183,6 +187,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+P_so_libs = @P_so_libs@
 RANLIB = @RANLIB@
 SET_MAKE = @SET_MAKE@
 SHCFLAGS = @SHCFLAGS@
@@ -212,7 +217,6 @@ ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
-am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 bindir = @bindir@
 build = @build@
@@ -341,7 +345,6 @@ libutils_a_LIBADD = \
        $(SOUND_SPEC_OBJS)
 
 subdir = utils
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h
 CONFIG_CLEAN_FILES =
@@ -436,7 +439,7 @@ distclean-depend:
 .c.o:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
 @am__fastdepCC_TRUE@     -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@   then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
 @am__fastdepCC_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
 @am__fastdepCC_TRUE@   fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@@ -446,14 +449,14 @@ distclean-depend:
 
 .c.obj:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@     -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \
+@am__fastdepCC_TRUE@   then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
 @am__fastdepCC_TRUE@   else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
 @am__fastdepCC_TRUE@   fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+@am__fastdepCC_FALSE@  $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`
 uninstall-info-am:
 
 ETAGS = etags
@@ -547,6 +550,7 @@ check: check-am
 all-am: Makefile $(LIBRARIES)
 
 installdirs:
+
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am