diff --git a/CMakeLists.txt b/CMakeLists.txt index 55c79a8ff..88dd0d7bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,6 @@ OPTION(WANT_WINMM "Include WinMM MIDI support" OFF) IF(LMMS_BUILD_APPLE) SET(WANT_ALSA OFF) SET(WANT_PULSEAUDIO OFF) - SET(WANT_SWH OFF) SET(WANT_VST OFF) SET(STATUS_ALSA "") SET(STATUS_PULSEAUDIO "") @@ -388,7 +387,15 @@ ELSE(WIN32) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC") ENDIF(WIN32) - +# set up apple vars before traversing into data/scripts +SET(MACOSX_BUNDLE_ICON_FILE "lmms.icns") +SET(MACOSX_BUNDLE_GUI_IDENTIFIER "LMMS") +SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION}") +SET(MACOSX_BUNDLE_BUNDLE_NAME "LMMS") +SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION}") +SET(MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION}") +SET(MACOSX_BUNDLE_COPYRIGHT "Tobias Doerffel, 2008-2010") +SET(MACOSX_BUNDLE_MIMETYPE "application/x-lmms-project") # make sub-directories ADD_SUBDIRECTORY(plugins) @@ -656,14 +663,6 @@ IF(WIN64) InstallDir \\\"\\\$PROGRAMFILES64\\\\${CPACK_PACKAGE_INSTALL_DIRECTORY}\\\"") ENDIF(WIN64) -SET(MACOSX_BUNDLE_ICON_FILE "${CMAKE_SOURCE_DIR}/data/themes/default/icon.png") -SET(MACOSX_BUNDLE_GUI_IDENTIFIER "LMMS") -SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION}") -SET(MACOSX_BUNDLE_BUNDLE_NAME "LMMS") -SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION}") -SET(MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION}") -SET(MACOSX_BUNDLE_COPYRIGHT "Tobias Doerffel, 2008-2010") - SET(CPACK_SOURCE_GENERATOR "TBZ2") SET(CPACK_SOURCE_PACKAGE_FILE_NAME "lmms-${VERSION}") INCLUDE(CPack) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index e385d2f13..c7f5a9d62 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -4,6 +4,7 @@ ADD_SUBDIRECTORY(presets) ADD_SUBDIRECTORY(projects) ADD_SUBDIRECTORY(samples) ADD_SUBDIRECTORY(themes) +ADD_SUBDIRECTORY(scripts) IF(LMMS_BUILD_LINUX) INSTALL(FILES themes/default/icon.png DESTINATION "${DATA_DIR}/pixmaps" RENAME lmms.png) @@ -17,3 +18,6 @@ IF(LMMS_BUILD_WIN32) INSTALL(FILES ${RAWWAVES} DESTINATION "${DATA_DIR}/stk/rawwaves") ENDIF(LMMS_BUILD_WIN32) +IF(LMMS_BUILD_APPLE) + CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/data/lmms.plist.in" "${CMAKE_INSTALL_PREFIX}/Info.plist") +ENDIF(LMMS_BUILD_APPLE) \ No newline at end of file diff --git a/data/lmms.plist.in b/data/lmms.plist.in new file mode 100644 index 000000000..e6aad9e96 --- /dev/null +++ b/data/lmms.plist.in @@ -0,0 +1,48 @@ + + + + + + CFBundleExecutable + @MACOSX_BUNDLE_GUI_IDENTIFIER@ + CFBundleGetInfoString + @MACOSX_BUNDLE_GUI_IDENTIFIER@ @MACOSX_BUNDLE_LONG_VERSION_STRING@ + CFBundleIdentifier + net.sourceforge.lmms + CFBundleIconFile + @MACOSX_BUNDLE_ICON_FILE@ + CFBundleName + @MACOSX_BUNDLE_BUNDLE_NAME@ + CFBundlePackageType + APPL + CFBundleDevelopmentRegion + English + CFBundleInfoDictionaryVersion + 6.0 + CFBundleVersion + @MACOSX_BUNDLE_LONG_VERSION_STRING@ + CFBundleDocumentTypes + + + CFBundleTypeIconFile + project.icns + CFBundleTypeName + @MACOSX_BUNDLE_GUI_IDENTIFIER@ Project + CFBundleTypeRole + Editor + LSIsAppleDefaultForType + + LSItemContentTypes + + public.mmp + public.mmpz + + CFBundleTypeExtensions + + mmp + mmpz + + + + + diff --git a/data/project.icns b/data/project.icns new file mode 100644 index 000000000..930afc217 Binary files /dev/null and b/data/project.icns differ diff --git a/data/scripts/CMakeLists.txt b/data/scripts/CMakeLists.txt new file mode 100644 index 000000000..405b5f65c --- /dev/null +++ b/data/scripts/CMakeLists.txt @@ -0,0 +1,13 @@ +SET(BUILD_ROOT "${CMAKE_CURRENT_BINARY_DIR}/../../") +IF(LMMS_BUILD_APPLE) + CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/data/scripts/create_apple_bundle.sh.in" + "${BUILD_ROOT}/create_apple_bundle.sh" @ONLY) + CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/data/scripts/create_apple_dmg.sh.in" + "${BUILD_ROOT}/create_apple_dmg.sh" @ONLY) + # Add execute permissions to bundle script + SET(CHMOD_CMD "chmod") + SET(CHMOD_ARG1 "u+x") + SET(CHMOD_ARG2 "${BUILD_ROOT}/create_apple_bundle.sh") + EXECUTE_PROCESS(COMMAND ${CHMOD_CMD} ${CHMOD_ARG1} ${CHMOD_ARG2}) + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${BUILD_ROOT}/create_apple_bundle.sh)") +ENDIF(LMMS_BUILD_APPLE) \ No newline at end of file diff --git a/data/scripts/create_apple_bundle.sh.in b/data/scripts/create_apple_bundle.sh.in new file mode 100644 index 000000000..8b335cb0d --- /dev/null +++ b/data/scripts/create_apple_bundle.sh.in @@ -0,0 +1,121 @@ +#!/bin/bash +#title :create_applet_installer.sh +#description :Creates Apple ".app" bundle for LMMS +#author :Tres Finocchiaro +#date :20140504 +#version :1.1 +#usage :bash create_applet_installer.sh +#notes :See also https://github.com/LMMS +#notes :Troubleshooting try: export DYLD_PRINT_LIBRARIES=1; export VERBOSE=1; +#requires :deploymacqt +#========================================================================================= + +# MacPorts Location +MACPORTS=/opt/local + + # LMMS project root directory (extracted source) +CMAKE_SRC=@CMAKE_SOURCE_DIR@ + +# LMMS compiled (install) resources +CMAKE_INSTALL=@CMAKE_INSTALL_PREFIX@ + +# LMMS working build directory +CMAKE_BUILD=$(cd @CMAKE_CURRENT_BINARY_DIR@/../..; pwd) + +# STK rawwaves directory +STK_RAWWAVE=${HOME}/stk-*/rawwaves + +# Place to create ".app" bundle +APP=${HOME}/Desktop/LMMS.app + +# MacPorts installs libreadline with wrong permissions +LIBREADLINE=${MACPORTS}/lib/libreadline.6.2.dylib + +# The DMG packager script location +DMG_SCRIPT_SRC=${CMAKE_BUILD}/create_apple_dmg.sh +DMG_SCRIPT_DST=${HOME}/Desktop/create_apple_dmg.sh + +#========================================================================================= + +MSG_COLOR='\x1B[1;36m' +COLOR_RESET='\x1B[0m' +echo -e "${MSG_COLOR}\n\nCreating App Bundle \"${APP}\"...${COLOR_RESET}" + +# Check for u+w permissions on libreadline +CHECKREADLINE=$(stat -f "%p" $LIBREADLINE) +CHECKREADLINE=${CHECKREADLINE:3:1} +if [ "${CHECKREADLINE}" != "7" ] +then + echo -e "\n\n\t\t\t\t***********\n\t\t\t\t* WARNING *\n\t\t\t\t***********" + echo -e "File ${LIBREADLINE} is not marked as user writable." + echo -e "This will break macdeployqt's linking process after it is copied." + echo -e "A sudo password is required to elevate and fix using chmod u+w." + echo -e "\nPLEASE ENTER SUDO PASSWORD:" + sudo chmod u+w "${MACPORTS}/lib/libreadline.6.2.dylib" +fi + +# Remove any old .app bundles +rm -Rf ${APP} + +# Create new bundle, copy our built code to it +mkdir -p ${APP} +cd ${CMAKE_INSTALL} +mkdir ${APP}/Contents +cp -R * ${APP}/Contents + +# Manually copy STK rawwaves +mkdir -p ${APP}/Contents/share/stk/rawwaves +cp ${STK_RAWWAVE}/*.raw ${APP}/Contents/share/stk/rawwaves + +# Make all libraries writable for macdeployqt +cd ${APP} +find . -type f -print0 | xargs -0 chmod u+w + +# Move lmms binary to the proper location +mkdir -p ${APP}/Contents/MacOS +mv ${APP}/Contents/bin/lmms ${APP}/Contents/MacOS +rm -rf ${APP}/Contents/bin + +# Move libraries to proper locations +mkdir -p ${APP}/Contents/Frameworks +mv ${APP}/Contents/lib/lmms/libZynAddSubFxCore.dylib \ + ${APP}/Contents/Frameworks/libZynAddSubFxCore.dylib + +mv ${APP}/Contents/lib/lmms/RemoteZynAddSubFx \ + ${APP}/Contents/MacOS/RemoteZynAddSubFx + +# Fix more Zyn Linking issues +install_name_tool -change libZynAddSubFxCore.dylib \ + @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ + ${APP}/Contents/lib/lmms/libzynaddsubfx.so + +install_name_tool -change ${CMAKE_BUILD}/plugins/zynaddsubfx/libZynAddSubFxCore.dylib \ + @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ + ${APP}/Contents/MacOS/RemoteZynAddSubFx + +# Build a list of shared objects in target/lib/lmms +for file in ${APP}/Contents/lib/lmms/*.so; do + _executables="${_executables} -executable=${APP}/Contents/lib/lmms/${file##*/}" +done + +# Build a list of shared objects in target/lib/lmms/ladspa +for file in ${APP}/Contents/lib/lmms/ladspa/*.so; do +_executables="${_executables} -executable=${APP}/Contents/lib/lmms/ladspa/${file##*/}" +done + +# Additional binaries that require linking +_executables="${_executables} -executable=${APP}/Contents/MacOS/RemoteZynAddSubFx" +_executables="${_executables} -executable=${APP}/Contents/Frameworks/libZynAddSubFxCore.dylib" + +# Build our App Package using "macdeployqt" +macdeployqt ${APP} $_executables + +# OS X Specific Artwork +cp ${CMAKE_SRC}/data/*.icns ${APP}/Contents/Resources/ + +# Done. Ready to build DMG +echo -e "\nFinished.\n\nYou may run LMMS from the Desktop." +echo -e "\nTo create an Apple DMG Package run ${MSG_COLOR}\"${DMG_SCRIPT_DST}\"${COLOR_RESET}.\n" +echo -e "(Note: You can drag/drop the script directly into this terminal window.)\n" +cp ${DMG_SCRIPT_SRC} ${DMG_SCRIPT_DST} +chmod +x ${DMG_SCRIPT_DST} diff --git a/data/scripts/create_apple_dmg.sh b/data/scripts/create_apple_dmg.sh.in old mode 100755 new mode 100644 similarity index 97% rename from data/scripts/create_apple_dmg.sh rename to data/scripts/create_apple_dmg.sh.in index be50c2b81..eb77b75bb --- a/data/scripts/create_apple_dmg.sh +++ b/data/scripts/create_apple_dmg.sh.in @@ -10,10 +10,10 @@ if [ -d "$dir" ]; then fi # set up your app name, version number, and background image file name -APP_NAME="LMMS" -VERSION="1.0.0" +APP_NAME="@MACOSX_BUNDLE_BUNDLE_NAME@" +VERSION="@MACOSX_BUNDLE_LONG_VERSION_STRING@" DMG_BACKGROUND_IMG="dmg_branding.png" -cp $HOME/lmms/data/$DMG_BACKGROUND_IMG . +cp "@CMAKE_SOURCE_DIR@/data/${DMG_BACKGROUND_IMG}" . # you should not need to change these APP_LOWERCASE=$(echo $APP_NAME|tr '[:upper:]' '[:lower:]') diff --git a/data/scripts/create_apple_installer.sh b/data/scripts/create_apple_installer.sh deleted file mode 100755 index 85efc59ec..000000000 --- a/data/scripts/create_apple_installer.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/bash -#title :create_applet_installer.sh -#description :Creates Apple ".app" bundle for LMMS -#author :Tres Finocchiaro -#date :20140331 -#version :1.0 -#usage :bash create_applet_installer.sh -#notes :See also https://github.com/LMMS -#notes :Troubleshooting try: export DYLD_PRINT_LIBRARIES=1 -#requires :deploymacqt -#========================================================================================= - -# MacPorts Location -MACPORTS=/opt/local - - # LMMS source directory -CMAKE_SRC=$HOME/lmms - -# LMMS compiled resources -CMAKE_INSTALL=$CMAKE_SRC/target - -# LMMS source build directory -CMAKE_BUILD=$CMAKE_SRC/build - -# STK rawwaves directory -STK_RAWWAVE=$HOME/stk-*/rawwaves - - -# Place to create ".app" bundle -APP=$HOME/Desktop/LMMS.app - -# MacPorts installs libreadline with wrong permissions -LIBREADLINE=$MACPORTS/lib/libreadline.6.2.dylib - -#========================================================================================= - -echo -e "\n\nRunning..." - -# Check for u+w permissions on libreadline -_perm=`stat -f "%p" $LIBREADLINE` -_perm=${_perm:3:1} -if [ ${_perm} != "7" ] -then - echo -e "\n\n\t\t\t\t***********\n\t\t\t\t* WARNING *\n\t\t\t\t***********" - echo -e "File $LIBREADLINE is not marked as user writable." - echo -e "This will break macdeployqt's linking process after it is copied." - echo -e "A sudo password is required to elevate and fix using chmod u+w." - echo -e "\nPLEASE ENTER SUDO PASSWORD:" - sudo chmod u+w $MACPORTS/lib/libreadline.6.2.dylib -fi - -# Remove any old .app bundles -rm -Rf $APP - -# Create new bundle, copy our built code to it -mkdir -p $APP -cd $CMAKE_INSTALL -mkdir $APP/Contents -cp -R * $APP/Contents - -# Manually copy STK rawwaves -mkdir -p $APP/Contents/share/stk/rawwaves -cp $STK_RAWWAVE/*.raw $APP/Contents/share/stk/rawwaves - -# Make all libraries writable for macdeployqt -cd $APP -find . -type f -print0 | xargs -0 chmod u+w - -# Move lmms binary to the proper location -mkdir -p $APP/Contents/MacOS -mv $APP/Contents/bin/lmms $APP/Contents/MacOS -rmdir $APP/Contents/bin - -# Move libraries to proper locations -mkdir -p $APP/Contents/Frameworks -mv $APP/Contents/lib/lmms/libZynAddSubFxCore.dylib \ - $APP/Contents/Frameworks/libZynAddSubFxCore.dylib - -mv $APP/Contents/lib/lmms/RemoteZynAddSubFx \ - $APP/Contents/MacOS/RemoteZynAddSubFx - -# Fix more Zyn Linking issues -# install_name_tool -change $CMAKE_INSTALL/lib/lmms/libZynAddSubFxCore.dylib \ -# @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ -# $APP/Contents/lib/lmms/libzynaddsubfx.so - -install_name_tool -change libZynAddSubFxCore.dylib \ - @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ - $APP/Contents/lib/lmms/libzynaddsubfx.so - -install_name_tool -change $CMAKE_BUILD/plugins/zynaddsubfx/libZynAddSubFxCore.dylib \ - @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ - $APP/Contents/MacOS/RemoteZynAddSubFx - -# Build a list of shared objects in target/lib/lmms -for file in $APP/Contents/lib/lmms/*.so; do - _executables="$_executables -executable=$APP/Contents/lib/lmms/${file##*/}" -done - -# Build a list of shared objects in target/lib/lmms/ladspa -for file in $APP/Contents/lib/lmms/ladspa/*.so; do - _executables="$_executables -executable=$APP/Contents/lib/lmms/ladspa/${file##*/}" -done - -# Additional binaries that require linking -_executables="$_executables -executable=$APP/Contents/MacOS/RemoteZynAddSubFx" -_executables="$_executables -executable=$APP/Contents/Frameworks/libZynAddSubFxCore.dylib" - -# Build our App Package using "macdeployqt" -macdeployqt $APP $_executables - -# OS X Specific Artwork -cp $CMAKE_SRC/data/lmms.icns $APP/Contents/Resources/ - -# Create "Info.plist" using lmms.icns file, http://iconverticons.com/online/) -echo -e "" > "$APP/Contents/Info.plist" -echo -e "> "$APP/Contents/Info.plist" -echo -e "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " CFBundleIconFile" >> "$APP/Contents/Info.plist" -echo -e " lmms.icns" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e "" >> "$APP/Contents/Info.plist" - -# Done. Ready to build DMG -echo -e "\nFinished.\n\nPlease run \"create_apple_dmg.sh\" from the Desktop to build the installer.\n" -echo -e "Note: You can drag/drop it into this terminal window.)\n" -cp $CMAKE_SRC/data/scripts/create_apple_dmg.sh $HOME/Desktop/ -chmod +x $HOME/Desktop/create_apple_dmg.sh diff --git a/plugins/LadspaEffect/swh/imp_1199.c b/plugins/LadspaEffect/swh/imp_1199.c index 599bedb81..f392ef8b4 100644 --- a/plugins/LadspaEffect/swh/imp_1199.c +++ b/plugins/LadspaEffect/swh/imp_1199.c @@ -99,8 +99,10 @@ inline void impulse2freq(int id, float *imp, unsigned int length, fftw_real *out for (i=0; i=last) impulse_time[i] = 0.0f; } #ifdef FFTW3 fftwf_execute(tmp_plan); diff --git a/plugins/LadspaEffect/swh/impulses/all.h b/plugins/LadspaEffect/swh/impulses/all.h index cf597bfeb..3355f327f 100644 --- a/plugins/LadspaEffect/swh/impulses/all.h +++ b/plugins/LadspaEffect/swh/impulses/all.h @@ -24,7 +24,11 @@ #include "impulses/20-matchless-chieftain-sm57.h" #include "impulses/21-matchless-chieftain-sm57-off.h" +#ifdef __clang__ +void mk_imps(fftw_real **impulse_freq) +#else inline void mk_imps(fftw_real **impulse_freq) +#endif { int c = 0; MK_IMP(unit); diff --git a/plugins/LadspaEffect/swh/sifter_1210.c b/plugins/LadspaEffect/swh/sifter_1210.c index 891e56ee1..06184ab40 100644 --- a/plugins/LadspaEffect/swh/sifter_1210.c +++ b/plugins/LadspaEffect/swh/sifter_1210.c @@ -33,7 +33,11 @@ void _init(); // forward declaration inline int partition(LADSPA_Data array[], int left, int right); +#ifdef __clang__ +void q_sort(LADSPA_Data array[], int left, int right) { +#else inline void q_sort(LADSPA_Data array[], int left, int right) { +#endif float pivot = partition(array, left, right); if (left < pivot) { diff --git a/plugins/LadspaEffect/swh/util/waveguide_nl.h b/plugins/LadspaEffect/swh/util/waveguide_nl.h index 64a322278..398518eb0 100644 --- a/plugins/LadspaEffect/swh/util/waveguide_nl.h +++ b/plugins/LadspaEffect/swh/util/waveguide_nl.h @@ -115,7 +115,8 @@ inline void waveguide_nl_process(waveguide_nl *wg, float in0, float in1, float * b = (*out0 + 1.0) * 6.0f; if (b > 1.0f) { b = 1.0f; - } else if (b < 0.0f) { + } + if (b < 0.0f) { b = 0.0f; } a1 = b * wg->a1a + (1.0f - b) * wg->a1b; @@ -129,7 +130,8 @@ inline void waveguide_nl_process(waveguide_nl *wg, float in0, float in1, float * b = (*out1 + 1.0) * 6.0f; if (b > 1.0f) { b = 1.0f; - } else if (b < 0.0f) { + } + if (b < 0.0f) { b = 0.0f; } a1 = b * wg->a1a + (1.0f - b) * wg->a1b; diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index 1510f630a..51e61ac1d 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -344,8 +344,10 @@ void configManager::loadConfigFile() if( m_ladDir.isEmpty() || m_ladDir == QDir::separator() || ( !m_ladDir.contains( ':' ) && !QDir( m_ladDir ).exists() ) ) { -#ifdef LMMS_BUILD_WIN32 +#if defined(LMMS_BUILD_WIN32) m_ladDir = m_pluginDir + "ladspa" + QDir::separator(); +#elif defined(LMMS_BUILD_APPLE) + m_ladDir = qApp->applicationDirPath() + "/../lib/lmms/ladspa/"; #else m_ladDir = qApp->applicationDirPath() + '/' + LIB_DIR + "/ladspa/"; #endif