diff --git a/README b/README index 6a9ecebf..0b6a773a 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ README for Sequencer64 0.96.8 (Native JACK, CLI, tempo, Linux/Windows, play-lists) Chris Ahlstrom -2015-09-10 to 2020-02-16 +2015-09-10 to 2020-05-27 Sequencer64 is a reboot of seq24, extending it greatly over the last four years. The heart of seq24 remains intact. It is an old friend with a whole lot of @@ -42,6 +42,11 @@ and using a conventional source tarball. Recent changes: + - Version 0.96.8: + - Many many tweaks and optimizations. + - Fixed bug in event_list::link_new(). + - Sped up the MIDI record code to try to avoid issues recording + chords from a MIDI keyboard. - Version 0.96.7: - Fixed issue #181 by adding more beats/bar menu values up to 20. Note that the fix to issue #77 allows numbers up to 128 to be diff --git a/aux-files/compile b/aux-files/compile index a85b723c..23fcba01 100755 --- a/aux-files/compile +++ b/aux-files/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) @@ -255,7 +255,8 @@ EOF echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/aux-files/depcomp b/aux-files/depcomp index b39f98f9..6b391623 100755 --- a/aux-files/depcomp +++ b/aux-files/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2016-01-11.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ scriptversion=2016-01-11.22; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -783,7 +783,7 @@ exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" diff --git a/aux-files/missing b/aux-files/missing index f62bbae3..8d0eaad2 100755 --- a/aux-files/missing +++ b/aux-files/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2013-10-28.13; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ else exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { @@ -207,9 +207,9 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \ exit $st # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/configure b/configure index 3e801dcc..09a17e5a 100755 --- a/configure +++ b/configure @@ -752,7 +752,6 @@ am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE -am__quote am__include DEPDIR OBJEXT @@ -835,7 +834,8 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -2614,7 +2614,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -am__api_version='1.15' +am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -3130,8 +3130,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -3182,7 +3182,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -3861,45 +3861,45 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" - -am_make=${MAKE-make} -cat > confinc << 'END' +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : @@ -6295,7 +6295,7 @@ esac fi : ${AR=ar} -: ${AR_FLAGS=cru} +: ${AR_FLAGS=cr} @@ -6796,11 +6796,8 @@ _LT_EOF test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -8019,8 +8016,8 @@ int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 + echo "$AR cr libconftest.a conftest.o" >&5 + $AR cr libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF @@ -9458,6 +9455,12 @@ lt_prog_compiler_static= lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -13400,7 +13403,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no @@ -13892,7 +13895,7 @@ fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -13957,7 +13960,7 @@ fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -14296,7 +14299,7 @@ fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support @@ -14380,7 +14383,7 @@ fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. @@ -14391,7 +14394,7 @@ fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' @@ -16904,8 +16907,8 @@ $as_echo "no" >&6; } fi pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JACK" >&5 -$as_echo_n "checking for JACK... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jack >= 0.90.0" >&5 +$as_echo_n "checking for jack >= 0.90.0... " >&6; } if test -n "$JACK_CFLAGS"; then pkg_cv_JACK_CFLAGS="$JACK_CFLAGS" @@ -16945,7 +16948,7 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -16963,7 +16966,7 @@ fi jack_found="no" elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } jack_found="no" else @@ -17020,8 +17023,8 @@ fi if test "$lash" != "no"; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LASH" >&5 -$as_echo_n "checking for LASH... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lash-1.0 >= 0.5.0" >&5 +$as_echo_n "checking for lash-1.0 >= 0.5.0... " >&6; } if test -n "$LASH_CFLAGS"; then pkg_cv_LASH_CFLAGS="$LASH_CFLAGS" @@ -17061,7 +17064,7 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -17079,7 +17082,7 @@ fi lash_found="no" elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } lash_found="no" else @@ -19273,8 +19276,8 @@ fi pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTKMM" >&5 -$as_echo_n "checking for GTKMM... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gtkmm-2.4 >= 2.4.0" >&5 +$as_echo_n "checking for gtkmm-2.4 >= 2.4.0... " >&6; } if test -n "$GTKMM_CFLAGS"; then pkg_cv_GTKMM_CFLAGS="$GTKMM_CFLAGS" @@ -19314,7 +19317,7 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -19341,7 +19344,7 @@ Alternatively, you may set the environment variables GTKMM_CFLAGS and GTKMM_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} @@ -21007,7 +21010,7 @@ esac CFLAGS="$CFLAGS $COMMONFLAGS" -CXXFLAGS="$CFLAGS -std=c++14 -Wno-variadic-macros -Wno-deprecated-declarations" +CXXFLAGS="$CFLAGS -std=c++14 -Wno-deprecated-copy -Wno-variadic-macros -Wno-deprecated-declarations" if test x$gnuwin = xyes; then GNU_WIN_TRUE= @@ -21790,7 +21793,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # INIT-COMMANDS # PACKAGE="$PACKAGE" -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -22866,29 +22869,35 @@ fi # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -22906,53 +22915,50 @@ $as_echo X"$mf" | q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } - /^X\(\/\/\)$/{ + /^X\/\(\/\/\)$/{ s//\1/ q } - /^X\(\/\).*/{ + /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk } ;; "libtool":C) diff --git a/configure.ac b/configure.ac index b170f661..2a27c557 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ dnl \file configure.ac dnl \library Sequencer64 dnl \author Chris Ahlstrom dnl \date 2015-09-11 -dnl \update 2020-04-18 +dnl \update 2020-05-27 dnl \version $Revision$ dnl \license $XPC_SUITE_GPL_LICENSE$ dnl @@ -742,7 +742,7 @@ dnl automatically for us. AH_TOP( -#define VERSION_DATE_SHORT "2020-04-18" +#define VERSION_DATE_SHORT "2020-05-27" #define VERSION "0.96.8" ) @@ -816,9 +816,13 @@ dnl dnl 2015-10-02: After a Debian Sid update, the configfile module wouldn't dnl compile because, we think, the sigc++ now required C++11 support. dnl Note the c++14 option. +dnl +dnl 2020-05-26: gcc 9 uncovers a -Wdeprecated-copy warning in some glibmm +dnl header files. We will try removing the disabling of this warning +dnl periodically. Not an issue with the Qt interface, though. CFLAGS="$CFLAGS $COMMONFLAGS" -CXXFLAGS="$CFLAGS -std=c++14 -Wno-variadic-macros -Wno-deprecated-declarations" +CXXFLAGS="$CFLAGS -std=c++14 -Wno-deprecated-copy -Wno-variadic-macros -Wno-deprecated-declarations" AM_CONDITIONAL(GNU_WIN, test x$gnuwin = xyes) diff --git a/include/config.h.in b/include/config.h.in index 0247c882..8d2fdfc1 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1,6 +1,6 @@ /* include/config.h.in. Generated from configure.ac by autoheader. */ -#define VERSION_DATE_SHORT "2020-04-18" +#define VERSION_DATE_SHORT "2020-05-27" #define VERSION "0.96.8" diff --git a/libseq64/include/daemonize.hpp b/libseq64/include/daemonize.hpp index 6dc6b35c..3c8df6fb 100644 --- a/libseq64/include/daemonize.hpp +++ b/libseq64/include/daemonize.hpp @@ -5,7 +5,7 @@ * \file daemonize.hpp * \author Chris Ahlstrom * \date 2005-07-03 to 2007-08-21 (from xpc-suite project) - * \updates 2020-02-04 + * \updates 2020-05-26 * \license GNU GPLv2 or above * * Daemonization of POSIX C Wrapper (PSXC) library @@ -50,8 +50,8 @@ namespace seq64 { /* - * Free functions. - * These functions do a lot of the work of dealing with UNIX daemons. + * Free functions. These functions do a lot of the work of dealing with UNIX + * daemons and timing. */ extern bool check_daemonize (int argc, char * argv []); @@ -62,13 +62,20 @@ extern uint32_t daemonize int mask = 0 ); extern void undaemonize (uint32_t previous_umask); + +/* + * Linux and Windows support. + */ + extern bool reroute_stdio ( const std::string & logfile = "", bool closem = false ); +extern bool microsleep (int us); +extern bool millisleep (int ms); -/* +/** * Basic session handling from use falkTX, circa 2020-02-02. The following * function is internal. * diff --git a/libseq64/include/event.hpp b/libseq64/include/event.hpp index d8ad0b67..15cebd50 100644 --- a/libseq64/include/event.hpp +++ b/libseq64/include/event.hpp @@ -28,7 +28,7 @@ * \library sequencer64 application * \author Seq24 team; modifications by Chris Ahlstrom * \date 2015-07-24 - * \updates 2018-11-24 + * \updates 2020-05-25 * \license GNU GPLv2 or above * * This module also declares/defines the various constants, status-byte @@ -166,8 +166,8 @@ const midibyte EVENT_MIDI_START = 0xFA; // no data bytes const midibyte EVENT_MIDI_CONTINUE = 0xFB; // no data bytes const midibyte EVENT_MIDI_STOP = 0xFC; // no data bytes const midibyte EVENT_MIDI_SONG_FD = 0xFD; // undefined -const midibyte EVENT_MIDI_ACTIVE_SENSE = 0xFE; // 0 data bytes, not used -const midibyte EVENT_MIDI_RESET = 0xFF; // 0 data bytes, not used +const midibyte EVENT_MIDI_ACTIVE_SENSE = 0xFE; // 0 data bytes +const midibyte EVENT_MIDI_RESET = 0xFF; // 0 data bytes /** * 0xFF is a MIDI "escape code" used in MIDI files to introduce a MIDI meta @@ -581,6 +581,15 @@ class event return m == EVENT_MIDI_SYSEX; } + /** + * Static test for sense/reset messages. + */ + + static bool is_sense_or_reset (midibyte m) + { + return m == EVENT_MIDI_ACTIVE_SENSE || m == EVENT_MIDI_RESET; + } + /** * Static test for messages that involve notes and velocity: Note On, * Note Off, and Aftertouch. This function requires that the channel @@ -677,6 +686,12 @@ class event void set_status (midibyte eventcode, midibyte channel); void set_meta_status (midibyte metatype); void set_status_keep_channel (midibyte eventcode); + bool set_midi_event + ( + midipulse timestamp, + const midibyte * buffer, + int count + ); /** * Sets the channel "nybble", without modifying the status "nybble". @@ -839,9 +854,9 @@ class event m_data[1] = (m_data[1] - 1) & 0x7F; } - bool append_sysex (midibyte * data, int len); + bool append_sysex (const midibyte * data, int len); bool append_sysex (midibyte data); - bool append_meta_data (midibyte metatype, midibyte * data, int len); + bool append_meta_data (midibyte metatype, const midibyte * data, int len); bool append_meta_data (midibyte metatype, const std::vector & data); void restart_sysex (); // kind of useless @@ -1154,8 +1169,6 @@ class event return is_note_off_velocity(m_status, m_data[1]); } - void adjust_note_off (); - /** * Indicates if the m_status value is a one-byte message (Program Change * or Channel Pressure. Channel is stripped, because sometimes we keep @@ -1164,7 +1177,7 @@ class event bool is_one_byte () const { - return is_one_byte_msg(m_status); // && 0xF0); + return is_one_byte_msg(m_status); } /** @@ -1190,6 +1203,17 @@ class event return m_status == EVENT_MIDI_SYSEX; } + /** + * Indicates if the event is a Sense event or a Reset event. + * Currently ignored by Sequencer64. + */ + + bool is_sense_reset () + { + return m_status == EVENT_MIDI_ACTIVE_SENSE || + m_status == EVENT_MIDI_RESET; + } + /** * Indicates if the event is a Meta event or not. * We're overloading the SysEx support to handle Meta events as well. @@ -1244,6 +1268,7 @@ class event } void print () const; + void print_note (bool is_a_link = false) const; /** * This function is used in sorting MIDI status events (e.g. note diff --git a/libseq64/include/event_list.hpp b/libseq64/include/event_list.hpp index 060ee59f..864cea78 100644 --- a/libseq64/include/event_list.hpp +++ b/libseq64/include/event_list.hpp @@ -28,7 +28,7 @@ * \library sequencer64 application * \author Seq24 team; modifications by Chris Ahlstrom * \date 2015-09-19 - * \updates 2018-07-02 + * \updates 2020-05-25 * \license GNU GPLv2 or above * * This module extracts the event-list functionality from the sequencer @@ -442,7 +442,8 @@ class event_list bool any_selected_events (midibyte status, midibyte cc) const; void select_all (); void unselect_all (); - void print () const; + void print (const std::string & tag = "") const; + void print_notes (const std::string & tag = "") const; /** * \getter m_events diff --git a/libseq64/include/mastermidibase.hpp b/libseq64/include/mastermidibase.hpp index 68bdc9c8..51f8eb5b 100644 --- a/libseq64/include/mastermidibase.hpp +++ b/libseq64/include/mastermidibase.hpp @@ -480,9 +480,6 @@ class mastermidibase bool save_clock (bussbyte bus, clock_e clock); bool save_input (bussbyte bus, bool inputing); -#if 0 - void swap (); -#endif }; // class mastermidibase diff --git a/libseq64/include/midibase.hpp b/libseq64/include/midibase.hpp index 98fb50eb..8e94e72f 100644 --- a/libseq64/include/midibase.hpp +++ b/libseq64/include/midibase.hpp @@ -27,7 +27,7 @@ * \library sequencer64 application * \author Seq24 team; modifications by Chris Ahlstrom * \date 2016-11-24 - * \updates 2017-05-12 + * \updates 2020-05-26 * \license GNU GPLv2 or above * * The midibase module is the new base class for the various implementations @@ -35,8 +35,9 @@ * base class for all such classes. */ -#include "app_limits.h" /* SEQ64_USE_DEFAULT_PPQN */ -#include "easy_macros.h" /* for autoconf header files */ +#include "app_limits.h" /* SEQ64_USE_DEFAULT_PPQN */ +#include "daemonize.hpp" /* milli- and microsleep() */ +#include "easy_macros.h" /* for autoconf header files */ #include "mutex.hpp" #include "midibus_common.hpp" #include "midibyte.hpp" /* seq64::midibyte typedef */ @@ -623,12 +624,6 @@ class midibase }; // class midibase -/* - * Free functions - */ - -extern void millisleep (unsigned long ms); - } // namespace seq64 #endif // SEQ64_MIDIBASE_HPP diff --git a/libseq64/include/perform.hpp b/libseq64/include/perform.hpp index e6d61cf3..d2b4eacb 100644 --- a/libseq64/include/perform.hpp +++ b/libseq64/include/perform.hpp @@ -28,7 +28,7 @@ * \library sequencer64 application * \author Seq24 team; modifications by Chris Ahlstrom * \date 2015-07-24 - * \updates 2020-02-22 + * \updates 2020-05-25 * \license GNU GPLv2 or above * * This class still has way too many members, even with the JACK and @@ -2387,6 +2387,7 @@ class perform void mute_screenset (int ss, bool flag = true); void output_func (); void input_func (); + bool poll_cycle (); void set_group_mute_state (int gtrack, bool muted); bool get_group_mute_state (int gtrack); int mute_group_offset (int track); @@ -3104,7 +3105,7 @@ class perform midi_control & midi_control_toggle (int ctl); midi_control & midi_control_on (int ctl); midi_control & midi_control_off (int ctl); - bool midi_control_event (const event & ev); + bool midi_control_event (const event & ev, bool recording = false); bool midi_control_record (const event & ev); bool handle_midi_control (int control, bool state); bool handle_midi_control_ex (int control, midi_control::action a, int v); diff --git a/libseq64/include/rect.hpp b/libseq64/include/rect.hpp index cc2272bb..9d35a2f2 100644 --- a/libseq64/include/rect.hpp +++ b/libseq64/include/rect.hpp @@ -217,13 +217,6 @@ class rect m_y += yv; } -#if 0 // see the cpp module for comments - void convert_tn_box_to_rect - ( - midipulse tick_s, midipulse tick_f, int note_h, int note_l - ); -#endif - private: /** diff --git a/libseq64/src/daemonize.cpp b/libseq64/src/daemonize.cpp index adb5fcf4..48ca34db 100644 --- a/libseq64/src/daemonize.cpp +++ b/libseq64/src/daemonize.cpp @@ -3,7 +3,7 @@ * \library sequencer64 application (from PSXC library) * \author Chris Ahlstrom * \date 2005-07-03 to 2007-08-21 (pre-Sequencer24/64) - * \updates 2020-02-09 + * \updates 2020-05-26 * \license GNU GPLv2 or above * * Daemonization module of the POSIX C Wrapper (PSXC) library @@ -67,16 +67,20 @@ #ifdef PLATFORM_LINUX #include /* struct sigaction */ +#include /* C::nanosleep(2) */ +#include /* usleep() or select() */ #endif #if defined PLATFORM_WINDOWS /* - * For Windows, only the reroute_stdio() function is defined, currently. + * For Windows, only the reroute_stdio() and microsleep() functions are + * defined, currently. */ #include /* _O_RDWR */ #include /* _open(), _close() */ +#include /* recent Windows "wait" functions */ #define STD_CLOSE _close #define STD_OPEN _open @@ -399,10 +403,126 @@ reroute_stdio (const std::string & logfile, bool closem) return result; } +/** + * This free-function in the seq64 namespace provides a way to suspend a + * thread for a small amount of time. + * + * \linux + * We can use the usleep(3) function. + * + * \unix + * In POSIX, select() can return early if any signal occurs. We don't + * correct for that here at this time. Actually, it is a convenient + * feature, and we wish that Sleep() would provide it. + * + * \win32 + * In Windows, the Sleep(0) function does not sleep, but it does cede + * control of the thread to the operating system, which then schedules + * another thread to run. + * + * \warning + * Please note that this function isn't all that accurate for small + * sleep values, due to the time taken to set up the operation, and + * resolution issues in many operating systems. + * + * \param ms + * The number of milliseconds to "sleep". + * + * \return + * Returns true if the ms parameter was 0 or greater. + */ + +bool +millisleep (int ms) +{ + bool result = ms >= 0; + if (result) + { +#if defined PLATFORM_LINUX + return microsleep(ms * 1000); +#elif defined PLATFORM_UNIX + struct timeval tv; + struct timeval * tvptr = &tv; + tv.tv_usec = long(ms % 1000) * 1000; + tv.tv_sec = long(ms / 1000; + result = select(0, 0, 0, 0, tvptr) != (-1); +#elif defined PLATFORM_WINDOWS // or PLATFORM_MINGW + if (ms == 0) + Sleep((DWORD) ms); + else + result = microsleep(ms * 1000); +#endif + } + return result; +} + +#ifdef PLATFORM_LINUX + +/** + * Sleeps for the given number of microseconds. nanosleep() is a Linux + * function which has some advantage over sleep(3) and usleep(3), such as not + * interacting with signals. It seems that it supports a non-busy wait. + * + * \param us + * Provides the desired number of microseconds to wait. + * + * \return + * Returns true if the full sleep occurred, or if interruped by a signal. + */ + +bool +microsleep (int us) +{ + struct timespec ts; + ts.tv_sec = us / 1000000; + ts.tv_nsec = (us % 1000000) * 1000; + + int rc = nanosleep(&ts, NULL); + return rc == 0 || rc == EINTR; +} + +#endif // PLATFORM_LINUX + +#ifdef PLATFORM_WINDOWS + +/** + * This implementation comes from https://gist.github.com/ngryman/6482577 and + * performs busy-waiting, meaning it will NOT relinquish the processor. + * + * \param us + * Provides the desired number of microseconds to wait. + * + * \return + * Returns true only if all calls succeeded. It doesn't matter if the + * wait completed, at this point. + */ + +bool +microsleep (int us) +{ + HANDLE timer = CreateWaitableTimer(NULL, TRUE, NULL); /* synchapi.h */ + bool result = timer != NULL; + if (result) + { + LARGE_INTEGER ft; + ft.QuadPart = -(10 * (__int64) us); + result = SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0) != 0; + if (result) + result = WaitForSingleObject(timer, INFINITE) != WAIT_FAILED; + + CloseHandle(timer); + } + return result; +} + +#endif // PLATFORM_WINDOWS + #ifdef PLATFORM_LINUX /* - * TODO: Make these values atomic? + * Session-handling is Linux-only. + * + * TODO: Make these values atomic? */ static bool sg_needs_close = false; diff --git a/libseq64/src/event.cpp b/libseq64/src/event.cpp index a887481f..c4348614 100644 --- a/libseq64/src/event.cpp +++ b/libseq64/src/event.cpp @@ -24,7 +24,7 @@ * \library sequencer64 application * \author Seq24 team; modifications by Chris Ahlstrom * \date 2015-07-24 - * \updates 2019-06-09 + * \updates 2020-05-25 * \license GNU GPLv2 or above * * A MIDI event (i.e. "track event") is encapsulated by the seq64::event @@ -353,6 +353,79 @@ event::set_status_keep_channel (midibyte eventcode) m_channel = eventcode & EVENT_GET_CHAN_MASK; } +/** + * In relation to issue #206. + * + * Combines a bunch of common operations in getting events. Code used in: + * + * - midi_in_jack::api_get_midi_event(event *) + * - midi_alsa_info::api_get_midi_event(event *) + * + * Can we use it in these contexts? + * + * - wrkfile::NoteArray(int, int) + * - midifile::parse_smf_1(...) [very unlikely] + * + * Some keyboards send Note On with velocity 0 for Note Off, so we take care + * of that situation here by creating a Note Off event, with the channel + * nybble preserved. Note that we call event::set_status_keep_channel() + * instead of using stazed's set_status function with the "record" parameter. + * Also, we have to mask in the actual channel number. + * + * Encapsulates some common code. This function assumes we have already set + * the status and data bytes. + */ + +bool +event::set_midi_event +( + midipulse timestamp, + const midibyte * buffer, + int count +) +{ + bool result = true; + set_timestamp(timestamp); + set_sysex_size(count); +#ifdef PLATFORM_DEBUG_TMI + printf + ( + "set_midi_event([%ld], status %02x, d0 %02X, d1 %02X, %d bytes)\n", + timestamp, buffer[0], buffer[1], buffer[2], count + ); +#endif + if (count == 3) + { + set_status_keep_channel(buffer[0]); + set_data(buffer[1], buffer[2]); + if (is_note_off_recorded()) + { + midibyte channel = buffer[0] & EVENT_GET_CHAN_MASK; + midibyte status = EVENT_NOTE_OFF | channel; + set_status_keep_channel(status); + } + } + else if (count == 2) + { + set_status_keep_channel(buffer[0]); + set_data(buffer[1]); + } + else + { + if (buffer[0] == EVENT_MIDI_SYSEX) + { + restart_sysex(); /* set up for sysex if needed */ + if (! append_sysex(buffer, count)) + { + errprint("event::append_sysex() failed"); + } + } + else + result = false; + } + return result; +} + /** * Sets a Meta event. Meta events have a status byte of EVENT_MIDI_META == * 0xff and a channel value that reflects the type of Meta event (e.g. 0x51 @@ -373,27 +446,6 @@ event::set_meta_status (midibyte metatype) m_channel = metatype; } -/** - * Some keyboards send Note On with velocity 0 for Note Off, so we take care - * of that situation here by creating a Note Off event, with the channel - * nybble preserved. Note that we call event::set_status_keep_channel() - * instead of using stazed's set_status function with the "record" parameter. - * Also, we have to mask in the actual channel number. - * - * Encapsulates some common code. This function assumes we have already set - * the status and data bytes. - */ - -void -event::adjust_note_off () -{ - if (is_note_off_recorded()) - { - midibyte status = EVENT_NOTE_OFF | m_channel; - set_status_keep_channel(status); - } -} - /** * Deletes and clears out the SYSEX buffer. (The m_sysex member used to be a * pointer.) @@ -427,7 +479,7 @@ event::restart_sysex () */ bool -event::append_sysex (midibyte * data, int dsize) +event::append_sysex (const midibyte * data, int dsize) { bool result = false; if (not_nullptr(data) && (dsize > 0)) @@ -482,7 +534,7 @@ event::append_sysex (midibyte * data, int dsize) */ bool -event::append_meta_data (midibyte metatype, midibyte * data, int dsize) +event::append_meta_data (midibyte metatype, const midibyte * data, int dsize) { bool result = not_nullptr(data) && (dsize > 0); if (result) @@ -579,6 +631,31 @@ event::print () const } } +/** + * + */ + +void +event::print_note (bool is_a_link) const +{ + if (is_note()) + { + std::string type = is_note_on() ? "On" : "Off" ; + printf + ( + "[%06ld] Note %s Key %02X Vel %02X Ch %02X ", + m_timestamp, type.c_str(), m_data[0], m_data[1], m_channel + ); + if (is_linked() && ! is_a_link) + { + event * mylink = get_linked(); + printf(": Link "); + mylink->print_note(true); + } + printf("\n"); + } +} + /** * The ranking, from high to low, is note off, note on, aftertouch, channel * pressure, and pitch wheel, control change, and program changes. The lower diff --git a/libseq64/src/event_list.cpp b/libseq64/src/event_list.cpp index 3b180b21..5ffd780d 100644 --- a/libseq64/src/event_list.cpp +++ b/libseq64/src/event_list.cpp @@ -335,7 +335,7 @@ event_list::merge (event_list & el, bool presort) #endif // SEQ64_USE_EVENT_MAP /** - * Links a new event. This function checks for a note on, then look for + * Links a new event. This function checks for a note on, then looks for * its note off. This function is provided in the event_list because it * does not depend on any external data. Also note that any desired * thread-safety must be provided by the caller. @@ -344,7 +344,6 @@ event_list::merge (event_list & el, bool presort) void event_list::link_new () { - bool endfound = false; for (Events::iterator on = m_events.begin(); on != m_events.end(); ++on) { event & eon = dref(on); @@ -352,14 +351,14 @@ event_list::link_new () { Events::iterator off = on; /* point to note on */ ++off; /* get next element */ - endfound = false; + bool endfound = false; while (off != m_events.end()) { event & eoff = dref(off); - if /* off event, == notes, and not linked */ + if /* Off, == notes, not linked */ ( eoff.is_note_off() && - eoff.get_note() == eoff.get_note() && ! eoff.is_linked() + eoff.get_note() == eon.get_note() && ! eoff.is_linked() ) { eon.link(&eoff); /* link backward */ @@ -403,6 +402,12 @@ event_list::link_new () * resize or move of notes must modify for wrapping if Note Off is >= * m_length. * + * THINK ABOUT IT: If we're in legacy merge mode for a loop, the Note Off is + * actually earlier than the Note On. And in replace mode, the Note On is + * cleared, leaving us with a dangling Note Off event. We should consider, in + * both modes, automatically adding the Note Off at the end of the loop and + * ignoring the next note off on the same note from the keyboard. Careful! + * * \threadunsafe * As in most case, the caller will use an automutex to call this * function safely. @@ -426,29 +431,18 @@ event_list::verify_and_link (midipulse slength) while (off != m_events.end()) { event & eoff = dref(off); - if /* Off, == notes, not marked */ + if /* Off, == notes, not linked */ ( eoff.is_note_off() && - eoff.get_note() == eon.get_note() && ! eoff.is_marked() + eoff.get_note() == eon.get_note() && ! eoff.is_linked() ) { /* - * THINK ABOUT IT: If we're in legacy merge mode for a - * loop, the Note Off is actually earlier than the Note - * On. And in replace mode, the Note On is cleared, - * leaving us with a dangling Note Off event. - * - * We should consider, in both modes, automatically adding - * the Note Off at the end of the loop and ignoring the - * next note off on the same note from the keyboard. - * - * Careful! + * See THINK ABOUT IT in the function banner. */ eon.link(&eoff); /* link + mark */ eoff.link(&eon); - eon.mark(); - eoff.mark(); endfound = true; break; } @@ -463,13 +457,11 @@ event_list::verify_and_link (midipulse slength) if ( eoff.is_note_off() && - eoff.get_note() == eon.get_note() && ! eoff.is_marked() + eoff.get_note() == eon.get_note() && ! eoff.is_linked() ) { eon.link(&eoff); /* link + mark */ eoff.link(&eon); - eon.mark(); - eoff.mark(); endfound = true; break; } @@ -478,7 +470,6 @@ event_list::verify_and_link (midipulse slength) } } } - unmark_all(); mark_out_of_range(slength); remove_marked(); /* prune out-of-range events */ @@ -652,7 +643,7 @@ event_list::mark_out_of_range (midipulse slength) for (Events::iterator i = m_events.begin(); i != m_events.end(); ++i) { event & e = dref(i); - bool prune = e.get_timestamp() > slength; /* WAS ">=", SEE BANNER */ + bool prune = e.get_timestamp() >= slength; /* WAS ">=", SEE BANNER */ if (! prune) prune = e.get_timestamp() < 0; /* added back, seq24 */ @@ -858,11 +849,41 @@ event_list::unselect_all () */ void -event_list::print () const +event_list::print (const std::string & tag) const { - printf("events[%d]:\n", count()); - for (Events::const_iterator i = m_events.begin(); i != m_events.end(); ++i) - dref(i).print(); + if (count() > 0) + { + printf("%d events %s:\n", count(), tag.c_str()); + for + ( + Events::const_iterator i = m_events.begin(); + i != m_events.end(); ++i + ) + { + dref(i).print(); + } + } +} + +/** + * Prints a list of the currently-held events. Useful for debugging. + */ + +void +event_list::print_notes (const std::string & tag) const +{ + if (count() > 0) + { + printf("Notes %s:\n", tag.c_str()); + for + ( + Events::const_iterator i = m_events.begin(); + i != m_events.end(); ++i + ) + { + dref(i).print_note(); + } + } } } // namespace seq64 diff --git a/libseq64/src/mastermidibase.cpp b/libseq64/src/mastermidibase.cpp index 9277b78c..0d799164 100644 --- a/libseq64/src/mastermidibase.cpp +++ b/libseq64/src/mastermidibase.cpp @@ -596,14 +596,15 @@ int mastermidibase::api_poll_for_midi () { int result = m_inbus_array.poll_for_midi(); +printf("mastermidibase::api_poll_for_midi ()\n"); if (result > 0) { if (result <= 2) - millisleep(1); /* is this sensible? */ + (void) microsleep(100); // millisleep(1); is this sensible? } else { - millisleep(1); + (void) microsleep(100); // millisleep(1); } return result; } diff --git a/libseq64/src/midibase.cpp b/libseq64/src/midibase.cpp index 492a3525..863a66c3 100644 --- a/libseq64/src/midibase.cpp +++ b/libseq64/src/midibase.cpp @@ -52,12 +52,6 @@ #include "midibase.hpp" /* seq64::midibase for ALSA */ #include "settings.hpp" /* seq64::rc() */ -#ifdef PLATFORM_WINDOWS -#include /* Sleep() */ -#else -#include /* usleep() or select() */ -#endif - /* * Do not document a namespace; it breaks Doxygen. */ @@ -823,49 +817,6 @@ midibase::show_bus_values () } } -/* - * This free-function in the seq64 namespace provides a way to suspend a - * thread for a small amount of time. - * - * \linux - * We can use the usleep(3) function. - * - * \unix - * In POSIX, select() can return early if any signal occurs. We don't - * correct for that here at this time. Actually, it is a convenient - * feature, and we wish that Sleep() would provide it. - * - * \win32 - * In Windows, the Sleep(0) function does not sleep, but it does cede - * control of the thread to the operating system, which then schedules - * another thread to run. - * - * \warning - * Please note that this function isn't all that accurate for small - * sleep values, due to the time taken to set up the operation, and - * resolution issues in many operating systems. - * - * \param ms - * The number of milliseconds to "sleep". - * - */ - -void -millisleep (unsigned long ms) -{ -#if defined PLATFORM_LINUX - (void) usleep((useconds_t) (ms * 1000)); -#elif defined PLATFORM_UNIX - struct timeval tv; - struct timeval * tvptr = &tv; - tv.tv_usec = long(ms % 1000) * 1000; - tv.tv_sec = long(ms / 1000; - (void) select(0, 0, 0, 0, tvptr); -#elif defined PLATFORM_WINDOWS // or PLATFORM_MINGW - Sleep((DWORD) ms); -#endif -} - } // namespace seq64 /* diff --git a/libseq64/src/perform.cpp b/libseq64/src/perform.cpp index 7b362cd6..cf519030 100644 --- a/libseq64/src/perform.cpp +++ b/libseq64/src/perform.cpp @@ -24,7 +24,7 @@ * \library sequencer64 application * \author Seq24 team; modifications by Chris Ahlstrom and others * \date 2015-07-24 - * \updates 2020-02-22 + * \updates 2020-05-26 * \license GNU GPLv2 or above * * This class is probably the single most important class in Sequencer64, as @@ -4381,16 +4381,8 @@ perform::output_func () delta_us = long(next_clock_delta_us); if (delta_us > 0) - { -#ifdef PLATFORM_WINDOWS - delta = delta_us / 1000; - Sleep(delta); -#else - delta.tv_sec = delta_us / 1000000; - delta.tv_nsec = (delta_us % 1000000) * 1000; - nanosleep(&delta, NULL); /* nanosleep() is Linux */ -#endif - } + (void) microsleep(delta_us); /* daemonize.hpp */ + #ifdef SEQ64_STATISTICS_SUPPORT else { @@ -5045,6 +5037,8 @@ perform::handle_midi_control_ex (int ctl, midi_control::action a, int v) * midi_control_event() iterates through all values. We need to "iterate" * between the record, quan_record, and thru values only. * + * CURRENTLY NOT USED!!! + * * \param ev * Provides the MIDI event to potentially trigger a recording-control * action. @@ -5278,32 +5272,53 @@ perform::set_thru (bool thru_active, int seq, bool toggle) * \param ev * Provides the MIDI event to potentially trigger a control action. * + * \param recording + * This parameter, if true, restricts the handled controls to start, stop, and + * record. + * * \return * Returns true if the event was actually handled, at least once. */ bool -perform::midi_control_event (const event & ev) +perform::midi_control_event (const event & ev, bool recording) { bool result = false; int offset = m_screenset_offset; - for (int ctl = 0; ctl < g_midi_control_limit; ++ctl, ++offset) + if (recording) { - /* - * \change ca 2018-10-28 GitHub issue #170. - * Breaking after success prevents a MIDI control from handling - * the same control event more than one time. For example, - * this prevents toggling multiple patterns with the same event. - * - * result = handle_midi_control_event(ev, ctl, offset); - * if (result) - * break; // differs from legacy behavior, which keeps going - */ + bool ok = handle_midi_control_event(ev, c_midi_control_start, offset); + if (! result) + result = ok; + + ok = handle_midi_control_event(ev, c_midi_control_stop, offset); + if (! result) + result = ok; - bool ok = handle_midi_control_event(ev, ctl, offset); + ok = handle_midi_control_event(ev, c_midi_control_record, offset); if (! result) result = ok; } + else + { + for (int ctl = 0; ctl < g_midi_control_limit; ++ctl, ++offset) + { + /* + * \change ca 2018-10-28 GitHub issue #170. + * Breaking after success prevents a MIDI control from handling + * the same control event more than one time. For example, + * this prevents toggling multiple patterns with the same event. + * + * result = handle_midi_control_event(ev, ctl, offset); + * if (result) + * break; // differs from legacy behavior, which keeps going + */ + + bool ok = handle_midi_control_event(ev, ctl, offset); + if (! result) + result = ok; + } + } return result; } @@ -5647,7 +5662,7 @@ perform::handle_playlist_control (int ctl, midi_control::action a, int v) * reset the position. Or, when continue is received, we won't reset the * position. We do an inner_stop(); the m_midiclockpos member holds the * stop position in case the next event is "continue". This feature is - * not in Kepler34. + * not in Kepler34 or Seq24, but is done in Seq32. * * EVENT_MIDI_CLOCK: * @@ -5692,191 +5707,150 @@ perform::handle_playlist_control (int ctl, midi_control::action a, int v) * It seems specific to certain Yamaha devices, but might prove useful * later. * - * For events less than or equal to SysEx, we call midi_control_event() - * to handle the MIDI controls that Sequencer64 supports. (These are - * configurable in the "rc" configuration file.) + * For events less than or equal to SysEx, we call midi_control_event() to handle + * the MIDI controls that Sequencer64 supports. (These are configurable in the + * "rc" configuration file.) We test for MIDI control events even if "dumping". + * Otherwise, we cannot handle any more control events once recording is turned + * on. WARNING: This can slow down recording, so we check only for recording + * status now. */ void perform::input_func () { - event ev; while (m_inputing) /* perhaps we should lock this variable */ { - if (m_master_bus->poll_for_midi() > 0) + if (! poll_cycle()) + return; + } + pthread_exit(0); +} + +/** + * A helper function for perform::input_func(). + */ + +bool +perform::poll_cycle () +{ + bool result = true; + if (m_master_bus->poll_for_midi() > 0) + { + do { - do + event ev; + if (m_master_bus->get_midi_event(&ev)) { - if (m_master_bus->get_midi_event(&ev)) + if (ev.get_status() < EVENT_MIDI_SYSEX) { - /* - * Used when starting from the beginning of the song. - * Obey the MIDI time clock. Comments moved to the - * banner. - */ - - if (ev.get_status() == EVENT_MIDI_START) - { - stop(); // Kepler34 - song_start_mode(false); // Kepler34 - start(song_start_mode()); - m_midiclockrunning = m_usemidiclock = true; - m_midiclocktick = m_midiclockpos = 0; - } - else if (ev.get_status() == EVENT_MIDI_CONTINUE) - { - m_midiclockrunning = true; - song_start_mode(false); // Kepler34 - start(song_start_mode()); - } - else if (ev.get_status() == EVENT_MIDI_STOP) - { - /* - * Do nothing; let the system pause; we're not getting - * ticks after the stop, so the song won't advance when - * start is received. We'll reset the position, or, when - * continue is received, we won't. - */ - - m_midiclockrunning = false; - all_notes_off(); - - /* - * This is not done in Seq24, but is done in Seq32. - */ - - inner_stop(true); /* eventually flushes */ - m_midiclockpos = get_tick(); - } - else if (ev.get_status() == EVENT_MIDI_CLOCK) - { - /* - * Issue #179. Higher PPQN need a longer increment than - * SEQ64_MIDI_CLOCK_INCREMENT (8) to get 24 clocks per - * quarter note. - */ - - if (m_midiclockrunning) - m_midiclocktick += m_midiclockincrement; - } - else if (ev.get_status() == EVENT_MIDI_SONG_POS) - { - midibyte d0, d1; // see note in banner - ev.get_data(d0, d1); - m_midiclockpos = combine_bytes(d0, d1); - } -#ifdef USE_ACTIVE_SENSE_AND_RESET - /* - * Currently filtered in midi_jack, but what about ALSA? - */ - - else if - ( - ev.get_status() == EVENT_MIDI_ACTIVE_SENSE || - ev.get_status() == EVENT_MIDI_RESET - ) - { - /* - * For now, we ignore these events on input. See - * GitHub sequencer64-packages/issues/4. MIGHT NOT BE - * A VALID FIX. STILL INVESTIGATING. - */ - - return; - } -#endif /* * Send out the current event, if "dumping". */ - if (ev.get_status() <= EVENT_MIDI_SYSEX) + if (m_master_bus->is_dumping()) { - /* - * Test for MIDI control events even if "dumping". - * Otherwise, we cannot handle any more control events - * once recording is turned on. WARNING: This can - * slow down recording, so we check only for recording - * status now. - */ - - if (m_master_bus->is_dumping()) + if (midi_control_event(ev, true)) /* quick check */ { - /* - * Check for all events, not just record-control, - * to prevent unwanted recordings. Issue #150? - * - * if (! midi_control_record()) - */ - - if (midi_control_event(ev)) - { #ifdef PLATFORM_DEBUG_TMI - std::string estr = to_string(ev); - printf("MIDI control event %s\n", estr.c_str()); + std::string estr = to_string(ev); + printf("MIDI control event %s\n", estr.c_str()); #endif - } - else - { - ev.set_timestamp(get_tick()); - if (rc().show_midi()) - ev.print(); - - if (m_filter_by_channel) - m_master_bus->dump_midi_input(ev); - else - m_master_bus->get_sequence()->stream_event(ev); - } } else { + ev.set_timestamp(get_tick()); +#ifdef PLATFORM_DEBUG_TMI + ev.print_note(); +#endif if (rc().show_midi()) ev.print(); - (void) midi_control_event(ev); - } - -#ifdef USE_STAZED_PARSE_SYSEX // more code to incorporate!!! - - /* - * Sequencer64 doesn't use incoming SysEx events. This - * code comes from the Seq32 project. - */ - - if (global_use_sysex) - { - if (FF_RW_button_type != FF_RW_RELEASE) - { - if (ev.is_note_off()) - { - /* - * Notes 91 G5 & 96 C6 on YPT = FF/RW keys - */ - - midibyte n = ev.get_note(); - if (n == 91 || n == 96) - FF_RW_button_type = FF_RW_RELEASE; - } - } + if (m_filter_by_channel) + m_master_bus->dump_midi_input(ev); + else + m_master_bus->get_sequence()->stream_event(ev); } -#endif } - if (ev.get_status() == EVENT_MIDI_SYSEX) + else { -#ifdef USE_STAZED_PARSE_SYSEX // more code to incorporate!!! - if (global_use_sysex) - parse_sysex(ev); -#endif if (rc().show_midi()) ev.print(); - if (rc().pass_sysex()) - m_master_bus->sysex(&ev); + (void) midi_control_event(ev); } } - } while (m_master_bus->is_more_input()); - } + else if (ev.get_status() == EVENT_MIDI_START) /* restart */ + { + stop(); /* Kepler34 */ + song_start_mode(false); /* Kepler34 */ + start(false); + m_midiclockrunning = m_usemidiclock = true; + m_midiclocktick = m_midiclockpos = 0; +#ifdef PLATFORM_DEBUG + if (rc().verbose_option()) + infoprint("MIDI Start"); +#endif + } + else if (ev.get_status() == EVENT_MIDI_CONTINUE) + { + m_midiclockrunning = true; + song_start_mode(false); /* Kepler34 */ + start(false); +#ifdef PLATFORM_DEBUG + if (rc().verbose_option()) + infoprint("MIDI Continue"); +#endif + } + else if (ev.get_status() == EVENT_MIDI_STOP) /* pause */ + { + m_midiclockrunning = false; + all_notes_off(); + inner_stop(true); /* flush */ + m_midiclockpos = get_tick(); +#ifdef PLATFORM_DEBUG + if (rc().verbose_option()) + infoprint("MIDI Stop"); +#endif + } + else if (ev.get_status() == EVENT_MIDI_CLOCK) + { + /* + * Issue #179. Higher PPQN need a longer increment than + * SEQ64_MIDI_CLOCK_INCREMENT (8) to get 24 clocks per + * quarter note. + */ + + if (m_midiclockrunning) + m_midiclocktick += m_midiclockincrement; + } + else if (ev.get_status() == EVENT_MIDI_SONG_POS) + { + midibyte d0, d1; // see note in banner + ev.get_data(d0, d1); + m_midiclockpos = combine_bytes(d0, d1); + } +#ifdef USE_ACTIVE_SENSE_AND_RESET + else if (ev.is_sense_reset()) + { + /* + * Currently filtered in midi_jack, but what about ALSA? + */ + + return false; + } +#endif + else if (ev.get_status() == EVENT_MIDI_SYSEX) + { + if (rc().show_midi()) + ev.print(); + + if (rc().pass_sysex()) + m_master_bus->sysex(&ev); + } + } + } while (m_master_bus->is_more_input()); } - pthread_exit(0); + return result; } /** @@ -5893,7 +5867,7 @@ perform::input_func () * value (actually 16-bit since most computer CPUs deal with 16-bit, not * 14-bit, integers). * - * I think Kepler64 got the bytes backward. + * I think Kepler34 got the bytes backward. * * \param b0 * The first byte to be combined. diff --git a/libseq64/src/rect.cpp b/libseq64/src/rect.cpp index 9477a825..cae790ba 100644 --- a/libseq64/src/rect.cpp +++ b/libseq64/src/rect.cpp @@ -235,58 +235,6 @@ rect::xy_to_rect_get } } -#if 0 - -/** - * Converts a tick/note box to an x/y rectangle. - * - * We should refactor this function to use the utility class seqroll::rect as - * the destination for the conversion. We need to implement convert_tn(), - * and that rquires "constants" from the globals module and a zoom member: - * - * c_num_keys = 128 - * c_key_x = 16 - * c_key_height = 12 - * c_keyarea_x = 36 - * c_keyoffset_x = c_keyarea_x - c_key_x - * m_zoom - * - * At some point, we might derive classes from rect to better manage the - * user-interface pixmaps. - * - * \param tick_s - * The starting tick of the rectangle. - * - * \param tick_f - * The finishing tick of the rectangle. - * - * \param note_h - * The high note of the rectangle. - * - * \param note_l - * The low note of the rectangle. - * - * \param [out] destination - * The destination rectangle. - */ - -void -rect::convert_tn_box_to_rect -( - midipulse tick_s, midipulse tick_f, int note_h, int note_l -) -{ - int x1, y1, x2, y2; - convert_tn(tick_s, note_h, x1, y1); /* convert box to X,Y values */ - convert_tn(tick_f, note_l, x2, y2); - int x, y, w, h; - rect::xy_to_rect_get(x1, y1, x2, y2, x, y, w, h); - set(x, y, w, h); - xy_to_rect(x1, y1, x2, y2); -} - -#endif // 0 - } // namespace seq64 /* diff --git a/libseq64/src/sequence.cpp b/libseq64/src/sequence.cpp index e21c532f..85bf32cb 100644 --- a/libseq64/src/sequence.cpp +++ b/libseq64/src/sequence.cpp @@ -25,7 +25,7 @@ * \library sequencer64 application * \author Seq24 team; modifications by Chris Ahlstrom * \date 2015-07-24 - * \updates 2020-03-13 + * \updates 2020-05-25 * \license GNU GPLv2 or above * * The functionality of this class also includes handling some of the @@ -1256,7 +1256,16 @@ void sequence::verify_and_link () { automutex locker(m_mutex); + +#ifdef PLATFORM_DEBUG_TMI + m_events.print_notes("before"); +#endif + m_events.verify_and_link(m_length); + +#ifdef PLATFORM_DEBUG_TMI + m_events.print_notes("after"); +#endif } /** @@ -3272,9 +3281,16 @@ bool sequence::add_event (const event & er) { automutex locker(m_mutex); + + /* + * Here, Seq32 marks painted events and removes them. Should we adopt + * this code? + */ + bool result = m_events.add(er); /* post/auto-sorts by time & rank */ if (result) { + verify_and_link(); /* ca 2020-05-25 */ reset_draw_marker(); set_dirty(); } @@ -3510,7 +3526,7 @@ sequence::stream_event (event & ev) if (m_thru) put_event_on_bus(ev); /* more locking */ - link_new(); /* more locking */ + m_events.link_new(); /* already locked */ if (m_quantized_rec && m_parent->is_pattern_playing()) { if (ev.is_note_off()) diff --git a/m4/pkg.m4 b/m4/pkg.m4 index 9a71878c..13a88901 100644 --- a/m4/pkg.m4 +++ b/m4/pkg.m4 @@ -1,29 +1,60 @@ -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) -# -# Copyright © 2004 Scott James Remnant . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.2]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) @@ -45,18 +76,19 @@ if test -n "$PKG_CONFIG"; then PKG_CONFIG="" fi fi[]dnl -])# PKG_PROG_PKG_CONFIG - -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ @@ -66,8 +98,10 @@ m4_ifvaln([$3], [else $3])dnl fi]) -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" @@ -79,10 +113,11 @@ m4_define([_PKG_CONFIG], else pkg_failed=untried fi[]dnl -])# _PKG_CONFIG +])dnl _PKG_CONFIG -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -90,26 +125,24 @@ if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then else _pkg_short_errors_supported=no fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED - - -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $1]) +AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) @@ -119,11 +152,11 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs @@ -140,7 +173,7 @@ installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full @@ -156,4 +189,87 @@ else AC_MSG_RESULT([yes]) $3 fi[]dnl -])# PKG_CHECK_MODULES +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR diff --git a/seq_alsamidi/src/mastermidibus.cpp b/seq_alsamidi/src/mastermidibus.cpp index f6c005cd..07684fe7 100644 --- a/seq_alsamidi/src/mastermidibus.cpp +++ b/seq_alsamidi/src/mastermidibus.cpp @@ -508,7 +508,7 @@ mastermidibus::api_poll_for_midi () { int result = poll(m_poll_descriptors, m_num_poll_descriptors, 1000); if (result == 0) - millisleep(1); + (void) microsleep(100); // millisleep(1); return result; } diff --git a/seq_gtkmm2/src/perfedit.cpp b/seq_gtkmm2/src/perfedit.cpp index 90b92190..61944960 100644 --- a/seq_gtkmm2/src/perfedit.cpp +++ b/seq_gtkmm2/src/perfedit.cpp @@ -278,7 +278,7 @@ perfedit::perfedit (perform & p, bool second_perfedit) m_entry_snap->set_size_request(40, -1); m_entry_snap->set_editable(false); - char num[12]; + char num[16]; for (int i = -SEQ64_OCTAVE_SIZE; i <= SEQ64_OCTAVE_SIZE; ++i) { if (i != 0) @@ -315,7 +315,7 @@ perfedit::perfedit (perform & p, bool second_perfedit) #define SET_BPB mem_fun(*this, &perfedit::set_beats_per_bar) - char b[4]; + char b[16]; for (int i = 0; i < SEQ64_MAXIMUM_BEATS_PER_MEASURE; ++i) { snprintf(b, sizeof b, "%d", i + 1); @@ -701,7 +701,7 @@ perfedit::set_beats_per_bar (int bpm) bpm <= SEQ64_MAXIMUM_BEATS_PER_MEASURE ) { - char b[8]; + char b[16]; snprintf(b, sizeof b, "%d", bpm); m_entry_bpm->set_text(b); if (m_bpm != 0) /* are we in construction? */ @@ -729,7 +729,7 @@ perfedit::set_beat_width (int bw) { if (bw != m_bw && bw > 0) { - char b[8]; + char b[16]; snprintf(b, sizeof b, "%d", bw); m_entry_bw->set_text(b); if (m_bw != 0) /* are we in construction? */ @@ -925,7 +925,7 @@ perfedit::transpose_button_callback (int transpose) void perfedit::set_transpose (int transpose) { - char b[12]; + char b[16]; snprintf(b, sizeof b, "%+d", transpose); m_entry_xpose->set_text(b); perf().all_notes_off(); diff --git a/seq_portmidi/src/pmlinuxalsa.c b/seq_portmidi/src/pmlinuxalsa.c index 06857e6c..8555ff95 100644 --- a/seq_portmidi/src/pmlinuxalsa.c +++ b/seq_portmidi/src/pmlinuxalsa.c @@ -174,43 +174,6 @@ alsa_use_queue (void) return pmNoError; } -#if 0 -/* - * EXPERIMENTAL. - * - * The s_queue must already exist. - */ - -static void -alsa_set_beats_per_minute (int tempo_us) -{ - if (s_queue >= 0 && not_nullptr(s_seq)) - { - snd_seq_queue_tempo_t * tempo; - snd_seq_queue_tempo_alloca(&tempo); - snd_seq_queue_tempo_set_tempo(tempo, tempo_us); - (void) snd_seq_set_queue_tempo(s_seq, s_queue, tempo); - - /* - * Do we have a snd_seq_restart_queue() to call? - */ - } -} - -static void -alsa_set_ppqn (int ppqn) -{ - snd_seq_queue_tempo_t * tempo; - snd_seq_queue_tempo_alloca(&tempo); - snd_seq_queue_tempo_set_ppq(tempo, ppqn); - - /* - * Do we have a snd_seq_restart_queue() to call? - */ -} - -#endif - /** * */ @@ -652,12 +615,6 @@ static PmError alsa_write_flush (PmInternal * midi, PmTimestamp UNUSED(timestamp)) { alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor; - -#if 0 - if (VERBOSE_ON) - printf("snd_seq_drain_output: 0x%x\n", (unsigned) s_seq); -#endif - desc->error = snd_seq_drain_output(s_seq); if (desc->error < 0) return pmHostError; diff --git a/seq_qt5/src/qlfoframe.cpp b/seq_qt5/src/qlfoframe.cpp index c42ff57c..0a51821f 100644 --- a/seq_qt5/src/qlfoframe.cpp +++ b/seq_qt5/src/qlfoframe.cpp @@ -343,30 +343,6 @@ qlfoframe::scale_lfo_change (int /*v*/) ui->m_phase_text->setText(tmp); } -#if 0 - -/** - * Undoes the LFO changes if there is undo available. - * - * TODO: implement undo via selection of "None" for the wave type. - * - * \return - * Always returns true. - */ - -bool -qlfoframe::on_focus_out_event (GdkEventFocus * /* p0 */) -{ - if (m_seq.get_hold_undo()) - { - m_seq.push_undo(true); - m_seq.set_hold_undo(false); - } - return true; -} - -#endif // 0 - /** * */ diff --git a/seq_qt5/src/qseqroll.cpp b/seq_qt5/src/qseqroll.cpp index 5b5a9e06..29ff5fc9 100644 --- a/seq_qt5/src/qseqroll.cpp +++ b/seq_qt5/src/qseqroll.cpp @@ -363,28 +363,6 @@ qseqroll::paintEvent (QPaintEvent *) painter.drawLine(prog_x, 0, prog_x, wh * 8); // why * 8? old_progress_x(seq().get_last_tick() / zoom() + c_keyboard_padding_x); - /* - * It would be easier to use ticks here, rather than x values. - */ - -#if 0 - - static bool s_loop_in_progress = false; /* indicates when to reset */ - if (old_progress_x() > c_keyboard_padding_x) - { - s_loop_in_progress = true; - } - else - { - if (s_loop_in_progress) - { - seq().loop_reset(true); /* for overwrite recording */ - s_loop_in_progress = false; - } - } - -#endif - /* * End of draw_progress_on_window() */ diff --git a/seq_rtmidi/include/rtmidi_types.hpp b/seq_rtmidi/include/rtmidi_types.hpp index e50e354d..d87f3baa 100644 --- a/seq_rtmidi/include/rtmidi_types.hpp +++ b/seq_rtmidi/include/rtmidi_types.hpp @@ -9,7 +9,7 @@ * \library sequencer64 application * \author Gary P. Scavone; severe refactoring by Chris Ahlstrom * \date 2016-11-20 - * \updates 2017-12-31 + * \updates 2020-05-24 * \license See the rtexmidi.lic file. Too big for a header file. * * The lack of hiding of these types within a class is a little to be @@ -178,6 +178,11 @@ class midi_message return reinterpret_cast(&m_bytes[0]); } + const midibyte * data () const + { + return m_bytes.data(); + } + int count () const { return int(m_bytes.size()); diff --git a/seq_rtmidi/src/midi_alsa_info.cpp b/seq_rtmidi/src/midi_alsa_info.cpp index 4363bcfc..20569861 100644 --- a/seq_rtmidi/src/midi_alsa_info.cpp +++ b/seq_rtmidi/src/midi_alsa_info.cpp @@ -6,7 +6,7 @@ * \library sequencer64 application * \author Chris Ahlstrom * \date 2016-11-14 - * \updates 2019-01-21 + * \updates 2020-05-24 * \license See the rtexmidi.lic file. Too big. * * API information found at: @@ -353,7 +353,7 @@ midi_alsa_info::api_poll_for_midi () { int result = poll(m_poll_descriptors, m_num_poll_descriptors, 1000); if (result == 0) - millisleep(1); + (void) microsleep(100); // millisleep(1); return result; } @@ -509,6 +509,10 @@ midi_alsa_info::api_port_start (mastermidibus & masterbus, int bus, int port) bool midi_alsa_info::api_get_midi_event (event * inev) { + /* + * Currently no build-in mutex lock. + */ + snd_seq_event_t * ev; bool sysex = false; bool result = false; @@ -580,47 +584,11 @@ midi_alsa_info::api_get_midi_event (event * inev) return false; } - inev->set_timestamp(ev->time.tick); - inev->set_status_keep_channel(buffer[0]); - - /** - * We will only get EVENT_SYSEX on the first packet of MIDI data; - * the rest we have to poll for. SysEx processing is currently - * disabled. + /* + * Note that ev->time.tick is always 0! (Same in Seq32). */ -#ifdef SEQ64_USE_SYSEX_PROCESSING - inev->set_sysex_size(bytes); /* why here? why not in "if"? */ - if (buffer[0] == EVENT_MIDI_SYSEX) - { - inev->restart_sysex(); /* set up for sysex if needed */ - sysex = inev->append_sysex(buffer, bytes); - } - else - { -#endif - /* - * Some keyboards send Note On with velocity 0 for Note Off, so we - * take care of that situation here by creating a Note Off event, - * with the channel nybble preserved. Note that we call - * event::set_status_keep_channel() instead of using stazed's - * set_status function with the "record" parameter. We do need to - * mask in the actual channel number! - */ - - inev->set_data(buffer[1], buffer[2]); - if (inev->is_note_off_recorded()) - { - midibyte channel = buffer[0] & EVENT_GET_CHAN_MASK; - midibyte status = EVENT_NOTE_OFF | channel; - inev->set_status_keep_channel(status); - } - sysex = false; - -#ifdef SEQ64_USE_SYSEX_PROCESSING - } -#endif - + result = inev->set_midi_event(ev->time.tick, buffer, bytes); while (sysex) /* sysex messages might be more than one message */ { snd_seq_event_input(m_alsa_seq, &ev); diff --git a/seq_rtmidi/src/midi_api.cpp b/seq_rtmidi/src/midi_api.cpp index 04e8880d..6b0e4423 100644 --- a/seq_rtmidi/src/midi_api.cpp +++ b/seq_rtmidi/src/midi_api.cpp @@ -245,7 +245,7 @@ midi_api::cancel_callback () int midi_api::api_poll_for_midi () { - millisleep(1); + (void) millisleep(1); return 0; } diff --git a/seq_rtmidi/src/midi_jack.cpp b/seq_rtmidi/src/midi_jack.cpp index a25d9c10..3d65eb50 100644 --- a/seq_rtmidi/src/midi_jack.cpp +++ b/seq_rtmidi/src/midi_jack.cpp @@ -6,7 +6,7 @@ * \library sequencer64 application * \author Gary P. Scavone; severe refactoring by Chris Ahlstrom * \date 2016-11-14 - * \updates 2019-04-27 + * \updates 2020-05-24 * \license See the rtexmidi.lic file. Too big for a header file. * * Written primarily by Alexander Svetalkin, with updates for delta time by @@ -1382,12 +1382,12 @@ midi_in_jack::api_poll_for_midi () rtmidi_in_data * rtindata = m_jack_data.m_jack_rtmidiin; if (rtindata->using_callback()) { - millisleep(1); + (void) microsleep(100); // millisleep(1); return 0; } else { - millisleep(1); + (void) microsleep(100); // millisleep(1); return rtindata->queue().count(); } } @@ -1423,51 +1423,9 @@ midi_in_jack::api_get_midi_event (event * inev) if (result) { midi_message mm = rtindata->queue().pop_front(); - inev->set_timestamp(mm.timestamp()); - if (mm.count() == 3) - { - inev->set_status_keep_channel(mm[0]); - inev->set_data(mm[1], mm[2]); - if (inev->is_note_off_recorded()) - { - midibyte channel = mm[0] & EVENT_GET_CHAN_MASK; - midibyte status = EVENT_NOTE_OFF | channel; - inev->set_status_keep_channel(status); - } - } - else if (mm.count() == 2) - { - inev->set_status_keep_channel(mm[0]); - inev->set_data(mm[1]); - } - else + result = inev->set_midi_event(mm.timestamp(), mm.data(), mm.count()); + if (result) { - /* - * TMI: infoprint("No-data system information encountered?"); - * - * The Yamaha PSS-790 is constantly emitting Active Sense events. - */ - -#ifdef SEQ64_USE_SYSEX_PROCESSING - - /** - * We will only get EVENT_SYSEX on the first packet of MIDI data; - * the rest we have to poll for. SysEx processing is currently - * disabled. The code that follows has a big bug! - */ - - midibyte buffer[0x1000]; /* temporary buffer for Sysex */ - inev->set_sysex_size(mm.count()); - if (buffer[0] == EVENT_MIDI_SYSEX) - { - inev->restart_sysex(); /* set up for sysex if needed */ - if (! inev->append_sysex(buffer, mm.count())) - { - errprint("event::append_sysex() failed"); - } - } -#endif - /* * For now, ignore certain messages; they're not handled by the * perform object. Could be handled there, but saves some @@ -1503,14 +1461,10 @@ midi_in_jack::api_get_midi_event (event * inev) } fflush(stdout); } - if (st == EVENT_MIDI_ACTIVE_SENSE || st == EVENT_MIDI_RESET) - { + if (event::is_sense_or_reset(st)) result = false; /* sequencer64-packages #4 */ - } else - { inev->set_status(st); - } } } return result; diff --git a/seq_rtmidi/src/midi_jack_info.cpp b/seq_rtmidi/src/midi_jack_info.cpp index 793a0a35..8580004a 100644 --- a/seq_rtmidi/src/midi_jack_info.cpp +++ b/seq_rtmidi/src/midi_jack_info.cpp @@ -534,7 +534,7 @@ midi_jack_info::api_port_start int midi_jack_info::api_poll_for_midi () { - millisleep(1); + (void) millisleep(1); return 0; } diff --git a/seq_rtmidi/src/midi_win.cpp b/seq_rtmidi/src/midi_win.cpp index 9e662e5e..f52398b7 100644 --- a/seq_rtmidi/src/midi_win.cpp +++ b/seq_rtmidi/src/midi_win.cpp @@ -6,7 +6,7 @@ * \library sequencer64 application * \author Gary P. Scavone; severe refactoring by Chris Ahlstrom * \date 2017-08-20 - * \updates 2019-01-05 + * \updates 2020-05-24 * \license See the rtexmidi.lic file. Too big for a header file. * * \deprecated @@ -934,12 +934,12 @@ midi_in_win::api_poll_for_midi () rtmidi_in_data * rtindata = m_jack_data.m_jack_rtmidiin; if (rtindata->using_callback()) { - millisleep(1); + (void) microsleep(100); // millisleep(1); return 0; } else { - millisleep(1); + (void) microsleep(100); // millisleep(1); return rtindata->queue().count(); } } @@ -964,54 +964,7 @@ midi_in_win::api_get_midi_event (event * inev) if (result) { midi_message mm = rtindata->queue().pop_front(); - inev->set_timestamp(mm.timestamp()); - if (mm.count() == 3) - { - inev->set_status_keep_channel(mm[0]); - inev->set_data(mm[1], mm[2]); - - /* - * Some keyboards send Note On with velocity 0 for Note Off, so - * we take care of that situation here by creating a Note Off - * event, with the channel nybble preserved. Note that we call - * event::set_status_keep_channel() instead of using stazed's - * set_status function with the "record" parameter. Also, we - * have to mask in the actual channel number. - */ - - if (inev->is_note_off_recorded()) - { - midibyte channel = mm[0] & EVENT_GET_CHAN_MASK; - midibyte status = EVENT_NOTE_OFF | channel; - inev->set_status_keep_channel(status); - } - } - else if (mm.count() == 2) - { - inev->set_status_keep_channel(mm[0]); - inev->set_data(mm[1]); - } - else - { - infoprint("SysEx information encountered?"); - -#ifdef SEQ64_USE_SYSEX_PROCESSING - - /** - * We will only get EVENT_SYSEX on the first packet of MIDI data; - * the rest we have to poll for. SysEx processing is currently - * disabled. The code that follows has a big bug! - */ - - midibyte buffer[0x1000]; /* temporary buffer for Sysex */ - inev->set_sysex_size(bytes); - if (buffer[0] == EVENT_MIDI_SYSEX) - { - inev->restart_sysex(); /* set up for sysex if needed */ - sysex = inev->append_sysex(buffer, bytes); - } -#endif - } + result = inev->set_midi_event(ev->time.tick, buffer, bytes); } return result; } diff --git a/seq_rtmidi/src/midi_win_info.cpp b/seq_rtmidi/src/midi_win_info.cpp index 80cc53f6..feb21ce1 100644 --- a/seq_rtmidi/src/midi_win_info.cpp +++ b/seq_rtmidi/src/midi_win_info.cpp @@ -270,32 +270,6 @@ midi_win_info::~midi_win_info () void midi_win_info::connect () { -#if 0 - if (is_nullptr(result)) - { - const char * clientname = rc().app_client_name().c_str(); - result = create_win_client(clientname); - if (not_nullptr(result)) - { - int rc = set_process_callback(...); - m_win_client = result; - if (rc == 0) - { - } - else - { - m_error_string = "can't set I/O callback"; - error(rterror::WARNING, m_error_string); - } - } - else - { - m_error_string = "Windows MM server not running?"; - error(rterror::WARNING, m_error_string); - } - } - return result; -#endif } /** @@ -305,14 +279,6 @@ midi_win_info::connect () void midi_win_info::disconnect () { -#if 0 - if (not_nullptr(m_jack_client)) - { - // jack_deactivate(m_jack_client); - // jack_client_close(m_jack_client); - // m_win_client = nullptr; - } -#endif } /** @@ -441,36 +407,7 @@ midi_win_info::api_flush () bool midi_win_info::api_connect () { -#if 0 - bool result = not_nullptr(client_handle()); - if (result) - { - for - ( - std::vector::iterator it = bus_container().begin(); - it != bus_container().end(); ++it - ) - { - midibus * m = *it; - if (! m->is_virtual_port()) - { - result = m->api_connect(); - if (! result) - { - break; - } - } - } - } - if (! result) - { - m_error_string = "JACK can't activate and connect I/O"; - error(rterror::WARNING, m_error_string); - } - return result; -#else return true; -#endif } /** @@ -526,7 +463,7 @@ midi_win_info::api_port_start (mastermidibus & masterbus, int bus, int port) int midi_win_info::api_poll_for_midi () { - millisleep(1); + (void) microsleep(100); // millisleep(1); return 0; }