Mercurial > hg > sonic-visualiser
changeset 940:440ead77632b
Merge from branch cxx11
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:22:46 +0100 |
parents | 2c5f8da27f72 (current diff) c2734beb9b15 (diff) |
children | 33418a475d9e |
files | .hgsubstate |
diffstat | 12 files changed, 329 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgsubstate Mon Apr 20 09:22:27 2015 +0100 +++ b/.hgsubstate Mon Apr 20 09:22:46 2015 +0100 @@ -1,5 +1,5 @@ d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay -879bdc878826bebec67130326f99397c430419b1 sv-dependency-builds +55ece8862b6d3a54aad271a53f9c1615e5d3bcf8 sv-dependency-builds 12d982e52190ded18b3b3560ea7f2883ef8667fb svapp 32ab6c48efaa23d24a67315bccdc27f3ba1a18d5 svcore 78c152e4db958ac5a36e0fba3102cb6fdc52dd62 svgui
--- a/acinclude.m4 Mon Apr 20 09:22:27 2015 +0100 +++ b/acinclude.m4 Mon Apr 20 09:22:46 2015 +0100 @@ -112,3 +112,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 <bkoz@redhat.com> +# Copyright (c) 2012 Zack Weinberg <zackw@panix.com> +# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu> +# Copyright (c) 2014 Alexey Sokolov <sokolov@google.com> +# +# 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 <typename T> + 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<check<bool>> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check<int> check_type; + check_type c; + check_type&& cr = static_cast<check_type&&>(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 +]) +
--- a/configure Mon Apr 20 09:22:27 2015 +0100 +++ b/configure Mon Apr 20 09:22:46 2015 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for Sonic Visualiser 2.4. +# Generated by GNU Autoconf 2.69 for Sonic Visualiser 2.4.1. # # Report bugs to <cannam@all-day-breakfast.com>. # @@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='Sonic Visualiser' PACKAGE_TARNAME='sonic-visualiser' -PACKAGE_VERSION='2.4' -PACKAGE_STRING='Sonic Visualiser 2.4' +PACKAGE_VERSION='2.4.1' +PACKAGE_STRING='Sonic Visualiser 2.4.1' PACKAGE_BUGREPORT='cannam@all-day-breakfast.com' PACKAGE_URL='' @@ -681,6 +681,7 @@ EGREP GREP CXXCPP +HAVE_CXX11 MKDIR_P INSTALL_DATA INSTALL_SCRIPT @@ -1333,7 +1334,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 Visualiser 2.4 to adapt to many kinds of systems. +\`configure' configures Sonic Visualiser 2.4.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1395,7 +1396,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Sonic Visualiser 2.4:";; + short | recursive ) echo "Configuration of Sonic Visualiser 2.4.1:";; esac cat <<\_ACEOF @@ -1546,7 +1547,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Sonic Visualiser configure 2.4 +Sonic Visualiser configure 2.4.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1886,7 +1887,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 Visualiser $as_me 2.4, which was +It was created by Sonic Visualiser $as_me 2.4.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3470,6 +3471,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 <typename T> + 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<check<bool>> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check<int> check_type; + check_type c; + check_type&& cr = static_cast<check_type&&>(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 <typename T> + 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<check<bool>> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check<int> check_type; + check_type c; + check_type&& cr = static_cast<check_type&&>(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' @@ -4223,9 +4364,10 @@ CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS" if test "x$GCC" = "xyes"; then - CXXFLAGS_DEBUG="-Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -g -pipe" - CXXFLAGS_RELEASE="-g0 -O2 -Wall -pipe" - CXXFLAGS_MINIMAL="-g0 -O0" + CXXFLAGS_ANY="-Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe" + CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g" + CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O2" + CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0" fi CXXFLAGS_BUILD="$CXXFLAGS_RELEASE" @@ -7902,7 +8044,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Sonic Visualiser $as_me 2.4, which was +This file was extended by Sonic Visualiser $as_me 2.4.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7955,7 +8097,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Sonic Visualiser config.status 2.4 +Sonic Visualiser config.status 2.4.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\"
--- a/configure.ac Mon Apr 20 09:22:27 2015 +0100 +++ b/configure.ac Mon Apr 20 09:22:46 2015 +0100 @@ -1,5 +1,5 @@ -AC_INIT([Sonic Visualiser], [2.4], cannam@all-day-breakfast.com) +AC_INIT([Sonic Visualiser], [2.4.1], cannam@all-day-breakfast.com) AC_CONFIG_SRCDIR(main/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 @@ -50,9 +53,10 @@ CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS" if test "x$GCC" = "xyes"; then - CXXFLAGS_DEBUG="-Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -g -pipe" - CXXFLAGS_RELEASE="-g0 -O2 -Wall -pipe" - CXXFLAGS_MINIMAL="-g0 -O0" + CXXFLAGS_ANY="-Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe" + CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g" + CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O2" + CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0" fi CXXFLAGS_BUILD="$CXXFLAGS_RELEASE"
--- a/main/MainWindow.cpp Mon Apr 20 09:22:27 2015 +0100 +++ b/main/MainWindow.cpp Mon Apr 20 09:22:46 2015 +0100 @@ -2342,8 +2342,8 @@ QString description; - int ssr = getMainModel()->getSampleRate(); - int tsr = ssr; + sv_samplerate_t ssr = getMainModel()->getSampleRate(); + sv_samplerate_t tsr = ssr; if (m_playSource) tsr = m_playSource->getTargetSampleRate(); if (ssr != tsr) { @@ -2808,7 +2808,7 @@ visible = pane->getImageSize(pane->getFirstVisibleFrame(), pane->getLastVisibleFrame()); - int sf0 = 0, sf1 = 0; + sv_frame_t sf0 = 0, sf1 = 0; if (haveSelection) { MultiSelection::SelectionList selections = m_viewManager->getSelections(); @@ -3749,8 +3749,8 @@ } } - int startFrame = 0, duration = 0; - int endFrame = 0; + sv_frame_t startFrame = 0, duration = 0; + sv_frame_t endFrame = 0; m_viewManager->getSelection().getExtents(startFrame, endFrame); if (endFrame > startFrame) duration = endFrame - startFrame; else startFrame = 0; @@ -3874,14 +3874,14 @@ { PlaySpeedRangeMapper mapper(0, 200); - float percent = m_playSpeed->mappedValue(); - float factor = mapper.getFactorForValue(percent); + double percent = m_playSpeed->mappedValue(); + double factor = mapper.getFactorForValue(percent); // cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << endl; bool something = (position != 100); - int pc = lrintf(percent); + int pc = int(lrint(percent)); if (!something) { contextHelpChanged(tr("Playback speed: Normal")); @@ -3972,7 +3972,7 @@ } bool haveSelection = false; - int startFrame = 0, endFrame = 0; + sv_frame_t startFrame = 0, endFrame = 0; if (m_viewManager && m_viewManager->haveInProgressSelection()) { @@ -4025,7 +4025,7 @@ if (!statusBar()->isVisible()) return; Pane *pane = 0; - int frame = m_viewManager->getPlaybackFrame(); + sv_frame_t frame = m_viewManager->getPlaybackFrame(); if (m_paneStack) pane = m_paneStack->getCurrentPane(); if (!pane) return; @@ -4052,7 +4052,8 @@ } void -MainWindow::sampleRateMismatch(int requested, int actual, +MainWindow::sampleRateMismatch(sv_samplerate_t requested, + sv_samplerate_t actual, bool willResample) { if (!willResample) { @@ -4118,7 +4119,7 @@ MIDIEvent ev(m_midiInput->readEvent()); - int frame = currentPane->alignFromReference(ev.getTime()); + sv_frame_t frame = currentPane->alignFromReference(ev.getTime()); bool noteOn = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON && ev.getVelocity() > 0);
--- a/main/MainWindow.h Mon Apr 20 09:22:27 2015 +0100 +++ b/main/MainWindow.h Mon Apr 20 09:22:46 2015 +0100 @@ -66,7 +66,7 @@ virtual void closeSession(); virtual void preferences(); - virtual void sampleRateMismatch(int, int, bool); + virtual void sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool); virtual void audioOverloadPluginDisabled(); virtual void audioTimeStretchMultiChannelDisabled();
--- a/main/OSCHandler.cpp Mon Apr 20 09:22:27 2015 +0100 +++ b/main/OSCHandler.cpp Mon Apr 20 09:22:46 2015 +0100 @@ -123,7 +123,7 @@ if (getMainModel()) { - int frame = m_viewManager->getPlaybackFrame(); + sv_frame_t frame = m_viewManager->getPlaybackFrame(); bool selection = false; bool play = (message.getMethod() == "play"); @@ -233,8 +233,8 @@ if (getMainModel()) { - int f0 = getMainModel()->getStartFrame(); - int f1 = getMainModel()->getEndFrame(); + sv_frame_t f0 = getMainModel()->getStartFrame(); + sv_frame_t f1 = getMainModel()->getEndFrame(); bool done = false; @@ -452,7 +452,7 @@ double level = message.getArg(0).toDouble(); Pane *currentPane = m_paneStack->getCurrentPane(); if (level < 1.0) level = 1.0; - if (currentPane) currentPane->setZoomLevel(lrint(level)); + if (currentPane) currentPane->setZoomLevel(int(lrint(level))); } }
--- a/main/PreferencesDialog.cpp Mon Apr 20 09:22:27 2015 +0100 +++ b/main/PreferencesDialog.cpp Mon Apr 20 09:22:46 2015 +0100 @@ -122,7 +122,6 @@ connect(propertyLayout, SIGNAL(currentIndexChanged(int)), this, SLOT(propertyLayoutChanged(int))); - m_tuningFrequency = prefs->getTuningFrequency();
--- a/main/PreferencesDialog.h Mon Apr 20 09:22:27 2015 +0100 +++ b/main/PreferencesDialog.h Mon Apr 20 09:22:46 2015 +0100 @@ -90,7 +90,7 @@ int m_spectrogramSmoothing; int m_spectrogramXSmoothing; int m_propertyLayout; - float m_tuningFrequency; + double m_tuningFrequency; int m_audioDevice; int m_resampleQuality; bool m_resampleOnLoad;
--- a/platform-dataquay.pri Mon Apr 20 09:22:27 2015 +0100 +++ b/platform-dataquay.pri Mon Apr 20 09:22:46 2015 +0100 @@ -3,10 +3,11 @@ include(./config.pri) } -CONFIG += staticlib +CONFIG += staticlib c++11 DEFINES -= USE_REDLAND QMAKE_CXXFLAGS -= -I/usr/include/rasqal -I/usr/include/raptor2 +QMAKE_CXXFLAGS -= -Werror EXTRALIBS -= -lrdf DEFINES += USE_SORD