# HG changeset patch # User Chris Cannam # Date 1458314155 0 # Node ID c8e5fcddf8bef22fa1b0c4969955b7ecaf5ff866 # Parent 5eadb3b687bbc3f869a2afd07e79a41eb0585610# Parent 4307b34f86c09e751980f5c2961b982737edfe83 Merge diff -r 5eadb3b687bb -r c8e5fcddf8be .hgsubstate --- a/.hgsubstate Fri Mar 18 15:15:37 2016 +0000 +++ b/.hgsubstate Fri Mar 18 15:15:55 2016 +0000 @@ -1,4 +1,4 @@ d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay -55ece8862b6d3a54aad271a53f9c1615e5d3bcf8 sv-dependency-builds -c8e291700c0eaa10c064dbf732ba0e72efa1f8a7 svcore -632d90c185ecc8655f7a85ba58dc568351449dfd vamp-plugin-sdk +1e4f338ae482429a7ab9bdd0825242042354152f sv-dependency-builds +0ad516dc5d8d1eac370c7f43eeb7775919e0f2e9 svcore +55de53d7c777008997721bb43051a67c3b3772d2 vamp-plugin-sdk diff -r 5eadb3b687bb -r c8e5fcddf8be .hgtags --- a/.hgtags Fri Mar 18 15:15:37 2016 +0000 +++ b/.hgtags Fri Mar 18 15:15:55 2016 +0000 @@ -14,3 +14,4 @@ 5fe1f2efd40779acbdccc4c91a53693bd61f6d9b sonic-annotator-1.0 766268a32378f8e9e4fdfd3c78c3d43d482976ca sonic-annotator-1.1 f35bbb3e4d41caf3ca1be5576ed8ef6ef7c23e34 sonic-annotator-1.2 +710f4885f901c7b6617cfa4f1d9b3ff6a431affb sonic-annotator-1.3 diff -r 5eadb3b687bb -r c8e5fcddf8be CHANGELOG --- a/CHANGELOG Fri Mar 18 15:15:37 2016 +0000 +++ b/CHANGELOG Fri Mar 18 15:15:55 2016 +0000 @@ -1,3 +1,25 @@ + +Changes in Sonic Annotator 1.4 since the previous release 1.3: + +Front-end changes: + + - Better error reporting, especially for invalid transform files + and transform-not-found + + - Avoid crashing out when a single plugin (that is not being used) + can't be loaded because of e.g. an undefined symbol + +Bug fixes: + + - Fix (with test) horrible crash with --multiplex option + + - Fix erroneous quantization to 16 bits for coded file types of + greater bit depth + + - Fix multiple outputs when requesting both summary and non-summary + for the same output + + Changes in Sonic Annotator 1.3 since the previous release 1.2: Back-end (feature writer) changes: diff -r 5eadb3b687bb -r c8e5fcddf8be acinclude.m4 --- a/acinclude.m4 Fri Mar 18 15:15:37 2016 +0000 +++ b/acinclude.m4 Fri Mar 18 15:15:55 2016 +0000 @@ -69,6 +69,9 @@ AC_CHECK_PROG(QMAKE, qmake-qt5, $QTDIR/bin/qmake-qt5,,$QTDIR/bin/) fi if test x$QMAKE = x ; then + AC_CHECK_PROG(QMAKE, qt5-qmake, $QTDIR/bin/qt5-qmake,,$QTDIR/bin/) +fi +if test x$QMAKE = x ; then AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/) fi if test x$QMAKE = x ; then @@ -78,6 +81,9 @@ AC_CHECK_PROG(QMAKE, qmake-qt5, qmake-qt5,,$PATH) fi if test x$QMAKE = x ; then + AC_CHECK_PROG(QMAKE, qt5-qmake, qt5-qmake,,$PATH) +fi +if test x$QMAKE = x ; then AC_CHECK_PROG(QMAKE, qmake, qmake,,$PATH) fi if test x$QMAKE = x ; then @@ -112,3 +118,146 @@ ]) +# From autoconf archive: + +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++11 +# standard; if necessary, add switches to CXXFLAGS to enable support. +# +# The first argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The second argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline C++11 support is required and that the macro +# should error out if no mode with that support is found. If specified +# 'optional', then configuration proceeds regardless, after defining +# HAVE_CXX11 if and only if a supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014 Alexey Sokolov +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[ + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + struct Base { + virtual void f() {} + }; + struct Child : public Base { + virtual void f() override {} + }; + + typedef check> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c); + + auto d = a; + auto l = [](){}; +]]) + +AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl + m4_if([$1], [], [], + [$1], [ext], [], + [$1], [noext], [], + [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl + m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], + [$2], [mandatory], [ax_cxx_compile_cxx11_required=true], + [$2], [optional], [ax_cxx_compile_cxx11_required=false], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])]) + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++11 features by default, + ax_cv_cxx_compile_cxx11, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], + [ax_cv_cxx_compile_cxx11=yes], + [ax_cv_cxx_compile_cxx11=no])]) + if test x$ax_cv_cxx_compile_cxx11 = xyes; then + ac_success=yes + fi + + m4_if([$1], [noext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=gnu++11 -std=gnu++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, + $cachevar, + [ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXXFLAGS="$ac_save_CXXFLAGS"]) + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi]) + + m4_if([$1], [ext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=c++11 -std=c++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, + $cachevar, + [ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXXFLAGS="$ac_save_CXXFLAGS"]) + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx11_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) + fi + else + if test x$ac_success = xno; then + HAVE_CXX11=0 + AC_MSG_NOTICE([No compiler with C++11 support was found]) + else + HAVE_CXX11=1 + AC_DEFINE(HAVE_CXX11,1, + [define if the compiler supports basic C++11 syntax]) + fi + + AC_SUBST(HAVE_CXX11) + fi +]) + diff -r 5eadb3b687bb -r c8e5fcddf8be configure --- a/configure Fri Mar 18 15:15:37 2016 +0000 +++ b/configure Fri Mar 18 15:15:55 2016 +0000 @@ -1,8 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for Sonic Annotator 1.2. -# -# Report bugs to . +# Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -266,8 +264,7 @@ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: cannam@all-day-breakfast.com about your system, + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." @@ -578,13 +575,14 @@ MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='Sonic Annotator' -PACKAGE_TARNAME='sonic-annotator' -PACKAGE_VERSION='1.2' -PACKAGE_STRING='Sonic Annotator 1.2' -PACKAGE_BUGREPORT='cannam@all-day-breakfast.com' -PACKAGE_URL='' - +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= + +ac_unique_file="Sonic Annotator" ac_unique_file="runner/main.cpp" # Factoring default headers for most tests. ac_includes_default="\ @@ -667,6 +665,7 @@ EGREP GREP CXXCPP +HAVE_CXX11 MKDIR_P INSTALL_DATA INSTALL_SCRIPT @@ -805,7 +804,7 @@ localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' @@ -1305,7 +1304,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Sonic Annotator 1.2 to adapt to many kinds of systems. +\`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1353,7 +1352,7 @@ --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/sonic-annotator] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1365,9 +1364,7 @@ fi if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of Sonic Annotator 1.2:";; - esac + cat <<\_ACEOF Optional Features: @@ -1432,7 +1429,7 @@ Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to . +Report bugs to the package provider. _ACEOF ac_status=$? fi @@ -1495,7 +1492,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Sonic Annotator configure 1.2 +configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1734,10 +1731,6 @@ $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ------------------------------------------- ## -## Report this to cannam@all-day-breakfast.com ## -## ------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 @@ -1835,7 +1828,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Sonic Annotator $as_me 1.2, which was +It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3419,6 +3412,146 @@ $as_echo "$MKDIR_P" >&6; } +# We are daringly making use of C++11 now + + ax_cxx_compile_cxx11_required=true + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + ac_success=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5 +$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; } +if ${ax_cv_cxx_compile_cxx11+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + struct Base { + virtual void f() {} + }; + struct Child : public Base { + virtual void f() override {} + }; + + typedef check> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c); + + auto d = a; + auto l = [](){}; + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ax_cv_cxx_compile_cxx11=yes +else + ax_cv_cxx_compile_cxx11=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5 +$as_echo "$ax_cv_cxx_compile_cxx11" >&6; } + if test x$ax_cv_cxx_compile_cxx11 = xyes; then + ac_success=yes + fi + + + + if test x$ac_success = xno; then + for switch in -std=c++11 -std=c++0x; do + cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 +$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } +if eval \${$cachevar+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + struct Base { + virtual void f() {} + }; + struct Child : public Base { + virtual void f() override {} + }; + + typedef check> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c); + + auto d = a; + auto l = [](){}; + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval $cachevar=yes +else + eval $cachevar=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXXFLAGS="$ac_save_CXXFLAGS" +fi +eval ac_res=\$$cachevar + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + if test x$ax_cxx_compile_cxx11_required = xtrue; then + if test x$ac_success = xno; then + as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 + fi + else + if test x$ac_success = xno; then + HAVE_CXX11=0 + { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 +$as_echo "$as_me: No compiler with C++11 support was found" >&6;} + else + HAVE_CXX11=1 + +$as_echo "#define HAVE_CXX11 1" >>confdefs.h + + fi + + + fi + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' @@ -3966,6 +4099,45 @@ fi if test x$QMAKE = x ; then + # Extract the first word of "qt5-qmake", so it can be a program name with args. +set dummy qt5-qmake; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_QMAKE+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$QMAKE"; then + ac_cv_prog_QMAKE="$QMAKE" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $QTDIR/bin/ +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_QMAKE="$QTDIR/bin/qt5-qmake" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +QMAKE=$ac_cv_prog_QMAKE +if test -n "$QMAKE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $QMAKE" >&5 +$as_echo "$QMAKE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test x$QMAKE = x ; then # Extract the first word of "qmake", so it can be a program name with args. set dummy qmake; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -4083,6 +4255,45 @@ fi if test x$QMAKE = x ; then + # Extract the first word of "qt5-qmake", so it can be a program name with args. +set dummy qt5-qmake; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_QMAKE+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$QMAKE"; then + ac_cv_prog_QMAKE="$QMAKE" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_QMAKE="qt5-qmake" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +QMAKE=$ac_cv_prog_QMAKE +if test -n "$QMAKE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $QMAKE" >&5 +$as_echo "$QMAKE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test x$QMAKE = x ; then # Extract the first word of "qmake", so it can be a program name with args. set dummy qmake; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -6231,7 +6442,7 @@ subdirs="$subdirs svcore" -ac_config_files="$ac_config_files config.pri version.h" +ac_config_files="$ac_config_files config.pri" cat >confcache <<\_ACEOF @@ -6776,7 +6987,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Sonic Annotator $as_me 1.2, which was +This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6823,13 +7034,13 @@ Configuration files: $config_files -Report bugs to ." +Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Sonic Annotator config.status 1.2 +config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -6942,7 +7153,6 @@ do case $ac_config_target in "config.pri") CONFIG_FILES="$CONFIG_FILES config.pri" ;; - "version.h") CONFIG_FILES="$CONFIG_FILES version.h" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff -r 5eadb3b687bb -r c8e5fcddf8be configure.ac --- a/configure.ac Fri Mar 18 15:15:37 2016 +0000 +++ b/configure.ac Fri Mar 18 15:15:55 2016 +0000 @@ -1,5 +1,5 @@ -AC_INIT([Sonic Annotator], [1.2], cannam@all-day-breakfast.com) +AC_INIT([Sonic Annotator], [], cannam@all-day-breakfast.com) AC_CONFIG_SRCDIR(runner/main.cpp) @@ -25,6 +25,9 @@ AC_PROG_INSTALL AC_PROG_MKDIR_P +# We are daringly making use of C++11 now +AX_CXX_COMPILE_STDCXX_11(noext) + AC_HEADER_STDC # These are the flags Autoconf guesses for us; we use them later if @@ -108,7 +111,7 @@ AC_SUBST(QMAKE_CONFIG) AC_CONFIG_SUBDIRS([svcore]) -AC_CONFIG_FILES([config.pri version.h]) +AC_CONFIG_FILES([config.pri]) AC_OUTPUT diff -r 5eadb3b687bb -r c8e5fcddf8be runner.pro --- a/runner.pro Fri Mar 18 15:15:37 2016 +0000 +++ b/runner.pro Fri Mar 18 15:15:55 2016 +0000 @@ -1,5 +1,7 @@ TEMPLATE = app +INCLUDEPATH += vamp-plugin-sdk + win32-g++ { INCLUDEPATH += sv-dependency-builds/win32-mingw/include LIBS += -Lsv-dependency-builds/win32-mingw/lib @@ -22,7 +24,7 @@ CONFIG += release DEFINES += NDEBUG BUILD_RELEASE NO_TIMING - DEFINES += HAVE_BZ2 HAVE_FFTW3 HAVE_FFTW3F HAVE_SNDFILE HAVE_SAMPLERATE HAVE_VAMP HAVE_VAMPHOSTSDK HAVE_DATAQUAY HAVE_MAD HAVE_ID3TAG + DEFINES += HAVE_BZ2 HAVE_FFTW3 HAVE_FFTW3F HAVE_SNDFILE HAVE_SAMPLERATE HAVE_DATAQUAY HAVE_MAD HAVE_ID3TAG LIBS += -lbz2 -lfftw3 -lfftw3f -lsndfile -lFLAC -logg -lvorbis -lvorbisenc -lvorbisfile -logg -lmad -lid3tag -lsamplerate -lz -lsord-0 -lserd-0 @@ -49,11 +51,7 @@ # look for win32 features win32-x-g++:QMAKE_LFLAGS += -Wl,-subsystem,console -# If you have compiled your Vamp plugin SDK with FFTW (using its -# HAVE_FFTW3 flag), you can define the same flag here to ensure the -# program saves and restores FFTW wisdom in its configuration properly -# -DEFINES += HAVE_FFTW3 +DEFINES += HAVE_FFTW3 HAVE_VAMP HAVE_VAMPHOSTSDK TARGET = sonic-annotator @@ -81,7 +79,7 @@ LIBS = $$MY_LIBS $$LIBS -#PRE_TARGETDEPS += svcore/libsvcore.a +PRE_TARGETDEPS += svcore/libsvcore.a HEADERS += \ vamp-plugin-sdk/vamp-hostsdk/PluginBase.h \ @@ -113,6 +111,7 @@ vamp-plugin-sdk/src/vamp-hostsdk/PluginSummarisingAdapter.cpp \ vamp-plugin-sdk/src/vamp-hostsdk/PluginWrapper.cpp \ vamp-plugin-sdk/src/vamp-hostsdk/RealTime.cpp \ + vamp-plugin-sdk/src/vamp-hostsdk/Files.cpp \ runner/main.cpp \ runner/DefaultFeatureWriter.cpp \ runner/FeatureExtractionManager.cpp \ diff -r 5eadb3b687bb -r c8e5fcddf8be runner/FeatureExtractionManager.cpp --- a/runner/FeatureExtractionManager.cpp Fri Mar 18 15:15:37 2016 +0000 +++ b/runner/FeatureExtractionManager.cpp Fri Mar 18 15:15:55 2016 +0000 @@ -323,6 +323,8 @@ << " (adapter step and block size " << m_blockSize << ")" << endl; +// cerr << "NOTE: That transform is: " << transform.toXmlString() << endl; + if (pida) { cerr << "NOTE: PluginInputDomainAdapter timestamp adjustment is " @@ -382,8 +384,11 @@ m_transformPluginMap[transform] = plugin; +// cerr << "NOTE: Assigned plugin " << plugin << " for transform: " << transform.toXmlString() << endl; + if (!(originalTransform == transform)) { m_transformPluginMap[originalTransform] = plugin; +// cerr << "NOTE: Also assigned plugin " << plugin << " for original transform: " << originalTransform.toXmlString() << endl; } } else { @@ -427,11 +432,36 @@ } bool FeatureExtractionManager::addFeatureExtractorFromFile -(QString transformXmlFile, const vector &writers) +(QString transformFile, const vector &writers) { + // We support two formats for transform description files, XML (in + // a format specific to Sonic Annotator) and RDF/Turtle. The RDF + // format can describe multiple transforms in a single file, the + // XML only one. + + // Possible errors we should report: + // + // 1. File does not exist or cannot be opened + // 2. File is ostensibly XML, but is not parseable + // 3. File is ostensibly Turtle, but is not parseable + // 4. File is XML, but contains no valid transform (e.g. is unrelated XML) + // 5. File is Turtle, but contains no valid transform(s) + // 6. File is Turtle and contains both valid and invalid transform(s) + + { + // We don't actually need to open this here yet, we just hoist + // it to the top for error reporting purposes + QFile file(transformFile); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + // Error case 1. File does not exist or cannot be opened + cerr << "ERROR: Failed to open transform file \"" << transformFile + << "\" for reading" << endl; + return false; + } + } + bool tryRdf = true; - - if (transformXmlFile.endsWith(".xml") || transformXmlFile.endsWith(".XML")) { + if (transformFile.endsWith(".xml") || transformFile.endsWith(".XML")) { // We don't support RDF-XML (and nor does the underlying // parser library) so skip the RDF parse if the filename // suggests XML, to avoid puking out a load of errors from @@ -439,44 +469,90 @@ tryRdf = false; } + bool tryXml = true; + if (transformFile.endsWith(".ttl") || transformFile.endsWith(".TTL") || + transformFile.endsWith(".ntriples") || transformFile.endsWith(".NTRIPLES") || + transformFile.endsWith(".n3") || transformFile.endsWith(".N3")) { + tryXml = false; + } + + QString rdfError, xmlError; + if (tryRdf) { + RDFTransformFactory factory - (QUrl::fromLocalFile(QFileInfo(transformXmlFile).absoluteFilePath()) + (QUrl::fromLocalFile(QFileInfo(transformFile).absoluteFilePath()) .toString()); ProgressPrinter printer("Parsing transforms RDF file"); std::vector transforms = factory.getTransforms(&printer); - if (!factory.isOK()) { - cerr << "WARNING: FeatureExtractionManager::addFeatureExtractorFromFile: Failed to parse transforms file: " << factory.getErrorString().toStdString() << endl; + + if (factory.isOK()) { + if (transforms.empty()) { + cerr << "ERROR: Transform file \"" << transformFile + << "\" is valid RDF but defines no transforms" << endl; + return false; + } else { + bool success = true; + for (int i = 0; i < (int)transforms.size(); ++i) { + if (!addFeatureExtractor(transforms[i], writers)) { + success = false; + } + } + return success; + } + } else { // !factory.isOK() if (factory.isRDF()) { - return false; // no point trying it as XML + cerr << "ERROR: Invalid transform RDF file \"" << transformFile + << "\": " << factory.getErrorString() << endl; + return false; } - } - if (!transforms.empty()) { - bool success = true; - for (int i = 0; i < (int)transforms.size(); ++i) { - if (!addFeatureExtractor(transforms[i], writers)) { - success = false; - } - } - return success; + + // the not-RDF case: fall through without reporting an + // error, so we try the file as XML, and if that fails, we + // print a general unparseable-file error + rdfError = factory.getErrorString(); } } - QFile file(transformXmlFile); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - cerr << "ERROR: Failed to open transform XML file \"" - << transformXmlFile.toStdString() << "\" for reading" << endl; - return false; + if (tryXml) { + + QFile file(transformFile); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + cerr << "ERROR: Failed to open transform file \"" + << transformFile.toStdString() << "\" for reading" << endl; + return false; + } + + QTextStream *qts = new QTextStream(&file); + QString qs = qts->readAll(); + delete qts; + file.close(); + + Transform transform(qs); + xmlError = transform.getErrorString(); + + if (xmlError == "") { + + if (transform.getIdentifier() == "") { + cerr << "ERROR: Transform file \"" << transformFile + << "\" is valid XML but defines no transform" << endl; + return false; + } + + return addFeatureExtractor(transform, writers); + } } - QTextStream *qts = new QTextStream(&file); - QString qs = qts->readAll(); - delete qts; - file.close(); + cerr << "ERROR: Transform file \"" << transformFile + << "\" could not be parsed" << endl; + if (rdfError != "") { + cerr << "ERROR: RDF parser reported: " << rdfError << endl; + } + if (xmlError != "") { + cerr << "ERROR: XML parser reported: " << xmlError << endl; + } - Transform transform(qs); - - return addFeatureExtractor(transform, writers); + return false; } void FeatureExtractionManager::addSource(QString audioSource, bool willMultiplex) @@ -489,7 +565,7 @@ if (m_channels == 0 || m_defaultSampleRate == 0) { - ProgressPrinter retrievalProgress("Determining default rate and channel count from first input file..."); + ProgressPrinter retrievalProgress("Retrieving first input file to determine default rate and channel count..."); FileSource source(audioSource, &retrievalProgress); if (!source.isAvailable()) { @@ -524,14 +600,14 @@ if (m_channels == 0) { m_channels = reader->getChannelCount(); cerr << "Taking default channel count of " - << reader->getChannelCount() << " from file" << endl; + << reader->getChannelCount() << " from audio file" << endl; } } if (m_defaultSampleRate == 0) { m_defaultSampleRate = reader->getNativeRate(); cerr << "Taking default sample rate of " - << reader->getNativeRate() << "Hz from file" << endl; + << reader->getNativeRate() << "Hz from audio file" << endl; cerr << "(Note: Default may be overridden by transforms)" << endl; } @@ -616,6 +692,12 @@ if (!reader) { throw FailedToOpenFile(source); } + if (reader->getChannelCount() != m_channels || + reader->getNativeRate() != m_sampleRate) { + cerr << "NOTE: File will be mixed or resampled for processing, to: " + << m_channels << "ch at " + << m_sampleRate << "Hz" << endl; + } return reader; } @@ -628,12 +710,6 @@ cerr << "Audio file \"" << audioSource.toStdString() << "\": " << reader->getChannelCount() << "ch at " << reader->getNativeRate() << "Hz" << endl; - if (reader->getChannelCount() != m_channels || - reader->getNativeRate() != m_sampleRate) { - cerr << "NOTE: File will be mixed or resampled for processing, to: " - << m_channels << "ch at " - << m_sampleRate << "Hz" << endl; - } // allocate audio buffers float **data = new float *[m_channels]; @@ -671,7 +747,7 @@ PluginMap::iterator pi = m_plugins.find(plugin); - std::cerr << "Calling reset on " << plugin << std::endl; +// std::cerr << "Calling reset on " << plugin << std::endl; plugin->reset(); for (TransformWriterMap::iterator ti = pi->second.begin(); @@ -852,6 +928,7 @@ } if (!m_summaries.empty()) { + // Summaries requested on the command line, for all transforms PluginSummarisingAdapter *adapter = dynamic_cast(plugin); if (!adapter) { @@ -868,12 +945,13 @@ featureSet = adapter->getSummaryForAllOutputs (getSummaryType(*sni), PluginSummarisingAdapter::ContinuousTimeAverage); - writeFeatures(audioSource, plugin, featureSet,//!!! *sni); + writeFeatures(audioSource, plugin, featureSet, Transform::stringToSummaryType(sni->c_str())); } } } + // Summaries specified in transform definitions themselves writeSummaries(audioSource, plugin); } @@ -895,11 +973,15 @@ const Transform &transform = ti->first; +// cerr << "FeatureExtractionManager::writeSummaries: plugin is " << plugin +// << ", found transform: " << transform.toXmlString() << endl; + Transform::SummaryType summaryType = transform.getSummaryType(); PluginSummarisingAdapter::SummaryType pType = (PluginSummarisingAdapter::SummaryType)summaryType; if (transform.getSummaryType() == Transform::NoSummary) { +// cerr << "(no summary, continuing)" << endl; continue; } @@ -913,7 +995,7 @@ Plugin::FeatureSet featureSet = adapter->getSummaryForAllOutputs (pType, PluginSummarisingAdapter::ContinuousTimeAverage); -// cout << "summary type " << int(pType) << " for transform:" << endl << transform.toXmlString().toStdString()<< endl << "... feature set with " << featureSet.size() << " elts" << endl; +// cerr << "summary type " << int(pType) << " for transform:" << endl << transform.toXmlString().toStdString()<< endl << "... feature set with " << featureSet.size() << " elts" << endl; writeFeatures(audioSource, plugin, featureSet, summaryType); } @@ -927,21 +1009,25 @@ // caller should have ensured plugin is in m_plugins PluginMap::iterator pi = m_plugins.find(plugin); + // Write features from the feature set passed in, according to the + // transforms listed for the given plugin with the given summary type + for (TransformWriterMap::const_iterator ti = pi->second.begin(); ti != pi->second.end(); ++ti) { const Transform &transform = ti->first; const vector &writers = ti->second; - - if (transform.getSummaryType() != Transform::NoSummary && - m_summaries.empty() && - summaryType == Transform::NoSummary) { - continue; - } - if (transform.getSummaryType() != Transform::NoSummary && - summaryType != Transform::NoSummary && - transform.getSummaryType() != summaryType) { +// cerr << "writeFeatures: plugin " << plugin << " has transform: " << transform.toXmlString() << endl; + + if (transform.getSummaryType() == Transform::NoSummary && + !m_summaries.empty()) { +// cerr << "transform has no summary, but summaries requested on command line, so going for it anyway" << endl; + } else if (transform.getSummaryType() != summaryType) { + // Either we're not writing a summary and the transform + // has one, or we're writing a summary but the transform + // has none or a different one; either way, skip it +// cerr << "summary type differs from passed-in one " << summaryType << endl; continue; } @@ -959,6 +1045,8 @@ Plugin::FeatureSet::const_iterator fsi = features.find(outputIndex); if (fsi == features.end()) continue; +// cerr << "this transform has " << writers.size() << " writer(s)" << endl; + for (int j = 0; j < (int)writers.size(); ++j) { writers[j]->write (audioSource, transform, desc, fsi->second, diff -r 5eadb3b687bb -r c8e5fcddf8be runner/FeatureExtractionManager.h --- a/runner/FeatureExtractionManager.h Fri Mar 18 15:15:37 2016 +0000 +++ b/runner/FeatureExtractionManager.h Fri Mar 18 15:15:55 2016 +0000 @@ -114,8 +114,8 @@ OutputIndexMap m_pluginOutputIndices; typedef set SummaryNameSet; - SummaryNameSet m_summaries; - bool m_summariesOnly; + SummaryNameSet m_summaries; // requested on command line for all transforms + bool m_summariesOnly; // command line flag Vamp::HostExt::PluginSummarisingAdapter::SegmentBoundaries m_boundaries; AudioFileReader *prepareReader(QString audioSource); diff -r 5eadb3b687bb -r c8e5fcddf8be runner/MultiplexedReader.cpp --- a/runner/MultiplexedReader.cpp Fri Mar 18 15:15:37 2016 +0000 +++ b/runner/MultiplexedReader.cpp Fri Mar 18 15:15:55 2016 +0000 @@ -60,7 +60,7 @@ for (int out_chan = 0; out_chan < out_chans; ++out_chan) { AudioFileReader *reader = m_readers[out_chan]; - SampleBlock readerBlock = getInterleavedFrames(start, frameCount); + SampleBlock readerBlock = reader->getInterleavedFrames(start, frameCount); int in_chans = reader->getChannelCount(); diff -r 5eadb3b687bb -r c8e5fcddf8be runner/main.cpp --- a/runner/main.cpp Fri Mar 18 15:15:37 2016 +0000 +++ b/runner/main.cpp Fri Mar 18 15:15:55 2016 +0000 @@ -137,6 +137,10 @@ return ws; } +static QString wrapCol(QString s) { + return wrap(s, 56, 22); +} + static bool isVersionNewerThan(QString a, QString b) // from VersionTester in svapp { @@ -186,8 +190,8 @@ cerr << endl; cerr << "Sonic Annotator v" << RUNNER_VERSION << endl; cerr << "A utility for batch feature extraction from audio files." << endl; - cerr << "Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London." << endl; - cerr << "Copyright 2007-2015 Queen Mary, University of London." << endl; + cerr << "Mark Levy, Chris Sutton, and Chris Cannam, Queen Mary, University of London." << endl; + cerr << "Copyright 2007-2016 Queen Mary, University of London." << endl; cerr << endl; cerr << "This program is free software. You may redistribute copies of it under the" << endl; cerr << "terms of the GNU General Public License ." << endl; @@ -199,7 +203,7 @@ cerr << " " << myname << " [-mrnf] -T translist.txt [..] -w [..]