diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fc5e1d52a7..136ad1a26ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) +CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) PROJECT(lmms) @@ -12,6 +12,7 @@ IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0045 NEW) CMAKE_POLICY(SET CMP0050 OLD) ENDIF() + CMAKE_POLICY(SET CMP0020 NEW) ENDIF(COMMAND CMAKE_POLICY) INCLUDE(CheckSubmodules) @@ -113,6 +114,7 @@ IF(LMMS_BUILD_MSYS AND CMAKE_BUILD_TYPE STREQUAL "Debug") SET(STATUS_STK "not built as requested") ENDIF() +SET(CMAKE_CXX_STANDARD_REQUIRED ON) CHECK_INCLUDE_FILES(stdint.h LMMS_HAVE_STDINT_H) CHECK_INCLUDE_FILES(stdlib.h LMMS_HAVE_STDLIB_H) @@ -308,13 +310,13 @@ ENDIF(WANT_PORTAUDIO) IF(WANT_SOUNDIO) FIND_PACKAGE(SoundIo) IF(SOUNDIO_FOUND) - SET(LMMS_HAVE_SOUNDIO TRUE) - SET(STATUS_SOUNDIO "OK") - INCLUDE_DIRECTORIES("${SOUNDIO_INCLUDE_DIR}") + SET(LMMS_HAVE_SOUNDIO TRUE) + SET(STATUS_SOUNDIO "OK") + INCLUDE_DIRECTORIES("${SOUNDIO_INCLUDE_DIR}") ELSE(SOUNDIO_FOUND) - SET(SOUNDIO_INCLUDE_DIR "") - SET(STATUS_SOUNDIO "not found, please install libsoundio if you require libsoundio support") - SET(SOUNDIO_LIBRARY "") + SET(SOUNDIO_INCLUDE_DIR "") + SET(STATUS_SOUNDIO "not found, please install libsoundio if you require libsoundio support") + SET(SOUNDIO_LIBRARY "") ENDIF(SOUNDIO_FOUND) ENDIF(WANT_SOUNDIO) @@ -490,32 +492,41 @@ ELSE() SET (STATUS_DEBUG_FPE "Disabled") ENDIF(WANT_DEBUG_FPE) - # check for libsamplerate PKG_CHECK_MODULES(SAMPLERATE REQUIRED samplerate>=0.1.8) # set compiler flags -SET(WERROR_FLAGS "-Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow") -OPTION(USE_WERROR "Add -werror to the build flags. Stops the build on warnings" OFF) -IF(${USE_WERROR}) - SET(WERROR_FLAGS "${WERROR_FLAGS} -Werror") -ENDIF() +IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|AppleClang") + SET(WERROR_FLAGS "-Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow") + OPTION(USE_WERROR "Add -werror to the build flags. Stops the build on warnings" OFF) + IF(${USE_WERROR}) + SET(WERROR_FLAGS "${WERROR_FLAGS} -Werror") + ENDIF() -# Due to a regression in gcc-4.8.X, we need to disable array-bounds check -IF (CMAKE_COMPILER_IS_GNUCXX AND ((CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "4.8.0") OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8.0") OR LMMS_BUILD_WIN32)) - SET(WERROR_FLAGS "${WERROR_FLAGS} -Wno-array-bounds") + # Due to a regression in gcc-4.8.X, we need to disable array-bounds check + IF (CMAKE_COMPILER_IS_GNUCXX AND ((CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "4.8.0") OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8.0") OR LMMS_BUILD_WIN32)) + SET(WERROR_FLAGS "${WERROR_FLAGS} -Wno-array-bounds") + ENDIF() +ELSEIF(MSVC) + # Remove any existing /W flags + STRING(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + SET(WERROR_FLAGS "/W2") + IF(${USE_WERROR}) + SET(WERROR_FLAGS "${WERROR_FLAGS} /WX") + ENDIF() ENDIF() + IF(NOT CMAKE_BUILD_TYPE) message(STATUS "Setting build type to 'Release' as none was specified.") set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" - "MinSizeRel" "RelWithDebInfo") + "MinSizeRel" "RelWithDebInfo") ENDIF() SET(CMAKE_C_FLAGS "${WERROR_FLAGS} ${CMAKE_C_FLAGS}") -SET(CMAKE_CXX_FLAGS "-fno-exceptions ${WERROR_FLAGS} ${CMAKE_CXX_FLAGS}") +SET(CMAKE_CXX_FLAGS "${WERROR_FLAGS} ${CMAKE_CXX_FLAGS}") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLMMS_DEBUG") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DLMMS_DEBUG") @@ -529,23 +540,25 @@ LIST(SORT LMMS_INCLUDES) # we somehow have to make LMMS-binary depend on MOC-files ADD_FILE_DEPENDENCIES("${CMAKE_BINARY_DIR}/lmmsconfig.h") -IF(WIN32) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes") -ELSE(WIN32) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC") -ENDIF(WIN32) +IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|AppleClang") + IF(WIN32) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes") + ELSE(WIN32) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC") + ENDIF(WIN32) +ENDIF() # use ccache OPTION(USE_CCACHE "Use ccache for compilation" OFF) IF(USE_CCACHE) - FIND_PROGRAM(CCACHE ccache) - IF (CCACHE) - MESSAGE(STATUS "Using ccache found in PATH") - SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE}) - SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE}) - ELSE() - MESSAGE(WARNING "USE_CCACHE enabled, but no ccache found") - ENDIF() + FIND_PROGRAM(CCACHE ccache) + IF (CCACHE) + MESSAGE(STATUS "Using ccache found in PATH") + SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE}) + SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE}) + ELSE() + MESSAGE(WARNING "USE_CCACHE enabled, but no ccache found") + ENDIF() ENDIF() # make sub-directories diff --git a/cmake/modules/BuildPlugin.cmake b/cmake/modules/BuildPlugin.cmake index f3bea9e3147..586279e82d8 100644 --- a/cmake/modules/BuildPlugin.cmake +++ b/cmake/modules/BuildPlugin.cmake @@ -74,10 +74,10 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader ${CMAKE_BINARY_DIR}/lmms") ADD_DEPENDENCIES(${PLUGIN_NAME} lmms) ENDIF(LMMS_BUILD_APPLE) - IF(LMMS_BUILD_WIN32) + IF(LMMS_BUILD_WIN32 AND STRIP) SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES PREFIX "") ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND ${STRIP} $) - ENDIF(LMMS_BUILD_WIN32) + ENDIF() SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${RCC_OUT} ${plugin_MOC_out}") ENDMACRO(BUILD_PLUGIN) diff --git a/cmake/modules/DetectMachine.cmake b/cmake/modules/DetectMachine.cmake index 60c4a0953ce..850ee8052f3 100644 --- a/cmake/modules/DetectMachine.cmake +++ b/cmake/modules/DetectMachine.cmake @@ -16,6 +16,10 @@ MESSAGE("PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") SET(LMMS_HOST_X86 FALSE) SET(LMMS_HOST_X86_64 FALSE) +IF(MSVC) + STRING(REGEX MATCH "86_64|amd64|AMD64" WIN64 "${CMAKE_SYSTEM_PROCESSOR}") +ENDIF() + IF(WIN32) IF(WIN64) SET(IS_X86_64 TRUE) diff --git a/include/BasicFilters.h b/include/BasicFilters.h index a3753dd9b3c..684596c4d7e 100644 --- a/include/BasicFilters.h +++ b/include/BasicFilters.h @@ -44,7 +44,7 @@ #include "interpolation.h" #include "MemoryManager.h" -template class BasicFilters; +template class BasicFilters; template class LinkwitzRiley diff --git a/include/Controller.h b/include/Controller.h index 3a9946073af..7aded3bc1ee 100644 --- a/include/Controller.h +++ b/include/Controller.h @@ -27,6 +27,7 @@ #ifndef CONTROLLER_H #define CONTROLLER_H +#include "export.h" #include "Engine.h" #include "Model.h" #include "JournallingObject.h" @@ -40,7 +41,7 @@ class ControllerConnection; typedef QVector ControllerVector; -class Controller : public Model, public JournallingObject +class EXPORT Controller : public Model, public JournallingObject { Q_OBJECT public: diff --git a/include/MicroTimer.h b/include/MicroTimer.h index ff10020ece9..2026619e2b0 100644 --- a/include/MicroTimer.h +++ b/include/MicroTimer.h @@ -25,45 +25,21 @@ #ifndef MICRO_TIMER #define MICRO_TIMER -#include "lmmsconfig.h" - -#ifdef LMMS_HAVE_SYS_TIME_H -#include -#endif - -#include -#include "lmms_basics.h" - +#include class MicroTimer { -public: - inline MicroTimer() - { - reset(); - } + using time_point = std::chrono::steady_clock::time_point; - inline ~MicroTimer() - { - } - - inline void reset() - { - gettimeofday( &begin, NULL ); - } - - inline int elapsed() const - { - struct timeval now; - gettimeofday( &now, NULL ); - return ( now.tv_sec - begin.tv_sec ) * 1000 * 1000 + - ( now.tv_usec - begin.tv_usec ); - } +public: + MicroTimer(); + ~MicroTimer(); + void reset(); + int elapsed() const; private: - struct timeval begin; - + time_point begin; } ; diff --git a/include/MixerProfiler.h b/include/MixerProfiler.h index c519b767a7f..0c46c34cb0d 100644 --- a/include/MixerProfiler.h +++ b/include/MixerProfiler.h @@ -27,6 +27,7 @@ #include +#include "lmms_basics.h" #include "MicroTimer.h" class MixerProfiler diff --git a/include/NotePlayHandle.h b/include/NotePlayHandle.h index 768a74aa276..a19887af25e 100644 --- a/include/NotePlayHandle.h +++ b/include/NotePlayHandle.h @@ -27,6 +27,7 @@ #define NOTE_PLAY_HANDLE_H #include "AtomicInt.h" +#include "BasicFilters.h" #include "Note.h" #include "PlayHandle.h" #include "Track.h" @@ -36,7 +37,6 @@ class QReadWriteLock; class InstrumentTrack; class NotePlayHandle; -template class BasicFilters; typedef QList NotePlayHandleList; typedef QList ConstNotePlayHandleList; diff --git a/include/PlayHandle.h b/include/PlayHandle.h index 329a8f7667e..a1c8e5c33da 100644 --- a/include/PlayHandle.h +++ b/include/PlayHandle.h @@ -28,6 +28,8 @@ #include #include +#include "export.h" + #include "MemoryManager.h" #include "ThreadableJob.h" @@ -38,7 +40,7 @@ class QThread; class Track; class AudioPort; -class PlayHandle : public ThreadableJob +class EXPORT PlayHandle : public ThreadableJob { public: enum Types diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index 2d811487587..bfba39de269 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -29,6 +29,7 @@ #include "MidiEvent.h" #include "VstSyncData.h" +#include #include #include #include @@ -234,7 +235,7 @@ class shmFifo // recursive lock inline void lock() { - if( !isInvalid() && __sync_add_and_fetch( &m_lockDepth, 1 ) == 1 ) + if( !isInvalid() && m_lockDepth.fetch_add( 1 ) == 0 ) { m_dataSem.acquire(); } @@ -243,7 +244,7 @@ class shmFifo // recursive unlock inline void unlock() { - if( __sync_sub_and_fetch( &m_lockDepth, 1) <= 0 ) + if( m_lockDepth.fetch_sub( 1 ) <= 1 ) { m_dataSem.release(); } @@ -404,7 +405,7 @@ class shmFifo shmData * m_data; QSystemSemaphore m_dataSem; QSystemSemaphore m_messageSem; - volatile int m_lockDepth; + std::atomic_int m_lockDepth; } ; #endif diff --git a/include/TrackContainerView.h b/include/TrackContainerView.h index 07e498df463..67575583b51 100644 --- a/include/TrackContainerView.h +++ b/include/TrackContainerView.h @@ -174,6 +174,7 @@ public slots: TrackContainerView* m_trackContainerView; } ; + friend class TrackContainerView::scrollArea; TrackContainer* m_tc; typedef QList trackViewList; diff --git a/include/export.h b/include/export.h index 5b64d8d0869..dd3709704f3 100644 --- a/include/export.h +++ b/include/export.h @@ -22,7 +22,6 @@ * */ - #ifndef EXPORT_H #define EXPORT_H diff --git a/include/lmms_basics.h b/include/lmms_basics.h index 8fe4325b869..637867b4d34 100644 --- a/include/lmms_basics.h +++ b/include/lmms_basics.h @@ -31,7 +31,7 @@ #include "lmmsconfig.h" #ifdef LMMS_HAVE_STDINT_H -#include +#include #endif @@ -56,9 +56,12 @@ typedef uint16_t fx_ch_t; // FX-channel (0 to MAX_EFFECT_CHANNEL) typedef uint32_t jo_id_t; // (unique) ID of a journalling object // use for improved branch prediction -#define likely(x) __builtin_expect((x),1) -#define unlikely(x) __builtin_expect((x),0) +#define likely(x) Q_LIKELY(x) +#define unlikely(x) Q_UNLIKELY(x) +// windows headers define "min" and "max" macros, breaking the methods bwloe +#undef min +#undef max template struct typeInfo @@ -93,7 +96,7 @@ struct typeInfo template<> inline float typeInfo::minEps() { - return 1.0e-10; + return 1.0e-10f; } template<> diff --git a/include/versioninfo.h b/include/versioninfo.h index 8477a61c0d7..b34936d5742 100644 --- a/include/versioninfo.h +++ b/include/versioninfo.h @@ -1,7 +1,11 @@ +#include "lmms_basics.h" + #ifdef __GNUC__ -#define GCC_VERSION "GCC " __VERSION__ +#define COMPILER_VERSION "GCC " __VERSION__ +#elif defined(_MSC_VER) +#define COMPILER_VERSION "MSVC " STRINGIFY(_MSC_FULL_VER) #else -#define GCC_VERSION "unknown compiler" +#define COMPILER_VERSION "unknown compiler" #endif #ifdef LMMS_HOST_X86 diff --git a/plugins/Amplifier/Amplifier.cpp b/plugins/Amplifier/Amplifier.cpp index f7b23d87fe9..c11fa6bcc1c 100644 --- a/plugins/Amplifier/Amplifier.cpp +++ b/plugins/Amplifier/Amplifier.cpp @@ -138,7 +138,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new AmplifierEffect( parent, static_cast( data ) ); } diff --git a/plugins/BassBooster/BassBooster.cpp b/plugins/BassBooster/BassBooster.cpp index 0499ba7ee0a..f7387b46eaa 100644 --- a/plugins/BassBooster/BassBooster.cpp +++ b/plugins/BassBooster/BassBooster.cpp @@ -148,7 +148,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new BassBoosterEffect( parent, static_cast( data ) ); } diff --git a/plugins/Bitcrush/Bitcrush.cpp b/plugins/Bitcrush/Bitcrush.cpp index 6c7073f3100..918b8efdde5 100644 --- a/plugins/Bitcrush/Bitcrush.cpp +++ b/plugins/Bitcrush/Bitcrush.cpp @@ -244,7 +244,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new BitcrushEffect( parent, static_cast( data ) ); } diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 762bd7695c8..cb36db03f32 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,8 +1,9 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +SET(CMAKE_DEBUG_POSTFIX "") # Enable C++11 -ADD_DEFINITIONS(-std=c++0x) +SET(CMAKE_CXX_STANDARD 11) IF(LMMS_BUILD_APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") @@ -86,6 +87,24 @@ IF("${PLUGIN_LIST}" STREQUAL "") ENDIF("${PLUGIN_LIST}" STREQUAL "") +IF(MSVC) + SET(MSVC_INCOMPATIBLE_PLUGINS + LadspaEffect + monstro + organic + ReverbSC + sid + vestige + vibed + vst_base + VstEffect + Xpressive + zynaddsubfx + ) + message(WARNING "Compiling with MSVC. The following plugins are not available: ${MSVC_INCOMPATIBLE_PLUGINS}") + LIST(REMOVE_ITEM PLUGIN_LIST ${MSVC_INCOMPATIBLE_PLUGINS}) +ENDIF() + FOREACH(PLUGIN ${PLUGIN_LIST}) ADD_SUBDIRECTORY(${PLUGIN}) ENDFOREACH() diff --git a/plugins/CrossoverEQ/CrossoverEQ.cpp b/plugins/CrossoverEQ/CrossoverEQ.cpp index b406045878e..3dc0e826574 100644 --- a/plugins/CrossoverEQ/CrossoverEQ.cpp +++ b/plugins/CrossoverEQ/CrossoverEQ.cpp @@ -215,7 +215,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new CrossoverEQEffect( parent, static_cast( data ) ); } diff --git a/plugins/Delay/DelayEffect.cpp b/plugins/Delay/DelayEffect.cpp index 2305b19668a..0161178b83c 100644 --- a/plugins/Delay/DelayEffect.cpp +++ b/plugins/Delay/DelayEffect.cpp @@ -157,7 +157,7 @@ extern "C" { //needed for getting plugin out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new DelayEffect( parent , static_cast( data ) ); } diff --git a/plugins/DualFilter/DualFilter.cpp b/plugins/DualFilter/DualFilter.cpp index 3189e2c2bdb..94450cc6ff7 100644 --- a/plugins/DualFilter/DualFilter.cpp +++ b/plugins/DualFilter/DualFilter.cpp @@ -222,7 +222,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new DualFilterEffect( parent, static_cast( data ) ); } diff --git a/plugins/DualFilter/DualFilterControls.cpp b/plugins/DualFilter/DualFilterControls.cpp index 7fdd59e88c1..63f7887f19f 100644 --- a/plugins/DualFilter/DualFilterControls.cpp +++ b/plugins/DualFilter/DualFilterControls.cpp @@ -40,7 +40,7 @@ DualFilterControls::DualFilterControls( DualFilterEffect* effect ) : m_enabled1Model( true, this, tr( "Filter 1 enabled" ) ), m_filter1Model( this, tr( "Filter 1 type" ) ), m_cut1Model( 7000.0f, 1.0f, 20000.0f, 1.0f, this, tr( "Cutoff 1 frequency" ) ), - m_res1Model( 0.5, BasicFilters<0>::minQ(), 10.0, 0.01, this, tr( "Q/Resonance 1" ) ), + m_res1Model( 0.5, BasicFilters<>::minQ(), 10.0, 0.01, this, tr( "Q/Resonance 1" ) ), m_gain1Model( 100.0f, 0.0f, 200.0f, 0.1f, this, tr( "Gain 1" ) ), m_mixModel( 0.0f, -1.0f, 1.0f, 0.01f, this, tr( "Mix" ) ), @@ -48,7 +48,7 @@ DualFilterControls::DualFilterControls( DualFilterEffect* effect ) : m_enabled2Model( true, this, tr( "Filter 2 enabled" ) ), m_filter2Model( this, tr( "Filter 2 type" ) ), m_cut2Model( 7000.0f, 1.0f, 20000.0f, 1.0f, this, tr( "Cutoff 2 frequency" ) ), - m_res2Model( 0.5, BasicFilters<0>::minQ(), 10.0, 0.01, this, tr( "Q/Resonance 2" ) ), + m_res2Model( 0.5, BasicFilters<>::minQ(), 10.0, 0.01, this, tr( "Q/Resonance 2" ) ), m_gain2Model( 100.0f, 0.0f, 200.0f, 0.1f, this, tr( "Gain 2" ) ) { m_filter1Model.addItem( tr( "LowPass" ), new PixmapLoader( "filter_lp" ) ); diff --git a/plugins/Eq/EqEffect.cpp b/plugins/Eq/EqEffect.cpp index fa664aa3b2d..4a10b672e4d 100644 --- a/plugins/Eq/EqEffect.cpp +++ b/plugins/Eq/EqEffect.cpp @@ -418,7 +418,7 @@ extern "C" { //needed for getting plugin out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new EqEffect( parent , static_cast( data ) ); } diff --git a/plugins/Flanger/FlangerEffect.cpp b/plugins/Flanger/FlangerEffect.cpp index d270c080182..2f5d96ef508 100644 --- a/plugins/Flanger/FlangerEffect.cpp +++ b/plugins/Flanger/FlangerEffect.cpp @@ -143,7 +143,7 @@ extern "C" { //needed for getting plugin out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new FlangerEffect( parent , static_cast( data ) ); } diff --git a/plugins/FreeBoy/FreeBoy.cpp b/plugins/FreeBoy/FreeBoy.cpp index c8aa4b07a4b..11ada239b9b 100644 --- a/plugins/FreeBoy/FreeBoy.cpp +++ b/plugins/FreeBoy/FreeBoy.cpp @@ -744,7 +744,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return( new FreeBoyInstrument( static_cast( _data ) ) ); diff --git a/plugins/GigPlayer/CMakeLists.txt b/plugins/GigPlayer/CMakeLists.txt index 88e15f87bd1..05e9f529dbd 100644 --- a/plugins/GigPlayer/CMakeLists.txt +++ b/plugins/GigPlayer/CMakeLists.txt @@ -4,7 +4,7 @@ if(LMMS_HAVE_GIG) # Disable C++11 on Clang until gig.h is patched IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - REMOVE_DEFINITIONS(-std=c++0x) + SET(CMAKE_CXX_STANDARD 98) ENDIF() # Required for not crashing loading files with libgig diff --git a/plugins/HydrogenImport/HydrogenImport.cpp b/plugins/HydrogenImport/HydrogenImport.cpp index f86cdffd703..c7536e87ec7 100644 --- a/plugins/HydrogenImport/HydrogenImport.cpp +++ b/plugins/HydrogenImport/HydrogenImport.cpp @@ -340,7 +340,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return new HydrogenImport( QString::fromUtf8( static_cast( _data ) ) ); diff --git a/plugins/LadspaEffect/CMakeLists.txt b/plugins/LadspaEffect/CMakeLists.txt index 533d668f375..25ea5c4c859 100644 --- a/plugins/LadspaEffect/CMakeLists.txt +++ b/plugins/LadspaEffect/CMakeLists.txt @@ -1,16 +1,12 @@ INCLUDE(BuildPlugin) -# Disable C++11 -REMOVE_DEFINITIONS(-std=c++0x) -# Enable C++11 for CXXFLAGS only and not for Windows -IF(NOT LMMS_BUILD_WIN32) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -ENDIF() - BUILD_PLUGIN(ladspaeffect LadspaEffect.cpp LadspaControls.cpp LadspaControlDialog.cpp LadspaSubPluginFeatures.cpp LadspaEffect.h LadspaControls.h LadspaControlDialog.h LadspaSubPluginFeatures.h MOCFILES LadspaEffect.h LadspaControls.h LadspaControlDialog.h EMBEDDED_RESOURCES logo.png) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ladspa") +# Disable C++11 +SET(CMAKE_CXX_STANDARD 98) + IF(WANT_CAPS) ADD_SUBDIRECTORY(caps) ENDIF(WANT_CAPS) diff --git a/plugins/LadspaEffect/LadspaEffect.cpp b/plugins/LadspaEffect/LadspaEffect.cpp index b5bbe2728c0..0ce66721322 100644 --- a/plugins/LadspaEffect/LadspaEffect.cpp +++ b/plugins/LadspaEffect/LadspaEffect.cpp @@ -24,6 +24,7 @@ */ +#include #include #include "LadspaEffect.h" @@ -141,12 +142,12 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, int frames = _frames; sampleFrame * o_buf = NULL; - sampleFrame sBuf [_frames]; + QVarLengthArray sBuf(_frames * DEFAULT_CHANNELS); if( m_maxSampleRate < Engine::mixer()->processingSampleRate() ) { o_buf = _buf; - _buf = &sBuf[0]; + _buf = reinterpret_cast(sBuf.data()); sampleDown( o_buf, _buf, m_maxSampleRate ); frames = _frames * m_maxSampleRate / Engine::mixer()->processingSampleRate(); @@ -593,7 +594,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model * _parent, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * _parent, void * _data ) { return new LadspaEffect( _parent, static_cast( diff --git a/plugins/MidiExport/MidiExport.cpp b/plugins/MidiExport/MidiExport.cpp index 1e20e9d40f4..d691c483003 100644 --- a/plugins/MidiExport/MidiExport.cpp +++ b/plugins/MidiExport/MidiExport.cpp @@ -347,7 +347,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return new MidiExport(); } diff --git a/plugins/MidiImport/MidiImport.cpp b/plugins/MidiImport/MidiImport.cpp index 85d244ca589..729c8b20084 100644 --- a/plugins/MidiImport/MidiImport.cpp +++ b/plugins/MidiImport/MidiImport.cpp @@ -611,7 +611,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return new MidiImport( QString::fromUtf8( static_cast( _data ) ) ); diff --git a/plugins/MultitapEcho/MultitapEcho.cpp b/plugins/MultitapEcho/MultitapEcho.cpp index 7e84a289ef5..be46a50c6b6 100644 --- a/plugins/MultitapEcho/MultitapEcho.cpp +++ b/plugins/MultitapEcho/MultitapEcho.cpp @@ -164,7 +164,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new MultitapEchoEffect( parent, static_cast( data ) ); } diff --git a/plugins/MultitapEcho/MultitapEchoControls.cpp b/plugins/MultitapEcho/MultitapEchoControls.cpp index 09c45228d72..533f5c30e5e 100644 --- a/plugins/MultitapEcho/MultitapEchoControls.cpp +++ b/plugins/MultitapEcho/MultitapEchoControls.cpp @@ -24,6 +24,7 @@ */ #include +#include #include "MultitapEchoControls.h" #include "MultitapEcho.h" @@ -102,7 +103,7 @@ void MultitapEchoControls::setDefaultAmpShape() { const int length = m_steps.value(); - float samples [length]; + QVarLengthArray samples(length); for( int i = 0; i < length; ++i ) { samples[i] = 0.0f; @@ -116,7 +117,7 @@ void MultitapEchoControls::setDefaultLpShape() { const int length = m_steps.value(); - float samples [length]; + QVarLengthArray samples(length); for( int i = 0; i < length; ++i ) { samples[i] = 3.0f; diff --git a/plugins/OpulenZ/CMakeLists.txt b/plugins/OpulenZ/CMakeLists.txt index f4efc374a02..58f661406a7 100644 --- a/plugins/OpulenZ/CMakeLists.txt +++ b/plugins/OpulenZ/CMakeLists.txt @@ -1,11 +1,9 @@ INCLUDE(BuildPlugin) -# Enable C++11 for CXXFLAGS only -REMOVE_DEFINITIONS(-std=c++0x) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - # Avoid unused warnings for mididata.h +IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable") +ENDIF() INCLUDE_DIRECTORIES(adplug/src) diff --git a/plugins/OpulenZ/OpulenZ.cpp b/plugins/OpulenZ/OpulenZ.cpp index 7913a4cbb32..55428ee3698 100644 --- a/plugins/OpulenZ/OpulenZ.cpp +++ b/plugins/OpulenZ/OpulenZ.cpp @@ -77,7 +77,7 @@ Plugin::Descriptor PLUGIN_EXPORT opulenz_plugin_descriptor = }; // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return( new OpulenzInstrument( static_cast( _data ) ) ); } diff --git a/plugins/ReverbSC/CMakeLists.txt b/plugins/ReverbSC/CMakeLists.txt index 71706df88ce..f6f6c7ee70f 100644 --- a/plugins/ReverbSC/CMakeLists.txt +++ b/plugins/ReverbSC/CMakeLists.txt @@ -1,10 +1,5 @@ INCLUDE(BuildPlugin) -# Enable C++11 for CXXFLAGS only -# This is needed since this plugin uses C. Otherwise Travis fails -REMOVE_DEFINITIONS(-std=c++0x) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - BUILD_PLUGIN( reverbsc ReverbSC.cpp diff --git a/plugins/ReverbSC/ReverbSC.cpp b/plugins/ReverbSC/ReverbSC.cpp index 58cb0a7703d..bfbd0390a96 100644 --- a/plugins/ReverbSC/ReverbSC.cpp +++ b/plugins/ReverbSC/ReverbSC.cpp @@ -151,7 +151,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new ReverbSCEffect( parent, diff --git a/plugins/SpectrumAnalyzer/SpectrumAnalyzer.cpp b/plugins/SpectrumAnalyzer/SpectrumAnalyzer.cpp index bba33463590..f07fa7f45b0 100644 --- a/plugins/SpectrumAnalyzer/SpectrumAnalyzer.cpp +++ b/plugins/SpectrumAnalyzer/SpectrumAnalyzer.cpp @@ -163,7 +163,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { return new SpectrumAnalyzer( parent, static_cast( data ) ); } diff --git a/plugins/VstEffect/VstEffect.cpp b/plugins/VstEffect/VstEffect.cpp index fb7b6b33ddd..17d29608b11 100644 --- a/plugins/VstEffect/VstEffect.cpp +++ b/plugins/VstEffect/VstEffect.cpp @@ -171,7 +171,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model * _parent, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * _parent, void * _data ) { return new VstEffect( _parent, static_cast( diff --git a/plugins/Xpressive/CMakeLists.txt b/plugins/Xpressive/CMakeLists.txt index 65f9a0d5512..6db01f46de5 100644 --- a/plugins/Xpressive/CMakeLists.txt +++ b/plugins/Xpressive/CMakeLists.txt @@ -11,12 +11,12 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Dexprtk_disable_rtl_vecops") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WERROR_FLAGS} -fexceptions") # See https://github.com/ArashPartow/exprtk/pull/9 -IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") EXECUTE_PROCESS(COMMAND patch exprtk/exprtk.hpp exprtk.hpp.patch WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_QUIET) ENDIF() -IF(LMMS_BUILD_WIN32) +IF(LMMS_BUILD_WIN32 AND NOT MSVC) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -Dexprtk_disable_enhanced_features") ENDIF() diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index f7ce90e133f..278e681949c 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -1319,7 +1319,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return new audioFileProcessor( static_cast( _data ) ); diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index 7f22211b2fd..3f95f02356a 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -582,7 +582,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return( new bitInvader( static_cast( _data ) ) ); } diff --git a/plugins/dynamics_processor/dynamics_processor.cpp b/plugins/dynamics_processor/dynamics_processor.cpp index 4f9c9648c72..12ed1fa88dd 100644 --- a/plugins/dynamics_processor/dynamics_processor.cpp +++ b/plugins/dynamics_processor/dynamics_processor.cpp @@ -233,7 +233,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model * _parent, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * _parent, void * _data ) { return( new dynProcEffect( _parent, static_cast( diff --git a/plugins/kicker/kicker.cpp b/plugins/kicker/kicker.cpp index 3b6b18c73b6..50af8628beb 100644 --- a/plugins/kicker/kicker.cpp +++ b/plugins/kicker/kicker.cpp @@ -367,7 +367,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return new kickerInstrument( static_cast( _data ) ); } diff --git a/plugins/ladspa_browser/ladspa_browser.cpp b/plugins/ladspa_browser/ladspa_browser.cpp index 23134048c1e..cfc356c8615 100644 --- a/plugins/ladspa_browser/ladspa_browser.cpp +++ b/plugins/ladspa_browser/ladspa_browser.cpp @@ -61,7 +61,7 @@ Plugin::Descriptor PLUGIN_EXPORT ladspabrowser_plugin_descriptor = // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model * _parent, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * _parent, void * _data ) { return new ladspaBrowser; } diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index 1a32f7f92d0..f3728b2025f 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -1041,7 +1041,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return( new lb302Synth( diff --git a/plugins/monstro/Monstro.cpp b/plugins/monstro/Monstro.cpp index 24da1aedcae..f1d84eb0fc6 100644 --- a/plugins/monstro/Monstro.cpp +++ b/plugins/monstro/Monstro.cpp @@ -1965,7 +1965,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return new MonstroInstrument( static_cast( _data ) ); } diff --git a/plugins/nes/Nes.cpp b/plugins/nes/Nes.cpp index b09f84a222d..ead8846873f 100644 --- a/plugins/nes/Nes.cpp +++ b/plugins/nes/Nes.cpp @@ -917,7 +917,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return( new NesInstrument( static_cast( _data ) ) ); } diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index 7d7c60057c3..49edc0c3011 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -641,7 +641,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return( new organicInstrument( static_cast( _data ) ) ); } diff --git a/plugins/patman/patman.cpp b/plugins/patman/patman.cpp index 55e64fa4805..2a15303bb46 100644 --- a/plugins/patman/patman.cpp +++ b/plugins/patman/patman.cpp @@ -66,7 +66,7 @@ Plugin::Descriptor PLUGIN_EXPORT patman_plugin_descriptor = // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return new patmanInstrument( static_cast( _data ) ); } diff --git a/plugins/peak_controller_effect/peak_controller_effect.cpp b/plugins/peak_controller_effect/peak_controller_effect.cpp index ec4ec1e94c0..e08abcb2404 100644 --- a/plugins/peak_controller_effect/peak_controller_effect.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect.cpp @@ -148,7 +148,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model * _parent, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * _parent, void * _data ) { return new PeakControllerEffect( _parent, static_cast( _data ) ); diff --git a/plugins/sfxr/sfxr.cpp b/plugins/sfxr/sfxr.cpp index d9e19a4fa5f..19e63479252 100644 --- a/plugins/sfxr/sfxr.cpp +++ b/plugins/sfxr/sfxr.cpp @@ -1120,7 +1120,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model*, void* data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model*, void* data ) { return new sfxrInstrument( static_cast( data ) ); } diff --git a/plugins/sid/sid_instrument.cpp b/plugins/sid/sid_instrument.cpp index 0ab8e217be1..796a1422183 100644 --- a/plugins/sid/sid_instrument.cpp +++ b/plugins/sid/sid_instrument.cpp @@ -822,7 +822,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return( new sidInstrument( static_cast( _data ) ) ); diff --git a/plugins/stereo_enhancer/stereo_enhancer.cpp b/plugins/stereo_enhancer/stereo_enhancer.cpp index 7d252f57654..cb55213f133 100644 --- a/plugins/stereo_enhancer/stereo_enhancer.cpp +++ b/plugins/stereo_enhancer/stereo_enhancer.cpp @@ -163,7 +163,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model * _parent, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * _parent, void * _data ) { return( new stereoEnhancerEffect( _parent, static_cast( diff --git a/plugins/stereo_matrix/stereo_matrix.cpp b/plugins/stereo_matrix/stereo_matrix.cpp index a9d2a8e10a5..b2634e95c29 100644 --- a/plugins/stereo_matrix/stereo_matrix.cpp +++ b/plugins/stereo_matrix/stereo_matrix.cpp @@ -113,7 +113,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model * _parent, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * _parent, void * _data ) { return( new stereoMatrixEffect( _parent, static_cast( diff --git a/plugins/triple_oscillator/TripleOscillator.cpp b/plugins/triple_oscillator/TripleOscillator.cpp index 4efb040d220..0b7ff6bbe64 100644 --- a/plugins/triple_oscillator/TripleOscillator.cpp +++ b/plugins/triple_oscillator/TripleOscillator.cpp @@ -791,7 +791,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return new TripleOscillator( static_cast( _data ) ); } diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index ec87e87808e..a3c3c66c8e4 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -1141,7 +1141,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return new vestigeInstrument( static_cast( _data ) ); } diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index b3738ef2409..3442d39dba1 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -777,7 +777,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return( new vibed( static_cast( _data ) ) ); } diff --git a/plugins/vst_base/CMakeLists.txt b/plugins/vst_base/CMakeLists.txt index a3f919adf31..afd0c7cd9f2 100644 --- a/plugins/vst_base/CMakeLists.txt +++ b/plugins/vst_base/CMakeLists.txt @@ -52,6 +52,7 @@ ADD_CUSTOM_COMMAND( -L${WINE_LIBRARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp -ansi -mwindows -lpthread ${EXTRA_FLAGS} -fno-omit-frame-pointer + -std=c++0x ${WINE_BUILD_FLAGS} -o ../RemoteVstPlugin # Ensure correct file extension diff --git a/plugins/watsyn/Watsyn.cpp b/plugins/watsyn/Watsyn.cpp index 40d64a4c437..c35ee7d81b2 100644 --- a/plugins/watsyn/Watsyn.cpp +++ b/plugins/watsyn/Watsyn.cpp @@ -1278,7 +1278,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return( new WatsynInstrument( static_cast( _data ) ) ); } diff --git a/plugins/waveshaper/waveshaper.cpp b/plugins/waveshaper/waveshaper.cpp index 0d6c1302965..047cd05d193 100644 --- a/plugins/waveshaper/waveshaper.cpp +++ b/plugins/waveshaper/waveshaper.cpp @@ -161,7 +161,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model * _parent, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * _parent, void * _data ) { return( new waveShaperEffect( _parent, static_cast( diff --git a/plugins/zynaddsubfx/CMakeLists.txt b/plugins/zynaddsubfx/CMakeLists.txt index d0e810c0b4a..bc711123cef 100644 --- a/plugins/zynaddsubfx/CMakeLists.txt +++ b/plugins/zynaddsubfx/CMakeLists.txt @@ -1,5 +1,6 @@ INCLUDE(BuildPlugin) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) # definitions for ZynAddSubFX IF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE OR LMMS_BUILD_OPENBSD) @@ -24,9 +25,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wno-write-strings -Wno-deprecated-d IF(LMMS_BUILD_WIN32) # link system-libraries ADD_DEFINITIONS(-DPTW32_STATIC_LIB) - # fix X11 headers errors caused by bug with mingw + c++11 - REMOVE_DEFINITIONS(-std=c++0x) - ADD_DEFINITIONS(-std=gnu++0x) + # fix X11 headers errors caused by bug with mingw + c++11 (enable -std=gnu++0x) + SET(CMAKE_CXX_EXTENSIONS ON) ENDIF(LMMS_BUILD_WIN32) SET(FLTK_SKIP_OPENGL TRUE) diff --git a/plugins/zynaddsubfx/ZynAddSubFx.cpp b/plugins/zynaddsubfx/ZynAddSubFx.cpp index c5627bcca10..d4f24b2f097 100644 --- a/plugins/zynaddsubfx/ZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/ZynAddSubFx.cpp @@ -658,7 +658,7 @@ extern "C" { // necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) +PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) { return new ZynAddSubFxInstrument( static_cast( _data ) ); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index be6e2bd147d..624fd5dc3e9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,7 @@ SET(CMAKE_AUTOMOC ON) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) # Enable C++11 -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +SET(CMAKE_CXX_STANDARD 11) IF(LMMS_BUILD_APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") @@ -33,7 +33,9 @@ INCLUDE_DIRECTORIES( "${CMAKE_SOURCE_DIR}/include" ) -IF(WIN32) +IF(WIN32 AND MSVC) + SET(WINRC "${CMAKE_BINARY_DIR}/lmms.rc") +ELSEIF(WIN32) SET(WINRC "${CMAKE_BINARY_DIR}/lmmsrc.obj") ADD_CUSTOM_COMMAND(OUTPUT "${WINRC}" COMMAND "${WINDRES}" @@ -125,7 +127,7 @@ ENDIF() SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LMMS_RCC_OUT} ${LMMS_UI_OUT} lmmsconfig.h lmms.1.gz") IF(LMMS_BUILD_WIN32) - SET(EXTRA_LIBRARIES "-lwinmm") + SET(EXTRA_LIBRARIES "winmm") ENDIF() IF(LMMS_BUILD_APPLE) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 604a63c040e..49686f691b8 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -34,6 +34,7 @@ set(LMMS_SRCS core/MemoryHelper.cpp core/MemoryManager.cpp core/MeterModel.cpp + core/MicroTimer.cpp core/Mixer.cpp core/MixerProfiler.cpp core/MixerWorkerThread.cpp diff --git a/src/core/DrumSynth.cpp b/src/core/DrumSynth.cpp index fd0695557f4..3379f1aa7ec 100644 --- a/src/core/DrumSynth.cpp +++ b/src/core/DrumSynth.cpp @@ -35,6 +35,11 @@ #define powf pow #endif +#ifdef _MSC_VER +//not #if LMMS_BUILD_WIN32 because we have strncasecmp in mingw +#define strcasecmp _stricmp +#endif + using namespace std; diff --git a/src/core/InstrumentSoundShaping.cpp b/src/core/InstrumentSoundShaping.cpp index 56011de04c5..8d13754da8d 100644 --- a/src/core/InstrumentSoundShaping.cpp +++ b/src/core/InstrumentSoundShaping.cpp @@ -22,6 +22,7 @@ * */ +#include #include #include "InstrumentSoundShaping.h" @@ -153,8 +154,8 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer, if( m_filterEnabledModel.value() ) { - float cutBuffer [frames]; - float resBuffer [frames]; + QVarLengthArray cutBuffer(frames); + QVarLengthArray resBuffer(frames); int old_filter_cut = 0; int old_filter_res = 0; @@ -167,11 +168,11 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer, if( m_envLfoParameters[Cut]->isUsed() ) { - m_envLfoParameters[Cut]->fillLevel( cutBuffer, envTotalFrames, envReleaseBegin, frames ); + m_envLfoParameters[Cut]->fillLevel( cutBuffer.data(), envTotalFrames, envReleaseBegin, frames ); } if( m_envLfoParameters[Resonance]->isUsed() ) { - m_envLfoParameters[Resonance]->fillLevel( resBuffer, envTotalFrames, envReleaseBegin, frames ); + m_envLfoParameters[Resonance]->fillLevel( resBuffer.data(), envTotalFrames, envReleaseBegin, frames ); } const float fcv = m_filterCutModel.value(); @@ -246,8 +247,8 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer, if( m_envLfoParameters[Volume]->isUsed() ) { - float volBuffer [frames]; - m_envLfoParameters[Volume]->fillLevel( volBuffer, envTotalFrames, envReleaseBegin, frames ); + QVarLengthArray volBuffer(frames); + m_envLfoParameters[Volume]->fillLevel( volBuffer.data(), envTotalFrames, envReleaseBegin, frames ); for( fpp_t frame = 0; frame < frames; ++frame ) { diff --git a/src/core/LocklessAllocator.cpp b/src/core/LocklessAllocator.cpp index 8a7a2fb546c..3133a1f0818 100644 --- a/src/core/LocklessAllocator.cpp +++ b/src/core/LocklessAllocator.cpp @@ -25,10 +25,12 @@ #include "LocklessAllocator.h" #include -#include #include "lmmsconfig.h" +#ifndef LMMS_BUILD_WIN32 +#include +#endif static const size_t SIZEOF_SET = sizeof( int ) * 8; diff --git a/src/core/MicroTimer.cpp b/src/core/MicroTimer.cpp new file mode 100644 index 00000000000..ba94f1c9a72 --- /dev/null +++ b/src/core/MicroTimer.cpp @@ -0,0 +1,27 @@ +#include "MicroTimer.h" + +using namespace std; +using namespace std::chrono; + +static_assert(ratio_less_equal::value, + "MicroTimer: steady_clock doesn't support microsecond resolution"); + +MicroTimer::MicroTimer() +{ + reset(); +} + +MicroTimer::~MicroTimer() +{ +} + +void MicroTimer::reset() +{ + begin = steady_clock::now(); +} + +int MicroTimer::elapsed() const +{ + auto now = steady_clock::now(); + return std::chrono::duration_cast>(now - begin).count(); +} diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index ed8d04a6ce8..94048fc4341 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -64,7 +64,7 @@ typedef LocklessList::Element LocklessListElement; -static __thread bool s_renderingThread; +static thread_local bool s_renderingThread; diff --git a/src/core/MixerWorkerThread.cpp b/src/core/MixerWorkerThread.cpp index e8c6bd61c08..ca31226b0e6 100644 --- a/src/core/MixerWorkerThread.cpp +++ b/src/core/MixerWorkerThread.cpp @@ -34,8 +34,6 @@ MixerWorkerThread::JobQueue MixerWorkerThread::globalJobQueue; QWaitCondition * MixerWorkerThread::queueReadyWaitCond = NULL; QList MixerWorkerThread::workerThreads; - - // implementation of internal JobQueue void MixerWorkerThread::JobQueue::reset( OperationMode _opMode ) { @@ -89,7 +87,7 @@ void MixerWorkerThread::JobQueue::wait() while( (int) m_itemsDone < (int) m_queueSize ) { #if defined(LMMS_HOST_X86) || defined(LMMS_HOST_X86_64) - asm( "pause" ); + _mm_pause(); #endif } } diff --git a/src/core/main.cpp b/src/core/main.cpp index bb1dcf289d4..6ce09681527 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -129,7 +129,7 @@ void printVersion( char *executableName ) "License as published by the Free Software Foundation; either\n" "version 2 of the License, or (at your option) any later version.\n\n" "Try \"%s --help\" for more information.\n\n", LMMS_VERSION, - PLATFORM, MACHINE, QT_VERSION_STR, GCC_VERSION, + PLATFORM, MACHINE, QT_VERSION_STR, COMPILER_VERSION, LMMS_PROJECT_COPYRIGHT, executableName ); } diff --git a/src/gui/AboutDialog.cpp b/src/gui/AboutDialog.cpp index 618d35966a8..11672e6a269 100644 --- a/src/gui/AboutDialog.cpp +++ b/src/gui/AboutDialog.cpp @@ -44,7 +44,7 @@ AboutDialog::AboutDialog(QWidget* parent) : arg( PLATFORM ). arg( MACHINE ). arg( QT_VERSION_STR ). - arg( GCC_VERSION ) ); + arg( COMPILER_VERSION ) ); versionLabel->setTextInteractionFlags( versionLabel->textInteractionFlags() | Qt::TextSelectableByMouse ); diff --git a/src/gui/dialogs/VersionedSaveDialog.cpp b/src/gui/dialogs/VersionedSaveDialog.cpp index e2720e5a122..e2acff590c4 100644 --- a/src/gui/dialogs/VersionedSaveDialog.cpp +++ b/src/gui/dialogs/VersionedSaveDialog.cpp @@ -98,7 +98,7 @@ bool VersionedSaveDialog::changeFileNameVersion(QString &fileName, bool incremen Q_ASSERT( ok ); // Can't decrement 0 - if ( !increment and version == 0 ) + if ( !increment && version == 0 ) return false; // Replace version number version = increment ? version + 1 : version - 1; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8cbe23858bf..bb846ea69d2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,7 +8,7 @@ INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include") INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}") -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x") +SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_AUTOMOC ON)