diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b370aed942..95b98c59559 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -100,7 +100,7 @@ jobs: command: | cd build make install - make appimage + make appimage || (cat appimage.log && false) cp ./lmms-*.AppImage /tmp/artifacts/ - store_artifacts: path: /tmp/artifacts/ diff --git a/.gitmodules b/.gitmodules index 94530a19710..3f4859b56d9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,3 +28,6 @@ [submodule "src/3rdparty/weakjack/weakjack"] path = src/3rdparty/weakjack/weakjack url = https://github.com/x42/weakjack.git +[submodule "src/3rdparty/mingw-std-threads"] + path = src/3rdparty/mingw-std-threads + url = https://github.com/meganz/mingw-std-threads.git diff --git a/CMakeLists.txt b/CMakeLists.txt index a9c4404cbb6..026b034ef1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ INCLUDE(CheckSubmodules) INCLUDE(AddFileDependencies) INCLUDE(CheckIncludeFiles) INCLUDE(FindPkgConfig) +INCLUDE(GenerateExportHeader) STRING(TOUPPER "${CMAKE_PROJECT_NAME}" PROJECT_NAME_UCASE) @@ -46,7 +47,6 @@ ENDIF() INCLUDE(VersionInfo) INCLUDE(DetectMachine) - OPTION(WANT_ALSA "Include ALSA (Advanced Linux Sound Architecture) support" ON) OPTION(WANT_CALF "Include CALF LADSPA plugins" ON) OPTION(WANT_CAPS "Include C* Audio Plugin Suite (LADSPA plugins)" ON) @@ -165,9 +165,14 @@ FIND_PACKAGE(Qt5Test) SET(QT_QTTEST_LIBRARY Qt5::Test) # check for libsndfile -PKG_CHECK_MODULES(SNDFILE REQUIRED sndfile>=1.0.18) -IF(NOT SNDFILE_FOUND) - MESSAGE(FATAL_ERROR "LMMS requires libsndfile1 and libsndfile1-dev >= 1.0.18 - please install, remove CMakeCache.txt and try again!") +IF(PKG_CONFIG_FOUND) + PKG_CHECK_MODULES(SNDFILE REQUIRED sndfile>=1.0.18) + IF(NOT SNDFILE_FOUND) + MESSAGE(FATAL_ERROR "LMMS requires libsndfile1 and libsndfile1-dev >= 1.0.18 - please install, remove CMakeCache.txt and try again!") + ENDIF() +ELSE() + FIND_PACKAGE(LibSndFile 1.0.18 REQUIRED) + SET(SNDFILE_LIBRARIES sndfile-shared) ENDIF() # check if we can use SF_SET_COMPRESSION_LEVEL IF(NOT SNDFILE_VERSION VERSION_LESS 1.0.26) @@ -393,8 +398,13 @@ ENDIF(WANT_JACK) # check for FFTW3F-library -PKG_CHECK_MODULES(FFTW3F REQUIRED fftw3f>=3.0.0) - +IF(PKG_CONFIG_FOUND) + PKG_CHECK_MODULES(FFTW3F REQUIRED fftw3f>=3.0.0) +ELSE() + #currently find_package for fftw is broken in vcpkg. Replace this when fixed + FIND_PATH(FFTW3F_INCLUDE_DIRS fftw3.h) + FIND_LIBRARY(FFTW3F_LIBRARIES fftw3f) +ENDIF() # check for FLTK FIND_PACKAGE(FLTK) @@ -476,10 +486,16 @@ ELSE() ENDIF(WANT_DEBUG_FPE) # check for libsamplerate -PKG_CHECK_MODULES(SAMPLERATE REQUIRED samplerate>=0.1.8) +IF(PKG_CONFIG_FOUND) + PKG_CHECK_MODULES(SAMPLERATE REQUIRED samplerate>=0.1.8) +ELSE() + #TODO no cmake config support. Can we check the version some other way? + FIND_FILE(SAMPLERATE_INCLUDE_DIRS samplerate.h) + FIND_LIBRARY(SAMPLERATE_LIBRARIES libsamplerate-0) +ENDIF() # set compiler flags -IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|AppleClang") +IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") 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}) @@ -699,4 +715,5 @@ MESSAGE( "-----------------------------------------------------------------\n" "\n\n") +SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "${BIN_DIR}") INCLUDE(InstallRequiredSystemLibraries) diff --git a/cmake/build_win32.sh b/cmake/build_win32.sh index 6fbf5287b66..33cd8ecce17 100755 --- a/cmake/build_win32.sh +++ b/cmake/build_win32.sh @@ -37,4 +37,4 @@ fi CMAKE_OPTS="-DCMAKE_PREFIX_PATH=$MINGW $CMAKE_OPTS" # shellcheck disable=SC2086 -cmake "$DIR/.." -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" -DCMAKE_MODULE_PATH="$DIR/../cmake/modules/" $CMAKE_OPTS +cmake "$DIR/.." -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" $CMAKE_OPTS diff --git a/cmake/linux/package_linux.sh.in b/cmake/linux/package_linux.sh.in index ec6224e3536..069938656e9 100644 --- a/cmake/linux/package_linux.sh.in +++ b/cmake/linux/package_linux.sh.in @@ -126,26 +126,32 @@ EOL chmod +x "${APPDIR}usr/bin/lmms" -# Per https://github.com/probonopd/linuxdeployqt/issues/129 +# Per https://github.com/probonopd/linuxdeployqt/issues/129 unset LD_LIBRARY_PATH # Ensure linuxdeployqt can find shared objects export LD_LIBRARY_PATH="${APPDIR}usr/lib/lmms/":$LD_LIBRARY_PATH # Handle wine linking -if [ -d "@WINE_LIBRARY_FIX@" ]; then - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@WINE_LIBRARY_FIX@:@WINE_LIBRARY_FIX@wine/ +if [ -d "@WINE_32_LIBRARY_DIR@" ]; then + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH/wine/:@WINE_32_LIBRARY_DIR@:@WINE_32_LIBRARY_DIR@wine/ +fi +if [ -d "@WINE_64_LIBRARY_DIR@" ]; then + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH/wine/:@WINE_64_LIBRARY_DIR@:@WINE_64_LIBRARY_DIR@wine/ fi # Move executables so linuxdeployqt can find them ZYNLIB="${APPDIR}usr/lib/lmms/RemoteZynAddSubFx" -VSTLIB="${APPDIR}usr/lib/lmms/RemoteVstPlugin.exe.so" +VSTLIB32="${APPDIR}usr/lib/lmms/RemoteVstPlugin32.exe.so" +VSTLIB64="${APPDIR}usr/lib/lmms/RemoteVstPlugin64.exe.so" ZYNBIN="${APPDIR}usr/bin/RemoteZynAddSubFx" -VSTBIN="${APPDIR}usr/bin/RemoteVstPlugin.exe.so" +VSTBIN32="${APPDIR}usr/bin/RemoteVstPlugin32.exe.so" +VSTBIN64="${APPDIR}usr/bin/RemoteVstPlugin64.exe.so" mv "$ZYNLIB" "$ZYNBIN" -mv "$VSTLIB" "$VSTBIN" +mv "$VSTLIB32" "$VSTBIN32" +mv "$VSTLIB64" "$VSTBIN64" # Patch the desktop file sed -i 's/.*Exec=.*/Exec=lmms.real/' "$DESKTOPFILE" @@ -156,7 +162,8 @@ for file in "${APPDIR}usr/lib/lmms/"*.so; do executables="${executables} -executable=$thisfile" done executables="${executables} -executable=${ZYNBIN}" -executables="${executables} -executable=${VSTBIN}" +executables="${executables} -executable=${VSTBIN32}" +executables="${executables} -executable=${VSTBIN64}" executables="${executables} -executable=${APPDIR}usr/lib/lmms/ladspa/imp_1199.so" executables="${executables} -executable=${APPDIR}usr/lib/lmms/ladspa/imbeq_1197.so" executables="${executables} -executable=${APPDIR}usr/lib/lmms/ladspa/pitch_scale_1193.so" @@ -171,7 +178,8 @@ success "Bundled and relinked dependencies" # Link to original location so lmms can find them ln -sr "$ZYNBIN" "$ZYNLIB" -ln -sr "$VSTBIN" "$VSTLIB" +ln -sr "$VSTBIN32" "$VSTLIB32" +ln -sr "$VSTBIN64" "$VSTLIB64" # Remove wine library conflict rm -f "${APPDIR}/usr/lib/libwine.so.1" diff --git a/cmake/modules/BuildPlugin.cmake b/cmake/modules/BuildPlugin.cmake index a527b847247..bcc89222c8a 100644 --- a/cmake/modules/BuildPlugin.cmake +++ b/cmake/modules/BuildPlugin.cmake @@ -6,7 +6,7 @@ INCLUDE(GenQrc) MACRO(BUILD_PLUGIN PLUGIN_NAME) - CMAKE_PARSE_ARGUMENTS(PLUGIN "" "" "MOCFILES;EMBEDDED_RESOURCES;UICFILES;LINK" ${ARGN}) + CMAKE_PARSE_ARGUMENTS(PLUGIN "" "LINK;EXPORT_BASE_NAME" "MOCFILES;EMBEDDED_RESOURCES;UICFILES" ${ARGN}) SET(PLUGIN_SOURCES ${PLUGIN_UNPARSED_ARGUMENTS}) INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/include") @@ -50,11 +50,11 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) SET(QT_LIBRARIES "${QT_OVERRIDE_LIBRARIES}") ENDIF() - IF ("${PLUGIN_LINK}" STREQUAL "SHARED") - ADD_LIBRARY(${PLUGIN_NAME} SHARED ${PLUGIN_SOURCES} ${plugin_MOC_out} ${RCC_OUT}) - ELSE () - ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES} ${plugin_MOC_out} ${RCC_OUT}) - ENDIF () + IF (NOT PLUGIN_LINK) + SET(PLUGIN_LINK "MODULE") + ENDIF() + + ADD_LIBRARY(${PLUGIN_NAME} ${PLUGIN_LINK} ${PLUGIN_SOURCES} ${plugin_MOC_out} ${RCC_OUT}) TARGET_LINK_LIBRARIES(${PLUGIN_NAME} Qt5::Widgets Qt5::Xml) @@ -62,7 +62,7 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) TARGET_LINK_LIBRARIES(${PLUGIN_NAME} lmms) ENDIF(LMMS_BUILD_WIN32) - INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION "${PLUGIN_DIR}") + INSTALL(TARGETS ${PLUGIN_NAME} DESTINATION "${PLUGIN_DIR}") IF(LMMS_BUILD_APPLE) SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader \"${CMAKE_BINARY_DIR}/lmms\"") @@ -74,5 +74,16 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) ENDIF() SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${RCC_OUT} ${plugin_MOC_out}") + + IF(NOT PLUGIN_EXPORT_BASE_NAME) + SET(PLUGIN_EXPORT_BASE_NAME "PLUGIN") + ENDIF() + + GENERATE_EXPORT_HEADER(${PLUGIN_NAME} + BASE_NAME ${PLUGIN_EXPORT_BASE_NAME} + ) + TARGET_INCLUDE_DIRECTORIES(${PLUGIN_NAME} + PUBLIC $ + ) ENDMACRO(BUILD_PLUGIN) diff --git a/cmake/modules/CheckCXXPreprocessor.cmake b/cmake/modules/CheckCXXPreprocessor.cmake new file mode 100644 index 00000000000..f841f52d149 --- /dev/null +++ b/cmake/modules/CheckCXXPreprocessor.cmake @@ -0,0 +1,33 @@ + +macro(CHECK_CXX_PREPROCESSOR VAR DIRECTIVE) + string(RANDOM DEFINED_KEY) + string(RANDOM UNDEFINED_KEY) + + set(TMP_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/CxxTmp/src.cpp") + SET(SRC " + #if ${DIRECTIVE} + #error ${DEFINED_KEY} + #else + #error ${UNDEFINED_KEY} + #endif + ") + file(WRITE ${TMP_FILENAME} "${SRC}") + try_compile(RESULT_VAR + ${CMAKE_CURRENT_BINARY_DIR} + ${TMP_FILENAME} + OUTPUT_VARIABLE OUTPUT_VAR + ) + + if(OUTPUT_VAR MATCHES ${DEFINED_KEY}) + set(${VAR} ON) + elseif(OUTPUT_VAR MATCHES ${UNDEFINED_KEY}) + set(${VAR} OFF) + else() + message(FATAL_ERROR "Can't determine if \"${DIRECTIVE}\" is true.") + endif() +endmacro() + + +macro(CHECK_CXX_DEFINE VAR DEFINE) + CHECK_CXX_PREPROCESSOR(${VAR} "defined(${DEFINE})") +endmacro() diff --git a/cmake/modules/DetectMachine.cmake b/cmake/modules/DetectMachine.cmake index 14efad76a38..a529d373299 100644 --- a/cmake/modules/DetectMachine.cmake +++ b/cmake/modules/DetectMachine.cmake @@ -16,8 +16,8 @@ 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}") +IF(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(WIN64 ON) ENDIF() IF(WIN32) diff --git a/cmake/modules/FindWine.cmake b/cmake/modules/FindWine.cmake index 9967dd9ba6b..a697a9dbc66 100644 --- a/cmake/modules/FindWine.cmake +++ b/cmake/modules/FindWine.cmake @@ -9,11 +9,18 @@ LIST(APPEND CMAKE_PREFIX_PATH /opt/wine-stable /opt/wine-devel /opt/wine-staging /usr/lib/wine/) -FIND_PATH(WINE_INCLUDE_DIR windows/windows.h PATH_SUFFIXES wine wine/wine) -FIND_LIBRARY(WINE_LIBRARY NAMES wine PATH_SUFFIXES wine i386-linux-gnu/wine) + +FIND_PATH(WINE_INCLUDE_DIR wine/exception.h PATH_SUFFIXES wine) FIND_PROGRAM(WINE_CXX NAMES wineg++ winegcc winegcc64 winegcc32 winegcc-stable PATHS /usr/lib/wine) +FIND_PROGRAM(WINE_BUILD NAMES winebuild) + +SET(_ARCHITECTURE ${CMAKE_LIBRARY_ARCHITECTURE}) + +FIND_LIBRARY(WINE_LIBRARY NAMES wine PATH_SUFFIXES wine i386-linux-gnu/wine) + +SET(CMAKE_LIBRARY_ARCHITECTURE ${_ARCHITECTURE}) SET(WINE_INCLUDE_DIRS ${WINE_INCLUDE_DIR} ) SET(WINE_LIBRARIES ${WINE_LIBRARY} ) @@ -24,6 +31,10 @@ STRING(REPLACE " " ";" WINEBUILD_FLAGS "${WINEBUILD_OUTPUT}") FOREACH(FLAG ${WINEBUILD_FLAGS}) IF("${FLAG}" MATCHES "libwinecrt0.a.*") + STRING(REGEX REPLACE "/wine/libwinecrt0.a.*" "" FLAG "${FLAG}") + + SET(WINE_64_LIBRARY_DIR "${FLAG}/") + # Debian systems STRING(REPLACE "/lib/x86_64-" "/lib/i386-" FLAG "${FLAG}") # Fedora systems @@ -33,12 +44,19 @@ FOREACH(FLAG ${WINEBUILD_FLAGS}) # WineHQ (/opt/wine-stable, /opt/wine-devel, /opt/wine-staging) STRING(REPLACE "/lib64/wine/" "/lib/wine/" FLAG "${FLAG}") - STRING(REGEX REPLACE "/wine/libwinecrt0.a.*" "" WINE_LIBRARY_FIX "${FLAG}") - SET(WINE_LIBRARY_FIX "${WINE_LIBRARY_FIX}/") + SET(WINE_32_LIBRARY_DIR "${FLAG}/") ENDIF() ENDFOREACH() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Wine DEFAULT_MSG WINE_CXX WINE_LIBRARIES WINE_INCLUDE_DIRS) -mark_as_advanced(WINE_INCLUDE_DIR WINE_LIBRARY) +mark_as_advanced(WINE_INCLUDE_DIR WINE_LIBRARY WINE_CXX WINE_BUILD) + +IF(WINE_32_LIBRARY_DIR) + SET(WINE_32_FLAGS "-L${WINE_32_LIBRARY_DIR}wine/ -L${WINE_32_LIBRARY_DIR}") +ENDIF() + +# Create winegcc wrapper +configure_file(${CMAKE_CURRENT_LIST_DIR}/winegcc_wrapper.in winegcc_wrapper @ONLY) +SET(WINEGCC "${CMAKE_CURRENT_BINARY_DIR}/winegcc_wrapper") diff --git a/cmake/modules/winegcc_wrapper.in b/cmake/modules/winegcc_wrapper.in new file mode 100755 index 00000000000..fee88c496e2 --- /dev/null +++ b/cmake/modules/winegcc_wrapper.in @@ -0,0 +1,63 @@ +#!/bin/sh +# Wrapper script for winegcc to remove .exe file ending automatically +# appended by winebuild. +# See FindWine.cmake for usage + +set -e + +args="$@" + +# Find output name, link mode and architecture +while [ $# -gt 0 ]; do + key="$1" + + case $key in + -o) + output=$2 + shift + ;; + -c) + no_link=true + ;; + -m32) + win32=true + ;; + *) + + ;; + esac + + shift +done + +if [ -z "$output" ]; then + # If -c is used without specifying an output name, GCC defaults to "a.out". + if [ "$no_link" != true ]; then + output="a.out" + no_move=true + fi +fi + +# Some Wine distributions can't find their own headers. WINE_INCLUDE_DIR provided +# by FindWine.cmake +extra_args="-I@WINE_INCLUDE_DIR@" + +# Apply -m32 library fix if necessary +if [ "$win32" = true ] && [ "$no_link" != true ]; then + extra_args="$extra_args @WINE_32_FLAGS@" +fi + +# Run winegcc +export WINEBUILD=@WINE_BUILD@ +@WINE_CXX@ $extra_args $args + +if [ "$no_move" = true ] || [ "$no_link" = true ]; then + exit 0 +fi + +if [ ! -e "$output.exe" ]; then + echo "Fatal error in winegcc wrapper: No output file \"$output.exe\" found." + exit 1 +fi + +mv $output.exe $output diff --git a/cmake/nsis/CMakeLists.txt b/cmake/nsis/CMakeLists.txt index b21c920e5c3..87668d32b0b 100644 --- a/cmake/nsis/CMakeLists.txt +++ b/cmake/nsis/CMakeLists.txt @@ -1,4 +1,7 @@ SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/nsis_branding.bmp") +IF(MSVC) + STRING(REPLACE "/" "\\\\" CPACK_PACKAGE_ICON ${CPACK_PACKAGE_ICON}) +ENDIF(MSVC) SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/lmms.ico") SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_PROJECT_NAME}.exe" PARENT_SCOPE) SET(CPACK_NSIS_DISPLAY_NAME "${PROJECT_NAME_UCASE} ${VERSION}" PARENT_SCOPE) @@ -8,7 +11,8 @@ SET(CPACK_NSIS_CONTACT "${PROJECT_EMAIL}" PARENT_SCOPE) SET(CPACK_PACKAGE_EXECUTABLES "${CMAKE_PROJECT_NAME}.exe;${PROJECT_NAME_UCASE}" PARENT_SCOPE) SET(CPACK_NSIS_MENU_LINKS "${CMAKE_PROJECT_NAME}.exe;${PROJECT_NAME_UCASE}" PARENT_SCOPE) SET(CPACK_NSIS_DEFINES " - !include ${CMAKE_SOURCE_DIR}/cmake/nsis/FileAssociation.nsh + !addincludedir ${CMAKE_SOURCE_DIR}/cmake/nsis + !include FileAssociation.nsh !include LogicLib.nsh !include WinVer.nsh") SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${VERSION}-win32") diff --git a/cmake/toolchains/Ubuntu-MinGW-W64-64.cmake b/cmake/toolchains/Ubuntu-MinGW-W64-64.cmake index e10ae73116b..a1b33ec6795 100644 --- a/cmake/toolchains/Ubuntu-MinGW-W64-64.cmake +++ b/cmake/toolchains/Ubuntu-MinGW-W64-64.cmake @@ -1,2 +1,4 @@ +SET(CMAKE_TOOLCHAIN_FILE_32 "${CMAKE_CURRENT_LIST_DIR}/Ubuntu-MinGW-W64-32.cmake") + INCLUDE(${CMAKE_CURRENT_LIST_DIR}/common/Win64.cmake) INCLUDE(${CMAKE_CURRENT_LIST_DIR}/common/Ubuntu-MinGW-W64.cmake) diff --git a/cmake/toolchains/Ubuntu-MinGW-X-Trusty-64.cmake b/cmake/toolchains/Ubuntu-MinGW-X-Trusty-64.cmake index 705e41eaef1..0f448fef527 100644 --- a/cmake/toolchains/Ubuntu-MinGW-X-Trusty-64.cmake +++ b/cmake/toolchains/Ubuntu-MinGW-X-Trusty-64.cmake @@ -3,4 +3,7 @@ SET(MINGW_PREFIX32 /opt/mingw32) SET(WIN64 TRUE) +SET(CMAKE_TOOLCHAIN_FILE_32 "${CMAKE_CURRENT_LIST_DIR}/Ubuntu-MinGW-X-Trusty-32.cmake") +SET(CMAKE_PREFIX_PATH_32 "${MINGW_PREFIX32}") + INCLUDE(${CMAKE_CURRENT_LIST_DIR}/common/Ubuntu-MinGW-X-Trusty.cmake) diff --git a/data/locale/CMakeLists.txt b/data/locale/CMakeLists.txt index 3c72e7d787d..9a772640640 100644 --- a/data/locale/CMakeLists.txt +++ b/data/locale/CMakeLists.txt @@ -26,7 +26,7 @@ FOREACH(_ts_file ${lmms_LOCALES}) STRING(REPLACE ".ts" ".qm" _qm_file "${_ts_file}") STRING(REPLACE ".ts" ".qm" _qm_target "${_ts_target}") ADD_CUSTOM_TARGET(${_ts_target} - COMMAND "${QT_LUPDATE_EXECUTABLE}" -locations none -no-obsolete -I ${CMAKE_SOURCE_DIR}/include/ ${LMMS_SRCS} ${LMMS_INCLUDES} ${LMMS_UIS} `find "\"${CMAKE_SOURCE_DIR}/plugins/\"" -type f -name '*.cpp' -or -name '*.h'` -ts "\"${_ts_file}\"" + COMMAND "${QT_LUPDATE_EXECUTABLE}" -locations none -no-obsolete -I ${CMAKE_SOURCE_DIR}/include/ ${LMMS_SRCS} ${LMMS_UIS} ${CMAKE_SOURCE_DIR}/plugins -ts "\"${_ts_file}\"" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) ADD_CUSTOM_TARGET(${_qm_target} COMMAND "${QT_LRELEASE_EXECUTABLE}" "${_ts_file}" -qm "${_qm_file}" diff --git a/include/AudioSdl.h b/include/AudioSdl.h index 11942efda88..19d9606eb8b 100644 --- a/include/AudioSdl.h +++ b/include/AudioSdl.h @@ -78,17 +78,35 @@ class AudioSdl : public AudioDevice static void sdlAudioCallback( void * _udata, Uint8 * _buf, int _len ); void sdlAudioCallback( Uint8 * _buf, int _len ); +#ifdef LMMS_HAVE_SDL2 + static void sdlInputAudioCallback( void * _udata, Uint8 * _buf, int _len ); + void sdlInputAudioCallback( Uint8 * _buf, int _len ); +#endif + SDL_AudioSpec m_audioHandle; surroundSampleFrame * m_outBuf; + +#ifdef LMMS_HAVE_SDL2 + uint64_t m_currentBufferFramePos; + uint64_t m_currentBufferFramesCount; +#else Uint8 * m_convertedBuf; int m_convertedBufPos; int m_convertedBufSize; + bool m_outConvertEndian; +#endif - bool m_convertEndian; bool m_stopped; +#ifdef LMMS_HAVE_SDL2 + SDL_AudioDeviceID m_outputDevice; + + SDL_AudioSpec m_inputAudioHandle; + SDL_AudioDeviceID m_inputDevice; +#endif + } ; #endif diff --git a/include/AutomatableButton.h b/include/AutomatableButton.h index 014f1eed8b5..578063f16cd 100644 --- a/include/AutomatableButton.h +++ b/include/AutomatableButton.h @@ -34,7 +34,7 @@ class automatableButtonGroup; -class EXPORT AutomatableButton : public QPushButton, public BoolModelView +class LMMS_EXPORT AutomatableButton : public QPushButton, public BoolModelView { Q_OBJECT public: @@ -79,7 +79,7 @@ public slots: -class EXPORT automatableButtonGroup : public QWidget, public IntModelView +class LMMS_EXPORT automatableButtonGroup : public QWidget, public IntModelView { Q_OBJECT public: diff --git a/include/AutomatableModel.h b/include/AutomatableModel.h index b04f3da9c02..8dbe80efddc 100644 --- a/include/AutomatableModel.h +++ b/include/AutomatableModel.h @@ -63,7 +63,7 @@ class ControllerConnection; -class EXPORT AutomatableModel : public Model, public JournallingObject +class LMMS_EXPORT AutomatableModel : public Model, public JournallingObject { Q_OBJECT MM_OPERATORS @@ -349,7 +349,7 @@ public slots: -template class EXPORT TypedAutomatableModel : public AutomatableModel +template class LMMS_EXPORT TypedAutomatableModel : public AutomatableModel { public: using AutomatableModel::AutomatableModel; @@ -377,7 +377,7 @@ template class EXPORT TypedAutomatableModel : public AutomatableMod // some typed AutomatableModel-definitions -class EXPORT FloatModel : public TypedAutomatableModel +class LMMS_EXPORT FloatModel : public TypedAutomatableModel { Q_OBJECT public: @@ -394,7 +394,7 @@ class EXPORT FloatModel : public TypedAutomatableModel } ; -class EXPORT IntModel : public TypedAutomatableModel +class LMMS_EXPORT IntModel : public TypedAutomatableModel { Q_OBJECT public: @@ -409,7 +409,7 @@ class EXPORT IntModel : public TypedAutomatableModel } ; -class EXPORT BoolModel : public TypedAutomatableModel +class LMMS_EXPORT BoolModel : public TypedAutomatableModel { Q_OBJECT public: diff --git a/include/AutomatableModelView.h b/include/AutomatableModelView.h index 3b320434fdc..964ffdc5d63 100644 --- a/include/AutomatableModelView.h +++ b/include/AutomatableModelView.h @@ -32,7 +32,7 @@ class QMenu; class QMouseEvent; -class EXPORT AutomatableModelView : public ModelView +class LMMS_EXPORT AutomatableModelView : public ModelView { public: AutomatableModelView( Model* model, QWidget* _this ); @@ -106,7 +106,7 @@ private slots: -template class EXPORT TypedModelView : public AutomatableModelView +template class LMMS_EXPORT TypedModelView : public AutomatableModelView { public: TypedModelView( Model* model, QWidget* _this) : @@ -127,6 +127,5 @@ using FloatModelView = TypedModelView; using IntModelView = TypedModelView; using BoolModelView = TypedModelView; - #endif diff --git a/include/AutomationPattern.h b/include/AutomationPattern.h index 89dcfed7c3f..070b6c669fe 100644 --- a/include/AutomationPattern.h +++ b/include/AutomationPattern.h @@ -38,7 +38,7 @@ class MidiTime; -class EXPORT AutomationPattern : public TrackContentObject +class LMMS_EXPORT AutomationPattern : public TrackContentObject { Q_OBJECT public: diff --git a/include/BBTrack.h b/include/BBTrack.h index 9e72c4f04a9..a906b54d259 100644 --- a/include/BBTrack.h +++ b/include/BBTrack.h @@ -125,7 +125,7 @@ protected slots: -class EXPORT BBTrack : public Track +class LMMS_EXPORT BBTrack : public Track { Q_OBJECT public: diff --git a/include/BBTrackContainer.h b/include/BBTrackContainer.h index 0ac84b6d38d..2363251570b 100644 --- a/include/BBTrackContainer.h +++ b/include/BBTrackContainer.h @@ -30,7 +30,7 @@ #include "ComboBoxModel.h" -class EXPORT BBTrackContainer : public TrackContainer +class LMMS_EXPORT BBTrackContainer : public TrackContainer { Q_OBJECT mapPropertyFromModel(int,currentBB,setCurrentBB,m_bbComboBoxModel); diff --git a/include/BandLimitedWave.h b/include/BandLimitedWave.h index 55f6e482c46..386713328d4 100644 --- a/include/BandLimitedWave.h +++ b/include/BandLimitedWave.h @@ -29,7 +29,7 @@ class QDataStream; class QString; -#include "export.h" +#include "lmms_export.h" #include "interpolation.h" #include "lmms_basics.h" #include "lmms_math.h" @@ -82,7 +82,7 @@ QDataStream& operator>> ( QDataStream &in, WaveMipMap &waveMipMap ); -class EXPORT BandLimitedWave +class LMMS_EXPORT BandLimitedWave { public: enum Waveforms diff --git a/include/BufferManager.h b/include/BufferManager.h index 97c553ac994..20390644b95 100644 --- a/include/BufferManager.h +++ b/include/BufferManager.h @@ -26,10 +26,10 @@ #ifndef BUFFER_MANAGER_H #define BUFFER_MANAGER_H -#include "export.h" +#include "lmms_export.h" #include "lmms_basics.h" -class EXPORT BufferManager +class LMMS_EXPORT BufferManager { public: static void init( fpp_t framesPerPeriod ); diff --git a/include/CaptionMenu.h b/include/CaptionMenu.h index 01aa3ca5eb2..e6531fe3166 100644 --- a/include/CaptionMenu.h +++ b/include/CaptionMenu.h @@ -28,12 +28,12 @@ #include -#include "export.h" +#include "lmms_export.h" /// /// \brief A context menu with a caption /// -class EXPORT CaptionMenu : public QMenu +class LMMS_EXPORT CaptionMenu : public QMenu { Q_OBJECT public: diff --git a/include/ComboBox.h b/include/ComboBox.h index 99f7f8750bc..927c8762062 100644 --- a/include/ComboBox.h +++ b/include/ComboBox.h @@ -34,7 +34,7 @@ -class EXPORT ComboBox : public QWidget, public IntModelView +class LMMS_EXPORT ComboBox : public QWidget, public IntModelView { Q_OBJECT public: diff --git a/include/ComboBoxModel.h b/include/ComboBoxModel.h index e4088679fb5..ad3603759ad 100644 --- a/include/ComboBoxModel.h +++ b/include/ComboBoxModel.h @@ -33,7 +33,7 @@ #include "embed.h" -class EXPORT ComboBoxModel : public IntModel +class LMMS_EXPORT ComboBoxModel : public IntModel { Q_OBJECT public: diff --git a/include/ConfigManager.h b/include/ConfigManager.h index 997d7f24caf..dc5b9f485cc 100644 --- a/include/ConfigManager.h +++ b/include/ConfigManager.h @@ -34,7 +34,7 @@ #include #include -#include "export.h" +#include "lmms_export.h" class LmmsCore; @@ -51,7 +51,7 @@ const QString TRACK_ICON_PATH = "track_icons/"; const QString LOCALE_PATH = "locale/"; -class EXPORT ConfigManager : public QObject +class LMMS_EXPORT ConfigManager : public QObject { Q_OBJECT public: diff --git a/include/Controller.h b/include/Controller.h index 89a5e93717b..d4fb9473160 100644 --- a/include/Controller.h +++ b/include/Controller.h @@ -27,7 +27,7 @@ #ifndef CONTROLLER_H #define CONTROLLER_H -#include "export.h" +#include "lmms_export.h" #include "Engine.h" #include "Model.h" #include "JournallingObject.h" @@ -41,7 +41,7 @@ class ControllerConnection; typedef QVector ControllerVector; -class EXPORT Controller : public Model, public JournallingObject +class LMMS_EXPORT Controller : public Model, public JournallingObject { Q_OBJECT public: diff --git a/include/ControllerConnection.h b/include/ControllerConnection.h index e9cd543cbf5..5c4d5f20ef1 100644 --- a/include/ControllerConnection.h +++ b/include/ControllerConnection.h @@ -42,7 +42,7 @@ class ControllerConnection; typedef QVector ControllerConnectionVector; -class EXPORT ControllerConnection : public QObject, public JournallingObject +class LMMS_EXPORT ControllerConnection : public QObject, public JournallingObject { Q_OBJECT public: diff --git a/include/DataFile.h b/include/DataFile.h index 9e4ca13e38a..5c634a6faa7 100644 --- a/include/DataFile.h +++ b/include/DataFile.h @@ -29,12 +29,12 @@ #include -#include "export.h" +#include "lmms_export.h" #include "MemoryManager.h" class QTextStream; -class EXPORT DataFile : public QDomDocument +class LMMS_EXPORT DataFile : public QDomDocument { MM_OPERATORS public: @@ -134,7 +134,7 @@ class EXPORT DataFile : public QDomDocument void loadData( const QByteArray & _data, const QString & _sourceFile ); - struct EXPORT typeDescStruct + struct LMMS_EXPORT typeDescStruct { Type m_type; QString m_name; diff --git a/include/Effect.h b/include/Effect.h index 2147ab1c523..d6aa04d9710 100644 --- a/include/Effect.h +++ b/include/Effect.h @@ -37,7 +37,7 @@ class EffectChain; class EffectControls; -class EXPORT Effect : public Plugin +class LMMS_EXPORT Effect : public Plugin { MM_OPERATORS Q_OBJECT diff --git a/include/EffectChain.h b/include/EffectChain.h index 5397fe81ca1..bc1e7df8c68 100644 --- a/include/EffectChain.h +++ b/include/EffectChain.h @@ -33,7 +33,7 @@ class Effect; -class EXPORT EffectChain : public Model, public SerializingObject +class LMMS_EXPORT EffectChain : public Model, public SerializingObject { Q_OBJECT public: diff --git a/include/EffectControlDialog.h b/include/EffectControlDialog.h index d139de1738b..712f3121792 100644 --- a/include/EffectControlDialog.h +++ b/include/EffectControlDialog.h @@ -33,7 +33,7 @@ class EffectControls; -class EXPORT EffectControlDialog : public QWidget, public ModelView +class LMMS_EXPORT EffectControlDialog : public QWidget, public ModelView { Q_OBJECT public: diff --git a/include/Engine.h b/include/Engine.h index 2f940dfbf20..fc25479969b 100644 --- a/include/Engine.h +++ b/include/Engine.h @@ -30,7 +30,7 @@ #include -#include "export.h" +#include "lmms_export.h" class BBTrackContainer; class DummyTrackContainer; @@ -53,7 +53,7 @@ class Ladspa2LMMS; class LmmsCore; typedef LmmsCore Engine; -class EXPORT LmmsCore : public QObject +class LMMS_EXPORT LmmsCore : public QObject { Q_OBJECT public: diff --git a/include/EnvelopeAndLfoParameters.h b/include/EnvelopeAndLfoParameters.h index 747bb94c2ad..4824062f3be 100644 --- a/include/EnvelopeAndLfoParameters.h +++ b/include/EnvelopeAndLfoParameters.h @@ -34,7 +34,7 @@ #include "lmms_basics.h" -class EXPORT EnvelopeAndLfoParameters : public Model, public JournallingObject +class LMMS_EXPORT EnvelopeAndLfoParameters : public Model, public JournallingObject { Q_OBJECT public: diff --git a/include/ExportFilter.h b/include/ExportFilter.h index 35416f49280..950bacbcdaf 100644 --- a/include/ExportFilter.h +++ b/include/ExportFilter.h @@ -32,7 +32,7 @@ #include "Plugin.h" -class EXPORT ExportFilter : public Plugin +class LMMS_EXPORT ExportFilter : public Plugin { public: ExportFilter( const Descriptor * _descriptor ) : Plugin( _descriptor, NULL ) {} diff --git a/include/Fader.h b/include/Fader.h index 80359b4c684..018f66e0cc0 100644 --- a/include/Fader.h +++ b/include/Fader.h @@ -57,7 +57,7 @@ class TextFloat; -class EXPORT Fader : public QWidget, public FloatModelView +class LMMS_EXPORT Fader : public QWidget, public FloatModelView { Q_OBJECT public: diff --git a/include/FileDialog.h b/include/FileDialog.h index 0cade996772..c3db2393d45 100644 --- a/include/FileDialog.h +++ b/include/FileDialog.h @@ -28,9 +28,9 @@ #include -#include "export.h" +#include "lmms_export.h" -class EXPORT FileDialog : public QFileDialog +class LMMS_EXPORT FileDialog : public QFileDialog { Q_OBJECT public: diff --git a/include/FxMixer.h b/include/FxMixer.h index 053480a6a7d..2c7ef3c5ae5 100644 --- a/include/FxMixer.h +++ b/include/FxMixer.h @@ -121,7 +121,7 @@ class FxRoute : public QObject }; -class EXPORT FxMixer : public Model, public JournallingObject +class LMMS_EXPORT FxMixer : public Model, public JournallingObject { Q_OBJECT public: diff --git a/include/FxMixerView.h b/include/FxMixerView.h index 30c75983885..9b07637edef 100644 --- a/include/FxMixerView.h +++ b/include/FxMixerView.h @@ -41,7 +41,7 @@ class QButtonGroup; class FxLine; -class EXPORT FxMixerView : public QWidget, public ModelView, +class LMMS_EXPORT FxMixerView : public QWidget, public ModelView, public SerializingObjectHook { Q_OBJECT diff --git a/include/Graph.h b/include/Graph.h index dc1d1fe1631..b6de16371ba 100644 --- a/include/Graph.h +++ b/include/Graph.h @@ -38,7 +38,7 @@ class graphModel; -class EXPORT Graph : public QWidget, public ModelView +class LMMS_EXPORT Graph : public QWidget, public ModelView { Q_OBJECT public: @@ -111,7 +111,7 @@ protected slots: } ; -class EXPORT graphModel : public Model +class LMMS_EXPORT graphModel : public Model { Q_OBJECT public: diff --git a/include/GuiApplication.h b/include/GuiApplication.h index 999db30093f..8b4284c026b 100644 --- a/include/GuiApplication.h +++ b/include/GuiApplication.h @@ -27,7 +27,7 @@ #include -#include "export.h" +#include "lmms_export.h" class QLabel; @@ -40,7 +40,7 @@ class PianoRollWindow; class ProjectNotes; class SongEditorWindow; -class EXPORT GuiApplication : public QObject +class LMMS_EXPORT GuiApplication : public QObject { Q_OBJECT; public: diff --git a/include/ImportFilter.h b/include/ImportFilter.h index 1b6fe2b596a..1fc141a32b7 100644 --- a/include/ImportFilter.h +++ b/include/ImportFilter.h @@ -34,7 +34,7 @@ class TrackContainer; -class EXPORT ImportFilter : public Plugin +class LMMS_EXPORT ImportFilter : public Plugin { public: ImportFilter( const QString & _file_name, diff --git a/include/Instrument.h b/include/Instrument.h index ec7245dced2..a373ae4ac47 100644 --- a/include/Instrument.h +++ b/include/Instrument.h @@ -27,7 +27,7 @@ #define INSTRUMENT_H #include -#include "export.h" +#include "lmms_export.h" #include "lmms_basics.h" #include "MemoryManager.h" #include "MidiTime.h" @@ -41,7 +41,7 @@ class NotePlayHandle; class Track; -class EXPORT Instrument : public Plugin +class LMMS_EXPORT Instrument : public Plugin { MM_OPERATORS public: diff --git a/include/InstrumentPlayHandle.h b/include/InstrumentPlayHandle.h index f027b7d11c6..3463a128b56 100644 --- a/include/InstrumentPlayHandle.h +++ b/include/InstrumentPlayHandle.h @@ -28,9 +28,9 @@ #include "PlayHandle.h" #include "Instrument.h" #include "NotePlayHandle.h" -#include "export.h" +#include "lmms_export.h" -class EXPORT InstrumentPlayHandle : public PlayHandle +class LMMS_EXPORT InstrumentPlayHandle : public PlayHandle { public: InstrumentPlayHandle( Instrument * instrument, InstrumentTrack* instrumentTrack ); diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index 5ef604defb8..fb12e825a41 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -63,7 +63,7 @@ class LedCheckBox; class QLabel; -class EXPORT InstrumentTrack : public Track, public MidiEventProcessor +class LMMS_EXPORT InstrumentTrack : public Track, public MidiEventProcessor { Q_OBJECT MM_OPERATORS diff --git a/include/InstrumentView.h b/include/InstrumentView.h index d4f8357080d..9c6081a775d 100644 --- a/include/InstrumentView.h +++ b/include/InstrumentView.h @@ -32,7 +32,7 @@ class InstrumentTrackWindow; -class EXPORT InstrumentView : public PluginView +class LMMS_EXPORT InstrumentView : public PluginView { public: InstrumentView( Instrument * _instrument, QWidget * _parent ); diff --git a/include/JournallingObject.h b/include/JournallingObject.h index f8e1a595083..6974bef84da 100644 --- a/include/JournallingObject.h +++ b/include/JournallingObject.h @@ -31,7 +31,7 @@ #include "SerializingObject.h" -class EXPORT JournallingObject : public SerializingObject +class LMMS_EXPORT JournallingObject : public SerializingObject { public: JournallingObject(); diff --git a/include/Knob.h b/include/Knob.h index f6c9cfa9903..319b38184f9 100644 --- a/include/Knob.h +++ b/include/Knob.h @@ -43,7 +43,7 @@ enum knobTypes -class EXPORT Knob : public QWidget, public FloatModelView +class LMMS_EXPORT Knob : public QWidget, public FloatModelView { Q_OBJECT Q_ENUMS( knobTypes ) diff --git a/include/Ladspa2LMMS.h b/include/Ladspa2LMMS.h index e5d35fbb12f..14899487cf9 100644 --- a/include/Ladspa2LMMS.h +++ b/include/Ladspa2LMMS.h @@ -30,7 +30,7 @@ #include "LadspaManager.h" -class EXPORT Ladspa2LMMS : public LadspaManager +class LMMS_EXPORT Ladspa2LMMS : public LadspaManager { public: diff --git a/include/LadspaControl.h b/include/LadspaControl.h index 1cd8a304e2f..2ad895b3f5a 100644 --- a/include/LadspaControl.h +++ b/include/LadspaControl.h @@ -36,7 +36,7 @@ typedef struct PortDescription port_desc_t; -class EXPORT LadspaControl : public Model, public JournallingObject +class LMMS_EXPORT LadspaControl : public Model, public JournallingObject { Q_OBJECT public: diff --git a/include/LadspaControlView.h b/include/LadspaControlView.h index 34689af4ee3..d2d0ca44d85 100644 --- a/include/LadspaControlView.h +++ b/include/LadspaControlView.h @@ -33,7 +33,7 @@ class LadspaControl; -class EXPORT LadspaControlView : public QWidget, public ModelView +class LMMS_EXPORT LadspaControlView : public QWidget, public ModelView { Q_OBJECT public: diff --git a/include/LadspaManager.h b/include/LadspaManager.h index 2338fbd4b1c..f9ac76eae5c 100644 --- a/include/LadspaManager.h +++ b/include/LadspaManager.h @@ -36,7 +36,7 @@ #include -#include "export.h" +#include "lmms_export.h" #include "lmms_basics.h" @@ -80,7 +80,7 @@ typedef struct ladspaManagerStorage } ladspaManagerDescription; -class EXPORT LadspaManager +class LMMS_EXPORT LadspaManager { public: diff --git a/include/LcdSpinBox.h b/include/LcdSpinBox.h index d6896f52bc7..ab04ec574b6 100644 --- a/include/LcdSpinBox.h +++ b/include/LcdSpinBox.h @@ -30,7 +30,7 @@ #include "AutomatableModelView.h" -class EXPORT LcdSpinBox : public LcdWidget, public IntModelView +class LMMS_EXPORT LcdSpinBox : public LcdWidget, public IntModelView { Q_OBJECT public: diff --git a/include/LcdWidget.h b/include/LcdWidget.h index 89bafd1d169..a9c55170403 100644 --- a/include/LcdWidget.h +++ b/include/LcdWidget.h @@ -29,9 +29,9 @@ #include #include -#include "export.h" +#include "lmms_export.h" -class EXPORT LcdWidget : public QWidget +class LMMS_EXPORT LcdWidget : public QWidget { Q_OBJECT diff --git a/include/LedCheckbox.h b/include/LedCheckbox.h index b1c901ed6ca..00f74ac0547 100644 --- a/include/LedCheckbox.h +++ b/include/LedCheckbox.h @@ -32,7 +32,7 @@ class QPixmap; -class EXPORT LedCheckBox : public AutomatableButton +class LMMS_EXPORT LedCheckBox : public AutomatableButton { Q_OBJECT public: diff --git a/include/LmmsPalette.h b/include/LmmsPalette.h index 5016ee978a7..49b831346db 100644 --- a/include/LmmsPalette.h +++ b/include/LmmsPalette.h @@ -24,13 +24,13 @@ */ #include -#include "export.h" +#include "lmms_export.h" #ifndef LMMSPALETTE_H #define LMMSPALETTE_H -class EXPORT LmmsPalette : public QWidget +class LMMS_EXPORT LmmsPalette : public QWidget { Q_OBJECT Q_PROPERTY( QColor background READ background WRITE setBackground ) diff --git a/include/MainWindow.h b/include/MainWindow.h index 0c6addcdb71..531cdfd528b 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -61,7 +61,7 @@ class MainWindow : public QMainWindow void addSpacingToToolBar( int _size ); // wrap the widget with a window decoration and add it to the workspace - EXPORT SubWindow* addWindowedWidget(QWidget *w, Qt::WindowFlags windowFlags=0); + LMMS_EXPORT SubWindow* addWindowedWidget(QWidget *w, Qt::WindowFlags windowFlags=0); /// diff --git a/include/MemoryManager.h b/include/MemoryManager.h index 23561e4c0ac..4c225e026a9 100644 --- a/include/MemoryManager.h +++ b/include/MemoryManager.h @@ -30,9 +30,9 @@ #include #include -#include "export.h" +#include "lmms_export.h" -class EXPORT MemoryManager +class LMMS_EXPORT MemoryManager { public: struct ThreadGuard diff --git a/include/MidiTime.h b/include/MidiTime.h index 37fcf625898..7aaacf96344 100644 --- a/include/MidiTime.h +++ b/include/MidiTime.h @@ -29,7 +29,7 @@ #include -#include "export.h" +#include "lmms_export.h" #include "lmms_basics.h" // note: 1 "Tact" = 1 Measure @@ -40,7 +40,7 @@ const int DefaultBeatsPerTact = DefaultTicksPerTact / DefaultStepsPerTact; class MeterModel; -class EXPORT TimeSig +class LMMS_EXPORT TimeSig { public: // in a time signature, @@ -57,7 +57,7 @@ class EXPORT TimeSig }; -class EXPORT MidiTime +class LMMS_EXPORT MidiTime { public: MidiTime( const tact_t tact, const tick_t ticks ); diff --git a/include/Mixer.h b/include/Mixer.h index 49920589250..bd057753ac6 100644 --- a/include/Mixer.h +++ b/include/Mixer.h @@ -66,7 +66,7 @@ const Octaves BaseOctave = DefaultOctave; class MixerWorkerThread; -class EXPORT Mixer : public QObject +class LMMS_EXPORT Mixer : public QObject { Q_OBJECT public: diff --git a/include/Model.h b/include/Model.h index 55e735a05a3..290639cc119 100644 --- a/include/Model.h +++ b/include/Model.h @@ -28,10 +28,10 @@ #include #include -#include "export.h" +#include "lmms_export.h" -class EXPORT Model : public QObject +class LMMS_EXPORT Model : public QObject { Q_OBJECT public: diff --git a/include/ModelView.h b/include/ModelView.h index a1071ddc273..907cd14efdf 100644 --- a/include/ModelView.h +++ b/include/ModelView.h @@ -29,7 +29,7 @@ #include "Model.h" -class EXPORT ModelView +class LMMS_EXPORT ModelView { public: ModelView( Model* model, QWidget* widget ); diff --git a/include/Note.h b/include/Note.h index c14f9d93109..0eae8f6b05c 100644 --- a/include/Note.h +++ b/include/Note.h @@ -78,7 +78,7 @@ const float MaxDetuning = 4 * 12.0f; -class EXPORT Note : public SerializingObject +class LMMS_EXPORT Note : public SerializingObject { public: Note( const MidiTime & length = MidiTime( 0 ), diff --git a/include/NotePlayHandle.h b/include/NotePlayHandle.h index f4b6c9ec4f0..c94a69c2ce1 100644 --- a/include/NotePlayHandle.h +++ b/include/NotePlayHandle.h @@ -42,7 +42,7 @@ typedef QList NotePlayHandleList; typedef QList ConstNotePlayHandleList; -class EXPORT NotePlayHandle : public PlayHandle, public Note +class LMMS_EXPORT NotePlayHandle : public PlayHandle, public Note { MM_OPERATORS public: diff --git a/include/Oscillator.h b/include/Oscillator.h index 6e89f9cb115..408e69dbc6c 100644 --- a/include/Oscillator.h +++ b/include/Oscillator.h @@ -39,7 +39,7 @@ class IntModel; -class EXPORT Oscillator +class LMMS_EXPORT Oscillator { MM_OPERATORS public: diff --git a/include/Pattern.h b/include/Pattern.h index 5924a0862ae..eddbed313f1 100644 --- a/include/Pattern.h +++ b/include/Pattern.h @@ -46,7 +46,7 @@ class SampleBuffer; -class EXPORT Pattern : public TrackContentObject +class LMMS_EXPORT Pattern : public TrackContentObject { Q_OBJECT public: diff --git a/include/PeakController.h b/include/PeakController.h index 39d7fded906..b2824f0ac55 100644 --- a/include/PeakController.h +++ b/include/PeakController.h @@ -36,7 +36,7 @@ class PeakControllerEffect; typedef QVector PeakControllerEffectVector; -class EXPORT PeakController : public Controller +class LMMS_EXPORT PeakController : public Controller { Q_OBJECT public: diff --git a/include/PixmapButton.h b/include/PixmapButton.h index 9f6ef807141..e44f5d95269 100644 --- a/include/PixmapButton.h +++ b/include/PixmapButton.h @@ -31,7 +31,7 @@ #include "AutomatableButton.h" -class EXPORT PixmapButton : public AutomatableButton +class LMMS_EXPORT PixmapButton : public AutomatableButton { Q_OBJECT public: diff --git a/include/PlayHandle.h b/include/PlayHandle.h index a1c8e5c33da..1760e1ec7c1 100644 --- a/include/PlayHandle.h +++ b/include/PlayHandle.h @@ -28,7 +28,7 @@ #include #include -#include "export.h" +#include "lmms_export.h" #include "MemoryManager.h" @@ -40,7 +40,7 @@ class QThread; class Track; class AudioPort; -class EXPORT PlayHandle : public ThreadableJob +class LMMS_EXPORT PlayHandle : public ThreadableJob { public: enum Types diff --git a/include/Plugin.h b/include/Plugin.h index 79399763580..a2cc7d696ab 100644 --- a/include/Plugin.h +++ b/include/Plugin.h @@ -41,7 +41,7 @@ class PluginView; class AutomatableModel; -class EXPORT Plugin : public Model, public JournallingObject +class LMMS_EXPORT Plugin : public Model, public JournallingObject { MM_OPERATORS Q_OBJECT @@ -78,7 +78,7 @@ class EXPORT Plugin : public Model, public JournallingObject return QString( supportedFileTypes ).split( QChar( ',' ) ).contains( extension ); } - class EXPORT SubPluginFeatures + class LMMS_EXPORT SubPluginFeatures { public: struct Key diff --git a/include/PluginFactory.h b/include/PluginFactory.h index fb3e8ea9412..56d32c4e421 100644 --- a/include/PluginFactory.h +++ b/include/PluginFactory.h @@ -31,12 +31,12 @@ #include #include -#include "export.h" +#include "lmms_export.h" #include "Plugin.h" class QLibrary; -class EXPORT PluginFactory +class LMMS_EXPORT PluginFactory { public: struct PluginInfo diff --git a/include/PluginView.h b/include/PluginView.h index 414e2bcae91..476d65acf49 100644 --- a/include/PluginView.h +++ b/include/PluginView.h @@ -31,7 +31,7 @@ #include "ModelView.h" -class EXPORT PluginView : public QWidget, public ModelView +class LMMS_EXPORT PluginView : public QWidget, public ModelView { public: PluginView( Plugin * _plugin, QWidget * _parent ) : diff --git a/include/PresetPreviewPlayHandle.h b/include/PresetPreviewPlayHandle.h index 313c20897ad..57996fa1714 100644 --- a/include/PresetPreviewPlayHandle.h +++ b/include/PresetPreviewPlayHandle.h @@ -32,7 +32,7 @@ class InstrumentTrack; class PreviewTrackContainer; -class EXPORT PresetPreviewPlayHandle : public PlayHandle +class LMMS_EXPORT PresetPreviewPlayHandle : public PlayHandle { public: PresetPreviewPlayHandle( const QString& presetFile, bool loadByPlugin = false, DataFile *dataFile = 0 ); diff --git a/include/ProjectNotes.h b/include/ProjectNotes.h index 4477b112fe0..ab82e4eeb8b 100644 --- a/include/ProjectNotes.h +++ b/include/ProjectNotes.h @@ -37,7 +37,7 @@ class QTextCharFormat; class QTextEdit; -class EXPORT ProjectNotes : public QMainWindow, public SerializingObject +class LMMS_EXPORT ProjectNotes : public QMainWindow, public SerializingObject { Q_OBJECT public: diff --git a/include/ProjectRenderer.h b/include/ProjectRenderer.h index acc51206302..4f932ad3495 100644 --- a/include/ProjectRenderer.h +++ b/include/ProjectRenderer.h @@ -30,8 +30,9 @@ #include "Mixer.h" #include "OutputSettings.h" +#include "lmms_export.h" -class ProjectRenderer : public QThread +class LMMS_EXPORT ProjectRenderer : public QThread { Q_OBJECT public: diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index e0df850033a..57f6b379b79 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -25,7 +25,6 @@ #ifndef REMOTE_PLUGIN_H #define REMOTE_PLUGIN_H -#include "export.h" #include "MidiEvent.h" #include "VstSyncData.h" @@ -79,8 +78,8 @@ typedef int32_t key_t; #ifdef BUILD_REMOTE_PLUGIN_CLIENT -#undef EXPORT -#define EXPORT +#undef LMMS_EXPORT +#define LMMS_EXPORT #define COMPILE_REMOTE_PLUGIN_BASE #ifndef SYNC_WITH_SHM_FIFO @@ -89,6 +88,7 @@ typedef int32_t key_t; #endif #else +#include "lmms_export.h" #include #include #include @@ -444,7 +444,7 @@ enum RemoteMessageIDs -class EXPORT RemotePluginBase +class LMMS_EXPORT RemotePluginBase { public: struct message @@ -768,7 +768,7 @@ class ProcessWatcher : public QThread } ; -class EXPORT RemotePlugin : public QObject, public RemotePluginBase +class LMMS_EXPORT RemotePlugin : public QObject, public RemotePluginBase { Q_OBJECT public: @@ -854,12 +854,11 @@ public slots: } + bool m_failed; private: void resizeSharedProcessingMemory(); - bool m_failed; - QProcess m_process; ProcessWatcher m_watcher; @@ -886,6 +885,7 @@ public slots: private slots: void processFinished( int exitCode, QProcess::ExitStatus exitStatus ); + void processErrored(QProcess::ProcessError err ); } ; #endif diff --git a/include/RingBuffer.h b/include/RingBuffer.h index 3386c117582..c761616bd78 100644 --- a/include/RingBuffer.h +++ b/include/RingBuffer.h @@ -32,7 +32,7 @@ #include "lmms_math.h" #include "MemoryManager.h" -class EXPORT RingBuffer : public QObject +class LMMS_EXPORT RingBuffer : public QObject { Q_OBJECT MM_OPERATORS diff --git a/include/SampleBuffer.h b/include/SampleBuffer.h index 974da669f39..26dda70a9fe 100644 --- a/include/SampleBuffer.h +++ b/include/SampleBuffer.h @@ -31,7 +31,7 @@ #include -#include "export.h" +#include "lmms_export.h" #include "interpolation.h" #include "lmms_basics.h" #include "lmms_math.h" @@ -48,7 +48,7 @@ class QRect; // may need to be higher - conversely, to optimize, some may work with lower values const f_cnt_t MARGIN[] = { 64, 64, 64, 4, 4 }; -class EXPORT SampleBuffer : public QObject, public sharedObject +class LMMS_EXPORT SampleBuffer : public QObject, public sharedObject { Q_OBJECT MM_OPERATORS @@ -58,7 +58,7 @@ class EXPORT SampleBuffer : public QObject, public sharedObject LoopOn, LoopPingPong }; - class EXPORT handleState + class LMMS_EXPORT handleState { MM_OPERATORS public: diff --git a/include/SerializingObject.h b/include/SerializingObject.h index e82ac7fcb3d..b61794d7cda 100644 --- a/include/SerializingObject.h +++ b/include/SerializingObject.h @@ -27,7 +27,7 @@ #include -#include "export.h" +#include "lmms_export.h" class QDomDocument; @@ -36,7 +36,7 @@ class QDomElement; class SerializingObjectHook; -class EXPORT SerializingObject +class LMMS_EXPORT SerializingObject { public: SerializingObject(); diff --git a/include/Song.h b/include/Song.h index 8b2c2131677..1f012f1be06 100644 --- a/include/Song.h +++ b/include/Song.h @@ -48,7 +48,7 @@ const bpm_t MaxTempo = 999; const tick_t MaxSongLength = 9999 * DefaultTicksPerTact; -class EXPORT Song : public TrackContainer +class LMMS_EXPORT Song : public TrackContainer { Q_OBJECT mapPropertyFromModel( int,getTempo,setTempo,m_tempoModel ); diff --git a/include/StringPairDrag.h b/include/StringPairDrag.h index a69d7d14380..cebc3089a15 100644 --- a/include/StringPairDrag.h +++ b/include/StringPairDrag.h @@ -31,12 +31,12 @@ #include #include -#include "export.h" +#include "lmms_export.h" class QPixmap; -class EXPORT StringPairDrag : public QDrag +class LMMS_EXPORT StringPairDrag : public QDrag { public: StringPairDrag( const QString & _key, const QString & _value, diff --git a/include/SubWindow.h b/include/SubWindow.h index 24485109ef6..067f9e31268 100644 --- a/include/SubWindow.h +++ b/include/SubWindow.h @@ -34,7 +34,7 @@ #include #include -#include "export.h" +#include "lmms_export.h" class QMoveEvent; class QResizeEvent; @@ -48,7 +48,7 @@ class QWidget; * for cusomizing the title bar appearance, lmms implements its own subwindow * class. */ -class EXPORT SubWindow : public QMdiSubWindow +class LMMS_EXPORT SubWindow : public QMdiSubWindow { Q_OBJECT Q_PROPERTY( QBrush activeColor READ activeColor WRITE setActiveColor ) diff --git a/include/TabBar.h b/include/TabBar.h index 4ef0b1ac797..48b429bd54e 100644 --- a/include/TabBar.h +++ b/include/TabBar.h @@ -30,13 +30,13 @@ #include #include -#include "export.h" +#include "lmms_export.h" class TabButton; -class EXPORT TabBar : public QWidget +class LMMS_EXPORT TabBar : public QWidget { Q_OBJECT public: diff --git a/include/TempoSyncKnob.h b/include/TempoSyncKnob.h index 343deb0675d..034e2b8f4b7 100644 --- a/include/TempoSyncKnob.h +++ b/include/TempoSyncKnob.h @@ -34,7 +34,7 @@ class MeterDialog; -class EXPORT TempoSyncKnob : public Knob +class LMMS_EXPORT TempoSyncKnob : public Knob { Q_OBJECT public: diff --git a/include/TempoSyncKnobModel.h b/include/TempoSyncKnobModel.h index 893e23eb45a..9a8ad619c11 100644 --- a/include/TempoSyncKnobModel.h +++ b/include/TempoSyncKnobModel.h @@ -30,7 +30,7 @@ class QAction; -class EXPORT TempoSyncKnobModel : public FloatModel +class LMMS_EXPORT TempoSyncKnobModel : public FloatModel { Q_OBJECT public: diff --git a/include/TextFloat.h b/include/TextFloat.h index 673e40e6396..ed10516b552 100644 --- a/include/TextFloat.h +++ b/include/TextFloat.h @@ -29,10 +29,10 @@ #include #include -#include "export.h" +#include "lmms_export.h" -class EXPORT TextFloat : public QWidget +class LMMS_EXPORT TextFloat : public QWidget { Q_OBJECT public: diff --git a/include/ToolPlugin.h b/include/ToolPlugin.h index bc8b3cf18f9..8a65147ac80 100644 --- a/include/ToolPlugin.h +++ b/include/ToolPlugin.h @@ -29,7 +29,7 @@ #include "Plugin.h" -class EXPORT ToolPlugin : public Plugin +class LMMS_EXPORT ToolPlugin : public Plugin { public: ToolPlugin( const Descriptor * _descriptor, Model * _parent ); diff --git a/include/ToolPluginView.h b/include/ToolPluginView.h index de0f8bb1ee5..2b64caaafd3 100644 --- a/include/ToolPluginView.h +++ b/include/ToolPluginView.h @@ -30,7 +30,7 @@ class ToolPlugin; -class EXPORT ToolPluginView : public PluginView +class LMMS_EXPORT ToolPluginView : public PluginView { public: ToolPluginView( ToolPlugin * _toolPlugin ); diff --git a/include/ToolTip.h b/include/ToolTip.h index 76b571bca43..7f769a05b2a 100644 --- a/include/ToolTip.h +++ b/include/ToolTip.h @@ -28,14 +28,14 @@ #include -#include "export.h" +#include "lmms_export.h" class QWidget; struct ToolTip { - static void EXPORT add( QWidget * _w, const QString & _txt ); + static void LMMS_EXPORT add( QWidget * _w, const QString & _txt ); } ; diff --git a/include/Track.h b/include/Track.h index 6ac6e390f18..302dcb5cc1d 100644 --- a/include/Track.h +++ b/include/Track.h @@ -463,7 +463,7 @@ private slots: // base-class for all tracks -class EXPORT Track : public Model, public JournallingObject +class LMMS_EXPORT Track : public Model, public JournallingObject { Q_OBJECT MM_OPERATORS diff --git a/include/TrackContainer.h b/include/TrackContainer.h index 33569c9d98e..1caca922e23 100644 --- a/include/TrackContainer.h +++ b/include/TrackContainer.h @@ -37,7 +37,7 @@ class InstrumentTrack; class TrackContainerView; -class EXPORT TrackContainer : public Model, public JournallingObject +class LMMS_EXPORT TrackContainer : public Model, public JournallingObject { Q_OBJECT public: diff --git a/include/ValueBuffer.h b/include/ValueBuffer.h index 1e714d45559..f9869de8888 100644 --- a/include/ValueBuffer.h +++ b/include/ValueBuffer.h @@ -29,9 +29,9 @@ #include #include "MemoryManager.h" -#include "export.h" +#include "lmms_export.h" -class EXPORT ValueBuffer : public std::vector +class LMMS_EXPORT ValueBuffer : public std::vector { MM_OPERATORS public: diff --git a/include/aeffectx.h b/include/aeffectx.h index b2f8f0c6d75..133d925acd8 100644 --- a/include/aeffectx.h +++ b/include/aeffectx.h @@ -28,6 +28,9 @@ #include +// Calling convention +#define VST_CALL_CONV __cdecl + #define CCONST(a, b, c, d)( ( ( (int32_t) a ) << 24 ) | \ ( ( (int32_t) b ) << 16 ) | \ ( ( (int32_t) c ) << 8 ) | \ @@ -205,13 +208,13 @@ class AEffect // 00-03 int32_t magic; // dispatcher 04-07 - intptr_t (* dispatcher)( AEffect * , int32_t , int32_t , intptr_t, void * , float ); + intptr_t (VST_CALL_CONV * dispatcher)( AEffect * , int32_t , int32_t , intptr_t, void * , float ); // process, quite sure 08-0b - void (* process)( AEffect * , float * * , float * * , int32_t ); + void (VST_CALL_CONV * process)( AEffect * , float * * , float * * , int32_t ); // setParameter 0c-0f - void (* setParameter)( AEffect * , int32_t , float ); + void (VST_CALL_CONV * setParameter)( AEffect * , int32_t , float ); // getParameter 10-13 - float (* getParameter)( AEffect * , int32_t ); + float (VST_CALL_CONV * getParameter)( AEffect * , int32_t ); // programs 14-17 int32_t numPrograms; // Params 18-1b @@ -238,7 +241,7 @@ class AEffect // Don't know 4c-4f char unknown1[4]; // processReplacing 50-53 - void (* processReplacing)( AEffect * , float * * , float * * , int ); + void (VST_CALL_CONV * processReplacing)( AEffect * , float * * , float * * , int ); } ; @@ -281,7 +284,7 @@ class VstTimeInfo -typedef intptr_t (* audioMasterCallback)( AEffect * , int32_t, int32_t, intptr_t, void * , float ); +typedef intptr_t (VST_CALL_CONV * audioMasterCallback)( AEffect * , int32_t, int32_t, intptr_t, void * , float ); #endif diff --git a/include/embed.h b/include/embed.h index 57ca743cdda..6348331f7e5 100644 --- a/include/embed.h +++ b/include/embed.h @@ -28,15 +28,15 @@ #include #include -#include "export.h" +#include "lmms_export.h" #include "lmms_basics.h" namespace embed { -QPixmap EXPORT getIconPixmap( const QString& _name, int _w = -1, int _h = -1 ); -QString EXPORT getText( const char * _name ); +QPixmap LMMS_EXPORT getIconPixmap( const QString& _name, int _w = -1, int _h = -1 ); +QString LMMS_EXPORT getText( const char * _name ); } diff --git a/include/export.h b/include/export.h deleted file mode 100644 index dd3709704f3..00000000000 --- a/include/export.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * export.h - macros for export-declarations - * - * Copyright (c) 2008 Tobias Doerffel - * - * This file is part of LMMS - https://lmms.io - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program (see COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - */ - -#ifndef EXPORT_H -#define EXPORT_H - -#include "lmmsconfig.h" - -#ifdef LMMS_BUILD_WIN32 - -#ifdef PLUGIN_NAME -#define EXPORT __declspec(dllimport) -#define PLUGIN_EXPORT __declspec(dllexport) -#else -#define EXPORT __declspec(dllexport) -#endif - -#else - -#define EXPORT -#define PLUGIN_EXPORT - -#endif - -#endif diff --git a/include/fft_helpers.h b/include/fft_helpers.h index c28af023765..23450d2ca5a 100644 --- a/include/fft_helpers.h +++ b/include/fft_helpers.h @@ -26,7 +26,7 @@ #ifndef FFT_HELPERS_H #define FFT_HELPERS_H -#include "export.h" +#include "lmms_export.h" #include @@ -44,13 +44,13 @@ enum WINDOWS * * returns -1 on error */ -float EXPORT maximum( float * _abs_spectrum, unsigned int _spec_size ); +float LMMS_EXPORT maximum( float * _abs_spectrum, unsigned int _spec_size ); /* apply hanning or hamming window to channel * * returns -1 on error */ -int EXPORT hanming( float * _timebuffer, int _length, WINDOWS _type ); +int LMMS_EXPORT hanming( float * _timebuffer, int _length, WINDOWS _type ); /* compute absolute values of complex_buffer, save to absspec_buffer * take care that - compl_len is not bigger than complex_buffer! @@ -58,7 +58,7 @@ int EXPORT hanming( float * _timebuffer, int _length, WINDOWS _type ); * * returns 0 on success, else -1 */ -int EXPORT absspec( fftwf_complex * _complex_buffer, float * _absspec_buffer, +int LMMS_EXPORT absspec( fftwf_complex * _complex_buffer, float * _absspec_buffer, int _compl_length ); /* build fewer subbands from many absolute spectrum values @@ -67,11 +67,11 @@ int EXPORT absspec( fftwf_complex * _complex_buffer, float * _absspec_buffer, * * returns 0 on success, else -1 */ -int EXPORT compressbands( float * _absspec_buffer, float * _compressedband, +int LMMS_EXPORT compressbands( float * _absspec_buffer, float * _compressedband, int _num_old, int _num_new, int _bottom, int _top ); -int EXPORT calc13octaveband31( float * _absspec_buffer, float * _subbands, +int LMMS_EXPORT calc13octaveband31( float * _absspec_buffer, float * _subbands, int _num_spec, float _max_frequency ); /* compute power of finite time sequence @@ -79,6 +79,6 @@ int EXPORT calc13octaveband31( float * _absspec_buffer, float * _subbands, * * returns power on success, else -1 */ -float EXPORT signalpower(float *timesignal, int num_values); +float LMMS_EXPORT signalpower(float *timesignal, int num_values); #endif diff --git a/include/stdshims.h b/include/stdshims.h index 456d31607dc..85c4f457aab 100644 --- a/include/stdshims.h +++ b/include/stdshims.h @@ -7,8 +7,10 @@ #include #include -#if (__cplusplus >= 201402L) +#if (__cplusplus >= 201402L || _MSC_VER) +#ifndef _MSC_VER #warning "This file should now be removed! The functions it provides are part of the C++14 standard." +#endif using std::make_unique; #else diff --git a/plugins/Amplifier/Amplifier.cpp b/plugins/Amplifier/Amplifier.cpp index c11fa6bcc1c..d90ea55b329 100644 --- a/plugins/Amplifier/Amplifier.cpp +++ b/plugins/Amplifier/Amplifier.cpp @@ -26,7 +26,7 @@ #include "Amplifier.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/BassBooster/BassBooster.cpp b/plugins/BassBooster/BassBooster.cpp index f7387b46eaa..6fdb1671c66 100644 --- a/plugins/BassBooster/BassBooster.cpp +++ b/plugins/BassBooster/BassBooster.cpp @@ -25,7 +25,7 @@ #include "BassBooster.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/Bitcrush/Bitcrush.cpp b/plugins/Bitcrush/Bitcrush.cpp index 918b8efdde5..0580d47cd5e 100644 --- a/plugins/Bitcrush/Bitcrush.cpp +++ b/plugins/Bitcrush/Bitcrush.cpp @@ -25,6 +25,7 @@ #include "Bitcrush.h" #include "embed.h" +#include "plugin_export.h" const int OS_RATE = 5; const float OS_RATIO = 1.0f / OS_RATE; diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 392a2ad459a..0f7e59443c2 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -11,6 +11,7 @@ ENDIF() INCLUDE_DIRECTORIES( ${SAMPLERATE_INCLUDE_DIRS} + "${CMAKE_BINARY_DIR}/src" ) SET(PLUGIN_LIST "" CACHE STRING "List of plug-ins to build") @@ -75,8 +76,8 @@ IF("${PLUGIN_LIST}" STREQUAL "") stereo_enhancer stereo_matrix stk - vestige vst_base + vestige VstEffect watsyn waveshaper @@ -94,9 +95,7 @@ IF(MSVC) organic ReverbSC sid - vestige vibed - vst_base VstEffect Xpressive zynaddsubfx diff --git a/plugins/CrossoverEQ/CrossoverEQ.cpp b/plugins/CrossoverEQ/CrossoverEQ.cpp index 3dc0e826574..e7d3dce7d34 100644 --- a/plugins/CrossoverEQ/CrossoverEQ.cpp +++ b/plugins/CrossoverEQ/CrossoverEQ.cpp @@ -27,6 +27,7 @@ #include "CrossoverEQ.h" #include "lmms_math.h" #include "embed.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/Delay/DelayEffect.cpp b/plugins/Delay/DelayEffect.cpp index 0161178b83c..0daad0d9d8c 100644 --- a/plugins/Delay/DelayEffect.cpp +++ b/plugins/Delay/DelayEffect.cpp @@ -26,7 +26,7 @@ #include "Engine.h" #include "embed.h" #include "interpolation.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/DualFilter/DualFilter.cpp b/plugins/DualFilter/DualFilter.cpp index 94450cc6ff7..5b8b7a622c1 100644 --- a/plugins/DualFilter/DualFilter.cpp +++ b/plugins/DualFilter/DualFilter.cpp @@ -27,7 +27,7 @@ #include "embed.h" #include "BasicFilters.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/Eq/EqEffect.cpp b/plugins/Eq/EqEffect.cpp index 64b43e5a537..6b7c61bcc49 100644 --- a/plugins/Eq/EqEffect.cpp +++ b/plugins/Eq/EqEffect.cpp @@ -24,12 +24,13 @@ #include "EqEffect.h" -#include "embed.h" #include "Engine.h" #include "EqFader.h" #include "interpolation.h" #include "lmms_math.h" +#include "embed.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/Flanger/FlangerEffect.cpp b/plugins/Flanger/FlangerEffect.cpp index 1404c06b000..7e441cf62a3 100644 --- a/plugins/Flanger/FlangerEffect.cpp +++ b/plugins/Flanger/FlangerEffect.cpp @@ -24,7 +24,9 @@ #include "FlangerEffect.h" #include "Engine.h" + #include "embed.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/FreeBoy/FreeBoy.cpp b/plugins/FreeBoy/FreeBoy.cpp index 75391e45267..1f720b825a2 100644 --- a/plugins/FreeBoy/FreeBoy.cpp +++ b/plugins/FreeBoy/FreeBoy.cpp @@ -42,6 +42,8 @@ #include "embed.h" +#include "plugin_export.h" + const blip_time_t FRAME_LENGTH = 70224; const long CLOCK_RATE = 4194304; diff --git a/plugins/GigPlayer/GigPlayer.cpp b/plugins/GigPlayer/GigPlayer.cpp index 938cd10b1bd..bf599025216 100644 --- a/plugins/GigPlayer/GigPlayer.cpp +++ b/plugins/GigPlayer/GigPlayer.cpp @@ -53,7 +53,7 @@ #include "LcdSpinBox.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { @@ -1390,7 +1390,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 GigInstrument( static_cast( _data ) ); } diff --git a/plugins/HydrogenImport/HydrogenImport.cpp b/plugins/HydrogenImport/HydrogenImport.cpp index c7536e87ec7..9f9f1dd4961 100644 --- a/plugins/HydrogenImport/HydrogenImport.cpp +++ b/plugins/HydrogenImport/HydrogenImport.cpp @@ -19,6 +19,8 @@ #include "BBTrackContainer.h" #include "Instrument.h" +#include "plugin_export.h" + #define MAX_LAYERS 4 extern "C" { diff --git a/plugins/LadspaEffect/LadspaEffect.cpp b/plugins/LadspaEffect/LadspaEffect.cpp index aceea2d4119..f9959a205c6 100644 --- a/plugins/LadspaEffect/LadspaEffect.cpp +++ b/plugins/LadspaEffect/LadspaEffect.cpp @@ -44,6 +44,7 @@ #include "embed.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/MidiExport/MidiExport.cpp b/plugins/MidiExport/MidiExport.cpp index d691c483003..fde08646f10 100644 --- a/plugins/MidiExport/MidiExport.cpp +++ b/plugins/MidiExport/MidiExport.cpp @@ -37,6 +37,7 @@ #include "BBTrack.h" #include "InstrumentTrack.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/MidiImport/MidiImport.cpp b/plugins/MidiImport/MidiImport.cpp index 1200c6f7821..46fac929931 100644 --- a/plugins/MidiImport/MidiImport.cpp +++ b/plugins/MidiImport/MidiImport.cpp @@ -44,9 +44,11 @@ #include "MainWindow.h" #include "MidiTime.h" #include "debug.h" -#include "embed.h" #include "Song.h" +#include "embed.h" +#include "plugin_export.h" + #include "portsmf/allegro.h" #define makeID(_c0, _c1, _c2, _c3) \ diff --git a/plugins/MultitapEcho/MultitapEcho.cpp b/plugins/MultitapEcho/MultitapEcho.cpp index be46a50c6b6..bff032deed9 100644 --- a/plugins/MultitapEcho/MultitapEcho.cpp +++ b/plugins/MultitapEcho/MultitapEcho.cpp @@ -25,7 +25,7 @@ #include "MultitapEcho.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/OpulenZ/OpulenZ.cpp b/plugins/OpulenZ/OpulenZ.cpp index 4b11102c37b..d8d5f3e263a 100644 --- a/plugins/OpulenZ/OpulenZ.cpp +++ b/plugins/OpulenZ/OpulenZ.cpp @@ -59,6 +59,8 @@ #include "PixmapButton.h" #include "ToolTip.h" +#include "plugin_export.h" + extern "C" { diff --git a/plugins/ReverbSC/ReverbSC.cpp b/plugins/ReverbSC/ReverbSC.cpp index bae59471cc8..3d56fd0d0ae 100644 --- a/plugins/ReverbSC/ReverbSC.cpp +++ b/plugins/ReverbSC/ReverbSC.cpp @@ -24,6 +24,7 @@ #include "ReverbSC.h" #include "embed.h" +#include "plugin_export.h" #define DB2LIN(X) pow(10, X / 20.0f); diff --git a/plugins/SpectrumAnalyzer/SpectrumAnalyzer.cpp b/plugins/SpectrumAnalyzer/SpectrumAnalyzer.cpp index f07fa7f45b0..0b947a3ba36 100644 --- a/plugins/SpectrumAnalyzer/SpectrumAnalyzer.cpp +++ b/plugins/SpectrumAnalyzer/SpectrumAnalyzer.cpp @@ -25,7 +25,7 @@ #include "SpectrumAnalyzer.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/VstEffect/CMakeLists.txt b/plugins/VstEffect/CMakeLists.txt index ec05a14ea4c..78d8e64835a 100644 --- a/plugins/VstEffect/CMakeLists.txt +++ b/plugins/VstEffect/CMakeLists.txt @@ -12,8 +12,7 @@ ENDIF() BUILD_PLUGIN(vsteffect VstEffect.cpp VstEffectControls.cpp VstEffectControlDialog.cpp VstSubPluginFeatures.cpp VstEffect.h VstEffectControls.h VstEffectControlDialog.h VstSubPluginFeatures.h MOCFILES VstEffectControlDialog.h VstEffectControls.h EMBEDDED_RESOURCES *.png) SET_TARGET_PROPERTIES(vsteffect PROPERTIES COMPILE_FLAGS "-Wno-attributes") -TARGET_LINK_LIBRARIES(vsteffect -lvstbase) -ADD_DEPENDENCIES(vsteffect vstbase) +TARGET_LINK_LIBRARIES(vsteffect vstbase) ENDIF(LMMS_SUPPORT_VST) diff --git a/plugins/VstEffect/VstEffect.cpp b/plugins/VstEffect/VstEffect.cpp index ed05a82a0ee..1a22176cda9 100644 --- a/plugins/VstEffect/VstEffect.cpp +++ b/plugins/VstEffect/VstEffect.cpp @@ -32,7 +32,7 @@ #include "VstSubPluginFeatures.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/Xpressive/Xpressive.cpp b/plugins/Xpressive/Xpressive.cpp index 8c9aa15326d..5822c9567e4 100644 --- a/plugins/Xpressive/Xpressive.cpp +++ b/plugins/Xpressive/Xpressive.cpp @@ -48,6 +48,8 @@ #include "ExprSynth.h" +#include "plugin_export.h" + extern "C" { Plugin::Descriptor PLUGIN_EXPORT xpressive_plugin_descriptor = { STRINGIFY( @@ -882,7 +884,7 @@ __attribute__((destructor)) static void module_destroy() 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 Xpressive(static_cast(_data))); } diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index 5f5f19c9d04..6c080f7c9ac 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -45,7 +45,7 @@ #include "DataFile.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index 86069a13c42..ecc77be0bc5 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -43,6 +43,8 @@ #include "embed.h" +#include "plugin_export.h" + extern "C" { diff --git a/plugins/carlabase/carla.h b/plugins/carlabase/carla.h index 6431e5300de..175a570d6ac 100644 --- a/plugins/carlabase/carla.h +++ b/plugins/carlabase/carla.h @@ -26,9 +26,9 @@ #define CARLA_H #include +#include "plugin_export.h" #include "CarlaNative.h" - #include "Instrument.h" #include "InstrumentView.h" diff --git a/plugins/carlapatchbay/carlapatchbay.cpp b/plugins/carlapatchbay/carlapatchbay.cpp index d67ffebb80c..bfc7570700e 100644 --- a/plugins/carlapatchbay/carlapatchbay.cpp +++ b/plugins/carlapatchbay/carlapatchbay.cpp @@ -43,7 +43,7 @@ Plugin::Descriptor PLUGIN_EXPORT carlapatchbay_plugin_descriptor = NULL } ; -Plugin* PLUGIN_EXPORT lmms_plugin_main(Model*, void* data) +PLUGIN_EXPORT Plugin* lmms_plugin_main(Model*, void* data) { return new CarlaInstrument(static_cast(data), &carlapatchbay_plugin_descriptor, true); } diff --git a/plugins/carlarack/carlarack.cpp b/plugins/carlarack/carlarack.cpp index 5225f46b902..420bc302985 100644 --- a/plugins/carlarack/carlarack.cpp +++ b/plugins/carlarack/carlarack.cpp @@ -43,7 +43,7 @@ Plugin::Descriptor PLUGIN_EXPORT carlarack_plugin_descriptor = NULL } ; -Plugin* PLUGIN_EXPORT lmms_plugin_main(Model*, void* data) +PLUGIN_EXPORT Plugin* lmms_plugin_main(Model*, void* data) { return new CarlaInstrument(static_cast(data), &carlarack_plugin_descriptor, false); } diff --git a/plugins/dynamics_processor/dynamics_processor.cpp b/plugins/dynamics_processor/dynamics_processor.cpp index 12ed1fa88dd..8c02b827da4 100644 --- a/plugins/dynamics_processor/dynamics_processor.cpp +++ b/plugins/dynamics_processor/dynamics_processor.cpp @@ -29,6 +29,7 @@ #include "interpolation.h" #include "embed.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/kicker/kicker.cpp b/plugins/kicker/kicker.cpp index 0318c92d2f6..2087cf88068 100644 --- a/plugins/kicker/kicker.cpp +++ b/plugins/kicker/kicker.cpp @@ -36,7 +36,7 @@ #include "KickerOsc.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/ladspa_browser/ladspa_browser.cpp b/plugins/ladspa_browser/ladspa_browser.cpp index 0e8275c4d0a..d265bc0e3e2 100644 --- a/plugins/ladspa_browser/ladspa_browser.cpp +++ b/plugins/ladspa_browser/ladspa_browser.cpp @@ -39,7 +39,7 @@ #include "TabButton.h" #include "embed.h" - +#include "plugin_export.h" extern "C" diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index 66b77ac3503..00d94f52cec 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -46,7 +46,7 @@ #include "BandLimitedWave.h" #include "embed.h" - +#include "plugin_export.h" // Envelope Recalculation period #define ENVINC 64 diff --git a/plugins/monstro/Monstro.cpp b/plugins/monstro/Monstro.cpp index 82f365ec182..44a53510074 100644 --- a/plugins/monstro/Monstro.cpp +++ b/plugins/monstro/Monstro.cpp @@ -37,6 +37,7 @@ #include "embed.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/nes/Nes.cpp b/plugins/nes/Nes.cpp index 70251c6cce9..5b34dcb1f60 100644 --- a/plugins/nes/Nes.cpp +++ b/plugins/nes/Nes.cpp @@ -36,6 +36,7 @@ #include "Oscillator.h" #include "embed.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index 2339587b5f3..8f5ae6b3611 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -42,7 +42,7 @@ #include "embed.h" - +#include "plugin_export.h" extern "C" diff --git a/plugins/patman/patman.cpp b/plugins/patman/patman.cpp index bf24c6d32b9..e555886fc9f 100644 --- a/plugins/patman/patman.cpp +++ b/plugins/patman/patman.cpp @@ -44,7 +44,7 @@ #include "embed.h" - +#include "plugin_export.h" extern "C" diff --git a/plugins/peak_controller_effect/peak_controller_effect.cpp b/plugins/peak_controller_effect/peak_controller_effect.cpp index 2b39352ff08..e8b31d6a0d3 100644 --- a/plugins/peak_controller_effect/peak_controller_effect.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect.cpp @@ -32,6 +32,7 @@ #include "lmms_math.h" #include "embed.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index 93867983d7a..292c5750f9d 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -46,7 +46,7 @@ #include "LcdSpinBox.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { @@ -1123,7 +1123,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 sf2Instrument( static_cast( _data ) ); } diff --git a/plugins/sfxr/sfxr.cpp b/plugins/sfxr/sfxr.cpp index 02e7413bbe2..c99f46f88cf 100644 --- a/plugins/sfxr/sfxr.cpp +++ b/plugins/sfxr/sfxr.cpp @@ -54,6 +54,8 @@ float frnd(float range) #include "embed.h" +#include "plugin_export.h" + extern "C" { diff --git a/plugins/sid/sid_instrument.cpp b/plugins/sid/sid_instrument.cpp index ce396083273..2eb46be565f 100644 --- a/plugins/sid/sid_instrument.cpp +++ b/plugins/sid/sid_instrument.cpp @@ -42,6 +42,7 @@ #include "ToolTip.h" #include "embed.h" +#include "plugin_export.h" #define C64_PAL_CYCLES_PER_SEC 985248 diff --git a/plugins/stereo_enhancer/stereo_enhancer.cpp b/plugins/stereo_enhancer/stereo_enhancer.cpp index cb55213f133..2faa5846d2f 100644 --- a/plugins/stereo_enhancer/stereo_enhancer.cpp +++ b/plugins/stereo_enhancer/stereo_enhancer.cpp @@ -26,7 +26,7 @@ #include "stereo_enhancer.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/stereo_matrix/stereo_matrix.cpp b/plugins/stereo_matrix/stereo_matrix.cpp index b2634e95c29..a03a615ba37 100644 --- a/plugins/stereo_matrix/stereo_matrix.cpp +++ b/plugins/stereo_matrix/stereo_matrix.cpp @@ -26,7 +26,7 @@ #include "stereo_matrix.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/stk/mallets/mallets.cpp b/plugins/stk/mallets/mallets.cpp index 964e1ddd297..7111bcdaa51 100644 --- a/plugins/stk/mallets/mallets.cpp +++ b/plugins/stk/mallets/mallets.cpp @@ -41,7 +41,7 @@ #include "Mixer.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { @@ -756,7 +756,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 malletsInstrument( static_cast( _data ) ); } diff --git a/plugins/triple_oscillator/TripleOscillator.cpp b/plugins/triple_oscillator/TripleOscillator.cpp index 55a7ed7ed3f..6b644fd468b 100644 --- a/plugins/triple_oscillator/TripleOscillator.cpp +++ b/plugins/triple_oscillator/TripleOscillator.cpp @@ -40,7 +40,7 @@ #include "ToolTip.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/vestige/CMakeLists.txt b/plugins/vestige/CMakeLists.txt index 21803a92433..823c032020a 100644 --- a/plugins/vestige/CMakeLists.txt +++ b/plugins/vestige/CMakeLists.txt @@ -1,6 +1,5 @@ IF(LMMS_SUPPORT_VST) INCLUDE(BuildPlugin) - INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../vst_base") LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/..") IF(LMMS_BUILD_LINUX) LINK_LIBRARIES(-Wl,--enable-new-dtags) @@ -10,7 +9,6 @@ IF(LMMS_SUPPORT_VST) SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PLUGIN_DIR}") ENDIF() BUILD_PLUGIN(vestige vestige.cpp vestige.h MOCFILES vestige.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png") - TARGET_LINK_LIBRARIES(vestige -lvstbase) - ADD_DEPENDENCIES(vestige vstbase) + TARGET_LINK_LIBRARIES(vestige vstbase) ENDIF(LMMS_SUPPORT_VST) diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index b8204f40496..710d9fe55dc 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -22,6 +22,10 @@ * */ +#include + +#include "VstPlugin.h" + #include "vestige.h" #include @@ -41,7 +45,7 @@ #include "gui_templates.h" #include "InstrumentPlayHandle.h" #include "InstrumentTrack.h" -#include "VstPlugin.h" + #include "MainWindow.h" #include "Mixer.h" #include "GuiApplication.h" @@ -52,6 +56,7 @@ #include "ToolTip.h" #include "FileDialog.h" + #include "embed.h" @@ -59,7 +64,7 @@ extern "C" { -Plugin::Descriptor PLUGIN_EXPORT vestige_plugin_descriptor = +Plugin::Descriptor Q_DECL_EXPORT vestige_plugin_descriptor = { STRINGIFY( PLUGIN_NAME ), "VeSTige", @@ -612,7 +617,7 @@ void VestigeInstrumentView::updateMenu( void ) QMenu * to_menu = m_selPresetButton->menu(); to_menu->clear(); - QAction *presetActions[list1.size()]; + QVector presetActions(list1.size()); for (int i = 0; i < list1.size(); i++) { presetActions[i] = new QAction(this); @@ -1163,7 +1168,7 @@ extern "C" { // necessary for getting instance out of shared lib -PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data ) +Q_DECL_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 95a2c428a44..f33a9042853 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -40,7 +40,7 @@ #include "Song.h" #include "embed.h" - +#include "plugin_export.h" extern "C" { diff --git a/plugins/vst_base/CMakeLists.txt b/plugins/vst_base/CMakeLists.txt index b0a478232e3..314d5fc18e4 100644 --- a/plugins/vst_base/CMakeLists.txt +++ b/plugins/vst_base/CMakeLists.txt @@ -1,93 +1,34 @@ -IF(LMMS_SUPPORT_VST) +IF(NOT LMMS_SUPPORT_VST) + RETURN() +ENDIF() INCLUDE(BuildPlugin) +INCLUDE(ExternalProject) -IF(LMMS_BUILD_WIN32) - ADD_DEFINITIONS(-DPTW32_STATIC_LIB) - ADD_EXECUTABLE(RemoteVstPlugin "${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp") - - TARGET_LINK_LIBRARIES(RemoteVstPlugin Qt5::Core) - TARGET_LINK_LIBRARIES(RemoteVstPlugin -lpthread -lgdi32 -lws2_32) - SET_TARGET_PROPERTIES(RemoteVstPlugin PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -O0") - ADD_CUSTOM_COMMAND(TARGET RemoteVstPlugin POST_BUILD COMMAND "${STRIP}" "$") - INSTALL(TARGETS RemoteVstPlugin RUNTIME DESTINATION "${PLUGIN_DIR}") - - # FIXME: 32-bit VST fails on MSYS - IF(LMMS_BUILD_WIN64 AND NOT LMMS_BUILD_MSYS) - # build 32 bit version of RemoteVstPlugin for Win64 so we can load - # 32 bit VST plugins - ADD_SUBDIRECTORY(Win64) - ENDIF(LMMS_BUILD_WIN64 AND NOT LMMS_BUILD_MSYS) -ENDIF(LMMS_BUILD_WIN32) - -SET(REMOTE_VST_PLUGIN_FILEPATH "RemoteVstPlugin" CACHE STRING "Relative file path to RemoteVstPlugin") +ADD_SUBDIRECTORY(vstbase) -INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src/3rdparty/qt5-x11embed/src/") -ADD_DEFINITIONS(-DREMOTE_VST_PLUGIN_FILEPATH="${REMOTE_VST_PLUGIN_FILEPATH}") -BUILD_PLUGIN(vstbase vst_base.cpp VstPlugin.cpp VstPlugin.h communication.h MOCFILES VstPlugin.h) - -IF(LMMS_BUILD_LINUX) - TARGET_LINK_LIBRARIES(vstbase qx11embedcontainer) +IF(LMMS_BUILD_LINUX AND WANT_VST_NOWINE) + RETURN() ENDIF() -IF(LMMS_BUILD_LINUX AND NOT WANT_VST_NOWINE) - -IF(LMMS_HOST_X86_64) - SET(EXTRA_FLAGS -m32) - IF(WINE_LIBRARY_FIX) - SET(EXTRA_FLAGS ${EXTRA_FLAGS} -nodefaultlibs ${WINE_LIBRARY_FIX}wine/libwinecrt0.a -L${WINE_LIBRARY_FIX}wine/ -luser32 -lkernel32 -lgdi32) - ENDIF() -ENDIF(LMMS_HOST_X86_64) - -SET(WINE_CXX_FLAGS "" CACHE STRING "Extra flags passed to wineg++") +SET(LMMS_BINARY_DIR ${CMAKE_BINARY_DIR}) +SET(LMMS_SOURCE_DIR ${CMAKE_SOURCE_DIR}) -STRING(REPLACE "include/wine" "include" WINE_INCLUDE_BASE_DIR ${WINE_INCLUDE_DIR}) -STRING(REPLACE "lib/libwine.so" "lib" WINE_LIBRARY_DIR ${WINE_LIBRARY}) -STRING(REPLACE " " ";" WINE_BUILD_FLAGS ${CMAKE_CXX_FLAGS} " " ${CMAKE_EXE_LINKER_FLAGS} " " ${WINE_CXX_FLAGS}) - -SET(WINE_CXX_ARGS - -I${CMAKE_BINARY_DIR} - -I${CMAKE_SOURCE_DIR}/include - -I${WINE_INCLUDE_BASE_DIR} - -I${WINE_INCLUDE_DIR}/windows - -L${WINE_LIBRARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp - -std=c++0x - -mwindows -lpthread ${EXTRA_FLAGS} -fno-omit-frame-pointer - ${WINE_BUILD_FLAGS} - -o ../RemoteVstPlugin +SET(EXTERNALPROJECT_ARGS + SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin" + INSTALL_COMMAND "" + BUILD_ALWAYS ON ) -# winegcc fails if winebuild is not in path -GET_FILENAME_COMPONENT(WINE_BINDIR ${WINE_CXX} PATH) -FIND_PROGRAM(WINEBUILD winebuild NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) -IF(NOT WINEBUILD) - IF(CMAKE_VERSION VERSION_LESS 3.1) - MESSAGE(WARNING "winebuild is not in PATH. Building RemoteVstPlugin may fail.") - ELSE() - SET(WINE_CXX_ARGS -E env PATH=$ENV{PATH}:${WINE_BINDIR} ${WINE_CXX} ${WINE_CXX_ARGS}) - SET(WINE_CXX "${CMAKE_COMMAND}") - ENDIF() -ENDIF() - -set(ENV{PATH} "$ENV{PATH}:${WINE_BINDIR}") - -ADD_CUSTOM_COMMAND( - SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp" - COMMAND export - ARGS "PATH=$PATH:${WINE_BINDIR}" - COMMAND ${WINE_CXX} - ARGS ${WINE_CXX_ARGS} - # Ensure correct file extension - COMMAND sh -c "mv ../RemoteVstPlugin.exe ../RemoteVstPlugin || true" - TARGET vstbase - OUTPUTS ../RemoteVstPlugin - VERBATIM +SET(EXTERNALPROJECT_CMAKE_ARGS + "-DLMMS_SOURCE_DIR=${CMAKE_SOURCE_DIR}" + "-DLMMS_BINARY_DIR=${CMAKE_BINARY_DIR}" + "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" + "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" + "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" ) -SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ../RemoteVstPlugin.exe.so) -INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin" "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin.exe.so" DESTINATION "${PLUGIN_DIR}") -ENDIF(LMMS_BUILD_LINUX AND NOT WANT_VST_NOWINE) - - -ENDIF(LMMS_SUPPORT_VST) +# build 32 bit version of RemoteVstPlugin +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin32.cmake") +# build 64 bit version of RemoteVstPlugin +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin64.cmake") diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index 174a80caa51..b53b71a2093 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -34,10 +34,6 @@ #include "RemotePlugin.h" -#ifdef LMMS_HAVE_PTHREAD_H -#include -#endif - #ifdef LMMS_HAVE_FCNTL_H #include #endif @@ -63,6 +59,12 @@ #define USE_WS_PREFIX #include +#ifdef USE_MINGW_THREADS_REPLACEMENT +# include +#else +# include +#endif + #include #include #include @@ -120,6 +122,25 @@ RemoteVstPlugin * __plugin = NULL; HWND __MessageHwnd = NULL; +//Returns the last Win32 error, in string format. Returns an empty string if there is no error. +std::string GetErrorAsString(DWORD errorMessageID) +{ + //Get the error message, if any. + if(errorMessageID == 0) + return std::string(); //No error message has been recorded + + LPSTR messageBuffer = nullptr; + size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL); + + std::string message(messageBuffer, size); + + //Free the buffer. + LocalFree(messageBuffer); + + return message; +} + class RemoteVstPlugin : public RemotePluginClient { @@ -243,17 +264,17 @@ class RemoteVstPlugin : public RemotePluginClient inline void lockShm() { - pthread_mutex_lock( &m_shmLock ); + m_shmLock.lock(); } inline bool tryLockShm() { - return pthread_mutex_trylock( &m_shmLock ) == 0; + return m_shmLock.try_lock(); } inline void unlockShm() { - pthread_mutex_unlock( &m_shmLock ); + m_shmLock.unlock(); } inline bool isShmValid() @@ -310,7 +331,7 @@ class RemoteVstPlugin : public RemotePluginClient } ; // callback used by plugin for being able to communicate with it's host - static intptr_t hostCallback( AEffect * _effect, int32_t _opcode, + static intptr_t VST_CALL_CONV hostCallback( AEffect * _effect, int32_t _opcode, int32_t _index, intptr_t _value, void * _ptr, float _opt ); @@ -349,7 +370,7 @@ class RemoteVstPlugin : public RemotePluginClient float * * m_inputs; float * * m_outputs; - pthread_mutex_t m_shmLock; + std::mutex m_shmLock; bool m_shmValid; typedef std::vector VstMidiEventList; @@ -395,7 +416,6 @@ RemoteVstPlugin::RemoteVstPlugin( const char * socketPath ) : m_shouldGiveIdle( false ), m_inputs( NULL ), m_outputs( NULL ), - m_shmLock(), m_shmValid( false ), m_midiEvents(), m_bpm( 0 ), @@ -405,8 +425,6 @@ RemoteVstPlugin::RemoteVstPlugin( const char * socketPath ) : m_shmID( -1 ), m_vstSyncData( NULL ) { - pthread_mutex_init( &m_shmLock, NULL ); - __plugin = this; #ifndef USE_QT_SHMEM @@ -496,8 +514,6 @@ RemoteVstPlugin::~RemoteVstPlugin() delete[] m_inputs; delete[] m_outputs; - - pthread_mutex_destroy( &m_shmLock ); } @@ -683,7 +699,7 @@ static void close_check( FILE* fp ) { if( fclose( fp ) ) { - perror( "close" ); + perror( "fclose" ); } } @@ -793,15 +809,12 @@ bool RemoteVstPlugin::load( const std::string & _plugin_file ) { if( ( m_libInst = LoadLibraryW( toWString(_plugin_file).c_str() ) ) == NULL ) { - // give VstPlugin class a chance to start 32 bit version of RemoteVstPlugin - if( GetLastError() == ERROR_BAD_EXE_FORMAT ) - { - sendMessage( IdVstBadDllFormat ); - } + DWORD error = GetLastError(); + debugMessage( "LoadLibrary failed: " + GetErrorAsString(error) ); return false; } - typedef AEffect * ( __stdcall * mainEntryPointer ) + typedef AEffect * ( VST_CALL_CONV * mainEntryPointer ) ( audioMasterCallback ); mainEntryPointer mainEntry = (mainEntryPointer) GetProcAddress( m_libInst, "VSTPluginMain" ); @@ -1275,7 +1288,7 @@ void RemoteVstPlugin::savePreset( const std::string & _file ) } fclose( stream ); - if ( !chunky ) + if ( !chunky ) delete[] data; delete[] (sBank*)pBank; @@ -1536,7 +1549,7 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode, _timeInfo.flags |= kVstTransportCycleActive; } - if( __plugin->m_vstSyncData->ppqPos != + if( __plugin->m_vstSyncData->ppqPos != __plugin->m_in->m_Timestamp ) { _timeInfo.ppqPos = __plugin->m_vstSyncData->ppqPos; @@ -1559,7 +1572,7 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode, { _timeInfo.flags |= kVstTransportPlaying; } - _timeInfo.barStartPos = ( (int) ( _timeInfo.ppqPos / + _timeInfo.barStartPos = ( (int) ( _timeInfo.ppqPos / ( 4 *__plugin->m_vstSyncData->timeSigNumer / (float) __plugin->m_vstSyncData->timeSigDenom ) ) ) * ( 4 * __plugin->m_vstSyncData->timeSigNumer @@ -1567,11 +1580,7 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode, _timeInfo.flags |= kVstBarsValid; -#ifdef LMMS_BUILD_WIN64 - return (long long) &_timeInfo; -#else - return (long) &_timeInfo; -#endif + return (intptr_t) &_timeInfo; case audioMasterProcessEvents: SHOW_CALLBACK( "amc: audioMasterProcessEvents\n" ); @@ -1995,14 +2004,6 @@ int main( int _argc, char * * _argv ) return -1; } -#ifdef LMMS_BUILD_WIN32 -#ifndef __WINPTHREADS_VERSION - // (non-portable) initialization of statically linked pthread library - pthread_win32_process_attach_np(); - pthread_win32_thread_attach_np(); -#endif -#endif - #ifdef LMMS_BUILD_LINUX #ifdef LMMS_HAVE_SCHED_H // try to set realtime-priority @@ -2110,14 +2111,6 @@ int main( int _argc, char * * _argv ) delete __plugin; - -#ifdef LMMS_BUILD_WIN32 -#ifndef __WINPTHREADS_VERSION - pthread_win32_thread_detach_np(); - pthread_win32_process_detach_np(); -#endif -#endif - return 0; } diff --git a/plugins/vst_base/RemoteVstPlugin/CMakeLists.txt b/plugins/vst_base/RemoteVstPlugin/CMakeLists.txt new file mode 100644 index 00000000000..1baf9406493 --- /dev/null +++ b/plugins/vst_base/RemoteVstPlugin/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 3.1) +project(RemoteVstPlugin + LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 11) + +include(CheckCXXPreprocessor) +include(CheckCXXSourceCompiles) + +CHECK_CXX_DEFINE(IS_WIN "_WIN32") +CHECK_CXX_DEFINE(IS_WIN64 "_WIN64") +CHECK_CXX_DEFINE(IS_MINGW "__MINGW32__") + +if(NOT IS_WIN) + message(FATAL_ERROR "Toolchain used does not target windows.") +ENDIF() + +if(IS_WIN64 OR CMAKE_SIZEOF_VOID_P EQUAL 8) + set(BITNESS 64) +else() + set(BITNESS 32) +endif() + +FOREACH( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} ) + STRING(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) + SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +ENDFOREACH() + +set(EXE_NAME RemoteVstPlugin${BITNESS}) +add_executable(${EXE_NAME} + ../RemoteVstPlugin.cpp +) + +target_include_directories(${EXE_NAME} + PRIVATE + "${LMMS_SOURCE_DIR}/plugins/vst_base/common" + "${LMMS_SOURCE_DIR}/include" + "${LMMS_BINARY_DIR}" +) + +if(WIN32) + find_package(Qt5Core REQUIRED) + target_link_libraries(${EXE_NAME} Qt5::Core) +endif() + +if(IS_MINGW) + SET(CMAKE_REQUIRED_FLAGS "-std=c++11") + + CHECK_CXX_SOURCE_COMPILES(" + #include + int main(int argc, const char* argv[]) { + std::mutex m; + return 0; + } + " HAS_STD_MUTEX) + + if(NOT HAS_STD_MUTEX) + target_include_directories(${EXE_NAME} PRIVATE + "${LMMS_SOURCE_DIR}/src/3rdparty/mingw-std-threads") + target_compile_definitions(${EXE_NAME} PRIVATE + -DUSE_MINGW_THREADS_REPLACEMENT) + endif() +endif() + +IF(STRIP) + ADD_CUSTOM_COMMAND(TARGET ${EXE_NAME} POST_BUILD COMMAND "${STRIP}" "$") +ENDIF() diff --git a/plugins/vst_base/RemoteVstPlugin32.cmake b/plugins/vst_base/RemoteVstPlugin32.cmake new file mode 100644 index 00000000000..a74c5b1f841 --- /dev/null +++ b/plugins/vst_base/RemoteVstPlugin32.cmake @@ -0,0 +1,67 @@ +IF(LMMS_BUILD_WIN32 AND NOT LMMS_BUILD_WIN64) + ADD_SUBDIRECTORY(RemoteVstPlugin) +ELSEIF(LMMS_BUILD_WIN64 AND MSVC) + SET(MSVC_VER ${CMAKE_CXX_COMPILER_VERSION}) + + IF(NOT CMAKE_GENERATOR_32) + IF(MSVC_VER VERSION_GREATER 19.0 OR MSVC_VER VERSION_EQUAL 19.0) + SET(CMAKE_GENERATOR_32 "Visual Studio 14 2015") + SET(MSVC_YEAR 2015) + ELSEIF(MSVC_VER VERSION_EQUAL 19.10 OR MSVC_VER VERSION_EQUAL 19.10) + SET(CMAKE_GENERATOR_32 "Visual Studio 15 2017") + SET(MSVC_YEAR 2017) + ELSE() + MESSAGE(SEND_WARNING "Can't build RemoteVstPlugin32, unknown MSVC version ${MSVC_VER} and no CMAKE_GENERATOR_32 set") + RETURN() + ENDIF() + ENDIF() + + IF(NOT QT_32_PREFIX AND NOT USING_VCPKG) + GET_FILENAME_COMPONENT(QT_BIN_DIR ${QT_QMAKE_EXECUTABLE} DIRECTORY) + SET(QT_32_PREFIX "${QT_BIN_DIR}/../../msvc${MSVC_YEAR}") + ENDIF() + + IF(NOT QT_32_PREFIX) + MESSAGE(WARNING "Can't build RemoteVstPlugin32, QT_32_PREFIX not set") + RETURN() + ELSEIF(NOT (IS_DIRECTORY ${QT_32_PREFIX} AND EXISTS ${QT_32_PREFIX}/bin/qmake.exe)) + MESSAGE(WARNING "Can't build RemoteVstPlugin32, no Qt 32 bit installation found at ${QT_32_PREFIX}") + RETURN() + ENDIF() + + ExternalProject_Add(RemoteVstPlugin32 + "${EXTERNALPROJECT_ARGS}" + CMAKE_GENERATOR "${CMAKE_GENERATOR_32}" + #CMAKE_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}" + CMAKE_ARGS + "${EXTERNALPROJECT_CMAKE_ARGS}" + "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" + "-DCMAKE_PREFIX_PATH=${QT_32_PREFIX}" + ) +ELSEIF(LMMS_BUILD_LINUX) + # Use winegcc + ExternalProject_Add(RemoteVstPlugin32 + "${EXTERNALPROJECT_ARGS}" + CMAKE_ARGS + "${EXTERNALPROJECT_CMAKE_ARGS}" + "-DCMAKE_CXX_COMPILER=${WINEGCC}" + "-DCMAKE_CXX_FLAGS=-m32 -mwindows" + ) +ELSEIF(CMAKE_TOOLCHAIN_FILE_32) + ExternalProject_Add(RemoteVstPlugin32 + "${EXTERNALPROJECT_ARGS}" + CMAKE_ARGS + "${EXTERNALPROJECT_CMAKE_ARGS}" + "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH_32}" + "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE_32}" + ) +ELSE() + message(WARNING "Can't build RemoteVstPlugin32, unknown environment. Please supply CMAKE_TOOLCHAIN_FILE_32 and optionally CMAKE_PREFIX_PATH_32") + RETURN() +ENDIF() + +IF(LMMS_BUILD_LINUX) + INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32" "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe.so" DESTINATION "${PLUGIN_DIR}") +ELSEIF(LMMS_BUILD_WIN32) + INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe" DESTINATION "${PLUGIN_DIR}") +ENDIF() diff --git a/plugins/vst_base/RemoteVstPlugin64.cmake b/plugins/vst_base/RemoteVstPlugin64.cmake new file mode 100644 index 00000000000..3922ce1712b --- /dev/null +++ b/plugins/vst_base/RemoteVstPlugin64.cmake @@ -0,0 +1,13 @@ +IF(LMMS_BUILD_WIN64) + ADD_SUBDIRECTORY(RemoteVstPlugin) + INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin64.exe" DESTINATION "${PLUGIN_DIR}") +ELSEIF(LMMS_BUILD_LINUX) + ExternalProject_Add(RemoteVstPlugin64 + "${EXTERNALPROJECT_ARGS}" + CMAKE_ARGS + "${EXTERNALPROJECT_CMAKE_ARGS}" + "-DCMAKE_CXX_COMPILER=${WINEGCC}" + "-DCMAKE_CXX_FLAGS=-m64 -mwindows" + ) + INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin64" "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin64.exe.so" DESTINATION "${PLUGIN_DIR}") +ENDIF() diff --git a/plugins/vst_base/VstPlugin.cpp b/plugins/vst_base/VstPlugin.cpp index 26c789275bb..28f54174ebc 100644 --- a/plugins/vst_base/VstPlugin.cpp +++ b/plugins/vst_base/VstPlugin.cpp @@ -24,6 +24,9 @@ #include "VstPlugin.h" +#include "communication.h" + +#include #include #include #include @@ -66,6 +69,60 @@ # include #endif +namespace PE +{ +// Utilities for reading PE file machine type +// See specification at https://msdn.microsoft.com/library/windows/desktop/ms680547(v=vs.85).aspx + +// Work around name conflict +#ifdef i386 +# undef i386 +#endif + +enum class MachineType : uint16_t +{ + unknown = 0x0, + amd64 = 0x8664, + i386 = 0x14c, +}; + +class FileInfo +{ +public: + FileInfo(QString filePath) + : m_file(filePath) + { + m_file.open(QFile::ReadOnly); + m_map = m_file.map(0, m_file.size()); + if (m_map == nullptr) { + throw std::runtime_error("Cannot map file"); + } + } + ~FileInfo() + { + m_file.unmap(m_map); + } + + MachineType machineType() + { + int32_t peOffset = qFromLittleEndian(* reinterpret_cast(m_map + 0x3C)); + uchar* peSignature = m_map + peOffset; + if (memcmp(peSignature, "PE\0\0", 4)) { + throw std::runtime_error("Invalid PE file"); + } + uchar * coffHeader = peSignature + 4; + uint16_t machineType = qFromLittleEndian(* reinterpret_cast(coffHeader)); + return static_cast(machineType); + } + +private: + QFile m_file; + uchar* m_map; +}; + +} + + VstPlugin::VstPlugin( const QString & _plugin ) : m_plugin( _plugin ), @@ -73,20 +130,32 @@ VstPlugin::VstPlugin( const QString & _plugin ) : m_embedMethod( gui ? ConfigManager::inst()->vstEmbedMethod() : "headless" ), - m_badDllFormat( false ), m_version( 0 ), m_currentProgram() { setSplittedChannels( true ); - tryLoad( REMOTE_VST_PLUGIN_FILEPATH ); -#ifdef LMMS_BUILD_WIN64 - if( m_badDllFormat ) + PE::MachineType machineType; + try { + PE::FileInfo peInfo(_plugin); + machineType = peInfo.machineType(); + } catch (std::runtime_error& e) { + qCritical() << "Error while determining PE file's machine type: " << e.what(); + machineType = PE::MachineType::unknown; + } + + switch(machineType) { - m_badDllFormat = false; - tryLoad( "32/RemoteVstPlugin32" ); + case PE::MachineType::amd64: + tryLoad( "RemoteVstPlugin64" ); + break; + case PE::MachineType::i386: + tryLoad( "RemoteVstPlugin32" ); + break; + default: + m_failed = true; + return; } -#endif setTempo( Engine::getSong()->getTempo() ); @@ -322,10 +391,6 @@ bool VstPlugin::processMessage( const message & _m ) { switch( _m.id ) { - case IdVstBadDllFormat: - m_badDllFormat = true; - break; - case IdVstPluginWindowID: m_pluginWindowID = _m.getInt(); if( m_embedMethod == "none" ) diff --git a/plugins/vst_base/VstPlugin.h b/plugins/vst_base/VstPlugin.h index 9e8b39771e9..5b459d40dd8 100644 --- a/plugins/vst_base/VstPlugin.h +++ b/plugins/vst_base/VstPlugin.h @@ -33,12 +33,14 @@ #include #include "JournallingObject.h" -#include "communication.h" +#include "RemotePlugin.h" + +#include "vstbase_export.h" class vstSubWin; -class PLUGIN_EXPORT VstPlugin : public RemotePlugin, public JournallingObject +class VSTBASE_EXPORT VstPlugin : public RemotePlugin, public JournallingObject { Q_OBJECT public: @@ -140,8 +142,6 @@ public slots: QSize m_pluginGeometry; const QString m_embedMethod; - bool m_badDllFormat; - QString m_name; int m_version; QString m_vendorString; diff --git a/plugins/vst_base/Win64/CMakeLists.txt b/plugins/vst_base/Win64/CMakeLists.txt deleted file mode 100644 index 39b9b5a9bbd..00000000000 --- a/plugins/vst_base/Win64/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/include") -SET(CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER32}") - -ADD_EXECUTABLE(RemoteVstPlugin32 "${CMAKE_CURRENT_SOURCE_DIR}/../RemoteVstPlugin.cpp") - -SET(QTCORE "Qt5Core") -TARGET_LINK_LIBRARIES(RemoteVstPlugin32 -l${QTCORE} -lpthread -lgdi32 -lws2_32) - -ADD_CUSTOM_COMMAND(TARGET RemoteVstPlugin32 POST_BUILD COMMAND "${STRIP}" "$") -SET_TARGET_PROPERTIES(RemoteVstPlugin32 PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -O0") - -INSTALL(TARGETS RemoteVstPlugin32 RUNTIME DESTINATION "${PLUGIN_DIR}/32") -INSTALL(FILES "${MINGW_PREFIX32}/bin/${QTCORE}.dll" "${MINGW_PREFIX32}/bin/zlib1.dll" "${MINGW_PREFIX32}/${CMAKE_SYSTEM_PROCESSOR32}-w64-mingw32/bin/libwinpthread-1.dll" - DESTINATION "${PLUGIN_DIR}/32") - diff --git a/plugins/vst_base/communication.h b/plugins/vst_base/communication.h index bacf43c1edc..756fd75573e 100644 --- a/plugins/vst_base/communication.h +++ b/plugins/vst_base/communication.h @@ -27,8 +27,6 @@ #ifndef _COMMUNICATION_H #define _COMMUNICATION_H -#include "RemotePlugin.h" - struct VstParameterDumpItem @@ -72,7 +70,6 @@ enum VstRemoteMessageIDs // remoteVstPlugin -> vstPlugin IdVstFailedLoadingPlugin, - IdVstBadDllFormat, IdVstPluginWindowID, IdVstPluginEditorGeometry, IdVstPluginName, diff --git a/plugins/vst_base/vst_base.cpp b/plugins/vst_base/vst_base.cpp index 1c1770abe85..0ca1159a221 100644 --- a/plugins/vst_base/vst_base.cpp +++ b/plugins/vst_base/vst_base.cpp @@ -26,12 +26,12 @@ #include "Plugin.h" #include "embed.h" - +#include "vstbase_export.h" extern "C" { -Plugin::Descriptor PLUGIN_EXPORT vstbase_plugin_descriptor = +Plugin::Descriptor VSTBASE_EXPORT vstbase_plugin_descriptor = { STRINGIFY( PLUGIN_NAME ), "VST Base", diff --git a/plugins/vst_base/vstbase/CMakeLists.txt b/plugins/vst_base/vstbase/CMakeLists.txt new file mode 100644 index 00000000000..28c09edb380 --- /dev/null +++ b/plugins/vst_base/vstbase/CMakeLists.txt @@ -0,0 +1,14 @@ +BUILD_PLUGIN(vstbase + ../vst_base.cpp ../VstPlugin.cpp ../VstPlugin.h ../communication.h + MOCFILES ../VstPlugin.h + EXPORT_BASE_NAME vstbase + LINK SHARED +) + +TARGET_INCLUDE_DIRECTORIES(vstbase + PUBLIC ../ +) + +IF(LMMS_BUILD_LINUX) + TARGET_LINK_LIBRARIES(vstbase qx11embedcontainer) +ENDIF() diff --git a/plugins/watsyn/Watsyn.cpp b/plugins/watsyn/Watsyn.cpp index c0a952fb873..0122b293a23 100644 --- a/plugins/watsyn/Watsyn.cpp +++ b/plugins/watsyn/Watsyn.cpp @@ -36,6 +36,7 @@ #include "interpolation.h" #include "embed.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/waveshaper/waveshaper.cpp b/plugins/waveshaper/waveshaper.cpp index 047cd05d193..3f9d3e19fba 100644 --- a/plugins/waveshaper/waveshaper.cpp +++ b/plugins/waveshaper/waveshaper.cpp @@ -29,6 +29,7 @@ #include "embed.h" #include "interpolation.h" +#include "plugin_export.h" extern "C" { diff --git a/plugins/zynaddsubfx/ZynAddSubFx.cpp b/plugins/zynaddsubfx/ZynAddSubFx.cpp index 7ec345ff06e..8a5d2fa11e0 100644 --- a/plugins/zynaddsubfx/ZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/ZynAddSubFx.cpp @@ -47,8 +47,7 @@ #include "ControllerConnection.h" #include "embed.h" - - +#include "plugin_export.h" extern "C" { diff --git a/src/3rdparty/CMakeLists.txt b/src/3rdparty/CMakeLists.txt index 7bc0a879044..b40f7c3cde0 100644 --- a/src/3rdparty/CMakeLists.txt +++ b/src/3rdparty/CMakeLists.txt @@ -1,5 +1,7 @@ set(CMAKE_C_FLAGS "") set(CMAKE_CXX_FLAGS "") +set(CMAKE_C_FLAGS_DEBUG "") +set(CMAKE_CXX_FLAGS_DEBUG "") IF(LMMS_BUILD_LINUX) set(BUILD_SHARED_LIBS OFF) diff --git a/src/3rdparty/mingw-std-threads b/src/3rdparty/mingw-std-threads new file mode 160000 index 00000000000..10665829daa --- /dev/null +++ b/src/3rdparty/mingw-std-threads @@ -0,0 +1 @@ +Subproject commit 10665829daaedc28629e5e9b014fe498c20d73f2 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 23be3682092..c37c235166b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -51,12 +51,13 @@ ADD_GEN_QRC(LMMS_RCC_OUT lmms.qrc # Paths relative to lmms executable FILE(RELATIVE_PATH LIB_DIR_RELATIVE "/${BIN_DIR}" "/${LIB_DIR}") FILE(RELATIVE_PATH PLUGIN_DIR_RELATIVE "/${BIN_DIR}" "/${PLUGIN_DIR}") -ADD_DEFINITIONS(-D'LIB_DIR="${LIB_DIR_RELATIVE}/"' -D'PLUGIN_DIR="${PLUGIN_DIR_RELATIVE}/"' ${PULSEAUDIO_DEFINITIONS} ${PORTAUDIO_DEFINITIONS}) +ADD_DEFINITIONS(-DLIB_DIR="${LIB_DIR_RELATIVE}" -DPLUGIN_DIR="${PLUGIN_DIR_RELATIVE}" ${PULSEAUDIO_DEFINITIONS} ${PORTAUDIO_DEFINITIONS}) INCLUDE_DIRECTORIES( ${JACK_INCLUDE_DIRS} ${SAMPLERATE_INCLUDE_DIRS} ${SNDFILE_INCLUDE_DIRS} ${SNDIO_INCLUDE_DIRS} + ${FFTW3F_INCLUDE_DIRS} ) IF(NOT ("${SDL2_INCLUDE_DIR}" STREQUAL "")) @@ -101,11 +102,27 @@ ADD_LIBRARY(lmmsobjs OBJECT ${LMMS_UI_OUT} ${LMMS_RCC_OUT} ) + +GENERATE_EXPORT_HEADER(lmmsobjs + BASE_NAME lmms +) + ADD_EXECUTABLE(lmms core/main.cpp $ "${WINRC}" ) +TARGET_INCLUDE_DIRECTORIES(lmms + PUBLIC ${CMAKE_CURRENT_BINARY_DIR} +) + +# GENERATE_EXPORT_HEADER doesn't do this automatically for OBJECT libraries +TARGET_COMPILE_DEFINITIONS(lmmsobjs + PRIVATE -Dlmmsobjs_EXPORTS +) +TARGET_COMPILE_DEFINITIONS(lmms + PRIVATE -Dlmmsobjs_EXPORTS +) # Set Visual Studio startup project to lmms # https://stackoverflow.com/a/37994396/8166701 @@ -173,89 +190,199 @@ IF(LMMS_BUILD_MSYS AND CMAKE_BUILD_TYPE STREQUAL "Debug") ENDIF() # Install -IF(LMMS_BUILD_WIN32) - SET_TARGET_PROPERTIES(lmms PROPERTIES - LINK_FLAGS "${LINK_FLAGS} -mwindows" - ENABLE_EXPORTS ON - ) - IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - ADD_CUSTOM_COMMAND(TARGET lmms POST_BUILD COMMAND "${STRIP}" "$") - ENDIF() +IF(NOT MSVC) + IF(LMMS_BUILD_WIN32) + SET_TARGET_PROPERTIES(lmms PROPERTIES + LINK_FLAGS "${LINK_FLAGS} -mwindows" + ENABLE_EXPORTS ON + ) + IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + ADD_CUSTOM_COMMAND(TARGET lmms POST_BUILD COMMAND "${STRIP}" "$") + ENDIF() - INSTALL(TARGETS lmms RUNTIME DESTINATION "${BIN_DIR}") - - INSTALL(FILES - "${MINGW_PREFIX}/bin/Qt5Core.dll" - "${MINGW_PREFIX}/bin/Qt5Gui.dll" - "${MINGW_PREFIX}/bin/Qt5Widgets.dll" - "${MINGW_PREFIX}/bin/Qt5Xml.dll" - DESTINATION .) - INSTALL(FILES - "${MINGW_PREFIX}/lib/qt5/plugins/platforms/qwindows.dll" - DESTINATION ./platforms) - INSTALL(FILES - "${MINGW_PREFIX}/bin/libsamplerate-0.dll" - "${MINGW_PREFIX}/bin/libsndfile-1.dll" - "${MINGW_PREFIX}/bin/libvorbis-0.dll" - "${MINGW_PREFIX}/bin/libvorbisenc-2.dll" - "${MINGW_PREFIX}/bin/libvorbisfile-3.dll" - "${MINGW_PREFIX}/bin/libjpeg-9.dll" - "${MINGW_PREFIX}/bin/libogg-0.dll" - "${MINGW_PREFIX}/bin/libmp3lame-0.dll" - "${MINGW_PREFIX}/bin/libfftw3f-3.dll" - "${MINGW_PREFIX}/bin/libFLAC-8.dll" - "${MINGW_PREFIX}/bin/libpng16-16.dll" - "${MINGW_PREFIX}/bin/SDL.dll" - "${MINGW_PREFIX}/bin/libglib-2.0-0.dll" - "${MINGW_PREFIX}/bin/libgthread-2.0-0.dll" - "${MINGW_PREFIX}/bin/zlib1.dll" - "${MINGW_PREFIX}/${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32/bin/libwinpthread-1.dll" - DESTINATION .) - IF(LMMS_BUILD_MSYS) + INSTALL(TARGETS lmms RUNTIME DESTINATION "${BIN_DIR}") INSTALL(FILES - "${MINGW_PREFIX}/bin/libwinpthread-1.dll" - "${MINGW_PREFIX}/bin/libgcc_s_seh-1.dll" - "${MINGW_PREFIX}/bin/libstdc++-6.dll" + "${MINGW_PREFIX}/bin/Qt5Core.dll" + "${MINGW_PREFIX}/bin/Qt5Gui.dll" + "${MINGW_PREFIX}/bin/Qt5Widgets.dll" + "${MINGW_PREFIX}/bin/Qt5Xml.dll" DESTINATION .) - ELSE() INSTALL(FILES - "${MINGW_PREFIX}/${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32/bin/libwinpthread-1.dll" - DESTINATION .) - ENDIF() - IF(FLTK_FOUND) + "${MINGW_PREFIX}/lib/qt5/plugins/platforms/qwindows.dll" + DESTINATION ./platforms) INSTALL(FILES - "${MINGW_PREFIX}/bin/libfltk.dll" - DESTINATION .) - ENDIF() - IF(FLUIDSYNTH_FOUND) + "${MINGW_PREFIX}/bin/libsamplerate-0.dll" + "${MINGW_PREFIX}/bin/libsndfile-1.dll" + "${MINGW_PREFIX}/bin/libvorbis-0.dll" + "${MINGW_PREFIX}/bin/libvorbisenc-2.dll" + "${MINGW_PREFIX}/bin/libvorbisfile-3.dll" + "${MINGW_PREFIX}/bin/libjpeg-9.dll" + "${MINGW_PREFIX}/bin/libogg-0.dll" + "${MINGW_PREFIX}/bin/libmp3lame-0.dll" + "${MINGW_PREFIX}/bin/libfftw3f-3.dll" + "${MINGW_PREFIX}/bin/libFLAC-8.dll" + "${MINGW_PREFIX}/bin/libpng16-16.dll" + "${MINGW_PREFIX}/bin/SDL.dll" + "${MINGW_PREFIX}/bin/libglib-2.0-0.dll" + "${MINGW_PREFIX}/bin/libgthread-2.0-0.dll" + "${MINGW_PREFIX}/bin/zlib1.dll" + "${MINGW_PREFIX}/${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32/bin/libwinpthread-1.dll" + DESTINATION .) + IF(LMMS_BUILD_MSYS) + INSTALL(FILES + "${MINGW_PREFIX}/bin/libwinpthread-1.dll" + "${MINGW_PREFIX}/bin/libgcc_s_seh-1.dll" + "${MINGW_PREFIX}/bin/libstdc++-6.dll" + DESTINATION .) + ELSE() + INSTALL(FILES + "${MINGW_PREFIX}/${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32/bin/libwinpthread-1.dll" + DESTINATION .) + ENDIF() + IF(FLTK_FOUND) + INSTALL(FILES + "${MINGW_PREFIX}/bin/libfltk.dll" + DESTINATION .) + ENDIF() + IF(FLUIDSYNTH_FOUND) + INSTALL(FILES + "${MINGW_PREFIX}/bin/libfluidsynth.dll" + DESTINATION .) + ENDIF() + IF(GIG_FOUND) + # Handle libgig-*.dll + FILE(GLOB GIG_LIBRARY "${MINGW_PREFIX}/bin/libgig-*.dll") + INSTALL(FILES + ${GIG_LIBRARY} + DESTINATION .) + ENDIF() + IF(PORTAUDIO_FOUND) + INSTALL(FILES + "${MINGW_PREFIX}/bin/libportaudio-2.dll" + DESTINATION .) + ENDIF() + IF(SOUNDIO_FOUND) + INSTALL(FILES + "${MINGW_PREFIX}/lib/libsoundio.dll" + DESTINATION .) + ENDIF() + + ELSE(LMMS_BUILD_WIN32) + IF(NOT LMMS_BUILD_APPLE) + SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -Wl,-E") + ENDIF(NOT LMMS_BUILD_APPLE) + + INSTALL(TARGETS lmms RUNTIME DESTINATION "${BIN_DIR}") + INSTALL(FILES "${CMAKE_BINARY_DIR}/lmms.1.gz" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1/" PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) + + ENDIF(LMMS_BUILD_WIN32) +ELSE(NOT MSVC) + SET_TARGET_PROPERTIES(lmms PROPERTIES + ENABLE_EXPORTS ON + ) + INSTALL(TARGETS lmms RUNTIME DESTINATION "${BIN_DIR}") + + SET_TARGET_PROPERTIES(lmms PROPERTIES + LINK_FLAGS "${LINK_FLAGS} -mwindows" + ENABLE_EXPORTS ON + ) + + #CMAKE_FIND_ROOT_PATH + SET(VCPKG_ROOT ${CMAKE_FIND_ROOT_PATH}) + + INSTALL(TARGETS lmms RUNTIME DESTINATION "${BIN_DIR}") + INSTALL(FILES - "${MINGW_PREFIX}/bin/libfluidsynth.dll" + "${VCPKG_ROOT}/bin/Qt5Core.dll" + "${VCPKG_ROOT}/bin/Qt5Gui.dll" + "${VCPKG_ROOT}/bin/Qt5Widgets.dll" + "${VCPKG_ROOT}/bin/Qt5Xml.dll" + + "${VCPKG_ROOT}/bin/zlib1.dll" + "${VCPKG_ROOT}/bin/jpeg62.dll" + "${VCPKG_ROOT}/bin/libpng16.dll" + "${VCPKG_ROOT}/bin/gthread-2.dll" + "${VCPKG_ROOT}/bin/glib-2.dll" + "${VCPKG_ROOT}/bin/harfbuzz.dll" + "${VCPKG_ROOT}/bin/pcre2-16.dll" + "${VCPKG_ROOT}/bin/double-conversion.dll" + "${VCPKG_ROOT}/bin/freetype.dll" + "${VCPKG_ROOT}/bin/libbz2.dll" + "${VCPKG_ROOT}/bin/pcre.dll" + "${VCPKG_ROOT}/bin/libiconv.dll" + "${VCPKG_ROOT}/bin/libcharset.dll" + "${VCPKG_ROOT}/bin/libintl.dll" DESTINATION .) - ENDIF() - IF(GIG_FOUND) - # Handle libgig-*.dll - FILE(GLOB GIG_LIBRARY "${MINGW_PREFIX}/bin/libgig-*.dll") + INSTALL(FILES - ${GIG_LIBRARY} - DESTINATION .) - ENDIF() - IF(PORTAUDIO_FOUND) + "${VCPKG_ROOT}/plugins/platforms/qwindows.dll" + DESTINATION ./platforms) + INSTALL(FILES - "${MINGW_PREFIX}/bin/libportaudio-2.dll" + "${VCPKG_ROOT}/bin/libsndfile-1.dll" + "${VCPKG_ROOT}/bin/ogg.dll" + "${VCPKG_ROOT}/bin/vorbis.dll" + "${VCPKG_ROOT}/bin/vorbisenc.dll" + "${VCPKG_ROOT}/bin/FLAC.dll" + "${VCPKG_ROOT}/bin/vorbisfile.dll" + + "${VCPKG_ROOT}/bin/libsamplerate-0.dll" + "${VCPKG_ROOT}/bin/SDL2.dll" + "${VCPKG_ROOT}/bin/fftw3f.dll" DESTINATION .) - ENDIF() - IF(SOUNDIO_FOUND) - INSTALL(FILES - "${MINGW_PREFIX}/lib/libsoundio.dll" + + #not yet in vcpkg + #IF(LAME_FOUND) + # INSTALL(FILES + # "${VCPKG_ROOT}/bin/libmp3lame-0.dll" + # DESTINATION .) + #ENDIF(LAME_FOUND) + + IF(FLTK_FOUND) + INSTALL(FILES + "${VCPKG_ROOT}/bin/libfltk_SHARED.dll" + + "${VCPKG_ROOT}/bin/zlib1.dll" + "${VCPKG_ROOT}/bin/jpeg62.dll" DESTINATION .) - ENDIF() - -ELSE(LMMS_BUILD_WIN32) - IF(NOT LMMS_BUILD_APPLE) - SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -Wl,-E") - ENDIF(NOT LMMS_BUILD_APPLE) - - INSTALL(TARGETS lmms RUNTIME DESTINATION "${BIN_DIR}") - INSTALL(FILES "${CMAKE_BINARY_DIR}/lmms.1.gz" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1/" PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) + ENDIF() + + IF(FLUIDSYNTH_FOUND) + INSTALL(FILES + "${VCPKG_ROOT}/bin/libfluidsynth-1.dll" + "${VCPKG_ROOT}/bin/glib-2.dll" + "${VCPKG_ROOT}/bin/pcre.dll" + "${VCPKG_ROOT}/bin/libiconv.dll" + "${VCPKG_ROOT}/bin/libcharset.dll" + "${VCPKG_ROOT}/bin/libintl.dll" + DESTINATION .) + ENDIF() -ENDIF(LMMS_BUILD_WIN32) + #not yet included in vcpkg + #IF(GIG_FOUND) + # # Handle libgig-*.dll + # FILE(GLOB GIG_LIBRARY "${VCPKG_ROOT}/bin/libgig-*.dll") + # INSTALL(FILES + # ${GIG_LIBRARY} + # DESTINATION .) + #ENDIF() + + IF(PORTAUDIO_FOUND) + IF(LMMS_BUILD_WIN64) + INSTALL(FILES + "${VCPKG_ROOT}/bin/portaudio-x64.dll" + DESTINATION .) + ELSE(LMMS_BUILD_WIN64) + INSTALL(FILES + "${VCPKG_ROOT}/bin/portaudio-x86.dll" + DESTINATION .) + ENDIF(LMMS_BUILD_WIN64) + ENDIF() + + #not yet in vcpkg + #IF(SOUNDIO_FOUND) + # INSTALL(FILES + # "${VCPKG_ROOT}/bin/libsoundio.dll" + # DESTINATION .) + #ENDIF() +ENDIF(NOT MSVC) \ No newline at end of file diff --git a/src/core/RemotePlugin.cpp b/src/core/RemotePlugin.cpp index 64b5e592d4c..d68f6aa6533 100644 --- a/src/core/RemotePlugin.cpp +++ b/src/core/RemotePlugin.cpp @@ -33,6 +33,7 @@ #include "Mixer.h" #include "Engine.h" +#include #include #ifndef SYNC_WITH_SHM_FIFO @@ -62,6 +63,7 @@ void ProcessWatcher::run() { fprintf( stderr, "remote plugin died! invalidating now.\n" ); + m_plugin->invalidate(); } } @@ -78,7 +80,6 @@ RemotePlugin::RemotePlugin() : RemotePluginBase(), #endif m_failed( true ), - m_process(), m_watcher( this ), m_commMutex( QMutex::Recursive ), m_splitChannels( false ), @@ -120,6 +121,11 @@ RemotePlugin::RemotePlugin() : qWarning( "Unable to start the server." ); } #endif + + connect( &m_process, SIGNAL( finished( int, QProcess::ExitStatus ) ), + this, SLOT( processFinished( int, QProcess::ExitStatus ) ) ); + connect( &m_process, SIGNAL( errorOccurred( QProcess::ProcessError ) ), + this, SLOT( processErrored( QProcess::ProcessError ) ) ); } @@ -219,9 +225,6 @@ bool RemotePlugin::init(const QString &pluginExecutable, qDebug() << exec << args; #endif - connect( &m_process, SIGNAL( finished( int, QProcess::ExitStatus ) ), - this, SLOT( processFinished( int, QProcess::ExitStatus ) ) ); - #ifndef SYNC_WITH_SHM_FIFO struct pollfd pollin; pollin.fd = m_server; @@ -454,11 +457,24 @@ void RemotePlugin::resizeSharedProcessingMemory() void RemotePlugin::processFinished( int exitCode, QProcess::ExitStatus exitStatus ) { + if ( exitStatus == QProcess::CrashExit ) + { + qCritical() << "Remote plugin crashed"; + } + else if ( exitCode ) + { + qCritical() << "Remote plugin exit code: " << exitCode; + } #ifndef SYNC_WITH_SHM_FIFO invalidate(); #endif } +void RemotePlugin::processErrored( QProcess::ProcessError err ) +{ + qCritical() << "Process error: " << err; +} + diff --git a/src/core/audio/AudioSdl.cpp b/src/core/audio/AudioSdl.cpp index 2b810e91374..0dbb9dc799f 100644 --- a/src/core/audio/AudioSdl.cpp +++ b/src/core/audio/AudioSdl.cpp @@ -34,19 +34,21 @@ #include "gui_templates.h" #include "Mixer.h" - AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) : AudioDevice( DEFAULT_CHANNELS, _mixer ), - m_outBuf( new surroundSampleFrame[mixer()->framesPerPeriod()] ), - m_convertedBufPos( 0 ), - m_convertEndian( false ) + m_outBuf( new surroundSampleFrame[mixer()->framesPerPeriod()] ) { _success_ful = false; +#ifdef LMMS_HAVE_SDL2 + m_currentBufferFramesCount = 0; + m_currentBufferFramePos = 0; +#else m_convertedBufSize = mixer()->framesPerPeriod() * channels() * sizeof( int_sample_t ); + m_convertedBufPos = 0; m_convertedBuf = new Uint8[m_convertedBufSize]; - +#endif if( SDL_Init( SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE ) < 0 ) { @@ -55,9 +57,15 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) : } m_audioHandle.freq = sampleRate(); +#ifdef LMMS_HAVE_SDL2 + m_audioHandle.format = AUDIO_F32SYS; // we want it in byte-order + // of system, so we don't have + // to convert the buffers +#else m_audioHandle.format = AUDIO_S16SYS; // we want it in byte-order // of system, so we don't have // to convert the buffers +#endif m_audioHandle.channels = channels(); m_audioHandle.samples = qMax( 1024, mixer()->framesPerPeriod()*2 ); @@ -66,15 +74,47 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) : SDL_AudioSpec actual; +#ifdef LMMS_HAVE_SDL2 + m_outputDevice = SDL_OpenAudioDevice (NULL, + 0, + &m_audioHandle, + &actual, + 0); + if (m_outputDevice == 0) { + qCritical( "Couldn't open SDL-audio: %s\n", SDL_GetError() ); + return; + } +#else // open the audio device, forcing the desired format if( SDL_OpenAudio( &m_audioHandle, &actual ) < 0 ) { qCritical( "Couldn't open SDL-audio: %s\n", SDL_GetError() ); return; } - m_convertEndian = ( m_audioHandle.format != actual.format ); + + m_outConvertEndian = ( m_audioHandle.format != actual.format ); +#endif + _success_ful = true; + +#ifdef LMMS_HAVE_SDL2 + m_inputAudioHandle = m_audioHandle; + m_inputAudioHandle.callback = sdlInputAudioCallback; + + m_inputDevice = SDL_OpenAudioDevice (NULL, + 1, + &m_inputAudioHandle, + &actual, + 0); + if (m_inputDevice != 0) { + m_supportsCapture = true; + } else { + m_supportsCapture = false; + qWarning ( "Couldn't open SDL capture device: %s\n", SDL_GetError ()); + } + +#endif } @@ -84,9 +124,18 @@ AudioSdl::~AudioSdl() { stopProcessing(); +#ifdef LMMS_HAVE_SDL2 + if (m_inputDevice != 0) + SDL_CloseAudioDevice(m_inputDevice); + if (m_outputDevice != 0) + SDL_CloseAudioDevice(m_outputDevice); +#else SDL_CloseAudio(); - SDL_Quit(); delete[] m_convertedBuf; +#endif + + SDL_Quit(); + delete[] m_outBuf; } @@ -97,7 +146,12 @@ void AudioSdl::startProcessing() { m_stopped = false; +#ifdef LMMS_HAVE_SDL2 + SDL_PauseAudioDevice (m_outputDevice, 0); + SDL_PauseAudioDevice (m_inputDevice, 0); +#else SDL_PauseAudio( 0 ); +#endif } @@ -105,12 +159,30 @@ void AudioSdl::startProcessing() void AudioSdl::stopProcessing() { +#ifdef LMMS_HAVE_SDL2 + if( SDL_GetAudioDeviceStatus(m_outputDevice) == SDL_AUDIO_PLAYING ) +#else if( SDL_GetAudioStatus() == SDL_AUDIO_PLAYING ) +#endif { +#ifdef LMMS_HAVE_SDL2 + SDL_LockAudioDevice (m_inputDevice); + SDL_LockAudioDevice (m_outputDevice); + + m_stopped = true; + + SDL_PauseAudioDevice (m_inputDevice, 1); + SDL_PauseAudioDevice (m_outputDevice, 1); + + SDL_UnlockAudioDevice (m_inputDevice); + SDL_UnlockAudioDevice (m_outputDevice); +#else SDL_LockAudio(); m_stopped = true; SDL_PauseAudio( 1 ); SDL_UnlockAudio(); +#endif + } } @@ -119,6 +191,8 @@ void AudioSdl::stopProcessing() void AudioSdl::applyQualitySettings() { + // Better than if (0) +#if 0 if( 0 )//hqAudio() ) { SDL_CloseAudio(); @@ -135,6 +209,7 @@ void AudioSdl::applyQualitySettings() qCritical( "Couldn't open SDL-audio: %s\n", SDL_GetError() ); } } +#endif AudioDevice::applyQualitySettings(); } @@ -160,6 +235,41 @@ void AudioSdl::sdlAudioCallback( Uint8 * _buf, int _len ) return; } + // SDL2: process float samples +#ifdef LMMS_HAVE_SDL2 + while( _len ) + { + if( m_currentBufferFramePos == 0 ) + { + // frames depend on the sample rate + const fpp_t frames = getNextBuffer( m_outBuf ); + if( !frames ) + { + memset( _buf, 0, _len ); + return; + } + m_currentBufferFramesCount = frames; + + } + const uint min_frames_count = qMin( _len/sizeof(sampleFrame), + m_currentBufferFramesCount + - m_currentBufferFramePos ); + + const float gain = mixer()->masterGain(); + for (uint f = 0; f < min_frames_count; f++) + { + (m_outBuf + m_currentBufferFramePos)[f][0] *= gain; + (m_outBuf + m_currentBufferFramePos)[f][1] *= gain; + } + + memcpy( _buf, m_outBuf + m_currentBufferFramePos, min_frames_count*sizeof(sampleFrame) ); + _buf += min_frames_count*sizeof(sampleFrame); + _len -= min_frames_count*sizeof(sampleFrame); + m_currentBufferFramePos += min_frames_count; + + m_currentBufferFramePos %= m_currentBufferFramesCount; + } +#else while( _len ) { if( m_convertedBufPos == 0 ) @@ -177,7 +287,7 @@ void AudioSdl::sdlAudioCallback( Uint8 * _buf, int _len ) convertToS16( m_outBuf, frames, mixer()->masterGain(), (int_sample_t *)m_convertedBuf, - m_convertEndian ); + m_outConvertEndian ); } const int min_len = qMin( _len, m_convertedBufSize - m_convertedBufPos ); @@ -187,10 +297,25 @@ void AudioSdl::sdlAudioCallback( Uint8 * _buf, int _len ) m_convertedBufPos += min_len; m_convertedBufPos %= m_convertedBufSize; } +#endif } +#ifdef LMMS_HAVE_SDL2 +void AudioSdl::sdlInputAudioCallback(void *_udata, Uint8 *_buf, int _len) { + AudioSdl * _this = static_cast( _udata ); + + _this->sdlInputAudioCallback( _buf, _len ); +} + +void AudioSdl::sdlInputAudioCallback(Uint8 *_buf, int _len) { + sampleFrame *samples_buffer = (sampleFrame *) _buf; + fpp_t frames = _len / sizeof ( sampleFrame ); + mixer()->pushInputFrames (samples_buffer, frames); +} + +#endif AudioSdl::setupWidget::setupWidget( QWidget * _parent ) : AudioDeviceSetupWidget( AudioSdl::name(), _parent ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ca78a5eb416..249e381912a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,6 +2,7 @@ INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}") INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include") INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}") +INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/src") SET(CMAKE_CXX_STANDARD 11)