diff --git a/.clang-tidy b/.clang-tidy index aff46bba6..5de9376e5 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -2,17 +2,22 @@ Checks: > bugprone-macro-parentheses, bugprone-macro-repeated-side-effects, + modernize-avoid-c-arrays, + modernize-loop-convert, modernize-redundant-void-arg, + modernize-use-auto, modernize-use-bool-literals, modernize-use-emplace, modernize-use-equals-default, modernize-use-equals-delete, modernize-use-override, + modernize-use-using, performance-trivially-destructible, + readability-braces-around-statements, + readability-const-return-type, readability-identifier-naming, readability-misleading-indentation, - readability-simplify-boolean-expr, - readability-braces-around-statements + readability-simplify-boolean-expr WarningsAsErrors: '' HeaderFilterRegex: '' # don't show errors from headers AnalyzeTemporaryDtors: false diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b51857402..007842b82 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -225,8 +225,8 @@ jobs: --triplet=${{ matrix.arch }}-windows ` --host-triplet=${{ matrix.arch }}-windows ` --recurse ` - fftw3 fluidsynth[sndfile] libsamplerate libsndfile libstk lilv lv2 ` - portaudio sdl2 + fftw3 fltk fluidsynth[sndfile] libsamplerate libsndfile libstk ` + lilv lv2 portaudio sdl2 - name: Set up build environment uses: ilammy/msvc-dev-cmd@d8610e2b41c6d0f0c3b4c46dad8df0fd826c68e1 with: diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 1d893989e..3f7700674 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -21,7 +21,7 @@ jobs: run: tests/scripted/check-namespace shellcheck: runs-on: ubuntu-latest - container: koalaman/shellcheck-alpine:v0.4.6 + container: koalaman/shellcheck-alpine:v0.9.0 steps: - name: Check out uses: actions/checkout@v3 diff --git a/.gitmodules b/.gitmodules index 2ccfcbcdf..ee6e7eac9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -49,3 +49,6 @@ [submodule "plugins/LadspaEffect/cmt/cmt"] path = plugins/LadspaEffect/cmt/cmt url = https://github.com/lmms/cmt +[submodule "src/3rdparty/hiir/hiir"] + path = src/3rdparty/hiir/hiir + url = https://github.com/LostRobotMusic/hiir diff --git a/CMakeLists.txt b/CMakeLists.txt index ad419e2cb..c5de064a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.8) +CMAKE_MINIMUM_REQUIRED(VERSION 3.9) PROJECT(lmms) @@ -486,6 +486,13 @@ ENDIF(WANT_JACK) FIND_PACKAGE(FFTW COMPONENTS fftw3f REQUIRED) # check for FLTK +set(FLTK_SKIP_OPENGL TRUE) +set(FLTK_SKIP_FORMS TRUE) +set(FLTK_SKIP_IMAGES TRUE) +set(FLTK_SKIP_MATH TRUE) +if(MINGW_PREFIX) + set(FLTK_SKIP_FLUID TRUE) +endif() FIND_PACKAGE(FLTK) IF(FLTK_FOUND) SET(STATUS_ZYN "OK") @@ -495,7 +502,7 @@ ENDIF() # check for Fluidsynth IF(WANT_SF2) - find_package(FluidSynth 1.0.7) + find_package(FluidSynth 1.1.0) if(FluidSynth_FOUND) SET(LMMS_HAVE_FLUIDSYNTH TRUE) SET(STATUS_FLUIDSYNTH "OK") diff --git a/README.md b/README.md index 7090a6a15..c64ca0a97 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ [![Join the chat at Discord](https://img.shields.io/badge/chat-on%20discord-7289DA.svg)](https://discord.gg/3sc5su7) [![Localise on transifex](https://img.shields.io/badge/localise-on_transifex-green.svg)](https://www.transifex.com/lmms/lmms/) -**New PRs may be affected by ongoing reorganization ([#5592](https://github.com/LMMS/lmms/issues/5592)). Please be prepared to rebase your PR as necessary.** - What is LMMS? -------------- diff --git a/cmake/apple/install_apple.sh.in b/cmake/apple/install_apple.sh.in index e1921b1a5..df9300712 100644 --- a/cmake/apple/install_apple.sh.in +++ b/cmake/apple/install_apple.sh.in @@ -6,9 +6,6 @@ set -e -# STK rawwaves directory -STK_RAWWAVE=$(brew --prefix stk)/share/stk/rawwaves - # Place to create ".app" bundle APP="@CMAKE_BINARY_DIR@/@PROJECT_NAME_UCASE@.app" @@ -29,11 +26,9 @@ command cp "@CMAKE_BINARY_DIR@/Info.plist" "@CMAKE_INSTALL_PREFIX@/" mkdir -p "$APP/Contents/MacOS" mkdir -p "$APP/Contents/Frameworks" mkdir -p "$APP/Contents/Resources" -mkdir -p "$APP/Contents/share/stk/rawwaves" cd "@CMAKE_INSTALL_PREFIX@" cp -R ./* "$APP/Contents" cp "@CMAKE_SOURCE_DIR@/cmake/apple/"*.icns "$APP/Contents/Resources/" -cp "$STK_RAWWAVE"/*.raw "$APP/Contents/share/stk/rawwaves" > /dev/null 2>&1 # Make all libraries writable for macdeployqt cd "$APP" diff --git a/cmake/install/CMakeLists.txt b/cmake/install/CMakeLists.txt index cd4100c9b..5ee731d16 100644 --- a/cmake/install/CMakeLists.txt +++ b/cmake/install/CMakeLists.txt @@ -36,6 +36,16 @@ IF(LMMS_BUILD_WIN32 OR LMMS_INSTALL_DEPENDENCIES) ) ENDIF() +# Install STK rawwaves +if(LMMS_HAVE_STK AND (LMMS_BUILD_WIN32 OR LMMS_BUILD_APPLE)) + if(STK_RAWWAVE_ROOT) + file(GLOB RAWWAVES "${STK_RAWWAVE_ROOT}/*.raw") + install(FILES ${RAWWAVES} DESTINATION "${DATA_DIR}/stk/rawwaves") + else() + message(WARNING "Can't find STK rawwave root!") + endif() +endif() + IF(LMMS_BUILD_APPLE) INSTALL(CODE "EXECUTE_PROCESS(COMMAND chmod u+x ${CMAKE_BINARY_DIR}/install_apple.sh)") INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_BINARY_DIR}/install_apple.sh)") diff --git a/cmake/linux/package_linux.sh.in b/cmake/linux/package_linux.sh.in index 89e500060..16cd5719b 100644 --- a/cmake/linux/package_linux.sh.in +++ b/cmake/linux/package_linux.sh.in @@ -149,6 +149,7 @@ fi # Patch the desktop file sed -i 's/.*Exec=.*/Exec=lmms.real/' "$DESKTOPFILE" +echo "X-AppImage-Version=@VERSION@" >> "$DESKTOPFILE" # Fix linking for soft-linked plugins for file in "${APPDIR}usr/lib/lmms/"*.so; do @@ -201,6 +202,9 @@ fi rm -f "${APPDIR}/AppRun" ln -sr "${APPDIR}/usr/bin/lmms" "${APPDIR}/AppRun" +# Add icon +ln -srf "${APPDIR}/lmms.png" "${APPDIR}/.DirIcon" + # Create AppImage echo -e "\nFinishing the AppImage..." run_and_log "$APPIMAGETOOL" "${APPDIR}" "@APPIMAGE_FILE@" diff --git a/cmake/modules/BashCompletion.cmake b/cmake/modules/BashCompletion.cmake index c3916f201..7301e82aa 100644 --- a/cmake/modules/BashCompletion.cmake +++ b/cmake/modules/BashCompletion.cmake @@ -24,7 +24,7 @@ # - Windows does not support bash completion # - macOS support should eventually be added for Homebrew (TODO) IF(WIN32) - MESSAGE(STATUS "Bash competion is not supported on this platform.") + MESSAGE(STATUS "Bash completion is not supported on this platform.") ELSEIF(APPLE) MESSAGE(STATUS "Bash completion is not yet implemented for this platform.") ELSE() diff --git a/cmake/modules/CheckSubmodules.cmake b/cmake/modules/CheckSubmodules.cmake index f36189c38..b9ea20778 100644 --- a/cmake/modules/CheckSubmodules.cmake +++ b/cmake/modules/CheckSubmodules.cmake @@ -18,7 +18,7 @@ # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # Files which confirm a successful clone -SET(VALID_CRUMBS "CMakeLists.txt;Makefile;Makefile.in;Makefile.am;configure.ac;configure.py;autogen.sh;.gitignore;LICENSE;Home.md") +SET(VALID_CRUMBS "CMakeLists.txt;Makefile;Makefile.in;Makefile.am;configure.ac;configure.py;autogen.sh;.gitignore;LICENSE;Home.md;license.txt") OPTION(NO_SHALLOW_CLONE "Disable shallow cloning of submodules" OFF) diff --git a/cmake/modules/FindSTK.cmake b/cmake/modules/FindSTK.cmake index 80ed0da42..0718f5039 100644 --- a/cmake/modules/FindSTK.cmake +++ b/cmake/modules/FindSTK.cmake @@ -26,6 +26,13 @@ else() endif() endif() +# find STK rawwave path +find_path(STK_RAWWAVE_ROOT + NAMES silence.raw sinewave.raw + HINTS "${STK_INCLUDE_DIR}/.." + PATH_SUFFIXES share/stk/rawwaves share/libstk/rawwaves +) + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(STK REQUIRED_VARS STK_LIBRARY STK_INCLUDE_DIR diff --git a/cmake/modules/PluginList.cmake b/cmake/modules/PluginList.cmake index 151c5bd66..6b2c7519a 100644 --- a/cmake/modules/PluginList.cmake +++ b/cmake/modules/PluginList.cmake @@ -33,6 +33,7 @@ SET(LMMS_PLUGIN_LIST Compressor CrossoverEQ Delay + Dispersion DualFilter DynamicsProcessor Eq @@ -100,7 +101,6 @@ ENDIF() IF(MSVC) SET(MSVC_INCOMPATIBLE_PLUGINS LadspaEffect - ZynAddSubFx ) message(WARNING "Compiling with MSVC. The following plugins are not available: ${MSVC_INCOMPATIBLE_PLUGINS}") LIST(REMOVE_ITEM PLUGIN_LIST ${MSVC_INCOMPATIBLE_PLUGINS}) diff --git a/cmake/modules/VersionInfo.cmake b/cmake/modules/VersionInfo.cmake index 9571514a6..6f4c371f1 100644 --- a/cmake/modules/VersionInfo.cmake +++ b/cmake/modules/VersionInfo.cmake @@ -3,6 +3,13 @@ IF(GIT_FOUND AND NOT FORCE_VERSION) SET(MAJOR_VERSION 0) SET(MINOR_VERSION 0) SET(PATCH_VERSION 0) + + # If this is a GitHub Actions pull request build, get the pull request + # number from the environment and add it to the build metadata + if("$ENV{GITHUB_REF}" MATCHES "refs/pull/([0-9]+)/merge") + list(APPEND BUILD_METADATA "pr${CMAKE_MATCH_1}") + endif() + # Look for git tag information (e.g. Tagged: "v1.0.0", Untagged: "v1.0.0-123-a1b2c3d") # Untagged format: [latest tag]-[number of commits]-[latest commit hash] EXECUTE_PROCESS( @@ -30,28 +37,43 @@ IF(GIT_FOUND AND NOT FORCE_VERSION) ENDIF() # 1 dash total: Dash in latest tag, no additional commits => pre-release IF(TAG_LIST_LENGTH EQUAL 2) + # Get the pre-release stage LIST(GET TAG_LIST 1 VERSION_STAGE) - SET(FORCE_VERSION "${FORCE_VERSION}-${VERSION_STAGE}") + list(APPEND PRERELEASE_DATA "${VERSION_STAGE}") # 2 dashes: Assume untagged with no dashes in latest tag name => stable + commits ELSEIF(TAG_LIST_LENGTH EQUAL 3) # Get the number of commits and latest commit hash LIST(GET TAG_LIST 1 EXTRA_COMMITS) LIST(GET TAG_LIST 2 COMMIT_HASH) - # Bump the patch version + list(APPEND PRERELEASE_DATA "${EXTRA_COMMITS}") + list(APPEND BUILD_METADATA "${COMMIT_HASH}") + # Bump the patch version, since a pre-release (as specified by the extra + # commits) compares lower than the main version alone MATH(EXPR PATCH_VERSION "${PATCH_VERSION}+1") - # Set the version to MAJOR.MINOR.PATCH-EXTRA_COMMITS+COMMIT_HASH - SET(FORCE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") - SET(FORCE_VERSION "${FORCE_VERSION}-${EXTRA_COMMITS}+${COMMIT_HASH}") + # Reassemble the main version using the new patch version + set(FORCE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") # 3 dashes: Assume untagged with 1 dash in latest tag name => pre-release + commits ELSEIF(TAG_LIST_LENGTH EQUAL 4) - # Get pre-release stage, number of commits, and latest commit hash + # Get the pre-release stage, number of commits, and latest commit hash LIST(GET TAG_LIST 1 VERSION_STAGE) LIST(GET TAG_LIST 2 EXTRA_COMMITS) LIST(GET TAG_LIST 3 COMMIT_HASH) - # Set the version to MAJOR.MINOR.PATCH-VERSION_STAGE.EXTRA_COMMITS+COMMIT_HASH - SET(FORCE_VERSION "${FORCE_VERSION}-${VERSION_STAGE}") - SET(FORCE_VERSION "${FORCE_VERSION}.${EXTRA_COMMITS}+${COMMIT_HASH}") + list(APPEND PRERELEASE_DATA "${VERSION_STAGE}") + list(APPEND PRERELEASE_DATA "${EXTRA_COMMITS}") + list(APPEND BUILD_METADATA "${COMMIT_HASH}") ENDIF() + + # If there is any pre-release data, append it after a hyphen + if(PRERELEASE_DATA) + string(REPLACE ";" "." PRERELEASE_DATA "${PRERELEASE_DATA}") + set(FORCE_VERSION "${FORCE_VERSION}-${PRERELEASE_DATA}") + endif() + + # If there is any build metadata, append it after a plus + if(BUILD_METADATA) + string(REPLACE ";" "." BUILD_METADATA "${BUILD_METADATA}") + set(FORCE_VERSION "${FORCE_VERSION}+${BUILD_METADATA}") + endif() ENDIF() IF(FORCE_VERSION STREQUAL "internal") diff --git a/cmake/nsis/CMakeLists.txt b/cmake/nsis/CMakeLists.txt index 9dca3495d..ee1bd45c3 100644 --- a/cmake/nsis/CMakeLists.txt +++ b/cmake/nsis/CMakeLists.txt @@ -73,12 +73,6 @@ SET(CPACK_NSIS_MUI_ICON "${CPACK_NSIS_MUI_ICON}" PARENT_SCOPE) CONFIGURE_FILE("lmms.rc.in" "${CMAKE_BINARY_DIR}/lmms.rc") CONFIGURE_FILE("zynaddsubfx.rc.in" "${CMAKE_BINARY_DIR}/plugins/ZynAddSubFx/zynaddsubfx.rc") -IF(LMMS_HAVE_STK) - FILE(GLOB RAWWAVES "${MINGW_PREFIX}/share/stk/rawwaves/*.raw") - LIST(SORT RAWWAVES) - INSTALL(FILES ${RAWWAVES} DESTINATION "${DATA_DIR}/stk/rawwaves") -ENDIF() - INSTALL(FILES "lmms.exe.manifest" DESTINATION .) INSTALL(FILES "lmms.VisualElementsManifest.xml" DESTINATION .) INSTALL(DIRECTORY "assets" DESTINATION .) diff --git a/data/locale/CMakeLists.txt b/data/locale/CMakeLists.txt index 4ce666dcf..f7f9071e7 100644 --- a/data/locale/CMakeLists.txt +++ b/data/locale/CMakeLists.txt @@ -29,9 +29,14 @@ FOREACH(_ts_file ${lmms_LOCALES}) ADD_CUSTOM_TARGET(${_ts_target} 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} + add_custom_command( + OUTPUT "${_qm_file}" COMMAND "${QT_LRELEASE_EXECUTABLE}" "${_ts_file}" -qm "${_qm_file}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + MAIN_DEPENDENCY "${_ts_file}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + VERBATIM + ) + add_custom_target("${_qm_target}" DEPENDS "${_qm_file}") LIST(APPEND ts_targets "${_ts_target}") LIST(APPEND qm_targets "${_qm_target}") LIST(APPEND QM_FILES "${_qm_file}") diff --git a/data/themes/classic/style.css b/data/themes/classic/style.css index 58ec5dc09..2880fe661 100644 --- a/data/themes/classic/style.css +++ b/data/themes/classic/style.css @@ -70,7 +70,7 @@ QToolTip { color: #4afd85; } -lmms--gui--TextFloat { +lmms--gui--TextFloat, lmms--gui--SimpleTextFloat { border-radius: 4px; background: qlineargradient(spread:reflect, x1:0.5, y1:0.5, x2:0.5, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(50, 50, 50, 220)); opacity: 175; diff --git a/data/themes/default/style.css b/data/themes/default/style.css index f4c651c9e..a9646cfe4 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -100,7 +100,7 @@ QToolTip { color: #d1d8e4; } -lmms--gui--TextFloat { +lmms--gui--TextFloat, lmms--gui--SimpleTextFloat { background: #040506; color: #d1d8e4; } diff --git a/include/AboutDialog.h b/include/AboutDialog.h index c7d65023f..2fd01faf5 100644 --- a/include/AboutDialog.h +++ b/include/AboutDialog.h @@ -22,9 +22,8 @@ * */ - -#ifndef ABOUT_DIALOG_H -#define ABOUT_DIALOG_H +#ifndef LMMS_GUI_ABOUT_DIALOG_H +#define LMMS_GUI_ABOUT_DIALOG_H #include @@ -42,5 +41,4 @@ public: } // namespace lmms::gui -#endif - +#endif // LMMS_GUI_ABOUT_DIALOG_H diff --git a/include/ActionGroup.h b/include/ActionGroup.h index 0fe9d78ed..e18f6fb23 100644 --- a/include/ActionGroup.h +++ b/include/ActionGroup.h @@ -22,9 +22,8 @@ * */ - -#ifndef ACTION_GROUP_H -#define ACTION_GROUP_H +#ifndef LMMS_GUI_ACTION_GROUP_H +#define LMMS_GUI_ACTION_GROUP_H #include @@ -59,4 +58,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_ACTION_GROUP_H diff --git a/include/AudioAlsa.h b/include/AudioAlsa.h index f96dd01c9..975532071 100644 --- a/include/AudioAlsa.h +++ b/include/AudioAlsa.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_ALSA_H -#define AUDIO_ALSA_H +#ifndef LMMS_AUDIO_ALSA_H +#define LMMS_AUDIO_ALSA_H #include "lmmsconfig.h" @@ -108,4 +108,4 @@ private: #endif // LMMS_HAVE_ALSA -#endif +#endif // LMMS_AUDIO_ALSA_H diff --git a/include/AudioAlsaSetupWidget.h b/include/AudioAlsaSetupWidget.h index f68d71e8a..cbe99ba01 100644 --- a/include/AudioAlsaSetupWidget.h +++ b/include/AudioAlsaSetupWidget.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_ALSA_SETUP_WIDGET_H -#define AUDIO_ALSA_SETUP_WIDGET_H +#ifndef LMMS_GUI_AUDIO_ALSA_SETUP_WIDGET_H +#define LMMS_GUI_AUDIO_ALSA_SETUP_WIDGET_H #include "lmmsconfig.h" @@ -66,4 +66,4 @@ private: #endif // LMMS_HAVE_ALSA -#endif +#endif // LMMS_GUI_AUDIO_ALSA_SETUP_WIDGET_H diff --git a/include/AudioDevice.h b/include/AudioDevice.h index 6b4e9939a..d1a9617cd 100644 --- a/include/AudioDevice.h +++ b/include/AudioDevice.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_DEVICE_H -#define AUDIO_DEVICE_H +#ifndef LMMS_AUDIO_DEVICE_H +#define LMMS_AUDIO_DEVICE_H #include #include @@ -160,4 +160,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUDIO_DEVICE_H diff --git a/include/AudioDeviceSetupWidget.h b/include/AudioDeviceSetupWidget.h index e984651e4..f56fa07a6 100644 --- a/include/AudioDeviceSetupWidget.h +++ b/include/AudioDeviceSetupWidget.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_DEVICE_SETUP_WIDGET_H -#define AUDIO_DEVICE_SETUP_WIDGET_H +#ifndef LMMS_GUI_AUDIO_DEVICE_SETUP_WIDGET_H +#define LMMS_GUI_AUDIO_DEVICE_SETUP_WIDGET_H #include "TabWidget.h" @@ -45,4 +45,4 @@ public: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_AUDIO_DEVICE_SETUP_WIDGET_H diff --git a/include/AudioDummy.h b/include/AudioDummy.h index 30b125b3a..e34260171 100644 --- a/include/AudioDummy.h +++ b/include/AudioDummy.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_DUMMY_H -#define AUDIO_DUMMY_H +#ifndef LMMS_AUDIO_DUMMY_H +#define LMMS_AUDIO_DUMMY_H #include "AudioDevice.h" #include "AudioDeviceSetupWidget.h" @@ -116,4 +116,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUDIO_DUMMY_H diff --git a/include/AudioEngine.h b/include/AudioEngine.h index 71751acb8..d0f269d87 100644 --- a/include/AudioEngine.h +++ b/include/AudioEngine.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_ENGINE_H -#define AUDIO_ENGINE_H +#ifndef LMMS_AUDIO_ENGINE_H +#define LMMS_AUDIO_ENGINE_H #include @@ -487,4 +487,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUDIO_ENGINE_H diff --git a/include/AudioEngineProfiler.h b/include/AudioEngineProfiler.h index 38631c6a9..7b5191e76 100644 --- a/include/AudioEngineProfiler.h +++ b/include/AudioEngineProfiler.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_ENGINE_PROFILER_H -#define AUDIO_ENGINE_PROFILER_H +#ifndef LMMS_AUDIO_ENGINE_PROFILER_H +#define LMMS_AUDIO_ENGINE_PROFILER_H #include @@ -62,4 +62,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUDIO_ENGINE_PROFILER_H diff --git a/include/AudioEngineWorkerThread.h b/include/AudioEngineWorkerThread.h index 87e2791b1..112930808 100644 --- a/include/AudioEngineWorkerThread.h +++ b/include/AudioEngineWorkerThread.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_ENGINE_WORKER_THREAD_H -#define AUDIO_ENGINE_WORKER_THREAD_H +#ifndef LMMS_AUDIO_ENGINE_WORKER_THREAD_H +#define LMMS_AUDIO_ENGINE_WORKER_THREAD_H #include @@ -121,4 +121,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUDIO_ENGINE_WORKER_THREAD_H diff --git a/include/AudioFileDevice.h b/include/AudioFileDevice.h index beee087e7..dc9a786a4 100644 --- a/include/AudioFileDevice.h +++ b/include/AudioFileDevice.h @@ -23,8 +23,8 @@ * */ -#ifndef AUDIO_FILE_DEVICE_H -#define AUDIO_FILE_DEVICE_H +#ifndef LMMS_AUDIO_FILE_DEVICE_H +#define LMMS_AUDIO_FILE_DEVICE_H #include @@ -73,4 +73,4 @@ using AudioFileDeviceInstantiaton } // namespace lmms -#endif +#endif // LMMS_AUDIO_FILE_DEVICE_H diff --git a/include/AudioFileFlac.h b/include/AudioFileFlac.h index 542a2e717..944e30478 100644 --- a/include/AudioFileFlac.h +++ b/include/AudioFileFlac.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_FILE_FLAC_H -#define AUDIO_FILE_FLAC_H +#ifndef LMMS_AUDIO_FILE_FLAC_H +#define LMMS_AUDIO_FILE_FLAC_H #include "lmmsconfig.h" @@ -33,7 +33,7 @@ namespace lmms { -class AudioFileFlac: public AudioFileDevice +class AudioFileFlac : public AudioFileDevice { public: AudioFileFlac(OutputSettings const& outputSettings, @@ -77,4 +77,4 @@ private: } // namespace lmms -#endif //AUDIO_FILE_FLAC_H +#endif // LMMS_AUDIO_FILE_FLAC_H diff --git a/include/AudioFileMP3.h b/include/AudioFileMP3.h index 290c9ccbf..4289ad211 100644 --- a/include/AudioFileMP3.h +++ b/include/AudioFileMP3.h @@ -23,8 +23,8 @@ * */ -#ifndef AUDIO_FILE_MP3_H -#define AUDIO_FILE_MP3_H +#ifndef LMMS_AUDIO_FILE_MP3_H +#define LMMS_AUDIO_FILE_MP3_H #include "lmmsconfig.h" @@ -75,4 +75,4 @@ private: #endif // LMMS_HAVE_MP3LAME -#endif +#endif // LMMS_AUDIO_FILE_MP3_H diff --git a/include/AudioFileOgg.h b/include/AudioFileOgg.h index 18617fa5f..77be8ca1c 100644 --- a/include/AudioFileOgg.h +++ b/include/AudioFileOgg.h @@ -23,8 +23,8 @@ * */ -#ifndef AUDIO_FILE_OGG_H -#define AUDIO_FILE_OGG_H +#ifndef LMMS_AUDIO_FILE_OGG_H +#define LMMS_AUDIO_FILE_OGG_H #include "lmmsconfig.h" @@ -113,4 +113,4 @@ private: #endif // LMMS_HAVE_OGGVORBIS -#endif +#endif // LMMS_AUDIO_FILE_OGG_H diff --git a/include/AudioFileWave.h b/include/AudioFileWave.h index 8dd3566f4..c186aaaa7 100644 --- a/include/AudioFileWave.h +++ b/include/AudioFileWave.h @@ -23,8 +23,8 @@ * */ -#ifndef AUDIO_FILE_WAVE_H -#define AUDIO_FILE_WAVE_H +#ifndef LMMS_AUDIO_FILE_WAVE_H +#define LMMS_AUDIO_FILE_WAVE_H #include "lmmsconfig.h" #include "AudioFileDevice.h" @@ -71,4 +71,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUDIO_FILE_WAVE_H diff --git a/include/AudioJack.h b/include/AudioJack.h index 263399487..2ef0f665c 100644 --- a/include/AudioJack.h +++ b/include/AudioJack.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_JACK_H -#define AUDIO_JACK_H +#ifndef LMMS_AUDIO_JACK_H +#define LMMS_AUDIO_JACK_H #include "lmmsconfig.h" @@ -144,4 +144,4 @@ signals: #endif // LMMS_HAVE_JACK -#endif +#endif // LMMS_AUDIO_JACK_H diff --git a/include/AudioOss.h b/include/AudioOss.h index 71103586a..55f64de85 100644 --- a/include/AudioOss.h +++ b/include/AudioOss.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_OSS_H -#define AUDIO_OSS_H +#ifndef LMMS_AUDIO_OSS_H +#define LMMS_AUDIO_OSS_H #include "lmmsconfig.h" @@ -92,4 +92,4 @@ private: #endif // LMMS_HAVE_OSS -#endif +#endif // LMMS_AUDIO_OSS_H diff --git a/include/AudioPort.h b/include/AudioPort.h index 5a2645784..d9803d205 100644 --- a/include/AudioPort.h +++ b/include/AudioPort.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_PORT_H -#define AUDIO_PORT_H +#ifndef LMMS_AUDIO_PORT_H +#define LMMS_AUDIO_PORT_H #include #include @@ -138,4 +138,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUDIO_PORT_H diff --git a/include/AudioPortAudio.h b/include/AudioPortAudio.h index 3fd32a7ac..01b8f3fd7 100644 --- a/include/AudioPortAudio.h +++ b/include/AudioPortAudio.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_PORTAUDIO_H -#define AUDIO_PORTAUDIO_H +#ifndef LMMS_AUDIO_PORTAUDIO_H +#define LMMS_AUDIO_PORTAUDIO_H #include @@ -163,4 +163,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUDIO_PORTAUDIO_H diff --git a/include/AudioPulseAudio.h b/include/AudioPulseAudio.h index 789296e27..b6a998274 100644 --- a/include/AudioPulseAudio.h +++ b/include/AudioPulseAudio.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_PULSEAUDIO_H -#define AUDIO_PULSEAUDIO_H +#ifndef LMMS_AUDIO_PULSEAUDIO_H +#define LMMS_AUDIO_PULSEAUDIO_H #include "lmmsconfig.h" @@ -104,4 +104,4 @@ private: #endif // LMMS_HAVE_PULSEAUDIO -#endif +#endif // LMMS_AUDIO_PULSEAUDIO_H diff --git a/include/AudioSampleRecorder.h b/include/AudioSampleRecorder.h index 7ad551916..8937ceb5e 100644 --- a/include/AudioSampleRecorder.h +++ b/include/AudioSampleRecorder.h @@ -23,8 +23,8 @@ * */ -#ifndef AUDIO_SAMPLE_RECORDER_H -#define AUDIO_SAMPLE_RECORDER_H +#ifndef LMMS_AUDIO_SAMPLE_RECORDER_H +#define LMMS_AUDIO_SAMPLE_RECORDER_H #include #include @@ -59,4 +59,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUDIO_SAMPLE_RECORDER_H diff --git a/include/AudioSdl.h b/include/AudioSdl.h index 7e7710a2f..62db8b68a 100644 --- a/include/AudioSdl.h +++ b/include/AudioSdl.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_SDL_H -#define AUDIO_SDL_H +#ifndef LMMS_AUDIO_SDL_H +#define LMMS_AUDIO_SDL_H #include "lmmsconfig.h" @@ -115,4 +115,4 @@ private: #endif // LMMS_HAVE_SDL -#endif +#endif // LMMS_AUDIO_SDL_H diff --git a/include/AudioSndio.h b/include/AudioSndio.h index 606850105..594ca94e7 100644 --- a/include/AudioSndio.h +++ b/include/AudioSndio.h @@ -23,8 +23,8 @@ * */ -#ifndef _AUDIO_SNDIO_H -#define _AUDIO_SNDIO_H +#ifndef LMMS_AUDIO_SNDIO_H +#define LMMS_AUDIO_SNDIO_H #include "lmmsconfig.h" @@ -87,6 +87,6 @@ private: } // namespace lmms -#endif // LMMS_HAVE_SNDIO +#endif // LMMS_HAVE_SNDIO -#endif // _AUDIO_SNDIO_H +#endif // LMMS_AUDIO_SNDIO_H diff --git a/include/AudioSoundIo.h b/include/AudioSoundIo.h index dc9afe7e4..b327f7d84 100644 --- a/include/AudioSoundIo.h +++ b/include/AudioSoundIo.h @@ -22,8 +22,8 @@ * */ -#ifndef AUDIO_SOUNDIO_H -#define AUDIO_SOUNDIO_H +#ifndef LMMS_AUDIO_SOUNDIO_H +#define LMMS_AUDIO_SOUNDIO_H #include @@ -145,4 +145,4 @@ private: #endif // LMMS_HAVE_SOUNDIO -#endif +#endif // LMMS_AUDIO_SOUNDIO_H diff --git a/include/AutomatableButton.h b/include/AutomatableButton.h index d8c58523c..3d78b8e9c 100644 --- a/include/AutomatableButton.h +++ b/include/AutomatableButton.h @@ -22,9 +22,8 @@ * */ - -#ifndef AUTOMATABLE_BUTTON_H -#define AUTOMATABLE_BUTTON_H +#ifndef LMMS_GUI_AUTOMATABLE_BUTTON_H +#define LMMS_GUI_AUTOMATABLE_BUTTON_H #include @@ -109,4 +108,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_AUTOMATABLE_BUTTON_H diff --git a/include/AutomatableModel.h b/include/AutomatableModel.h index c8f2ab548..1e6d5eda3 100644 --- a/include/AutomatableModel.h +++ b/include/AutomatableModel.h @@ -22,8 +22,8 @@ * */ -#ifndef AUTOMATABLE_MODEL_H -#define AUTOMATABLE_MODEL_H +#ifndef LMMS_AUTOMATABLE_MODEL_H +#define LMMS_AUTOMATABLE_MODEL_H #include #include @@ -507,5 +507,4 @@ using AutomatedValueMap = QMap; } // namespace lmms -#endif - +#endif // LMMS_AUTOMATABLE_MODEL_H diff --git a/include/AutomatableModelView.h b/include/AutomatableModelView.h index 1e8ef7398..12b2e4d49 100644 --- a/include/AutomatableModelView.h +++ b/include/AutomatableModelView.h @@ -23,8 +23,8 @@ * */ -#ifndef AUTOMATABLE_MODEL_VIEW_H -#define AUTOMATABLE_MODEL_VIEW_H +#ifndef LMMS_GUI_AUTOMATABLE_MODEL_VIEW_H +#define LMMS_GUI_AUTOMATABLE_MODEL_VIEW_H #include "ModelView.h" #include "AutomatableModel.h" @@ -137,5 +137,4 @@ using BoolModelView = TypedModelView; } // namespace lmms::gui -#endif - +#endif // LMMS_GUI_AUTOMATABLE_MODEL_VIEW_H diff --git a/include/AutomatableSlider.h b/include/AutomatableSlider.h index ba11741b5..cb1a6965f 100644 --- a/include/AutomatableSlider.h +++ b/include/AutomatableSlider.h @@ -22,9 +22,8 @@ * */ - -#ifndef AUTOMATABLE_SLIDER_H -#define AUTOMATABLE_SLIDER_H +#ifndef LMMS_GUI_AUTOMATABLE_SLIDER_H +#define LMMS_GUI_AUTOMATABLE_SLIDER_H #include @@ -77,4 +76,4 @@ using sliderModel = IntModel; } // namespace lmms::gui -#endif +#endif // LMMS_GUI_AUTOMATABLE_SLIDER_H diff --git a/include/AutomationClip.h b/include/AutomationClip.h index 3e253d85f..10c714c3d 100644 --- a/include/AutomationClip.h +++ b/include/AutomationClip.h @@ -24,8 +24,8 @@ * */ -#ifndef AUTOMATION_CLIP_H -#define AUTOMATION_CLIP_H +#ifndef LMMS_AUTOMATION_CLIP_H +#define LMMS_AUTOMATION_CLIP_H #include #include @@ -154,7 +154,7 @@ public: float valueAt( const TimePos & _time ) const; float *valuesAfter( const TimePos & _time ) const; - const QString name() const; + QString name() const; // settings-management void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override; @@ -260,4 +260,4 @@ inline int POS(AutomationClip::TimemapIterator it) } // namespace lmms -#endif +#endif // LMMS_AUTOMATION_CLIP_H diff --git a/include/AutomationClipView.h b/include/AutomationClipView.h index b4de7839c..a20e2ce28 100644 --- a/include/AutomationClipView.h +++ b/include/AutomationClipView.h @@ -22,8 +22,8 @@ * */ -#ifndef AUTOMATION_CLIP_VIEW_H -#define AUTOMATION_CLIP_VIEW_H +#ifndef LMMS_GUI_AUTOMATION_CLIP_VIEW_H +#define LMMS_GUI_AUTOMATION_CLIP_VIEW_H #include @@ -85,4 +85,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_AUTOMATION_CLIP_VIEW_H diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index 52609416f..c2ab98092 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -23,8 +23,8 @@ * */ -#ifndef AUTOMATION_EDITOR_H -#define AUTOMATION_EDITOR_H +#ifndef LMMS_GUI_AUTOMATION_EDITOR_H +#define LMMS_GUI_AUTOMATION_EDITOR_H #include @@ -304,4 +304,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_AUTOMATION_EDITOR_H diff --git a/include/AutomationNode.h b/include/AutomationNode.h index 11bd6d57d..a922109e6 100644 --- a/include/AutomationNode.h +++ b/include/AutomationNode.h @@ -23,8 +23,8 @@ * */ -#ifndef AUTOMATION_NODE_H -#define AUTOMATION_NODE_H +#ifndef LMMS_AUTOMATION_NODE_H +#define LMMS_AUTOMATION_NODE_H namespace lmms { @@ -156,4 +156,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUTOMATION_NODE_H diff --git a/include/AutomationTrack.h b/include/AutomationTrack.h index 1779bf102..64c2cc43a 100644 --- a/include/AutomationTrack.h +++ b/include/AutomationTrack.h @@ -24,8 +24,8 @@ * */ -#ifndef AUTOMATION_TRACK_H -#define AUTOMATION_TRACK_H +#ifndef LMMS_AUTOMATION_TRACK_H +#define LMMS_AUTOMATION_TRACK_H #include "Track.h" @@ -62,4 +62,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_AUTOMATION_TRACK_H diff --git a/include/AutomationTrackView.h b/include/AutomationTrackView.h index 18454bec2..449e9bef8 100644 --- a/include/AutomationTrackView.h +++ b/include/AutomationTrackView.h @@ -23,8 +23,8 @@ * */ -#ifndef AUTOMATION_TRACK_VIEW_H -#define AUTOMATION_TRACK_VIEW_H +#ifndef LMMS_GUI_AUTOMATION_TRACK_VIEW_H +#define LMMS_GUI_AUTOMATION_TRACK_VIEW_H #include "TrackView.h" @@ -52,4 +52,4 @@ public: } // namespace lmms -#endif +#endif // LMMS_GUI_AUTOMATION_TRACK_VIEW_H diff --git a/include/BandLimitedWave.h b/include/BandLimitedWave.h index 588fc4eea..2a12c62e3 100644 --- a/include/BandLimitedWave.h +++ b/include/BandLimitedWave.h @@ -23,8 +23,8 @@ * */ -#ifndef BANDLIMITEDWAVE_H -#define BANDLIMITEDWAVE_H +#ifndef LMMS_BANDLIMITEDWAVE_H +#define LMMS_BANDLIMITEDWAVE_H class QDataStream; class QString; @@ -149,7 +149,8 @@ public: return sr; -/* lookup = lookup << 1; + /* + lookup = lookup << 1; tlen = tlen << 1; t += 1; const sample_t s3 = s_waveforms[ _wave ].sampleAt( t, lookup ); @@ -159,7 +160,7 @@ public: const float ip2 = ( ( tlen - _wavelen ) / tlen - 0.5 ) * 2.0; return linearInterpolate( s12, s34, ip2 ); - */ + */ }; @@ -174,4 +175,4 @@ public: } // namespace lmms -#endif +#endif // LMMS_BANDLIMITEDWAVE_H diff --git a/include/BasicFilters.h b/include/BasicFilters.h index 836d758b6..c10c47489 100644 --- a/include/BasicFilters.h +++ b/include/BasicFilters.h @@ -28,9 +28,8 @@ * */ - -#ifndef BASIC_FILTERS_H -#define BASIC_FILTERS_H +#ifndef LMMS_BASIC_FILTERS_H +#define LMMS_BASIC_FILTERS_H #ifndef __USE_XOPEN #define __USE_XOPEN @@ -918,4 +917,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_BASIC_FILTERS_H diff --git a/include/BufferManager.h b/include/BufferManager.h index 57729918e..712e420ff 100644 --- a/include/BufferManager.h +++ b/include/BufferManager.h @@ -23,8 +23,8 @@ * */ -#ifndef BUFFER_MANAGER_H -#define BUFFER_MANAGER_H +#ifndef LMMS_BUFFER_MANAGER_H +#define LMMS_BUFFER_MANAGER_H #include "lmms_export.h" #include "lmms_basics.h" @@ -54,4 +54,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_BUFFER_MANAGER_H diff --git a/include/CPULoadWidget.h b/include/CPULoadWidget.h index dd2747ef2..904445c67 100644 --- a/include/CPULoadWidget.h +++ b/include/CPULoadWidget.h @@ -23,9 +23,8 @@ * */ - -#ifndef CPULOAD_WIDGET_H -#define CPULOAD_WIDGET_H +#ifndef LMMS_GUI_CPU_LOAD_WIDGET_H +#define LMMS_GUI_CPU_LOAD_WIDGET_H #include #include @@ -70,4 +69,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_CPU_LOAD_WIDGET_H diff --git a/include/CaptionMenu.h b/include/CaptionMenu.h index f6a2fff25..4a8889a83 100644 --- a/include/CaptionMenu.h +++ b/include/CaptionMenu.h @@ -22,9 +22,8 @@ * */ - -#ifndef CAPTION_MENU_H -#define CAPTION_MENU_H +#ifndef LMMS_GUI_CAPTION_MENU_H +#define LMMS_GUI_CAPTION_MENU_H #include @@ -47,4 +46,4 @@ public: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_CAPTION_MENU_H diff --git a/include/Clip.h b/include/Clip.h index 204a071a7..8f4162d96 100644 --- a/include/Clip.h +++ b/include/Clip.h @@ -22,8 +22,8 @@ * */ -#ifndef TRACK_CONTENT_OBJECT_H -#define TRACK_CONTENT_OBJECT_H +#ifndef LMMS_CLIP_H +#define LMMS_CLIP_H #include @@ -194,4 +194,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_CLIP_H diff --git a/include/ClipView.h b/include/ClipView.h index 8cfb9e7a4..32c5130b9 100644 --- a/include/ClipView.h +++ b/include/ClipView.h @@ -22,8 +22,8 @@ * */ -#ifndef TRACK_CONTENT_OBJECT_VIEW_H -#define TRACK_CONTENT_OBJECT_VIEW_H +#ifndef LMMS_GUI_CLIP_VIEW_H +#define LMMS_GUI_CLIP_VIEW_H #include @@ -252,4 +252,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_CLIP_VIEW_H diff --git a/include/Clipboard.h b/include/Clipboard.h index 1c2dcb647..c6ae66ee8 100644 --- a/include/Clipboard.h +++ b/include/Clipboard.h @@ -22,8 +22,8 @@ * */ -#ifndef CLIPBOARD_H -#define CLIPBOARD_H +#ifndef LMMS_CLIPBOARD_H +#define LMMS_CLIPBOARD_H #include #include @@ -68,4 +68,4 @@ namespace lmms::Clipboard } // namespace lmms::Clipboard -#endif +#endif // LMMS_CLIPBOARD_H diff --git a/include/ColorChooser.h b/include/ColorChooser.h index 5482a9a03..0e85ea9bb 100644 --- a/include/ColorChooser.h +++ b/include/ColorChooser.h @@ -21,8 +21,8 @@ * */ -#ifndef COLOR_CHOOSER_H -#define COLOR_CHOOSER_H +#ifndef LMMS_GUI_COLOR_CHOOSER_H +#define LMMS_GUI_COLOR_CHOOSER_H #include #include @@ -34,7 +34,7 @@ namespace lmms::gui { -class ColorChooser: public QColorDialog +class ColorChooser : public QColorDialog { public: ColorChooser(const QColor &initial, QWidget *parent): QColorDialog(initial, parent) {}; @@ -68,5 +68,4 @@ private: } // namespace lmms::gui -#endif - +#endif // LMMS_GUI_COLOR_CHOOSER_H diff --git a/include/ComboBox.h b/include/ComboBox.h index 9a0e5a517..8153451e8 100644 --- a/include/ComboBox.h +++ b/include/ComboBox.h @@ -22,9 +22,8 @@ * */ - -#ifndef COMBOBOX_H -#define COMBOBOX_H +#ifndef LMMS_GUI_COMBOBOX_H +#define LMMS_GUI_COMBOBOX_H #include #include @@ -83,4 +82,4 @@ private slots: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_COMBOBOX_H diff --git a/include/ComboBoxModel.h b/include/ComboBoxModel.h index 0c76620d8..8fd1f49f4 100644 --- a/include/ComboBoxModel.h +++ b/include/ComboBoxModel.h @@ -22,8 +22,8 @@ * */ -#ifndef COMBOBOX_MODEL_H -#define COMBOBOX_MODEL_H +#ifndef LMMS_COMBOBOX_MODEL_H +#define LMMS_COMBOBOX_MODEL_H #include #include @@ -95,4 +95,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_COMBOBOX_MODEL_H diff --git a/include/ConfigManager.h b/include/ConfigManager.h index fd2967b6a..eee069681 100644 --- a/include/ConfigManager.h +++ b/include/ConfigManager.h @@ -22,9 +22,8 @@ * */ - -#ifndef CONFIG_MGR_H -#define CONFIG_MGR_H +#ifndef LMMS_CONFIG_MANAGER_H +#define LMMS_CONFIG_MANAGER_H #include "lmmsconfig.h" @@ -314,4 +313,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_CONFIG_MANAGER_H diff --git a/include/ControlLayout.h b/include/ControlLayout.h index 8c629f8e1..568ce1a85 100644 --- a/include/ControlLayout.h +++ b/include/ControlLayout.h @@ -70,8 +70,8 @@ ** ****************************************************************************/ -#ifndef CONTROLLAYOUT_H -#define CONTROLLAYOUT_H +#ifndef LMMS_GUI_CONTROL_LAYOUT_H +#define LMMS_GUI_CONTROL_LAYOUT_H #include #include @@ -141,4 +141,4 @@ private: } // namespace lmms::gui -#endif // CONTROLLAYOUT_H +#endif // LMMS_GUI_CONTROL_LAYOUT_H diff --git a/include/Controller.h b/include/Controller.h index d949cf90c..0a5eb0f36 100644 --- a/include/Controller.h +++ b/include/Controller.h @@ -23,9 +23,8 @@ * */ - -#ifndef CONTROLLER_H -#define CONTROLLER_H +#ifndef LMMS_CONTROLLER_H +#define LMMS_CONTROLLER_H #include "lmms_export.h" #include "Engine.h" @@ -184,5 +183,4 @@ signals: } // namespace lmms -#endif - +#endif // LMMS_CONTROLLER_H diff --git a/include/ControllerConnection.h b/include/ControllerConnection.h index 8230971cc..4473b68e0 100644 --- a/include/ControllerConnection.h +++ b/include/ControllerConnection.h @@ -26,9 +26,8 @@ * */ - -#ifndef CONTROLLER_CONNECTION_H -#define CONTROLLER_CONNECTION_H +#ifndef LMMS_CONTROLLER_CONNECTION_H +#define LMMS_CONTROLLER_CONNECTION_H #include #include @@ -128,5 +127,4 @@ signals: } // namespace lmms -#endif - +#endif // LMMS_CONTROLLER_CONNECTION_H diff --git a/include/ControllerConnectionDialog.h b/include/ControllerConnectionDialog.h index 5565c8a67..6fb9d45d0 100644 --- a/include/ControllerConnectionDialog.h +++ b/include/ControllerConnectionDialog.h @@ -23,9 +23,8 @@ * */ - -#ifndef CONTROLLER_CONNECTION_DIALOG_H -#define CONTROLLER_CONNECTION_DIALOG_H +#ifndef LMMS_GUI_CONTROLLER_CONNECTION_DIALOG_H +#define LMMS_GUI_CONTROLLER_CONNECTION_DIALOG_H #include #include @@ -111,4 +110,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_CONTROLLER_CONNECTION_DIALOG_H diff --git a/include/ControllerDialog.h b/include/ControllerDialog.h index 4f496ad77..0c53a8c84 100644 --- a/include/ControllerDialog.h +++ b/include/ControllerDialog.h @@ -23,8 +23,8 @@ * */ -#ifndef CONTROLLER_DIALOG_H -#define CONTROLLER_DIALOG_H +#ifndef LMMS_GUI_CONTROLLER_DIALOG_H +#define LMMS_GUI_CONTROLLER_DIALOG_H #include @@ -61,4 +61,4 @@ protected: } // namespace lmms -#endif +#endif // LMMS_GUI_CONTROLLER_DIALOG_H diff --git a/include/ControllerRackView.h b/include/ControllerRackView.h index 904e523dd..303cc2b40 100644 --- a/include/ControllerRackView.h +++ b/include/ControllerRackView.h @@ -22,8 +22,8 @@ * */ -#ifndef CONTROLLER_RACK_VIEW_H -#define CONTROLLER_RACK_VIEW_H +#ifndef LMMS_GUI_CONTROLLER_RACK_VIEW_H +#define LMMS_GUI_CONTROLLER_RACK_VIEW_H #include #include @@ -92,4 +92,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_CONTROLLER_RACK_VIEW_H diff --git a/include/ControllerView.h b/include/ControllerView.h index 8b8db0674..d1ba533a1 100644 --- a/include/ControllerView.h +++ b/include/ControllerView.h @@ -22,8 +22,8 @@ * */ -#ifndef CONTROLLER_VIEW_H -#define CONTROLLER_VIEW_H +#ifndef LMMS_GUI_CONTROLLER_VIEW_H +#define LMMS_GUI_CONTROLLER_VIEW_H #include @@ -88,4 +88,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_CONTROLLER_VIEW_H diff --git a/include/Controls.h b/include/Controls.h index 9ffed465e..5ed19027e 100644 --- a/include/Controls.h +++ b/include/Controls.h @@ -22,10 +22,8 @@ * */ -#ifndef CONTROLS_H -#define CONTROLS_H - - +#ifndef LMMS_GUI_CONTROLS_H +#define LMMS_GUI_CONTROLS_H // headers only required for covariance #include "AutomatableModel.h" @@ -146,4 +144,4 @@ public: } // namespace lmms -#endif // CONTROLS_H +#endif // LMMS_GUI_CONTROLS_H diff --git a/include/CustomTextKnob.h b/include/CustomTextKnob.h index cde718810..19768ec87 100644 --- a/include/CustomTextKnob.h +++ b/include/CustomTextKnob.h @@ -1,6 +1,29 @@ -/* Text customizable knob */ -#ifndef CUSTOM_TEXT_KNOB_H -#define CUSTOM_TEXT_KNOB_H +/* + * CustomTextKnob.h + * + * Copyright (c) 2020 Ibuki Sugiyama
+ * + * 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 LMMS_GUI_CUSTOM_TEXT_KNOB_H +#define LMMS_GUI_CUSTOM_TEXT_KNOB_H #include "Knob.h" @@ -34,4 +57,4 @@ protected: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_CUSTOM_TEXT_KNOB_H diff --git a/include/DataFile.h b/include/DataFile.h index 5eb61a932..a91b37f9b 100644 --- a/include/DataFile.h +++ b/include/DataFile.h @@ -23,9 +23,8 @@ * */ - -#ifndef DATA_FILE_H -#define DATA_FILE_H +#ifndef LMMS_DATA_FILE_H +#define LMMS_DATA_FILE_H #include #include @@ -143,14 +142,6 @@ private: void loadData( const QByteArray & _data, const QString & _sourceFile ); - - struct LMMS_EXPORT typeDescStruct - { - Type m_type; - QString m_name; - } ; - static typeDescStruct s_types[TypeCount]; - QString m_fileName; //!< The origin file name or "" if this DataFile didn't originate from a file QDomElement m_content; QDomElement m_head; @@ -162,4 +153,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_DATA_FILE_H diff --git a/include/Delay.h b/include/Delay.h index 529577d58..daa871baf 100644 --- a/include/Delay.h +++ b/include/Delay.h @@ -22,10 +22,9 @@ * Boston, MA 02110-1301 USA. * */ - - -#ifndef DELAY_H -#define DELAY_H + +#ifndef LMMS_DELAY_H +#define LMMS_DELAY_H #include "lmms_basics.h" #include "lmms_math.h" @@ -365,4 +364,4 @@ using StereoAllpassDelay = AllpassDelay<2>; } // namespace lmms -#endif +#endif // LMMS_DELAY_H diff --git a/include/DeprecationHelper.h b/include/DeprecationHelper.h index 7786665a3..b9be6d42f 100644 --- a/include/DeprecationHelper.h +++ b/include/DeprecationHelper.h @@ -24,8 +24,8 @@ * */ -#ifndef DEPRECATIONHELPER_H -#define DEPRECATIONHELPER_H +#ifndef LMMS_DEPRECATIONHELPER_H +#define LMMS_DEPRECATIONHELPER_H #include #include @@ -66,4 +66,4 @@ inline QPoint position(QWheelEvent *wheelEvent) } // namespace lmms -#endif // DEPRECATIONHELPER_H +#endif // LMMS_DEPRECATIONHELPER_H diff --git a/include/DetuningHelper.h b/include/DetuningHelper.h index f90af3697..e5d5f5712 100644 --- a/include/DetuningHelper.h +++ b/include/DetuningHelper.h @@ -23,8 +23,8 @@ * */ -#ifndef DETUNING_HELPER_H -#define DETUNING_HELPER_H +#ifndef LMMS_DETUNING_HELPER_H +#define LMMS_DETUNING_HELPER_H #include "InlineAutomation.h" #include "MemoryManager.h" @@ -64,4 +64,4 @@ public: } // namespace lmms -#endif +#endif // LMMS_DETUNING_HELPER_H diff --git a/include/DrumSynth.h b/include/DrumSynth.h index 98574f2d2..750055ddb 100644 --- a/include/DrumSynth.h +++ b/include/DrumSynth.h @@ -23,9 +23,8 @@ * */ - -#ifndef DRUMSYNTH_H -#define DRUMSYNTH_H +#ifndef LMMS_DRUM_SYNTH_H +#define LMMS_DRUM_SYNTH_H #include #include "lmms_basics.h" @@ -57,4 +56,4 @@ class DrumSynth { } // namespace lmms -#endif // DRUMSYNTH_H +#endif // LMMS_DRUM_SYNTH_H diff --git a/include/DspEffectLibrary.h b/include/DspEffectLibrary.h index eb03e1cf0..d8268fd8d 100644 --- a/include/DspEffectLibrary.h +++ b/include/DspEffectLibrary.h @@ -22,9 +22,8 @@ * */ - -#ifndef DSP_EFFECT_LIBRARY_H -#define DSP_EFFECT_LIBRARY_H +#ifndef LMMS_DSPEFFECTLIBRARY_H +#define LMMS_DSPEFFECTLIBRARY_H #include "lmms_math.h" #include "lmms_constants.h" @@ -331,5 +330,4 @@ namespace lmms::DspEffectLibrary } // namespace lmms::DspEffectLibrary - -#endif +#endif // LMMS_DSPEFFECTLIBRARY_H diff --git a/include/DummyEffect.h b/include/DummyEffect.h index 9db45a3e1..0a80b90a9 100644 --- a/include/DummyEffect.h +++ b/include/DummyEffect.h @@ -22,8 +22,8 @@ * */ -#ifndef DUMMY_EFFECT_H -#define DUMMY_EFFECT_H +#ifndef LMMS_DUMMY_EFFECT_H +#define LMMS_DUMMY_EFFECT_H #include @@ -149,4 +149,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_DUMMY_EFFECT_H diff --git a/include/DummyInstrument.h b/include/DummyInstrument.h index a40d8338f..aefa035db 100644 --- a/include/DummyInstrument.h +++ b/include/DummyInstrument.h @@ -23,8 +23,8 @@ * */ -#ifndef DUMMY_INSTRUMENT_H -#define DUMMY_INSTRUMENT_H +#ifndef LMMS_DUMMY_INSTRUMENT_H +#define LMMS_DUMMY_INSTRUMENT_H #include "Instrument.h" #include "InstrumentView.h" @@ -77,4 +77,4 @@ public: } // namespace lmms -#endif +#endif // LMMS_DUMMY_INSTRUMENT_H diff --git a/include/DummyPlugin.h b/include/DummyPlugin.h index 1c763ec3e..3f6746b74 100644 --- a/include/DummyPlugin.h +++ b/include/DummyPlugin.h @@ -23,8 +23,8 @@ * */ -#ifndef DUMMY_PLUGIN_H -#define DUMMY_PLUGIN_H +#ifndef LMMS_DUMMY_PLUGIN_H +#define LMMS_DUMMY_PLUGIN_H #include "Plugin.h" #include "PluginView.h" @@ -68,4 +68,4 @@ protected: } // namespace lmms -#endif +#endif // LMMS_DUMMY_PLUGIN_H diff --git a/include/Editor.h b/include/Editor.h index 1a39ea72f..681bce46c 100644 --- a/include/Editor.h +++ b/include/Editor.h @@ -22,8 +22,8 @@ * */ -#ifndef EDITOR_COMMON_H -#define EDITOR_COMMON_H +#ifndef LMMS_GUI_EDITOR_H +#define LMMS_GUI_EDITOR_H #include #include @@ -113,4 +113,4 @@ protected: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_EDITOR_H diff --git a/include/Effect.h b/include/Effect.h index add1f7158..1f566e0e9 100644 --- a/include/Effect.h +++ b/include/Effect.h @@ -23,8 +23,8 @@ * */ -#ifndef EFFECT_H -#define EFFECT_H +#ifndef LMMS_EFFECT_H +#define LMMS_EFFECT_H #include "Plugin.h" #include "Engine.h" @@ -241,4 +241,4 @@ using EffectKeyList = Effect::Descriptor::SubPluginFeatures::KeyList; } // namespace lmms -#endif +#endif // LMMS_EFFECT_H diff --git a/include/EffectChain.h b/include/EffectChain.h index a9da8e530..57cf8d547 100644 --- a/include/EffectChain.h +++ b/include/EffectChain.h @@ -23,8 +23,8 @@ * */ -#ifndef EFFECT_CHAIN_H -#define EFFECT_CHAIN_H +#ifndef LMMS_EFFECT_CHAIN_H +#define LMMS_EFFECT_CHAIN_H #include "Model.h" #include "SerializingObject.h" @@ -85,5 +85,4 @@ signals: } // namespace lmms -#endif - +#endif // LMMS_EFFECT_CHAIN_H diff --git a/include/EffectControlDialog.h b/include/EffectControlDialog.h index 6389db4a3..4bef5ee79 100644 --- a/include/EffectControlDialog.h +++ b/include/EffectControlDialog.h @@ -23,8 +23,8 @@ * */ -#ifndef EFFECT_CONTROL_DIALOG_H -#define EFFECT_CONTROL_DIALOG_H +#ifndef LMMS_GUI_EFFECT_CONTROL_DIALOG_H +#define LMMS_GUI_EFFECT_CONTROL_DIALOG_H #include @@ -64,4 +64,4 @@ protected: } // namespace lmms -#endif +#endif // LMMS_GUI_EFFECT_CONTROL_DIALOG_H diff --git a/include/EffectControls.h b/include/EffectControls.h index 994145a40..294f61027 100644 --- a/include/EffectControls.h +++ b/include/EffectControls.h @@ -22,8 +22,8 @@ * */ -#ifndef EFFECT_CONTROLS_H -#define EFFECT_CONTROLS_H +#ifndef LMMS_EFFECT_CONTROLS_H +#define LMMS_EFFECT_CONTROLS_H #include "Model.h" #include "JournallingObject.h" @@ -82,4 +82,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_EFFECT_CONTROLS_H diff --git a/include/EffectRackView.h b/include/EffectRackView.h index fb68fda68..a1e21be09 100644 --- a/include/EffectRackView.h +++ b/include/EffectRackView.h @@ -23,8 +23,8 @@ * */ -#ifndef EFFECT_RACK_VIEW_H -#define EFFECT_RACK_VIEW_H +#ifndef LMMS_GUI_EFFECT_RACK_VIEW_H +#define LMMS_GUI_EFFECT_RACK_VIEW_H #include @@ -88,4 +88,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_EFFECT_RACK_VIEW_H diff --git a/include/EffectSelectDialog.h b/include/EffectSelectDialog.h index b0acfb734..493b07774 100644 --- a/include/EffectSelectDialog.h +++ b/include/EffectSelectDialog.h @@ -22,8 +22,8 @@ * */ -#ifndef EFFECT_SELECT_DIALOG_H -#define EFFECT_SELECT_DIALOG_H +#ifndef LMMS_GUI_EFFECT_SELECT_DIALOG_H +#define LMMS_GUI_EFFECT_SELECT_DIALOG_H #include #include @@ -70,5 +70,4 @@ private: } // namespace lmms::gui - -#endif +#endif // LMMS_GUI_EFFECT_SELECT_DIALOG_H diff --git a/include/EffectView.h b/include/EffectView.h index 90bb54896..e90700952 100644 --- a/include/EffectView.h +++ b/include/EffectView.h @@ -23,13 +23,14 @@ * */ -#ifndef EFFECT_VIEW_H -#define EFFECT_VIEW_H +#ifndef LMMS_GUI_EFFECT_VIEW_H +#define LMMS_GUI_EFFECT_VIEW_H #include "AutomatableModel.h" #include "PluginView.h" #include "Effect.h" +class QGraphicsOpacityEffect; class QGroupBox; class QLabel; class QPushButton; @@ -61,6 +62,11 @@ public: } static constexpr int DEFAULT_WIDTH = 215; + static constexpr int DEFAULT_HEIGHT = 60; + + void mouseMoveEvent(QMouseEvent* event) override; + void mousePressEvent(QMouseEvent* event) override; + void mouseReleaseEvent(QMouseEvent* event) override; public slots: void editControls(); @@ -90,10 +96,13 @@ private: Knob * m_gate; QMdiSubWindow * m_subWindow; EffectControlDialog * m_controlView; + + bool m_dragging; + QGraphicsOpacityEffect* m_opacityEffect; } ; } // namespace lmms::gui -#endif +#endif // LMMS_GUI_EFFECT_VIEW_H diff --git a/include/Engine.h b/include/Engine.h index b63308cde..ed4cbd93c 100644 --- a/include/Engine.h +++ b/include/Engine.h @@ -22,14 +22,12 @@ * */ - -#ifndef ENGINE_H -#define ENGINE_H +#ifndef LMMS_ENGINE_H +#define LMMS_ENGINE_H #include #include - #include "lmmsconfig.h" #include "lmms_export.h" #include "lmms_basics.h" @@ -157,5 +155,4 @@ private: } // namespace lmms -#endif - +#endif // LMMS_ENGINE_H diff --git a/include/EnvelopeAndLfoParameters.h b/include/EnvelopeAndLfoParameters.h index 534adcbe5..a713a90f3 100644 --- a/include/EnvelopeAndLfoParameters.h +++ b/include/EnvelopeAndLfoParameters.h @@ -22,8 +22,8 @@ * */ -#ifndef ENVELOPE_AND_LFO_PARAMETERS_H -#define ENVELOPE_AND_LFO_PARAMETERS_H +#ifndef LMMS_ENVELOPE_AND_LFO_PARAMETERS_H +#define LMMS_ENVELOPE_AND_LFO_PARAMETERS_H #include @@ -190,4 +190,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_ENVELOPE_AND_LFO_PARAMETERS_H diff --git a/include/EnvelopeAndLfoView.h b/include/EnvelopeAndLfoView.h index a82ccf606..b5c7a67d4 100644 --- a/include/EnvelopeAndLfoView.h +++ b/include/EnvelopeAndLfoView.h @@ -23,8 +23,8 @@ * */ -#ifndef ENVELOPE_AND_LFO_VIEW_H -#define ENVELOPE_AND_LFO_VIEW_H +#ifndef LMMS_GUI_ENVELOPE_AND_LFO_VIEW_H +#define LMMS_GUI_ENVELOPE_AND_LFO_VIEW_H #include @@ -104,4 +104,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_ENVELOPE_AND_LFO_VIEW_H diff --git a/include/ExportFilter.h b/include/ExportFilter.h index 29efef539..acbdbb65e 100644 --- a/include/ExportFilter.h +++ b/include/ExportFilter.h @@ -23,8 +23,8 @@ * */ -#ifndef EXPORT_FILTER_H -#define EXPORT_FILTER_H +#ifndef LMMS_EXPORT_FILTER_H +#define LMMS_EXPORT_FILTER_H #include @@ -69,4 +69,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_EXPORT_FILTER_H diff --git a/include/ExportProjectDialog.h b/include/ExportProjectDialog.h index 56d039afe..56a9fc1f5 100644 --- a/include/ExportProjectDialog.h +++ b/include/ExportProjectDialog.h @@ -23,9 +23,8 @@ * */ - -#ifndef EXPORT_PROJECT_DIALOG_H -#define EXPORT_PROJECT_DIALOG_H +#ifndef LMMS_GUI_EXPORT_PROJECT_DIALOG_H +#define LMMS_GUI_EXPORT_PROJECT_DIALOG_H #include #include @@ -70,5 +69,4 @@ private: } // namespace lmms::gui - -#endif +#endif // LMMS_GUI_EXPORT_PROJECT_DIALOG_H diff --git a/include/FadeButton.h b/include/FadeButton.h index d33900913..166ef5f21 100644 --- a/include/FadeButton.h +++ b/include/FadeButton.h @@ -22,9 +22,8 @@ * */ - -#ifndef FADE_BUTTON_H -#define FADE_BUTTON_H +#ifndef LMMS_GUI_FADE_BUTTON_H +#define LMMS_GUI_FADE_BUTTON_H #include #include @@ -77,4 +76,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_FADE_BUTTON_H diff --git a/include/Fader.h b/include/Fader.h index 54acfc57d..b46bed11b 100644 --- a/include/Fader.h +++ b/include/Fader.h @@ -44,9 +44,8 @@ * */ - -#ifndef FADER_H -#define FADER_H +#ifndef LMMS_GUI_FADER_H +#define LMMS_GUI_FADER_H #include #include @@ -55,10 +54,11 @@ #include "AutomatableModelView.h" + namespace lmms::gui { -class TextFloat; +class SimpleTextFloat; class LMMS_EXPORT Fader : public QWidget, public FloatModelView @@ -164,7 +164,7 @@ private: int m_moveStartPoint; float m_startValue; - static TextFloat * s_textFloat; + static SimpleTextFloat * s_textFloat; QColor m_peakGreen; QColor m_peakRed; @@ -174,5 +174,4 @@ private: } // namespace lmms::gui - -#endif +#endif // LMMS_GUI_FADER_H diff --git a/include/FifoBuffer.h b/include/FifoBuffer.h index d49e367c0..cdb1df41f 100644 --- a/include/FifoBuffer.h +++ b/include/FifoBuffer.h @@ -22,8 +22,8 @@ * */ -#ifndef FIFO_BUFFER_H -#define FIFO_BUFFER_H +#ifndef LMMS_FIFO_BUFFER_H +#define LMMS_FIFO_BUFFER_H #include @@ -94,4 +94,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_FIFO_BUFFER_H diff --git a/include/FileBrowser.h b/include/FileBrowser.h index 43a0b3331..51103b19f 100644 --- a/include/FileBrowser.h +++ b/include/FileBrowser.h @@ -22,9 +22,8 @@ * */ - -#ifndef FILE_BROWSER_H -#define FILE_BROWSER_H +#ifndef LMMS_GUI_FILE_BROWSER_H +#define LMMS_GUI_FILE_BROWSER_H #include #include @@ -298,4 +297,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_FILE_BROWSER_H diff --git a/include/FileDialog.h b/include/FileDialog.h index ed5d2f231..67ef1d8eb 100644 --- a/include/FileDialog.h +++ b/include/FileDialog.h @@ -22,9 +22,8 @@ * */ - -#ifndef FILEDIALOG_H -#define FILEDIALOG_H +#ifndef LMMS_GUI_FILE_DIALOG_H +#define LMMS_GUI_FILE_DIALOG_H #include @@ -57,4 +56,4 @@ public: } // namespace lmms::gui -#endif // FILEDIALOG_H +#endif // LMMS_GUI_FILE_DIALOG_H diff --git a/include/Graph.h b/include/Graph.h index 178d1b567..f62215ac2 100644 --- a/include/Graph.h +++ b/include/Graph.h @@ -23,9 +23,8 @@ * */ - -#ifndef GRAPH_H -#define GRAPH_H +#ifndef LMMS_GUI_GRAPH_H +#define LMMS_GUI_GRAPH_H #include #include @@ -228,4 +227,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_GRAPH_H diff --git a/include/GroupBox.h b/include/GroupBox.h index e20db80a6..6a8f424f9 100644 --- a/include/GroupBox.h +++ b/include/GroupBox.h @@ -22,9 +22,8 @@ * */ - -#ifndef GROUP_BOX_H -#define GROUP_BOX_H +#ifndef LMMS_GUI_GROUP_BOX_H +#define LMMS_GUI_GROUP_BOX_H #include @@ -74,5 +73,4 @@ private: } // namespace lmms::gui - -#endif +#endif // LMMS_GUI_GROUP_BOX_H diff --git a/include/GuiApplication.h b/include/GuiApplication.h index e39983138..3a0851499 100644 --- a/include/GuiApplication.h +++ b/include/GuiApplication.h @@ -22,8 +22,8 @@ * */ -#ifndef GUIAPPLICATION_H -#define GUIAPPLICATION_H +#ifndef LMMS_GUI_GUI_APPLICATION_H +#define LMMS_GUI_GUI_APPLICATION_H #include @@ -93,4 +93,4 @@ LMMS_EXPORT GuiApplication* getGUI(); } // namespace lmms::gui -#endif // GUIAPPLICATION_H +#endif // LMMS_GUI_GUI_APPLICATION_H diff --git a/include/ImportFilter.h b/include/ImportFilter.h index b7a910e5d..9c73b3861 100644 --- a/include/ImportFilter.h +++ b/include/ImportFilter.h @@ -23,8 +23,8 @@ * */ -#ifndef IMPORT_FILTER_H -#define IMPORT_FILTER_H +#ifndef LMMS_IMPORT_FILTER_H +#define LMMS_IMPORT_FILTER_H #include @@ -114,4 +114,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_IMPORT_FILTER_H diff --git a/include/InlineAutomation.h b/include/InlineAutomation.h index 435604506..3e27e137b 100644 --- a/include/InlineAutomation.h +++ b/include/InlineAutomation.h @@ -22,8 +22,8 @@ * */ -#ifndef INLINE_AUTOMATION_H -#define INLINE_AUTOMATION_H +#ifndef LMMS_INLINE_AUTOMATION_H +#define LMMS_INLINE_AUTOMATION_H #include "AutomationNode.h" #include "AutomationClip.h" @@ -99,4 +99,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_INLINE_AUTOMATION_H diff --git a/include/Instrument.h b/include/Instrument.h index 4e48e2fd6..1c42c970e 100644 --- a/include/Instrument.h +++ b/include/Instrument.h @@ -23,8 +23,8 @@ * */ -#ifndef INSTRUMENT_H -#define INSTRUMENT_H +#ifndef LMMS_INSTRUMENT_H +#define LMMS_INSTRUMENT_H #include #include "lmms_export.h" @@ -154,4 +154,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Instrument::Flags) } // namespace lmms -#endif +#endif // LMMS_INSTRUMENT_H diff --git a/include/InstrumentFunctionViews.h b/include/InstrumentFunctionViews.h index 99ba92031..71a6e8aaa 100644 --- a/include/InstrumentFunctionViews.h +++ b/include/InstrumentFunctionViews.h @@ -22,8 +22,8 @@ * */ -#ifndef INSTRUMENT_FUNCTION_VIEWS_H -#define INSTRUMENT_FUNCTION_VIEWS_H +#ifndef LMMS_INSTRUMENT_FUNCTION_VIEWS_H +#define LMMS_INSTRUMENT_FUNCTION_VIEWS_H #include "ModelView.h" @@ -99,4 +99,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_INSTRUMENT_FUNCTION_VIEWS_H diff --git a/include/InstrumentFunctions.h b/include/InstrumentFunctions.h index a349ddf9c..f62b74e9a 100644 --- a/include/InstrumentFunctions.h +++ b/include/InstrumentFunctions.h @@ -22,8 +22,8 @@ * */ -#ifndef INSTRUMENT_FUNCTIONS_H -#define INSTRUMENT_FUNCTIONS_H +#ifndef LMMS_INSTRUMENT_FUNCTIONS_H +#define LMMS_INSTRUMENT_FUNCTIONS_H #include "JournallingObject.h" #include "lmms_basics.h" @@ -52,6 +52,7 @@ class InstrumentFunctionNoteStacking : public Model, public JournallingObject public: static const int MAX_CHORD_POLYPHONY = 13; + static const int NUM_CHORD_TABLES = 95; private: using ChordSemiTones = std::array; @@ -129,7 +130,7 @@ public: ChordSemiTones m_semiTones; }; - static Init s_initTable[]; + static std::array s_initTable; public: static const ChordTable & getInstance() @@ -223,4 +224,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_INSTRUMENT_FUNCTIONS_H diff --git a/include/InstrumentMidiIOView.h b/include/InstrumentMidiIOView.h index 81feee082..7877229a2 100644 --- a/include/InstrumentMidiIOView.h +++ b/include/InstrumentMidiIOView.h @@ -23,8 +23,8 @@ * */ -#ifndef INSTRUMENT_MIDI_IO_VIEW_H -#define INSTRUMENT_MIDI_IO_VIEW_H +#ifndef LMMS_GUI_INSTRUMENT_MIDI_IO_VIEW_H +#define LMMS_GUI_INSTRUMENT_MIDI_IO_VIEW_H #include @@ -77,4 +77,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_INSTRUMENT_MIDI_IO_VIEW_H diff --git a/include/InstrumentMiscView.h b/include/InstrumentMiscView.h index 25e16395d..28f3c6a8e 100644 --- a/include/InstrumentMiscView.h +++ b/include/InstrumentMiscView.h @@ -24,8 +24,8 @@ * */ -#ifndef INSTRUMENT_MISC_VIEW_H -#define INSTRUMENT_MISC_VIEW_H +#ifndef LMMS_GUI_INSTRUMENT_MISC_VIEW_H +#define LMMS_GUI_INSTRUMENT_MISC_VIEW_H #include @@ -71,4 +71,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_INSTRUMENT_MISC_VIEW_H diff --git a/include/InstrumentPlayHandle.h b/include/InstrumentPlayHandle.h index e9516ab19..bbf53d16c 100644 --- a/include/InstrumentPlayHandle.h +++ b/include/InstrumentPlayHandle.h @@ -22,8 +22,8 @@ * */ -#ifndef INSTRUMENT_PLAY_HANDLE_H -#define INSTRUMENT_PLAY_HANDLE_H +#ifndef LMMS_INSTRUMENT_PLAY_HANDLE_H +#define LMMS_INSTRUMENT_PLAY_HANDLE_H #include "PlayHandle.h" #include "Instrument.h" @@ -85,4 +85,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_INSTRUMENT_PLAY_HANDLE_H diff --git a/include/InstrumentSoundShaping.h b/include/InstrumentSoundShaping.h index 11ed4f1c4..6db3078ec 100644 --- a/include/InstrumentSoundShaping.h +++ b/include/InstrumentSoundShaping.h @@ -22,8 +22,8 @@ * */ -#ifndef INSTRUMENT_SOUND_SHAPING_H -#define INSTRUMENT_SOUND_SHAPING_H +#ifndef LMMS_INSTRUMENT_SOUND_SHAPING_H +#define LMMS_INSTRUMENT_SOUND_SHAPING_H #include "ComboBoxModel.h" @@ -92,4 +92,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_INSTRUMENT_SOUND_SHAPING_H diff --git a/include/InstrumentSoundShapingView.h b/include/InstrumentSoundShapingView.h index aa8aff19d..8f671514a 100644 --- a/include/InstrumentSoundShapingView.h +++ b/include/InstrumentSoundShapingView.h @@ -22,8 +22,8 @@ * */ -#ifndef INSTRUMENT_SOUND_SHAPING_VIEW_H -#define INSTRUMENT_SOUND_SHAPING_VIEW_H +#ifndef LMMS_GUI_INSTRUMENT_SOUND_SHAPING_VIEW_H +#define LMMS_GUI_INSTRUMENT_SOUND_SHAPING_VIEW_H #include @@ -73,4 +73,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_INSTRUMENT_SOUND_SHAPING_VIEW_H diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index 90cd25814..f21723363 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -23,8 +23,8 @@ * */ -#ifndef INSTRUMENT_TRACK_H -#define INSTRUMENT_TRACK_H +#ifndef LMMS_INSTRUMENT_TRACK_H +#define LMMS_INSTRUMENT_TRACK_H #include "AudioPort.h" #include "InstrumentFunctions.h" @@ -224,6 +224,11 @@ public: return &m_mixerChannelModel; } + BoolModel* useMasterPitchModel() + { + return &m_useMasterPitchModel; + } + void setPreviewMode( const bool ); bool isPreviewMode() const @@ -239,7 +244,6 @@ signals: void instrumentChanged(); void midiNoteOn( const lmms::Note& ); void midiNoteOff( const lmms::Note& ); - void nameChanged(); void newNote(); void endNote(); @@ -320,4 +324,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_INSTRUMENT_TRACK_H diff --git a/include/InstrumentTrackView.h b/include/InstrumentTrackView.h index 3201f81d6..363f5b3ab 100644 --- a/include/InstrumentTrackView.h +++ b/include/InstrumentTrackView.h @@ -22,8 +22,8 @@ * */ -#ifndef INSTRUMENT_TRACK_VIEW_H -#define INSTRUMENT_TRACK_VIEW_H +#ifndef LMMS_GUI_INSTRUMENT_TRACK_VIEW_H +#define LMMS_GUI_INSTRUMENT_TRACK_VIEW_H #include "TrackView.h" @@ -121,4 +121,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_INSTRUMENT_TRACK_VIEW_H diff --git a/include/InstrumentTrackWindow.h b/include/InstrumentTrackWindow.h index 68750c0b8..d41bbdac8 100644 --- a/include/InstrumentTrackWindow.h +++ b/include/InstrumentTrackWindow.h @@ -22,8 +22,8 @@ * */ -#ifndef INSTRUMENT_TRACK_WINDOW_H -#define INSTRUMENT_TRACK_WINDOW_H +#ifndef LMMS_GUI_INSTRUMENT_TRACK_WINDOW_H +#define LMMS_GUI_INSTRUMENT_TRACK_WINDOW_H #include @@ -169,4 +169,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_INSTRUMENT_TRACK_WINDOW_H diff --git a/include/InstrumentView.h b/include/InstrumentView.h index ab18465eb..40014a11f 100644 --- a/include/InstrumentView.h +++ b/include/InstrumentView.h @@ -22,9 +22,8 @@ * */ - -#ifndef INSTRUMENT_VIEW_H -#define INSTRUMENT_VIEW_H +#ifndef LMMS_GUI_INSTRUMENT_VIEW_H +#define LMMS_GUI_INSTRUMENT_VIEW_H #include "Instrument.h" #include "PluginView.h" @@ -76,4 +75,4 @@ public: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_INSTRUMENT_VIEW_H diff --git a/include/IoHelper.h b/include/IoHelper.h index c7d65c917..40c576b83 100644 --- a/include/IoHelper.h +++ b/include/IoHelper.h @@ -22,8 +22,8 @@ * */ -#ifndef IO_HELPER_H -#define IO_HELPER_H +#ifndef LMMS_IO_HELPER_H +#define LMMS_IO_HELPER_H #include "lmmsconfig.h" @@ -47,7 +47,7 @@ namespace lmms #ifdef _WIN32 -std::wstring toWString(const std::string& s) +inline std::wstring toWString(const std::string& s) { std::wstring ret; int len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), @@ -64,7 +64,7 @@ std::wstring toWString(const std::string& s) #endif -FILE* F_OPEN_UTF8(std::string const& fname, const char* mode){ +inline FILE* F_OPEN_UTF8(std::string const& fname, const char* mode){ #ifdef LMMS_BUILD_WIN32 return _wfopen(toWString(fname).data(), toWString(mode).data()); #else @@ -73,7 +73,7 @@ FILE* F_OPEN_UTF8(std::string const& fname, const char* mode){ } -int fileToDescriptor(FILE* f, bool closeFile = true) +inline int fileToDescriptor(FILE* f, bool closeFile = true) { int fh; if (f == nullptr) {return -1;} @@ -91,4 +91,4 @@ int fileToDescriptor(FILE* f, bool closeFile = true) } // namespace lmms -#endif +#endif // LMMS_IO_HELPER_H diff --git a/include/JournallingObject.h b/include/JournallingObject.h index 41ae65295..f3e134f34 100644 --- a/include/JournallingObject.h +++ b/include/JournallingObject.h @@ -22,8 +22,8 @@ * */ -#ifndef JOURNALLING_OBJECT_H -#define JOURNALLING_OBJECT_H +#ifndef LMMS_JOURNALLING_OBJECT_H +#define LMMS_JOURNALLING_OBJECT_H #include @@ -103,5 +103,4 @@ private: } // namespace lmms -#endif - +#endif // LMMS_JOURNALLING_OBJECT_H diff --git a/include/Keymap.h b/include/Keymap.h index 6286f8362..967d80789 100644 --- a/include/Keymap.h +++ b/include/Keymap.h @@ -22,8 +22,8 @@ * */ -#ifndef KEYMAP_H -#define KEYMAP_H +#ifndef LMMS_KEYMAP_H +#define LMMS_KEYMAP_H #include #include @@ -80,4 +80,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_KEYMAP_H diff --git a/include/Knob.h b/include/Knob.h index 16ac7ed01..289af8cd5 100644 --- a/include/Knob.h +++ b/include/Knob.h @@ -22,9 +22,8 @@ * */ - -#ifndef KNOB_H -#define KNOB_H +#ifndef LMMS_GUI_KNOB_H +#define LMMS_GUI_KNOB_H #include #include @@ -41,7 +40,7 @@ namespace lmms::gui { -class TextFloat; +class SimpleTextFloat; enum knobTypes { @@ -175,7 +174,7 @@ private: } - static TextFloat * s_textFloat; + static SimpleTextFloat * s_textFloat; QString m_label; bool m_isHtmlLabel; @@ -214,4 +213,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_KNOB_H diff --git a/include/Ladspa2LMMS.h b/include/Ladspa2LMMS.h index 4b7eb2482..abb969124 100644 --- a/include/Ladspa2LMMS.h +++ b/include/Ladspa2LMMS.h @@ -23,13 +23,11 @@ * */ -#ifndef LADSPA_2_LMMS_H -#define LADSPA_2_LMMS_H - +#ifndef LMMS_LADSPA_2_LMMS_H +#define LMMS_LADSPA_2_LMMS_H #include "LadspaManager.h" - namespace lmms { @@ -83,4 +81,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_LADSPA_2_LMMS_H diff --git a/include/LadspaBase.h b/include/LadspaBase.h index 3feb7d204..51c0ca202 100644 --- a/include/LadspaBase.h +++ b/include/LadspaBase.h @@ -23,8 +23,8 @@ * */ -#ifndef LADSPA_BASE_H -#define LADSPA_BASE_H +#ifndef LMMS_LADSPA_BASE_H +#define LMMS_LADSPA_BASE_H #include "LadspaManager.h" #include "Plugin.h" @@ -83,4 +83,4 @@ inline Plugin::Descriptor::SubPluginFeatures::Key ladspaKeyToSubPluginKey( } // namespace lmms -#endif +#endif // LMMS_LADSPA_BASE_H diff --git a/include/LadspaControl.h b/include/LadspaControl.h index 53918b08a..8af8f9923 100644 --- a/include/LadspaControl.h +++ b/include/LadspaControl.h @@ -23,8 +23,8 @@ * */ -#ifndef LADSPA_CONTROL_H -#define LADSPA_CONTROL_H +#ifndef LMMS_LADSPA_CONTROL_H +#define LMMS_LADSPA_CONTROL_H #include @@ -133,4 +133,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_LADSPA_CONTROL_H diff --git a/include/LadspaControlView.h b/include/LadspaControlView.h index 5dafa4e5c..4f12c29e2 100644 --- a/include/LadspaControlView.h +++ b/include/LadspaControlView.h @@ -23,8 +23,8 @@ * */ -#ifndef LADSPA_CONTROL_VIEW_H -#define LADSPA_CONTROL_VIEW_H +#ifndef LMMS_GUI_LADSPA_CONTROL_VIEW_H +#define LMMS_GUI_LADSPA_CONTROL_VIEW_H #include @@ -55,4 +55,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_LADSPA_CONTROL_VIEW_H diff --git a/include/LadspaManager.h b/include/LadspaManager.h index 176526193..8c00d2604 100644 --- a/include/LadspaManager.h +++ b/include/LadspaManager.h @@ -24,9 +24,8 @@ * */ - -#ifndef LADSPA_MANAGER_H -#define LADSPA_MANAGER_H +#ifndef LMMS_LADSPA_MANAGER_H +#define LMMS_LADSPA_MANAGER_H #include @@ -350,4 +349,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_LADSPA_MANAGER_H diff --git a/include/LcdFloatSpinBox.h b/include/LcdFloatSpinBox.h index ab0de304e..74a870114 100644 --- a/include/LcdFloatSpinBox.h +++ b/include/LcdFloatSpinBox.h @@ -23,9 +23,8 @@ * */ - -#ifndef LCD_FLOATSPINBOX_H -#define LCD_FLOATSPINBOX_H +#ifndef LMMS_GUI_LCD_FLOATSPINBOX_H +#define LMMS_GUI_LCD_FLOATSPINBOX_H #include @@ -85,4 +84,4 @@ using LcdFloatSpinBoxModel = FloatModel; } // namespace lmms::gui -#endif +#endif // LMMS_GUI_LCD_FLOATSPINBOX_H diff --git a/include/LcdSpinBox.h b/include/LcdSpinBox.h index 9c8923763..aeccd2635 100644 --- a/include/LcdSpinBox.h +++ b/include/LcdSpinBox.h @@ -22,9 +22,8 @@ * */ - -#ifndef LCD_SPINBOX_H -#define LCD_SPINBOX_H +#ifndef LMMS_GUI_LCD_SPINBOX_H +#define LMMS_GUI_LCD_SPINBOX_H #include "LcdWidget.h" #include "AutomatableModelView.h" @@ -90,4 +89,4 @@ using LcdSpinBoxModel = IntModel; } // namespace lmms::gui -#endif +#endif // LMMS_GUI_LCD_SPINBOX_H diff --git a/include/LcdWidget.h b/include/LcdWidget.h index d55cfc017..f19c2c583 100644 --- a/include/LcdWidget.h +++ b/include/LcdWidget.h @@ -22,9 +22,8 @@ * */ - -#ifndef LCD_WIDGET_H -#define LCD_WIDGET_H +#ifndef LMMS_GUI_LCD_WIDGET_H +#define LMMS_GUI_LCD_WIDGET_H #include #include @@ -117,4 +116,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_LCD_WIDGET_H diff --git a/include/LedCheckBox.h b/include/LedCheckBox.h index a215592e6..95016b87f 100644 --- a/include/LedCheckBox.h +++ b/include/LedCheckBox.h @@ -22,9 +22,8 @@ * */ - -#ifndef LED_CHECKBOX_H -#define LED_CHECKBOX_H +#ifndef LMMS_GUI_LED_CHECKBOX_H +#define LMMS_GUI_LED_CHECKBOX_H #include "AutomatableButton.h" @@ -84,4 +83,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_LED_CHECKBOX_H diff --git a/include/LeftRightNav.h b/include/LeftRightNav.h index df72193dc..49ad25ecf 100644 --- a/include/LeftRightNav.h +++ b/include/LeftRightNav.h @@ -22,8 +22,8 @@ * */ -#ifndef LEFT_RIGHT_NAV_H -#define LEFT_RIGHT_NAV_H +#ifndef LMMS_GUI_LEFT_RIGHT_NAV_H +#define LMMS_GUI_LEFT_RIGHT_NAV_H #include "PixmapButton.h" @@ -51,4 +51,4 @@ private: } // namespace lmms::gui -#endif \ No newline at end of file +#endif // LMMS_GUI_LEFT_RIGHT_NAV_H diff --git a/include/LfoController.h b/include/LfoController.h index 48aee3d30..1c63ba698 100644 --- a/include/LfoController.h +++ b/include/LfoController.h @@ -22,8 +22,8 @@ * */ -#ifndef LFO_CONTROLLER_H -#define LFO_CONTROLLER_H +#ifndef LMMS_LFO_CONTROLLER_H +#define LMMS_LFO_CONTROLLER_H #include @@ -51,7 +51,7 @@ class LfoControllerDialog; } -class LfoController : public Controller +class LfoController : public Controller { Q_OBJECT public: @@ -136,4 +136,4 @@ private slots: } // namespace lmms -#endif +#endif // LMMS_LFO_CONTROLLER_H diff --git a/include/LinkedModelGroupViews.h b/include/LinkedModelGroupViews.h index 72598281b..cf5aabd0d 100644 --- a/include/LinkedModelGroupViews.h +++ b/include/LinkedModelGroupViews.h @@ -22,15 +22,13 @@ * */ -#ifndef LINKEDMODELGROUPVIEWS_H -#define LINKEDMODELGROUPVIEWS_H - +#ifndef LMMS_GUI_LINKED_MODEL_GROUP_VIEWS_H +#define LMMS_GUI_LINKED_MODEL_GROUP_VIEWS_H #include #include #include - namespace lmms { @@ -120,4 +118,4 @@ private: } // namespace lmms -#endif // LINKEDMODELGROUPVIEWS_H +#endif // LMMS_GUI_LINKED_MODEL_GROUP_VIEWS_H diff --git a/include/LinkedModelGroups.h b/include/LinkedModelGroups.h index 84a216f30..c537d7fca 100644 --- a/include/LinkedModelGroups.h +++ b/include/LinkedModelGroups.h @@ -22,15 +22,13 @@ * */ -#ifndef LINKEDMODELGROUPS_H -#define LINKEDMODELGROUPS_H - +#ifndef LMMS_LINKED_MODEL_GROUPS_H +#define LMMS_LINKED_MODEL_GROUPS_H #include #include "Model.h" - class QDomDocument; class QDomElement; @@ -133,6 +131,8 @@ public: private: //! models for the controls + //! @note The AutomatableModels behind the ModelInfo are not owned, + //! but referenced after `addModel` is being called. std::map m_models; }; @@ -178,4 +178,4 @@ public: } // namespace lmms -#endif // LINKEDMODELGROUPS_H +#endif // LMMS_LINKED_MODEL_GROUPS_H diff --git a/include/LmmsPalette.h b/include/LmmsPalette.h index 023872254..91a469de0 100644 --- a/include/LmmsPalette.h +++ b/include/LmmsPalette.h @@ -23,13 +23,12 @@ * */ -#ifndef LMMSPALETTE_H -#define LMMSPALETTE_H +#ifndef LMMS_GUI_LMMS_PALETTE_H +#define LMMS_GUI_LMMS_PALETTE_H #include #include "lmms_export.h" - namespace lmms::gui { @@ -86,7 +85,6 @@ private: }; - } // namespace lmms::gui -#endif +#endif // LMMS_GUI_LMMS_PALETTE_H diff --git a/include/LmmsStyle.h b/include/LmmsStyle.h index ae5b65f99..b3be03952 100644 --- a/include/LmmsStyle.h +++ b/include/LmmsStyle.h @@ -23,9 +23,8 @@ * */ - -#ifndef LMMS_STYLE_H -#define LMMS_STYLE_H +#ifndef LMMS_GUI_LMMS_STYLE_H +#define LMMS_GUI_LMMS_STYLE_H #include @@ -96,4 +95,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_LMMS_STYLE_H diff --git a/include/LocaleHelper.h b/include/LocaleHelper.h index b071a1596..9c829fcaa 100644 --- a/include/LocaleHelper.h +++ b/include/LocaleHelper.h @@ -25,8 +25,8 @@ * */ -#ifndef LOCALEHELPER_H -#define LOCALEHELPER_H +#ifndef LMMS_LOCALEHELPER_H +#define LMMS_LOCALEHELPER_H #include @@ -67,4 +67,4 @@ inline float toFloat(QString str, bool* ok = nullptr) } // namespace lmms::LocaleHelper -#endif // LOCALEHELPER_H +#endif // LMMS_LOCALEHELPER_H diff --git a/include/LocklessAllocator.h b/include/LocklessAllocator.h index adde5fe6f..d44b99543 100644 --- a/include/LocklessAllocator.h +++ b/include/LocklessAllocator.h @@ -22,8 +22,8 @@ * */ -#ifndef LOCKLESS_ALLOCATOR_H -#define LOCKLESS_ALLOCATOR_H +#ifndef LMMS_LOCKLESS_ALLOCATOR_H +#define LMMS_LOCKLESS_ALLOCATOR_H #include #include @@ -84,4 +84,4 @@ public: } // namespace lmms -#endif +#endif // LMMS_LOCKLESS_ALLOCATOR_H diff --git a/include/LocklessList.h b/include/LocklessList.h index 44b718059..4a0c27de0 100644 --- a/include/LocklessList.h +++ b/include/LocklessList.h @@ -22,8 +22,8 @@ * */ -#ifndef LOCKLESS_LIST_H -#define LOCKLESS_LIST_H +#ifndef LMMS_LOCKLESS_LIST_H +#define LMMS_LOCKLESS_LIST_H #include "LocklessAllocator.h" @@ -97,4 +97,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_LOCKLESS_LIST_H diff --git a/include/LocklessRingBuffer.h b/include/LocklessRingBuffer.h index e77c62ccb..99c48cc90 100644 --- a/include/LocklessRingBuffer.h +++ b/include/LocklessRingBuffer.h @@ -22,8 +22,8 @@ * */ -#ifndef LOCKLESSRINGBUFFER_H -#define LOCKLESSRINGBUFFER_H +#ifndef LMMS_LOCKLESS_RING_BUFFER_H +#define LMMS_LOCKLESS_RING_BUFFER_H #include #include @@ -89,4 +89,4 @@ private: } // namespace lmms -#endif //LOCKLESSRINGBUFFER_H +#endif // LMMS_LOCKLESS_RING_BUFFER_H diff --git a/include/Lv2Basics.h b/include/Lv2Basics.h index b935e6a02..9a958d973 100644 --- a/include/Lv2Basics.h +++ b/include/Lv2Basics.h @@ -1,7 +1,7 @@ /* * Lv2Basics.h - basic Lv2 utils * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -22,10 +22,8 @@ * */ - -#ifndef LV2BASICS_H -#define LV2BASICS_H - +#ifndef LMMS_LV2BASICS_H +#define LMMS_LV2BASICS_H #include "lmmsconfig.h" @@ -69,4 +67,5 @@ std::string stdStringFromPortName(const LilvPlugin* plug, const LilvPort* port); } // namespace lmms #endif // LMMS_HAVE_LV2 -#endif // LV2BASICS_H + +#endif // LMMS_LV2BASICS_H diff --git a/include/Lv2ControlBase.h b/include/Lv2ControlBase.h index c6b08db8c..f5cb0cdb4 100644 --- a/include/Lv2ControlBase.h +++ b/include/Lv2ControlBase.h @@ -1,7 +1,7 @@ /* * Lv2ControlBase.h - Lv2 control base class * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -22,8 +22,8 @@ * */ -#ifndef LV2_CONTROL_BASE_H -#define LV2_CONTROL_BASE_H +#ifndef LMMS_LV2_CONTROL_BASE_H +#define LMMS_LV2_CONTROL_BASE_H #include "lmmsconfig.h" @@ -77,6 +77,9 @@ public: static Plugin::PluginTypes check(const LilvPlugin* m_plugin, std::vector &issues); + void shutdown(); + void init(Model* meAsModel); + const LilvPlugin* getPlugin() const { return m_plugin; } Lv2Proc *control(std::size_t idx) { return m_procs[idx].get(); } @@ -95,6 +98,7 @@ protected: Lv2ControlBase(class Model *that, const QString& uri); Lv2ControlBase(const Lv2ControlBase&) = delete; ~Lv2ControlBase() override; + void reload(); Lv2ControlBase& operator=(const Lv2ControlBase&) = delete; @@ -129,8 +133,6 @@ protected: void saveSettings(QDomDocument &doc, QDomElement &that); void loadSettings(const QDomElement &that); void loadFile(const QString &file); - //! TODO: not implemented - void reloadPlugin(); /* more functions that must be called from virtuals @@ -142,11 +144,6 @@ protected: const class TimePos &time, f_cnt_t offset); private: - //! Return the DataFile settings type - virtual DataFile::Types settingsType() = 0; - //! Inform the plugin about a file name change - virtual void setNameFromFile(const QString &fname) = 0; - //! Independent processors //! If this is a mono effect, the vector will have size 2 in order to //! fulfill LMMS' requirement of having stereo input and output @@ -163,4 +160,5 @@ private: } // namespace lmms #endif // LMMS_HAVE_LV2 -#endif // LV2_CONTROL_BASE_H + +#endif // LMMS_LV2_CONTROL_BASE_H diff --git a/include/Lv2Evbuf.h b/include/Lv2Evbuf.h index 9732fc5e1..319bdf9ce 100644 --- a/include/Lv2Evbuf.h +++ b/include/Lv2Evbuf.h @@ -1,5 +1,5 @@ /* - * lv2_evbuf.h - Lv2 event buffer definitions + * Lv2Evbuf.h - Lv2 event buffer definitions * * Copyright (c) 2019-2020 Johannes Lorenz * @@ -30,8 +30,8 @@ * match the LMMS coding conventions. */ -#ifndef LV2_EVBUF_H -#define LV2_EVBUF_H +#ifndef LMMS_LV2_EVBUF_H +#define LMMS_LV2_EVBUF_H #include "lmmsconfig.h" @@ -155,4 +155,4 @@ lv2_evbuf_write( LV2_Evbuf_Iterator* iter, #endif // LMMS_HAVE_LV2 -#endif // LV2_EVBUF_H +#endif // LMMS_LV2_EVBUF_H diff --git a/include/Lv2Features.h b/include/Lv2Features.h index 033273f31..b5bc284c8 100644 --- a/include/Lv2Features.h +++ b/include/Lv2Features.h @@ -22,8 +22,8 @@ * */ -#ifndef LV2FEATURES_H -#define LV2FEATURES_H +#ifndef LMMS_LV2_FEATURES_H +#define LMMS_LV2_FEATURES_H #include "lmmsconfig.h" @@ -69,6 +69,8 @@ public: { return m_featurePointers.data(); } + //! Clear everything + void clear(); private: //! feature storage @@ -84,4 +86,4 @@ private: #endif // LMMS_HAVE_LV2 -#endif // LV2FEATURES_H +#endif // LMMS_LV2_FEATURES_H diff --git a/include/Lv2Manager.h b/include/Lv2Manager.h index 7c4a4bcb7..89f6a0efd 100644 --- a/include/Lv2Manager.h +++ b/include/Lv2Manager.h @@ -1,7 +1,7 @@ /* * Lv2Manager.h - Implementation of Lv2Manager class * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -22,8 +22,8 @@ * */ -#ifndef LV2MANAGER_H -#define LV2MANAGER_H +#ifndef LMMS_LV2_MANAGER_H +#define LMMS_LV2_MANAGER_H #include "lmmsconfig.h" @@ -166,4 +166,4 @@ private: #endif // LMMS_HAVE_LV2 -#endif // LV2MANAGER_H +#endif // LMMS_LV2_MANAGER_H diff --git a/include/Lv2Options.h b/include/Lv2Options.h index 32225ea89..ca4fe2b7f 100644 --- a/include/Lv2Options.h +++ b/include/Lv2Options.h @@ -22,8 +22,8 @@ * */ -#ifndef LV2OPTIONS_H -#define LV2OPTIONS_H +#ifndef LMMS_LV2_OPTIONS_H +#define LMMS_LV2_OPTIONS_H #include "lmmsconfig.h" @@ -107,4 +107,4 @@ private: #endif // LMMS_HAVE_LV2 -#endif // LV2OPTIONS_H +#endif // LMMS_LV2_OPTIONS_H diff --git a/include/Lv2Ports.h b/include/Lv2Ports.h index 07676fdd4..0f0b02913 100644 --- a/include/Lv2Ports.h +++ b/include/Lv2Ports.h @@ -22,8 +22,8 @@ * */ -#ifndef LV2PORTS_H -#define LV2PORTS_H +#ifndef LMMS_LV2PORTS_H +#define LMMS_LV2PORTS_H #include "lmmsconfig.h" @@ -270,4 +270,5 @@ const Target* dcast(const PortBase* base) } // namespace lmms #endif // LMMS_HAVE_LV2 -#endif // LV2PORTS_H + +#endif // LMMS_LV2PORTS_H diff --git a/include/Lv2Proc.h b/include/Lv2Proc.h index 31a694044..1be284ced 100644 --- a/include/Lv2Proc.h +++ b/include/Lv2Proc.h @@ -22,8 +22,8 @@ * */ -#ifndef LV2PROC_H -#define LV2PROC_H +#ifndef LMMS_LV2_PROC_H +#define LMMS_LV2_PROC_H #include "lmmsconfig.h" @@ -59,8 +59,8 @@ namespace Lv2Ports } -//! Class representing one Lv2 processor, i.e. one Lv2 handle -//! For Mono effects, 1 Lv2ControlBase references 2 Lv2Proc +//! Class representing one Lv2 processor, i.e. one Lv2 handle. +//! For Mono effects, 1 Lv2ControlBase references 2 Lv2Proc. class Lv2Proc : public LinkedModelGroup { public: @@ -68,10 +68,12 @@ public: std::vector &issues); /* - ctor/dtor + ctor/dtor/reload */ Lv2Proc(const LilvPlugin* plugin, Model *parent); ~Lv2Proc() override; + void reload(); + void onSampleRateChanged(); //! Must be checked after ctor or reload bool isValid() const { return m_valid; } @@ -195,6 +197,8 @@ private: static int32_t defaultEvbufSize() { return 1 << 15; /* ardour uses this*/ } //! models for the controls, sorted by port symbols + //! @note These are not owned, but rather link to the models in + //! ControlPorts in `m_ports` std::map m_connectedModels; void initMOptions(); //!< initialize m_options @@ -220,4 +224,5 @@ private: } // namespace lmms #endif // LMMS_HAVE_LV2 -#endif // LV2PROC_H + +#endif // LMMS_LV2_PROC_H diff --git a/include/Lv2SubPluginFeatures.h b/include/Lv2SubPluginFeatures.h index 9ba2c76cb..57eab8715 100644 --- a/include/Lv2SubPluginFeatures.h +++ b/include/Lv2SubPluginFeatures.h @@ -3,7 +3,7 @@ * Plugin::Descriptor::SubPluginFeatures for * hosting LV2 plugins * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -24,8 +24,8 @@ * */ -#ifndef LV2_SUBPLUGIN_FEATURES_H -#define LV2_SUBPLUGIN_FEATURES_H +#ifndef LMMS_LV2_SUBPLUGIN_FEATURES_H +#define LMMS_LV2_SUBPLUGIN_FEATURES_H #include "lmmsconfig.h" @@ -66,4 +66,4 @@ public: #endif // LMMS_HAVE_LV2 -#endif +#endif // LMMS_LV2_SUBPLUGIN_FEATURES_H diff --git a/include/Lv2UridCache.h b/include/Lv2UridCache.h index bae42d318..b64003a2e 100644 --- a/include/Lv2UridCache.h +++ b/include/Lv2UridCache.h @@ -22,8 +22,8 @@ * */ -#ifndef LV2URIDCACHE_H -#define LV2URIDCACHE_H +#ifndef LMMS_LV2_URID_CACHE_H +#define LMMS_LV2_URID_CACHE_H #include "lmmsconfig.h" @@ -74,4 +74,5 @@ template<> struct Lv2UridCache::IdForType { static constexpr auto } // namespace lmms #endif // LMMS_HAVE_LV2 -#endif // LV2URIDCACHE_H + +#endif // LMMS_LV2_URID_CACHE_H diff --git a/include/Lv2UridMap.h b/include/Lv2UridMap.h index 9db9cb0c2..b8733023e 100644 --- a/include/Lv2UridMap.h +++ b/include/Lv2UridMap.h @@ -22,8 +22,8 @@ * */ -#ifndef LV2URIDMAP_H -#define LV2URIDMAP_H +#ifndef LMMS_LV2_URID_MAP_H +#define LMMS_LV2_URID_MAP_H #include "lmmsconfig.h" @@ -75,4 +75,5 @@ public: } // namespace lmms #endif // LMMS_HAVE_LV2 -#endif // LV2URIDMAP_H + +#endif // LMMS_LV2_URID_MAP_H diff --git a/include/Lv2ViewBase.h b/include/Lv2ViewBase.h index 605440814..f7d0e9bcb 100644 --- a/include/Lv2ViewBase.h +++ b/include/Lv2ViewBase.h @@ -1,7 +1,7 @@ /* * Lv2ViewBase.h - base class for Lv2 plugin views * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -22,15 +22,14 @@ * */ -#ifndef LV2VIEWBASE_H -#define LV2VIEWBASE_H +#ifndef LMMS_GUI_LV2_VIEW_BASE_H +#define LMMS_GUI_LV2_VIEW_BASE_H #include "lmmsconfig.h" #ifdef LMMS_HAVE_LV2 - #include "LinkedModelGroupViews.h" #include "lmms_export.h" #include "Lv2Basics.h" @@ -109,4 +108,5 @@ private: } // namespace lmms #endif // LMMS_HAVE_LV2 -#endif // LV2VIEWBASE_H + +#endif // LMMS_GUI_LV2_VIEW_BASE_H diff --git a/include/MainApplication.h b/include/MainApplication.h index 04bc82226..98fcdef20 100644 --- a/include/MainApplication.h +++ b/include/MainApplication.h @@ -22,8 +22,8 @@ * */ -#ifndef MAINAPPLICATION_H -#define MAINAPPLICATION_H +#ifndef LMMS_GUI_MAIN_APPLICATION_H +#define LMMS_GUI_MAIN_APPLICATION_H #include "lmmsconfig.h" @@ -64,4 +64,4 @@ private: } // namespace lmms::gui -#endif // MAINAPPLICATION_H +#endif // LMMS_GUI_MAIN_APPLICATION_H diff --git a/include/MainWindow.h b/include/MainWindow.h index e093d1082..c4bbb6767 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -22,8 +22,8 @@ * */ -#ifndef MAIN_WINDOW_H -#define MAIN_WINDOW_H +#ifndef LMMS_GUI_MAIN_WINDOW_H +#define LMMS_GUI_MAIN_WINDOW_H #include #include @@ -263,4 +263,4 @@ signals: } // namespace lmms -#endif +#endif // LMMS_GUI_MAIN_WINDOW_H diff --git a/include/MemoryHelper.h b/include/MemoryHelper.h index 1def9d9c4..e709ffc8a 100644 --- a/include/MemoryHelper.h +++ b/include/MemoryHelper.h @@ -21,9 +21,8 @@ * */ - -#ifndef MEMORY_HELPER_H -#define MEMORY_HELPER_H +#ifndef LMMS_MEMORY_HELPER_H +#define LMMS_MEMORY_HELPER_H #include @@ -47,5 +46,4 @@ private: } // namespace lmms -#endif - +#endif // LMMS_MEMORY_HELPER_H diff --git a/include/MemoryManager.h b/include/MemoryManager.h index d50ad173d..fa2fe8110 100644 --- a/include/MemoryManager.h +++ b/include/MemoryManager.h @@ -24,8 +24,8 @@ * */ -#ifndef MEMORY_MANAGER_H -#define MEMORY_MANAGER_H +#ifndef LMMS_MEMORY_MANAGER_H +#define LMMS_MEMORY_MANAGER_H #include #include @@ -108,4 +108,4 @@ void MM_FREE(T* ptr) } // namespace lmms -#endif +#endif // LMMS_MEMORY_MANAGER_H diff --git a/include/MeterDialog.h b/include/MeterDialog.h index 67dca2568..dca7e5de6 100644 --- a/include/MeterDialog.h +++ b/include/MeterDialog.h @@ -23,8 +23,8 @@ * */ -#ifndef METER_DIALOG_H -#define METER_DIALOG_H +#ifndef LMMS_GUI_METER_DIALOG_H +#define LMMS_GUI_METER_DIALOG_H #include @@ -54,4 +54,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_METER_DIALOG_H diff --git a/include/MeterModel.h b/include/MeterModel.h index c2e715b79..6c0304e37 100644 --- a/include/MeterModel.h +++ b/include/MeterModel.h @@ -22,8 +22,8 @@ * */ -#ifndef METER_MODEL_H -#define METER_MODEL_H +#ifndef LMMS_METER_MODEL_H +#define LMMS_METER_MODEL_H #include "AutomatableModel.h" @@ -68,4 +68,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_METER_MODEL_H diff --git a/include/MicroTimer.h b/include/MicroTimer.h index ea74e964d..cd03403dc 100644 --- a/include/MicroTimer.h +++ b/include/MicroTimer.h @@ -22,8 +22,8 @@ * */ -#ifndef MICRO_TIMER_H -#define MICRO_TIMER_H +#ifndef LMMS_MICRO_TIMER_H +#define LMMS_MICRO_TIMER_H #include @@ -48,4 +48,4 @@ private: } // namespace lmms -#endif // MICRO_TIMER_H +#endif // LMMS_MICRO_TIMER_H diff --git a/include/Microtuner.h b/include/Microtuner.h index dff8f5773..c92549581 100644 --- a/include/Microtuner.h +++ b/include/Microtuner.h @@ -22,8 +22,8 @@ * */ -#ifndef MICROTUNER_H -#define MICROTUNER_H +#ifndef LMMS_MICROTUNER_H +#define LMMS_MICROTUNER_H #include "AutomatableModel.h" #include "ComboBoxModel.h" @@ -74,4 +74,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_MICROTUNER_H diff --git a/include/MicrotunerConfig.h b/include/MicrotunerConfig.h index 690587dd5..0706a530f 100644 --- a/include/MicrotunerConfig.h +++ b/include/MicrotunerConfig.h @@ -22,9 +22,8 @@ * */ -#ifndef MICROTUNER_CONFIG_H -#define MICROTUNER_CONFIG_H - +#ifndef LMMS_GUI_MICROTUNER_CONFIG_H +#define LMMS_GUI_MICROTUNER_CONFIG_H #include @@ -96,4 +95,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_MICROTUNER_CONFIG_H diff --git a/include/Midi.h b/include/Midi.h index f75254d84..21db021b3 100644 --- a/include/Midi.h +++ b/include/Midi.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDI_H -#define MIDI_H +#ifndef LMMS_MIDI_H +#define LMMS_MIDI_H #include "lmms_basics.h" @@ -143,4 +143,4 @@ const int MidiMaxPitchBend = 16383; } // namespace lmms -#endif +#endif // LMMS_MIDI_H diff --git a/include/MidiAlsaRaw.h b/include/MidiAlsaRaw.h index 57a477264..345cdbd54 100644 --- a/include/MidiAlsaRaw.h +++ b/include/MidiAlsaRaw.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDI_ALSA_RAW_H -#define MIDI_ALSA_RAW_H +#ifndef LMMS_MIDI_ALSA_RAW_H +#define LMMS_MIDI_ALSA_RAW_H #include "lmmsconfig.h" @@ -85,4 +85,4 @@ private: #endif // LMMS_HAVE_ALSA -#endif +#endif // LMMS_MIDI_ALSA_RAW_H diff --git a/include/MidiAlsaSeq.h b/include/MidiAlsaSeq.h index fa287a409..006cdefc8 100644 --- a/include/MidiAlsaSeq.h +++ b/include/MidiAlsaSeq.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDI_ALSA_SEQ_H -#define MIDI_ALSA_SEQ_H +#ifndef LMMS_MIDI_ALSA_SEQ_H +#define LMMS_MIDI_ALSA_SEQ_H #include "lmmsconfig.h" @@ -158,5 +158,4 @@ signals: #endif // LMMS_HAVE_ALSA -#endif - +#endif // LMMS_MIDI_ALSA_SEQ_H diff --git a/include/MidiApple.h b/include/MidiApple.h index 794641e64..37d408d4d 100644 --- a/include/MidiApple.h +++ b/include/MidiApple.h @@ -23,8 +23,8 @@ * */ -#ifndef MIDI_APPLE_H -#define MIDI_APPLE_H +#ifndef LMMS_MIDI_APPLE_H +#define LMMS_MIDI_APPLE_H #include "lmmsconfig.h" @@ -155,5 +155,4 @@ signals: #endif // LMMS_BUILD_APPLE - -#endif +#endif // LMMS_MIDI_APPLE_H diff --git a/include/MidiCCRackView.h b/include/MidiCCRackView.h index 59f1de020..4cb82b3d8 100644 --- a/include/MidiCCRackView.h +++ b/include/MidiCCRackView.h @@ -1,5 +1,29 @@ -#ifndef MIDI_CC_RACK_VIEW_H -#define MIDI_CC_RACK_VIEW_H +/* + * MidiCCRackView.h - declaration of the MIDI CC rack widget + * + * Copyright (c) 2020 Ian Caio + * + * 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 LMMS_GUI_MIDI_CC_RACK_VIEW_H +#define LMMS_GUI_MIDI_CC_RACK_VIEW_H #include @@ -49,4 +73,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_MIDI_CC_RACK_VIEW_H diff --git a/include/MidiClient.h b/include/MidiClient.h index 954cd5ef5..3a64f709c 100644 --- a/include/MidiClient.h +++ b/include/MidiClient.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDI_CLIENT_H -#define MIDI_CLIENT_H +#ifndef LMMS_MIDI_CLIENT_H +#define LMMS_MIDI_CLIENT_H #include #include @@ -173,5 +173,4 @@ private: } // namespace lmms -#endif - +#endif // LMMS_MIDI_CLIENT_H diff --git a/include/MidiClip.h b/include/MidiClip.h index 6433ba507..bbb7d325d 100644 --- a/include/MidiClip.h +++ b/include/MidiClip.h @@ -23,9 +23,8 @@ * */ -#ifndef MIDI_CLIP_H -#define MIDI_CLIP_H - +#ifndef LMMS_MIDI_CLIP_H +#define LMMS_MIDI_CLIP_H #include "Clip.h" #include "Note.h" @@ -155,4 +154,4 @@ signals: } // namespace lmms -#endif +#endif // LMMS_MIDI_CLIP_H diff --git a/include/MidiClipView.h b/include/MidiClipView.h index 1a9809733..6558688b4 100644 --- a/include/MidiClipView.h +++ b/include/MidiClipView.h @@ -21,10 +21,10 @@ * Boston, MA 02110-1301 USA. * */ - -#ifndef MIDI_CLIP_VIEW_H -#define MIDI_CLIP_VIEW_H - + +#ifndef LMMS_GUI_MIDI_CLIP_VIEW_H +#define LMMS_GUI_MIDI_CLIP_VIEW_H + #include #include "ClipView.h" @@ -43,7 +43,7 @@ class MidiClipView : public ClipView public: MidiClipView( MidiClip* clip, TrackView* parent ); - ~MidiClipView() override = default; + ~MidiClipView() override = default; Q_PROPERTY(QColor noteFillColor READ getNoteFillColor WRITE setNoteFillColor) Q_PROPERTY(QColor noteBorderColor READ getNoteBorderColor WRITE setNoteBorderColor) @@ -107,5 +107,5 @@ private: } // namespace gui } // namespace lmms - - #endif + +#endif // LMMS_GUI_MIDI_CLIP_VIEW_H diff --git a/include/MidiController.h b/include/MidiController.h index 500acc5f8..c4ef49590 100644 --- a/include/MidiController.h +++ b/include/MidiController.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDI_CONTROLLER_H -#define MIDI_CONTROLLER_H +#ifndef LMMS_MIDI_CONTROLLER_H +#define LMMS_MIDI_CONTROLLER_H #include @@ -92,4 +92,4 @@ protected: } // namespace lmms -#endif +#endif // LMMS_MIDI_CONTROLLER_H diff --git a/include/MidiDummy.h b/include/MidiDummy.h index 67a91e326..b117bd136 100644 --- a/include/MidiDummy.h +++ b/include/MidiDummy.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDI_DUMMY_H -#define MIDI_DUMMY_H +#ifndef LMMS_MIDI_DUMMY_H +#define LMMS_MIDI_DUMMY_H #include "MidiClient.h" @@ -65,4 +65,4 @@ protected: } // namespace lmms -#endif +#endif // LMMS_MIDI_DUMMY_H diff --git a/include/MidiEvent.h b/include/MidiEvent.h index 6c2bfdd55..956c33fb3 100644 --- a/include/MidiEvent.h +++ b/include/MidiEvent.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDI_EVENT_H -#define MIDI_EVENT_H +#ifndef LMMS_MIDI_EVENT_H +#define LMMS_MIDI_EVENT_H #include #include "Midi.h" @@ -221,4 +221,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_MIDI_EVENT_H diff --git a/include/MidiEventProcessor.h b/include/MidiEventProcessor.h index 132a5fc42..1c45b3e3f 100644 --- a/include/MidiEventProcessor.h +++ b/include/MidiEventProcessor.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDI_EVENT_PROCESSOR_H -#define MIDI_EVENT_PROCESSOR_H +#ifndef LMMS_MIDI_EVENT_PROCESSOR_H +#define LMMS_MIDI_EVENT_PROCESSOR_H #include "MidiEvent.h" #include "MemoryManager.h" @@ -49,4 +49,4 @@ public: } // namespace lmms -#endif +#endif // LMMS_MIDI_EVENT_PROCESSOR_H diff --git a/include/MidiEventToByteSeq.h b/include/MidiEventToByteSeq.h index f2e36f50a..6490ae385 100644 --- a/include/MidiEventToByteSeq.h +++ b/include/MidiEventToByteSeq.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDIEVENTTOBYTESEQ_H -#define MIDIEVENTTOBYTESEQ_H +#ifndef LMMS_MIDIEVENTTOBYTESEQ_H +#define LMMS_MIDIEVENTTOBYTESEQ_H #include #include @@ -51,4 +51,4 @@ std::size_t LMMS_EXPORT writeToByteSeq( const class MidiEvent& ev, } // namespace lmms -#endif // MIDIEVENTTOBYTESEQ_H +#endif // LMMS_MIDIEVENTTOBYTESEQ_H diff --git a/include/MidiJack.h b/include/MidiJack.h index a4a944b81..e2b38e290 100644 --- a/include/MidiJack.h +++ b/include/MidiJack.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDIJACK_H -#define MIDIJACK_H +#ifndef LMMS_MIDI_JACK_H +#define LMMS_MIDI_JACK_H #include "lmmsconfig.h" @@ -102,4 +102,4 @@ private: #endif // LMMS_HAVE_JACK -#endif // MIDIJACK_H +#endif // LMMS_MIDI_JACK_H diff --git a/include/MidiOss.h b/include/MidiOss.h index 944359055..9acc0e8e6 100644 --- a/include/MidiOss.h +++ b/include/MidiOss.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDI_OSS_H -#define MIDI_OSS_H +#ifndef LMMS_MIDI_OSS_H +#define LMMS_MIDI_OSS_H #include "lmmsconfig.h" @@ -78,5 +78,4 @@ private: #endif // LMMS_HAVE_OSS - -#endif +#endif // LMMS_MIDI_OSS_H diff --git a/include/MidiPort.h b/include/MidiPort.h index 7ef9adf90..6f759708e 100644 --- a/include/MidiPort.h +++ b/include/MidiPort.h @@ -23,8 +23,8 @@ * */ -#ifndef MIDI_PORT_H -#define MIDI_PORT_H +#ifndef LMMS_MIDI_PORT_H +#define LMMS_MIDI_PORT_H #include #include @@ -190,4 +190,4 @@ using MidiPortList = QList; } // namespace lmms -#endif +#endif // LMMS_MIDI_PORT_H diff --git a/include/MidiPortMenu.h b/include/MidiPortMenu.h index 215a73d06..0b3fc1b2f 100644 --- a/include/MidiPortMenu.h +++ b/include/MidiPortMenu.h @@ -23,8 +23,8 @@ * */ -#ifndef MIDI_PORT_MENU_H -#define MIDI_PORT_MENU_H +#ifndef LMMS_GUI_MIDI_PORT_MENU_H +#define LMMS_GUI_MIDI_PORT_MENU_H #include @@ -61,4 +61,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_MIDI_PORT_MENU_H diff --git a/include/MidiSetupWidget.h b/include/MidiSetupWidget.h index 4021db142..a61b606ac 100644 --- a/include/MidiSetupWidget.h +++ b/include/MidiSetupWidget.h @@ -22,9 +22,8 @@ * */ -#ifndef MIDISETUPWIDGET_H -#define MIDISETUPWIDGET_H - +#ifndef LMMS_GUI_MIDI_SETUP_WIDGET_H +#define LMMS_GUI_MIDI_SETUP_WIDGET_H #include "TabWidget.h" @@ -60,4 +59,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_MIDI_SETUP_WIDGET_H diff --git a/include/MidiSndio.h b/include/MidiSndio.h index 3ebd14d05..5734745b9 100644 --- a/include/MidiSndio.h +++ b/include/MidiSndio.h @@ -23,8 +23,8 @@ * */ -#ifndef _MIDI_SNDIO_H -#define _MIDI_SNDIO_H +#ifndef LMMS_MIDI_SNDIO_H +#define LMMS_MIDI_SNDIO_H #include "lmmsconfig.h" @@ -75,4 +75,4 @@ private: #endif // LMMS_HAVE_SNDIO -#endif // _MIDI_SNDIO_H +#endif // LMMS_MIDI_SNDIO_H diff --git a/include/MidiWinMM.h b/include/MidiWinMM.h index 0f2bd0d5f..3a8edfbcd 100644 --- a/include/MidiWinMM.h +++ b/include/MidiWinMM.h @@ -22,8 +22,8 @@ * */ -#ifndef MIDI_WINMM_H -#define MIDI_WINMM_H +#ifndef LMMS_MIDI_WINMM_H +#define LMMS_MIDI_WINMM_H #include "lmmsconfig.h" @@ -150,5 +150,4 @@ signals: #endif // LMMS_BUILD_WIN32 -#endif - +#endif // LMMS_MIDI_WINMM_H diff --git a/include/MixHelpers.h b/include/MixHelpers.h index 6599b40ec..6458c65fc 100644 --- a/include/MixHelpers.h +++ b/include/MixHelpers.h @@ -22,8 +22,8 @@ * */ -#ifndef MIX_HELPERS_H -#define MIX_HELPERS_H +#ifndef LMMS_MIX_HELPERS_H +#define LMMS_MIX_HELPERS_H #include "lmms_basics.h" @@ -81,5 +81,4 @@ void multiplyAndAddMultipliedJoined( sampleFrame* dst, const sample_t* srcLeft, } // namespace lmms -#endif - +#endif // LMMS_MIX_HELPERS_H diff --git a/include/Mixer.h b/include/Mixer.h index ecd864ae7..6589836c4 100644 --- a/include/Mixer.h +++ b/include/Mixer.h @@ -22,8 +22,8 @@ * */ -#ifndef MIXER_H -#define MIXER_H +#ifndef LMMS_MIXER_H +#define LMMS_MIXER_H #include "Model.h" #include "EffectChain.h" @@ -100,37 +100,37 @@ class MixerChannel : public ThreadableJob class MixerRoute : public QObject { Q_OBJECT - public: - MixerRoute( MixerChannel * from, MixerChannel * to, float amount ); - ~MixerRoute() override = default; - +public: + MixerRoute( MixerChannel * from, MixerChannel * to, float amount ); + ~MixerRoute() override = default; + mix_ch_t senderIndex() const { return m_from->m_channelIndex; } - + mix_ch_t receiverIndex() const { return m_to->m_channelIndex; } - + FloatModel * amount() { return &m_amount; } - + MixerChannel * sender() const { return m_from; } - + MixerChannel * receiver() const { return m_to; } - + void updateName(); - + private: MixerChannel * m_from; MixerChannel * m_to; @@ -202,6 +202,10 @@ public: // rename channels when moving etc. if they still have their original name void validateChannelName( int index, int oldIndex ); + // check if the index channel receives audio from any other channel + // or from any instrument or sample track + bool isChannelInUse(int index); + void toggledSolo(); void activateSolo(); void deactivateSolo(); @@ -226,4 +230,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_MIXER_H diff --git a/include/MixerLine.h b/include/MixerLine.h index decd5f3aa..68a61728c 100644 --- a/include/MixerLine.h +++ b/include/MixerLine.h @@ -23,8 +23,8 @@ * */ -#ifndef MIXERLINE_H -#define MIXERLINE_H +#ifndef LMMS_GUI_MIXER_LINE_H +#define LMMS_GUI_MIXER_LINE_H #include @@ -117,4 +117,4 @@ private slots: } // namespace lmms::gui -#endif // MIXERLINE_H +#endif // LMMS_GUI_MIXER_LINE_H diff --git a/include/MixerLineLcdSpinBox.h b/include/MixerLineLcdSpinBox.h index bfd6cd5c9..1ae2813f2 100644 --- a/include/MixerLineLcdSpinBox.h +++ b/include/MixerLineLcdSpinBox.h @@ -22,8 +22,8 @@ * */ -#ifndef MIXER_LINE_LCD_SPIN_BOX_H -#define MIXER_LINE_LCD_SPIN_BOX_H +#ifndef LMMS_GUI_MIXER_LINE_LCD_SPIN_BOX_H +#define LMMS_GUI_MIXER_LINE_LCD_SPIN_BOX_H #include "LcdSpinBox.h" @@ -56,4 +56,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_MIXER_LINE_LCD_SPIN_BOX_H diff --git a/include/MixerView.h b/include/MixerView.h index a7b1b5191..2bb5ed417 100644 --- a/include/MixerView.h +++ b/include/MixerView.h @@ -22,8 +22,8 @@ * */ -#ifndef MIXER_VIEW_H -#define MIXER_VIEW_H +#ifndef LMMS_GUI_MIXER_VIEW_H +#define LMMS_GUI_MIXER_VIEW_H #include #include @@ -95,6 +95,7 @@ public: // notify the view that a mixer channel was deleted void deleteChannel(int index); + bool confirmRemoval(int index); // delete all unused channels void deleteUnusedChannels(); @@ -132,11 +133,11 @@ private: QWidget * m_racksWidget; void updateMaxChannelSelector(); - + friend class MixerChannelView; } ; } // namespace lmms::gui -#endif +#endif // LMMS_GUI_MIXER_VIEW_H diff --git a/include/Model.h b/include/Model.h index 567d4ffd7..ce7b751e7 100644 --- a/include/Model.h +++ b/include/Model.h @@ -22,8 +22,8 @@ * */ -#ifndef MODEL_H -#define MODEL_H +#ifndef LMMS_MODEL_H +#define LMMS_MODEL_H #include #include @@ -37,35 +37,18 @@ class LMMS_EXPORT Model : public QObject { Q_OBJECT public: - Model( Model * _parent, QString _display_name = QString(), - bool _default_constructed = false ) : - QObject( _parent ), - m_displayName( _display_name ), - m_defaultConstructed( _default_constructed ) - { - } + Model(Model* parent, QString displayName = QString(), + bool defaultConstructed = false); ~Model() override = default; - bool isDefaultConstructed() - { - return m_defaultConstructed; - } + bool isDefaultConstructed() const; - Model* parentModel() const - { - return static_cast( parent() ); - } + Model* parentModel() const; - virtual QString displayName() const - { - return m_displayName; - } + virtual QString displayName() const; - virtual void setDisplayName( const QString& displayName ) - { - m_displayName = displayName; - } + virtual void setDisplayName(const QString& displayName); virtual QString fullDisplayName() const; @@ -90,5 +73,4 @@ signals: } // namespace lmms -#endif - +#endif // LMMS_MODEL_H diff --git a/include/ModelView.h b/include/ModelView.h index a858dc7ec..786a6812c 100644 --- a/include/ModelView.h +++ b/include/ModelView.h @@ -22,8 +22,8 @@ * */ -#ifndef MODEL_VIEW_H -#define MODEL_VIEW_H +#ifndef LMMS_GUI_MODEL_VIEW_H +#define LMMS_GUI_MODEL_VIEW_H #include #include "Model.h" @@ -85,5 +85,4 @@ private: } // namespace lmms::gui -#endif - +#endif // LMMS_GUI_MODEL_VIEW_H diff --git a/include/ModelVisitor.h b/include/ModelVisitor.h index 8805e30e2..a4654e529 100644 --- a/include/ModelVisitor.h +++ b/include/ModelVisitor.h @@ -22,8 +22,8 @@ * */ -#ifndef MODELVISITOR_H -#define MODELVISITOR_H +#ifndef LMMS_MODEL_VISITOR_H +#define LMMS_MODEL_VISITOR_H namespace lmms { @@ -68,4 +68,4 @@ public: } // namespace lmms -#endif // MODELVISITOR_H +#endif // LMMS_MODEL_VISITOR_H diff --git a/include/NStateButton.h b/include/NStateButton.h index 4dac1a436..a6b4c4d9a 100644 --- a/include/NStateButton.h +++ b/include/NStateButton.h @@ -22,9 +22,8 @@ * */ - -#ifndef NSTATE_BUTTON_H -#define NSTATE_BUTTON_H +#ifndef LMMS_GUI_NSTATE_BUTTON_H +#define LMMS_GUI_NSTATE_BUTTON_H #include #include @@ -78,4 +77,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_NSTATE_BUTTON_H diff --git a/include/Note.h b/include/Note.h index 464f3906f..15aeaa2ce 100644 --- a/include/Note.h +++ b/include/Note.h @@ -23,8 +23,8 @@ * */ -#ifndef NOTE_H -#define NOTE_H +#ifndef LMMS_NOTE_H +#define LMMS_NOTE_H #include #include @@ -265,4 +265,4 @@ std::optional boundsForNotes(const NoteVector& notes); } // namespace lmms -#endif +#endif // LMMS_NOTE_H diff --git a/include/NotePlayHandle.h b/include/NotePlayHandle.h index 4969fd84a..29477705b 100644 --- a/include/NotePlayHandle.h +++ b/include/NotePlayHandle.h @@ -23,8 +23,8 @@ * */ -#ifndef NOTE_PLAY_HANDLE_H -#define NOTE_PLAY_HANDLE_H +#ifndef LMMS_NOTE_PLAY_HANDLE_H +#define LMMS_NOTE_PLAY_HANDLE_H #include @@ -364,4 +364,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_NOTE_PLAY_HANDLE_H diff --git a/include/Oscillator.h b/include/Oscillator.h index e9f64008c..46d858032 100644 --- a/include/Oscillator.h +++ b/include/Oscillator.h @@ -23,8 +23,8 @@ * */ -#ifndef OSCILLATOR_H -#define OSCILLATOR_H +#ifndef LMMS_OSCILLATOR_H +#define LMMS_OSCILLATOR_H #include #include @@ -255,7 +255,7 @@ private: static fftwf_plan s_fftPlan; static fftwf_plan s_ifftPlan; static fftwf_complex * s_specBuf; - static float s_sampleBuffer[OscillatorConstants::WAVETABLE_LENGTH]; + static std::array s_sampleBuffer; static void generateSawWaveTable(int bands, sample_t* table, int firstBand = 1); static void generateTriangleWaveTable(int bands, sample_t* table, int firstBand = 1); @@ -313,4 +313,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_OSCILLATOR_H diff --git a/include/OscillatorConstants.h b/include/OscillatorConstants.h index 0450c2f17..85ae38fe8 100644 --- a/include/OscillatorConstants.h +++ b/include/OscillatorConstants.h @@ -1,5 +1,5 @@ /* - * OscillatorConstants.h - declaration of constants used in Oscillator and SampleBuffer + * OscillatorConstants.h - declaration of constants used in Oscillator and SampleBuffer * for band limited wave tables * * Copyright (c) 2018 Dave French @@ -23,8 +23,8 @@ * */ -#ifndef OSCILLATORCONSTANTS_H -#define OSCILLATORCONSTANTS_H +#ifndef LMMS_OSCILLATORCONSTANTS_H +#define LMMS_OSCILLATORCONSTANTS_H #include @@ -55,4 +55,4 @@ namespace lmms::OscillatorConstants } // namespace lmms::OscillatorConstants -#endif // OSCILLATORCONSTANTS_H +#endif // LMMS_OSCILLATORCONSTANTS_H diff --git a/include/Oscilloscope.h b/include/Oscilloscope.h index db4cf2b4a..209370ce0 100644 --- a/include/Oscilloscope.h +++ b/include/Oscilloscope.h @@ -22,9 +22,8 @@ * */ - -#ifndef OSCILLOSCOPE_H -#define OSCILLOSCOPE_H +#ifndef LMMS_GUI_OSCILLOSCOPE_H +#define LMMS_GUI_OSCILLOSCOPE_H #include #include @@ -79,4 +78,4 @@ private: } // namespace lmms::gui -#endif // OSCILLOSCOPE_H +#endif // LMMS_GUI_OSCILLOSCOPE_H diff --git a/include/OutputSettings.h b/include/OutputSettings.h index 03e3333ac..12242e1bb 100644 --- a/include/OutputSettings.h +++ b/include/OutputSettings.h @@ -23,12 +23,11 @@ * */ -#ifndef OUTPUT_SETTINGS_H -#define OUTPUT_SETTINGS_H +#ifndef LMMS_OUTPUT_SETTINGS_H +#define LMMS_OUTPUT_SETTINGS_H #include "lmms_basics.h" - namespace lmms { @@ -120,4 +119,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_OUTPUT_SETTINGS_H diff --git a/include/PathUtil.h b/include/PathUtil.h index 8b1ef1097..9b410d014 100644 --- a/include/PathUtil.h +++ b/include/PathUtil.h @@ -22,8 +22,8 @@ * */ -#ifndef PATHUTIL_H -#define PATHUTIL_H +#ifndef LMMS_PATHUTIL_H +#define LMMS_PATHUTIL_H #include "lmms_export.h" @@ -70,4 +70,4 @@ namespace lmms::PathUtil } // namespace lmms::PathUtil -#endif +#endif // LMMS_PATHUTIL_H diff --git a/include/PatternClip.h b/include/PatternClip.h index f1d0e2557..968a0b198 100644 --- a/include/PatternClip.h +++ b/include/PatternClip.h @@ -21,10 +21,9 @@ * Boston, MA 02110-1301 USA. * */ - -#ifndef PATTERN_CLIP_H -#define PATTERN_CLIP_H +#ifndef LMMS_PATTERN_CLIP_H +#define LMMS_PATTERN_CLIP_H #include "Clip.h" @@ -59,4 +58,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_PATTERN_CLIP_H diff --git a/include/PatternClipView.h b/include/PatternClipView.h index d170e4bef..ee313f32a 100644 --- a/include/PatternClipView.h +++ b/include/PatternClipView.h @@ -21,11 +21,9 @@ * Boston, MA 02110-1301 USA. * */ - - -#ifndef PATTERN_CLIP_VIEW_H -#define PATTERN_CLIP_VIEW_H +#ifndef LMMS_GUI_PATTERN_CLIP_VIEW_H +#define LMMS_GUI_PATTERN_CLIP_VIEW_H #include @@ -74,4 +72,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_PATTERN_CLIP_VIEW_H diff --git a/include/PatternEditor.h b/include/PatternEditor.h index ffe08e335..5787f27ec 100644 --- a/include/PatternEditor.h +++ b/include/PatternEditor.h @@ -22,10 +22,8 @@ * */ - -#ifndef PATTERN_EDITOR_H -#define PATTERN_EDITOR_H - +#ifndef LMMS_GUI_PATTERN_EDITOR_H +#define LMMS_GUI_PATTERN_EDITOR_H #include "Editor.h" #include "TrackContainerView.h" @@ -99,4 +97,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_PATTERN_EDITOR_H diff --git a/include/PatternStore.h b/include/PatternStore.h index 7bd377941..fcb55e411 100644 --- a/include/PatternStore.h +++ b/include/PatternStore.h @@ -22,9 +22,8 @@ * */ - -#ifndef PATTERN_STORE_H -#define PATTERN_STORE_H +#ifndef LMMS_PATTERN_STORE_H +#define LMMS_PATTERN_STORE_H #include "TrackContainer.h" #include "ComboBoxModel.h" @@ -114,4 +113,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_PATTERN_STORE_H diff --git a/include/PatternTrack.h b/include/PatternTrack.h index 73ddd4766..1c0c610d2 100644 --- a/include/PatternTrack.h +++ b/include/PatternTrack.h @@ -22,10 +22,8 @@ * */ - -#ifndef PATTERN_TRACK_H -#define PATTERN_TRACK_H - +#ifndef LMMS_PATTERN_TRACK_H +#define LMMS_PATTERN_TRACK_H #include @@ -104,4 +102,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_PATTERN_TRACK_H diff --git a/include/PatternTrackView.h b/include/PatternTrackView.h index b6d33e444..09a1ba37b 100644 --- a/include/PatternTrackView.h +++ b/include/PatternTrackView.h @@ -22,10 +22,8 @@ * */ - -#ifndef PATTERN_TRACK_VIEW_H -#define PATTERN_TRACK_VIEW_H - +#ifndef LMMS_GUI_PATTERN_TRACK_VIEW_H +#define LMMS_GUI_PATTERN_TRACK_VIEW_H #include "TrackView.h" @@ -70,4 +68,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_PATTERN_TRACK_VIEW_H diff --git a/include/PeakController.h b/include/PeakController.h index 58d666dd0..357e2a95d 100644 --- a/include/PeakController.h +++ b/include/PeakController.h @@ -22,8 +22,8 @@ * */ -#ifndef PEAK_CONTROLLER_H -#define PEAK_CONTROLLER_H +#ifndef LMMS_PEAK_CONTROLLER_H +#define LMMS_PEAK_CONTROLLER_H #include "Controller.h" #include "ControllerDialog.h" @@ -107,4 +107,4 @@ protected: } // namespace lmms -#endif +#endif // LMMS_PEAK_CONTROLLER_H diff --git a/include/PerfLog.h b/include/PerfLog.h index b8cc35f45..7b0b587f6 100644 --- a/include/PerfLog.h +++ b/include/PerfLog.h @@ -22,8 +22,8 @@ * */ -#ifndef PERFLOG_H -#define PERFLOG_H +#ifndef LMMS_PERFLOG_H +#define LMMS_PERFLOG_H #include #include @@ -77,4 +77,4 @@ class PerfLogTimer } // namespace lmms -#endif +#endif // LMMS_PERFLOG_H diff --git a/include/Piano.h b/include/Piano.h index 01a20046d..96f374840 100644 --- a/include/Piano.h +++ b/include/Piano.h @@ -22,8 +22,8 @@ * */ -#ifndef PIANO_H -#define PIANO_H +#ifndef LMMS_PIANO_H +#define LMMS_PIANO_H #include "Note.h" #include "Model.h" @@ -44,17 +44,17 @@ public: BlackKey } ; - Piano( InstrumentTrack* track ); + Piano(InstrumentTrack* track); - void setKeyState( int key, bool state ); + void setKeyState(int key, bool state); - bool isKeyPressed( int key ) const + bool isKeyPressed(int key) const { return m_pressedKeys[key]; } - void handleKeyPress( int key, int midiVelocity = -1 ); - void handleKeyRelease( int key ); + void handleKeyPress(int key, int midiVelocity = -1); + void handleKeyRelease(int key); InstrumentTrack* instrumentTrack() const { @@ -75,7 +75,7 @@ public: static const unsigned int NumBlackKeys = 53; private: - static bool isValidKey( int key ) + static bool isValidKey(int key) { return key >= 0 && key < NumKeys; } @@ -89,5 +89,4 @@ private: } // namespace lmms -#endif - +#endif // LMMS_PIANO_H diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 60cf01e1d..6100792d5 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -24,8 +24,8 @@ * */ -#ifndef PIANO_ROLL_H -#define PIANO_ROLL_H +#ifndef LMMS_GUI_PIANO_ROLL_H +#define LMMS_GUI_PIANO_ROLL_H #include #include @@ -60,7 +60,7 @@ namespace gui class ComboBox; class PositionLine; -class TextFloat; +class SimpleTextFloat; class TimeLineWidget; @@ -149,6 +149,8 @@ public: { return m_midiClip != nullptr; } + + int trackOctaveSize() const; Song::PlayModes desiredPlayModeForAccompany() const; @@ -343,9 +345,9 @@ private: static QPixmap * s_toolOpen; static QPixmap* s_toolKnife; - static PianoRollKeyTypes prKeyOrder[]; + static std::array prKeyOrder; - static TextFloat * s_textFloat; + static SimpleTextFloat * s_textFloat; ComboBoxModel m_zoomingModel; ComboBoxModel m_zoomingYModel; @@ -573,4 +575,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_PIANO_ROLL_H diff --git a/include/PianoView.h b/include/PianoView.h index 7f586809d..6421ff438 100644 --- a/include/PianoView.h +++ b/include/PianoView.h @@ -22,8 +22,8 @@ * */ -#ifndef PIANO_VIEW_H -#define PIANO_VIEW_H +#ifndef LMMS_GUI_PIANO_VIEW_H +#define LMMS_GUI_PIANO_VIEW_H #include #include @@ -103,4 +103,4 @@ signals: } // namespace lmms -#endif +#endif // LMMS_GUI_PIANO_VIEW_H diff --git a/include/Pitch.h b/include/Pitch.h index 6213ef374..1f721b5f1 100644 --- a/include/Pitch.h +++ b/include/Pitch.h @@ -22,8 +22,8 @@ * */ -#ifndef PITCH_H -#define PITCH_H +#ifndef LMMS_PITCH_H +#define LMMS_PITCH_H #include @@ -40,4 +40,4 @@ constexpr pitch_t DefaultPitch = 0; } // namespace lmms -#endif +#endif // LMMS_PITCH_H diff --git a/include/PixmapButton.h b/include/PixmapButton.h index 6c37f9112..e8f546dc0 100644 --- a/include/PixmapButton.h +++ b/include/PixmapButton.h @@ -22,9 +22,8 @@ * */ - -#ifndef PIXMAP_BUTTON_H -#define PIXMAP_BUTTON_H +#ifndef LMMS_GUI_PIXMAP_BUTTON_H +#define LMMS_GUI_PIXMAP_BUTTON_H #include @@ -68,4 +67,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_PIXMAP_BUTTON_H diff --git a/include/PlayHandle.h b/include/PlayHandle.h index 542d45871..c64931ac0 100644 --- a/include/PlayHandle.h +++ b/include/PlayHandle.h @@ -22,8 +22,8 @@ * */ -#ifndef PLAY_HANDLE_H -#define PLAY_HANDLE_H +#ifndef LMMS_PLAY_HANDLE_H +#define LMMS_PLAY_HANDLE_H #include #include @@ -166,4 +166,4 @@ using ConstPlayHandleList = QList; } // namespace lmms -#endif +#endif // LMMS_PLAY_HANDLE_H diff --git a/include/Plugin.h b/include/Plugin.h index 6a4d95bb4..b1982f98c 100644 --- a/include/Plugin.h +++ b/include/Plugin.h @@ -22,8 +22,8 @@ * */ -#ifndef PLUGIN_H -#define PLUGIN_H +#ifndef LMMS_PLUGIN_H +#define LMMS_PLUGIN_H #include #include @@ -312,4 +312,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_PLUGIN_H diff --git a/include/PluginBrowser.h b/include/PluginBrowser.h index 1f2041cf4..2bb1b6d5c 100644 --- a/include/PluginBrowser.h +++ b/include/PluginBrowser.h @@ -22,8 +22,8 @@ * */ -#ifndef PLUGIN_BROWSER_H -#define PLUGIN_BROWSER_H +#ifndef LMMS_GUI_PLUGIN_BROWSER_H +#define LMMS_GUI_PLUGIN_BROWSER_H #include @@ -56,8 +56,6 @@ private: }; - - class PluginDescWidget : public QWidget { Q_OBJECT @@ -65,13 +63,14 @@ public: using PluginKey = Plugin::Descriptor::SubPluginFeatures::Key; PluginDescWidget( const PluginKey & _pk, QWidget * _parent ); QString name() const; - + void openInNewInstrumentTrack(QString value); protected: void enterEvent( QEvent * _e ) override; void leaveEvent( QEvent * _e ) override; void mousePressEvent( QMouseEvent * _me ) override; void paintEvent( QPaintEvent * _pe ) override; + void contextMenuEvent(QContextMenuEvent* e) override; private: constexpr static int DEFAULT_HEIGHT{24}; @@ -85,4 +84,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_PLUGIN_BROWSER_H diff --git a/include/PluginFactory.h b/include/PluginFactory.h index 8b8b88b6e..001ea190a 100644 --- a/include/PluginFactory.h +++ b/include/PluginFactory.h @@ -22,13 +22,14 @@ * */ -#ifndef PLUGINFACTORY_H -#define PLUGINFACTORY_H +#ifndef LMMS_PLUGIN_FACTORY_H +#define LMMS_PLUGIN_FACTORY_H #include #include #include +#include #include #include #include @@ -46,7 +47,7 @@ class LMMS_EXPORT PluginFactory public: struct PluginInfo { - const QString name() const; + QString name() const; QFileInfo file; std::shared_ptr library = nullptr; Plugin::Descriptor* descriptor = nullptr; @@ -66,8 +67,8 @@ public: static PluginFactory* instance(); /// Returns a list of all found plugins' descriptors. - const Plugin::DescriptorList descriptors() const; - const Plugin::DescriptorList descriptors(Plugin::PluginTypes type) const; + Plugin::DescriptorList descriptors() const; + Plugin::DescriptorList descriptors(Plugin::PluginTypes type) const; struct PluginInfoAndKey { @@ -79,12 +80,12 @@ public: /// Returns a list of all found plugins' PluginFactory::PluginInfo objects. const PluginInfoList& pluginInfos() const; /// Returns a plugin that support the given file extension - const PluginInfoAndKey pluginSupportingExtension(const QString& ext); + PluginInfoAndKey pluginSupportingExtension(const QString& ext); /// Returns the PluginInfo object of the plugin with the given name. /// If the plugin is not found, an empty PluginInfo is returned (use /// PluginInfo::isNull() to check this). - const PluginInfo pluginInfo(const char* name) const; + PluginInfo pluginInfo(const char* name) const; /// When loading a library fails during discovery, the error string is saved. /// It can be retrieved by calling this function. @@ -111,4 +112,4 @@ LMMS_EXPORT PluginFactory* getPluginFactory(); } // namespace lmms -#endif // PLUGINFACTORY_H +#endif // LMMS_PLUGIN_FACTORY_H diff --git a/include/PluginIssue.h b/include/PluginIssue.h index f0fa275f3..87e895113 100644 --- a/include/PluginIssue.h +++ b/include/PluginIssue.h @@ -22,13 +22,12 @@ * */ -#ifndef PLUGINISSUE_H -#define PLUGINISSUE_H +#ifndef LMMS_PLUGIN_ISSUE_H +#define LMMS_PLUGIN_ISSUE_H #include #include - namespace lmms { @@ -85,5 +84,4 @@ QDebug operator<<(QDebug stream, const PluginIssue& iss); } // namespace lmms - -#endif // PLUGINISSUE_H +#endif // LMMS_PLUGIN_ISSUE_H diff --git a/include/PluginView.h b/include/PluginView.h index 2c06b9ba2..3c78cb00a 100644 --- a/include/PluginView.h +++ b/include/PluginView.h @@ -22,8 +22,8 @@ * */ -#ifndef PLUGIN_VIEW_H -#define PLUGIN_VIEW_H +#ifndef LMMS_GUI_PLUGIN_VIEW_H +#define LMMS_GUI_PLUGIN_VIEW_H #include @@ -47,4 +47,4 @@ public: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_PLUGIN_VIEW_H diff --git a/include/PositionLine.h b/include/PositionLine.h index cc1313e57..3e798948f 100644 --- a/include/PositionLine.h +++ b/include/PositionLine.h @@ -23,8 +23,8 @@ * */ -#ifndef POSITION_LINE_H -#define POSITION_LINE_H +#ifndef LMMS_GUI_POSITION_LINE_H +#define LMMS_GUI_POSITION_LINE_H #include @@ -51,4 +51,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_POSITION_LINE_H diff --git a/include/PresetPreviewPlayHandle.h b/include/PresetPreviewPlayHandle.h index dfff0fc21..b8199a71b 100644 --- a/include/PresetPreviewPlayHandle.h +++ b/include/PresetPreviewPlayHandle.h @@ -23,8 +23,8 @@ * */ -#ifndef PRESET_PREVIEW_PLAY_HANDLE_H -#define PRESET_PREVIEW_PLAY_HANDLE_H +#ifndef LMMS_PRESET_PREVIEW_PLAY_HANDLE_H +#define LMMS_PRESET_PREVIEW_PLAY_HANDLE_H #include "NotePlayHandle.h" @@ -69,4 +69,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_PRESET_PREVIEW_PLAY_HANDLE_H diff --git a/include/ProjectJournal.h b/include/ProjectJournal.h index 31a61755d..a4a263078 100644 --- a/include/ProjectJournal.h +++ b/include/ProjectJournal.h @@ -22,8 +22,8 @@ * */ -#ifndef PROJECT_JOURNAL_H -#define PROJECT_JOURNAL_H +#ifndef LMMS_PROJECT_JOURNAL_H +#define LMMS_PROJECT_JOURNAL_H #include #include @@ -126,5 +126,4 @@ private: } // namespace lmms -#endif - +#endif // LMMS_PROJECT_JOURNAL_H diff --git a/include/ProjectNotes.h b/include/ProjectNotes.h index 4b9476616..861dcb4a8 100644 --- a/include/ProjectNotes.h +++ b/include/ProjectNotes.h @@ -22,9 +22,8 @@ * */ - -#ifndef PROJECT_NOTES_H -#define PROJECT_NOTES_H +#ifndef LMMS_GUI_PROJECT_NOTES_H +#define LMMS_GUI_PROJECT_NOTES_H #include @@ -94,4 +93,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_PROJECT_NOTES_H diff --git a/include/ProjectRenderer.h b/include/ProjectRenderer.h index 75537ed69..95a1f53ed 100644 --- a/include/ProjectRenderer.h +++ b/include/ProjectRenderer.h @@ -22,8 +22,8 @@ * */ -#ifndef PROJECT_RENDERER_H -#define PROJECT_RENDERER_H +#ifndef LMMS_PROJECT_RENDERER_H +#define LMMS_PROJECT_RENDERER_H #include "AudioFileDevice.h" #include "lmmsconfig.h" @@ -76,7 +76,7 @@ public: static QString getFileExtensionFromFormat( ExportFileFormats fmt ); - static const FileEncodeDevice fileEncodeDevices[]; + static const std::array fileEncodeDevices; public slots: void startProcessing(); @@ -103,4 +103,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_PROJECT_RENDERER_H diff --git a/include/ProjectVersion.h b/include/ProjectVersion.h index 5be259c97..d9a459a43 100644 --- a/include/ProjectVersion.h +++ b/include/ProjectVersion.h @@ -23,9 +23,8 @@ * */ - -#ifndef PROJECT_VERSION_H -#define PROJECT_VERSION_H +#ifndef LMMS_PROJECT_VERSION_H +#define LMMS_PROJECT_VERSION_H #include #include @@ -82,4 +81,4 @@ inline bool operator!=(const ProjectVersion & v1, const ProjectVersion & v2) { r } // namespace lmms -#endif +#endif // LMMS_PROJECT_VERSION_H diff --git a/include/QuadratureLfo.h b/include/QuadratureLfo.h index 42d4d32c0..6f007e072 100644 --- a/include/QuadratureLfo.h +++ b/include/QuadratureLfo.h @@ -22,8 +22,8 @@ * */ -#ifndef QUADRATURELFO_H -#define QUADRATURELFO_H +#ifndef LMMS_QUADRATURE_LFO_H +#define LMMS_QUADRATURE_LFO_H #include "lmms_math.h" @@ -100,4 +100,4 @@ private: } // namespace lmms -#endif // QUADRATURELFO_H +#endif // LMMS_QUADRATURE_LFO_H diff --git a/include/RaiiHelpers.h b/include/RaiiHelpers.h index 0cfa2c4ac..3108dc080 100644 --- a/include/RaiiHelpers.h +++ b/include/RaiiHelpers.h @@ -19,10 +19,11 @@ * 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 RAII_HELPERS_H -#define RAII_HELPERS_H +#ifndef LMMS_RAII_HELPERS_H +#define LMMS_RAII_HELPERS_H #include #include @@ -63,4 +64,4 @@ using UniqueNullableResource = std::unique_ptr @@ -45,4 +45,4 @@ private slots: } // namespace lmms::gui -#endif // RECENTPROJECTSMENU_H +#endif // LMMS_GUI_RECENT_PROJECTS_MENU_H diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index 96c910d5d..c5fcd7dd2 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -22,8 +22,8 @@ * */ -#ifndef REMOTE_PLUGIN_H -#define REMOTE_PLUGIN_H +#ifndef LMMS_REMOTE_PLUGIN_H +#define LMMS_REMOTE_PLUGIN_H #include "RemotePluginBase.h" #include "SharedMemory.h" @@ -197,4 +197,4 @@ LMMS_EXPORT inline std::string QSTR_TO_STDSTR(QString const& qstr) } // namespace lmms -#endif // REMOTE_PLUGIN_H +#endif // LMMS_REMOTE_PLUGIN_H diff --git a/include/RemotePluginBase.h b/include/RemotePluginBase.h index e309496bc..357be1bea 100644 --- a/include/RemotePluginBase.h +++ b/include/RemotePluginBase.h @@ -22,8 +22,8 @@ * */ -#ifndef REMOTE_PLUGIN_BASE_H -#define REMOTE_PLUGIN_BASE_H +#ifndef LMMS_REMOTE_PLUGIN_BASE_H +#define LMMS_REMOTE_PLUGIN_BASE_H #include "MidiEvent.h" @@ -673,4 +673,4 @@ private: } // namespace lmms -#endif // REMOTE_PLUGIN_BASE_H +#endif // LMMS_REMOTE_PLUGIN_BASE_H diff --git a/include/RemotePluginClient.h b/include/RemotePluginClient.h index 4c5fcc060..77eef68f0 100644 --- a/include/RemotePluginClient.h +++ b/include/RemotePluginClient.h @@ -22,8 +22,8 @@ * */ -#ifndef REMOTE_PLUGIN_CLIENT_H -#define REMOTE_PLUGIN_CLIENT_H +#ifndef LMMS_REMOTE_PLUGIN_CLIENT_H +#define LMMS_REMOTE_PLUGIN_CLIENT_H #include "RemotePluginBase.h" @@ -355,4 +355,4 @@ void RemotePluginClient::doProcessing() } // namespace lmms -#endif // REMOTE_PLUGIN_CLIENT_H +#endif // LMMS_REMOTE_PLUGIN_CLIENT_H diff --git a/include/RenameDialog.h b/include/RenameDialog.h index b543963d7..1129f2bb5 100644 --- a/include/RenameDialog.h +++ b/include/RenameDialog.h @@ -23,13 +23,11 @@ * */ - -#ifndef RENAME_DIALOG_H -#define RENAME_DIALOG_H +#ifndef LMMS_GUI_RENAME_DIALOG_H +#define LMMS_GUI_RENAME_DIALOG_H #include - class QLineEdit; namespace lmms::gui @@ -62,4 +60,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_RENAME_DIALOG_H diff --git a/include/RenderManager.h b/include/RenderManager.h index 9ec4c511e..5240e96a8 100644 --- a/include/RenderManager.h +++ b/include/RenderManager.h @@ -23,8 +23,8 @@ * */ -#ifndef RENDER_MANAGER_H -#define RENDER_MANAGER_H +#ifndef LMMS_RENDER_MANAGER_H +#define LMMS_RENDER_MANAGER_H #include @@ -85,4 +85,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_RENDER_MANAGER_H diff --git a/include/RingBuffer.h b/include/RingBuffer.h index c7db6b4e5..90a607a13 100644 --- a/include/RingBuffer.h +++ b/include/RingBuffer.h @@ -23,9 +23,8 @@ * */ - -#ifndef RINGBUFFER_H -#define RINGBUFFER_H +#ifndef LMMS_RING_BUFFER_H +#define LMMS_RING_BUFFER_H #include #include @@ -225,4 +224,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_RING_BUFFER_H diff --git a/include/RmsHelper.h b/include/RmsHelper.h index 19b7da89c..fd2c0f9bb 100644 --- a/include/RmsHelper.h +++ b/include/RmsHelper.h @@ -23,8 +23,8 @@ * */ -#ifndef RMS_HELPER_H -#define RMS_HELPER_H +#ifndef LMMS_RMS_HELPER_H +#define LMMS_RMS_HELPER_H #include "lmms_math.h" @@ -98,4 +98,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_RMS_HELPER_H diff --git a/include/RowTableView.h b/include/RowTableView.h index 9934dbade..3e1c1988d 100644 --- a/include/RowTableView.h +++ b/include/RowTableView.h @@ -22,8 +22,8 @@ * */ -#ifndef ROW_TABLE_VIEW_H -#define ROW_TABLE_VIEW_H +#ifndef LMMS_GUI_ROW_TABLE_VIEW_H +#define LMMS_GUI_ROW_TABLE_VIEW_H #include @@ -56,4 +56,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_ROW_TABLE_VIEW_H diff --git a/include/Rubberband.h b/include/Rubberband.h index d35233b4f..cfe36bb70 100644 --- a/include/Rubberband.h +++ b/include/Rubberband.h @@ -23,9 +23,8 @@ * */ - -#ifndef RUBBERBAND_H -#define RUBBERBAND_H +#ifndef LMMS_GUI_RUBBERBAND_H +#define LMMS_GUI_RUBBERBAND_H #include #include @@ -94,5 +93,4 @@ private: } // namespace lmms::gui -#endif - +#endif // LMMS_GUI_RUBBERBAND_H diff --git a/include/SampleBuffer.h b/include/SampleBuffer.h index f4d67859e..e2ed24b81 100644 --- a/include/SampleBuffer.h +++ b/include/SampleBuffer.h @@ -22,9 +22,8 @@ * */ - -#ifndef SAMPLE_BUFFER_H -#define SAMPLE_BUFFER_H +#ifndef LMMS_SAMPLE_BUFFER_H +#define LMMS_SAMPLE_BUFFER_H #include #include @@ -356,4 +355,4 @@ signals: } // namespace lmms -#endif +#endif // LMMS_SAMPLE_BUFFER_H diff --git a/include/SampleClip.h b/include/SampleClip.h index 51225ded8..c9e247328 100644 --- a/include/SampleClip.h +++ b/include/SampleClip.h @@ -21,9 +21,9 @@ * Boston, MA 02110-1301 USA. * */ - -#ifndef SAMPLE_CLIP_H -#define SAMPLE_CLIP_H + +#ifndef LMMS_SAMPLE_CLIP_H +#define LMMS_SAMPLE_CLIP_H #include "Clip.h" @@ -100,4 +100,4 @@ signals: } // namespace lmms -#endif +#endif // LMMS_SAMPLE_CLIP_H diff --git a/include/SampleClipView.h b/include/SampleClipView.h index 74873dca7..b3f53d790 100644 --- a/include/SampleClipView.h +++ b/include/SampleClipView.h @@ -22,13 +22,11 @@ * */ -#ifndef SAMPLE_CLIP_VIEW_H -#define SAMPLE_CLIP_VIEW_H +#ifndef LMMS_GUI_SAMPLE_CLIP_VIEW_H +#define LMMS_GUI_SAMPLE_CLIP_VIEW_H #include "ClipView.h" - - namespace lmms { @@ -73,4 +71,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_SAMPLE_CLIP_VIEW_H diff --git a/include/SamplePlayHandle.h b/include/SamplePlayHandle.h index 69ee3b38d..d016fcf0b 100644 --- a/include/SamplePlayHandle.h +++ b/include/SamplePlayHandle.h @@ -23,8 +23,8 @@ * */ -#ifndef SAMPLE_PLAY_HANDLE_H -#define SAMPLE_PLAY_HANDLE_H +#ifndef LMMS_SAMPLE_PLAY_HANDLE_H +#define LMMS_SAMPLE_PLAY_HANDLE_H #include "SampleBuffer.h" #include "AutomatableModel.h" @@ -100,4 +100,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_SAMPLE_PLAY_HANDLE_H diff --git a/include/SampleRecordHandle.h b/include/SampleRecordHandle.h index 5b23f5345..de1ca19ba 100644 --- a/include/SampleRecordHandle.h +++ b/include/SampleRecordHandle.h @@ -22,9 +22,8 @@ * */ - -#ifndef SAMPLE_RECORD_HANDLE_H -#define SAMPLE_RECORD_HANDLE_H +#ifndef LMMS_SAMPLE_RECORD_HANDLE_H +#define LMMS_SAMPLE_RECORD_HANDLE_H #include #include @@ -75,4 +74,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_SAMPLE_RECORD_HANDLE_H diff --git a/include/SampleTrack.h b/include/SampleTrack.h index 8f424178a..f71f01cd1 100644 --- a/include/SampleTrack.h +++ b/include/SampleTrack.h @@ -22,9 +22,8 @@ * */ -#ifndef SAMPLE_TRACK_H -#define SAMPLE_TRACK_H - +#ifndef LMMS_SAMPLE_TRACK_H +#define LMMS_SAMPLE_TRACK_H #include "AudioPort.h" #include "Track.h" @@ -110,4 +109,4 @@ private: } // namespace lmms -#endif \ No newline at end of file +#endif // LMMS_SAMPLE_TRACK_H diff --git a/include/SampleTrackView.h b/include/SampleTrackView.h index 9921aa735..b586df15e 100644 --- a/include/SampleTrackView.h +++ b/include/SampleTrackView.h @@ -22,8 +22,8 @@ * */ -#ifndef SAMPLE_TRACK_VIEW_H -#define SAMPLE_TRACK_VIEW_H +#ifndef LMMS_GUI_SAMPLE_TRACK_VIEW_H +#define LMMS_GUI_SAMPLE_TRACK_VIEW_H #include "TrackView.h" @@ -109,4 +109,4 @@ private: } // namespace lmms -#endif \ No newline at end of file +#endif // LMMS_GUI_SAMPLE_TRACK_VIEW_H diff --git a/include/SampleTrackWindow.h b/include/SampleTrackWindow.h index d302b2c44..c2a722d53 100644 --- a/include/SampleTrackWindow.h +++ b/include/SampleTrackWindow.h @@ -21,12 +21,9 @@ * Boston, MA 02110-1301 USA. * */ - - -#ifndef SAMPLE_TRACK_WINDOW_H -#define SAMPLE_TRACK_WINDOW_H - +#ifndef LMMS_GUI_SAMPLE_TRACK_WINDOW_H +#define LMMS_GUI_SAMPLE_TRACK_WINDOW_H #include @@ -43,7 +40,7 @@ class EffectRackView; class Knob; class MixerLineLcdSpinBox; class SampleTrackView; - + class SampleTrackWindow : public QWidget, public ModelView, public SerializingObjectHook { @@ -102,5 +99,4 @@ private: } // namespace lmms::gui - -#endif +#endif // LMMS_GUI_SAMPLE_TRACK_WINDOW_H diff --git a/include/Scale.h b/include/Scale.h index 3a92dd689..eeae5eb92 100644 --- a/include/Scale.h +++ b/include/Scale.h @@ -22,8 +22,8 @@ * */ -#ifndef SCALE_H -#define SCALE_H +#ifndef LMMS_SCALE_H +#define LMMS_SCALE_H #include #include @@ -47,7 +47,7 @@ public: QString getString() const { if (m_denominator) {return QString::number(m_numerator) + "/" + QString::number(m_denominator);} - else {return QString().sprintf("%.4f", m_cents);} + else {return QString("%1").arg(m_cents, 0, 'f', 4);} } void saveSettings(QDomDocument &doc, QDomElement &element) override; @@ -89,4 +89,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_SCALE_H diff --git a/include/SendButtonIndicator.h b/include/SendButtonIndicator.h index ec4a90db3..f1ee2dbca 100644 --- a/include/SendButtonIndicator.h +++ b/include/SendButtonIndicator.h @@ -21,8 +21,9 @@ * Boston, MA 02110-1301 USA. * */ -#ifndef SENDBUTTONINDICATOR_H -#define SENDBUTTONINDICATOR_H + +#ifndef LMMS_GUI_SEND_BUTTON_INDICATOR_H +#define LMMS_GUI_SEND_BUTTON_INDICATOR_H #include @@ -63,4 +64,4 @@ private: } // namespace lmms -#endif // SENDBUTTONINDICATOR_H +#endif // LMMS_GUI_SEND_BUTTON_INDICATOR_H diff --git a/include/SerializingObject.h b/include/SerializingObject.h index e32d5d046..8f75d069e 100644 --- a/include/SerializingObject.h +++ b/include/SerializingObject.h @@ -22,8 +22,8 @@ * */ -#ifndef SERIALIZING_OBJECT_H -#define SERIALIZING_OBJECT_H +#ifndef LMMS_SERIALIZING_OBJECT_H +#define LMMS_SERIALIZING_OBJECT_H #include @@ -101,5 +101,4 @@ private: } // namespace lmms -#endif - +#endif // LMMS_SERIALIZING_OBJECT_H diff --git a/include/SetupDialog.h b/include/SetupDialog.h index 8973938bf..27a4ce4f9 100644 --- a/include/SetupDialog.h +++ b/include/SetupDialog.h @@ -22,9 +22,8 @@ * */ - -#ifndef SETUP_DIALOG_H -#define SETUP_DIALOG_H +#ifndef LMMS_GUI_SETUP_DIALOG_H +#define LMMS_GUI_SETUP_DIALOG_H #include #include @@ -83,6 +82,7 @@ private slots: void toggleLetPreviewsFinish(bool enabled); void toggleSoloLegacyBehavior(bool enabled); void toggleTrackDeletionWarning(bool enabled); + void toggleMixerChannelDeletionWarning(bool enabled); void toggleMMPZ(bool enabled); void toggleDisableBackup(bool enabled); void toggleOpenLastProject(bool enabled); @@ -142,6 +142,7 @@ private: bool m_letPreviewsFinish; bool m_soloLegacyBehavior; bool m_trackDeletionWarning; + bool m_mixerChannelDeletionWarning; bool m_MMPZ; bool m_disableBackup; bool m_openLastProject; @@ -214,4 +215,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_SETUP_DIALOG_H diff --git a/include/SharedMemory.h b/include/SharedMemory.h index 32a40ff25..c2790c78b 100644 --- a/include/SharedMemory.h +++ b/include/SharedMemory.h @@ -19,10 +19,11 @@ * 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 SHARED_MEMORY_H -#define SHARED_MEMORY_H +#ifndef LMMS_SHARED_MEMORY_H +#define LMMS_SHARED_MEMORY_H #include #include @@ -148,4 +149,4 @@ private: } // namespace lmms -#endif // SHARED_MEMORY_H +#endif // LMMS_SHARED_MEMORY_H diff --git a/include/SideBar.h b/include/SideBar.h index 8755c660a..0dab7abd7 100644 --- a/include/SideBar.h +++ b/include/SideBar.h @@ -22,8 +22,8 @@ * */ -#ifndef SIDE_BAR_H -#define SIDE_BAR_H +#ifndef LMMS_GUI_SIDE_BAR_H +#define LMMS_GUI_SIDE_BAR_H #include #include @@ -60,4 +60,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_SIDE_BAR_H diff --git a/include/SideBarWidget.h b/include/SideBarWidget.h index 5df3ccb7a..caf955327 100644 --- a/include/SideBarWidget.h +++ b/include/SideBarWidget.h @@ -22,8 +22,8 @@ * */ -#ifndef SIDE_BAR_WIDGET_H -#define SIDE_BAR_WIDGET_H +#ifndef LMMS_GUI_SIDE_BAR_WIDGET_H +#define LMMS_GUI_SIDE_BAR_WIDGET_H #include #include @@ -90,4 +90,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_SIDE_BAR_WIDGET_H diff --git a/include/SimpleTextFloat.h b/include/SimpleTextFloat.h new file mode 100644 index 000000000..f720d0b3e --- /dev/null +++ b/include/SimpleTextFloat.h @@ -0,0 +1,61 @@ +/* + * TextFloat.h - class textFloat, a floating text-label + * + * Copyright (c) 2023 LMMS team +* +* 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 SIMPLE_TEXT_FLOAT_H +#define SIMPLE_TEXT_FLOAT_H + +#include + +#include "lmms_export.h" + +class QLabel; + +namespace lmms::gui +{ + +class LMMS_EXPORT SimpleTextFloat : public QWidget +{ + Q_OBJECT +public: + SimpleTextFloat(); + ~SimpleTextFloat() override = default; + + void setText(const QString & text); + + void setVisibilityTimeOut(int msecs); + + void moveGlobal(QWidget * w, const QPoint & offset) + { + move(w->mapToGlobal(QPoint(0, 0)) + offset); + } + +private: + QLabel * m_textLabel; +}; + + +} // namespace lmms::gui + +#endif diff --git a/include/Song.h b/include/Song.h index 569b3ad14..c13fe0e96 100644 --- a/include/Song.h +++ b/include/Song.h @@ -22,8 +22,8 @@ * */ -#ifndef SONG_H -#define SONG_H +#ifndef LMMS_SONG_H +#define LMMS_SONG_H #include @@ -283,7 +283,6 @@ public: bpm_t getTempo(); - AutomationClip * tempoAutomationClip() override; AutomationTrack * globalAutomationTrack() { @@ -352,6 +351,11 @@ public: return m_timeSigModel; } + IntModel& tempoModel() + { + return m_tempoModel; + } + void exportProjectMidi(QString const & exportFileName) const; inline void setLoadOnLaunch(bool value) { m_loadOnLaunch = value; } @@ -528,4 +532,4 @@ signals: } // namespace lmms -#endif +#endif // LMMS_SONG_H diff --git a/include/SongEditor.h b/include/SongEditor.h index ea57cc125..081b2cb61 100644 --- a/include/SongEditor.h +++ b/include/SongEditor.h @@ -23,10 +23,8 @@ * */ - -#ifndef SONG_EDITOR_H -#define SONG_EDITOR_H - +#ifndef LMMS_GUI_SONG_EDITOR_H +#define LMMS_GUI_SONG_EDITOR_H #include "Editor.h" #include "TrackContainerView.h" @@ -228,4 +226,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_SONG_EDITOR_H diff --git a/include/StepRecorder.h b/include/StepRecorder.h index b89fadb15..456e69a69 100644 --- a/include/StepRecorder.h +++ b/include/StepRecorder.h @@ -18,8 +18,8 @@ * */ -#ifndef STEP_RECORDER_H -#define STEP_RECORDER_H +#ifndef LMMS_STEP_RECORDER_H +#define LMMS_STEP_RECORDER_H #include #include @@ -152,4 +152,4 @@ class StepRecorder : public QObject } // namespace lmms -#endif //STEP_RECORDER_H +#endif // LMMS_STEP_RECORDER_H diff --git a/include/StepRecorderWidget.h b/include/StepRecorderWidget.h index 4067b0001..48f1e0fb0 100644 --- a/include/StepRecorderWidget.h +++ b/include/StepRecorderWidget.h @@ -19,9 +19,9 @@ * Boston, MA 02110-1301 USA. * */ -#ifndef STEP_RECOREDER_WIDGET_H -#define STEP_RECOREDER_WIDGET_H +#ifndef LMMS_GUI_STEP_RECOREDER_WIDGET_H +#define LMMS_GUI_STEP_RECOREDER_WIDGET_H #include #include @@ -95,4 +95,4 @@ signals: } // namespace lmms::gui -#endif //STEP_RECOREDER_WIDGET_H +#endif // LMMS_GUI_STEP_RECOREDER_WIDGET_H diff --git a/include/StringPairDrag.h b/include/StringPairDrag.h index e58b88f90..c43996d76 100644 --- a/include/StringPairDrag.h +++ b/include/StringPairDrag.h @@ -23,8 +23,8 @@ * */ -#ifndef STRING_PAIR_DRAG_H -#define STRING_PAIR_DRAG_H +#ifndef LMMS_GUI_STRING_PAIR_DRAG_H +#define LMMS_GUI_STRING_PAIR_DRAG_H #include #include @@ -55,4 +55,4 @@ public: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_STRING_PAIR_DRAG_H diff --git a/include/SubWindow.h b/include/SubWindow.h index 3c73a9dde..fdda6de42 100644 --- a/include/SubWindow.h +++ b/include/SubWindow.h @@ -23,8 +23,9 @@ * Boston, MA 02110-1301 USA. * */ -#ifndef SUBWINDOW_H -#define SUBWINDOW_H + +#ifndef LMMS_GUI_SUBWINDOW_H +#define LMMS_GUI_SUBWINDOW_H #include #include @@ -104,4 +105,4 @@ private slots: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_SUBWINDOW_H diff --git a/include/SweepOscillator.h b/include/SweepOscillator.h index f113ea0fa..b5521da3b 100644 --- a/include/SweepOscillator.h +++ b/include/SweepOscillator.h @@ -22,8 +22,8 @@ * */ -#ifndef SWEEP_OSCILLATOR_H -#define SWEEP_OSCILLATOR_H +#ifndef LMMS_SWEEP_OSCILLATOR_H +#define LMMS_SWEEP_OSCILLATOR_H #include "Oscillator.h" #include "DspEffectLibrary.h" @@ -69,4 +69,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_SWEEP_OSCILLATOR_H diff --git a/include/TabBar.h b/include/TabBar.h index 2395e15f5..fa2703287 100644 --- a/include/TabBar.h +++ b/include/TabBar.h @@ -22,9 +22,8 @@ * */ - -#ifndef TAB_BAR_H -#define TAB_BAR_H +#ifndef LMMS_GUI_TAB_BAR_H +#define LMMS_GUI_TAB_BAR_H #include #include @@ -91,4 +90,4 @@ signals: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_TAB_BAR_H diff --git a/include/TabButton.h b/include/TabButton.h index 938230a91..c12a2037f 100644 --- a/include/TabButton.h +++ b/include/TabButton.h @@ -22,9 +22,8 @@ * */ - -#ifndef TAB_BUTTON_H -#define TAB_BUTTON_H +#ifndef LMMS_GUI_TAB_BUTTON_H +#define LMMS_GUI_TAB_BUTTON_H #include @@ -67,4 +66,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_TAB_BUTTON_H diff --git a/include/TabWidget.h b/include/TabWidget.h index 27a35d2a8..d28537df8 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -22,9 +22,8 @@ * */ - -#ifndef TAB_WIDGET_H -#define TAB_WIDGET_H +#ifndef LMMS_GUI_TAB_WIDGET_H +#define LMMS_GUI_TAB_WIDGET_H #include #include @@ -112,4 +111,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_TAB_WIDGET_H diff --git a/include/TemplatesMenu.h b/include/TemplatesMenu.h index 7f425bd2f..6e527c571 100644 --- a/include/TemplatesMenu.h +++ b/include/TemplatesMenu.h @@ -21,8 +21,9 @@ * Boston, MA 02110-1301 USA. * */ -#ifndef TEMPLATESMENU_H -#define TEMPLATESMENU_H + +#ifndef LMMS_GUI_TEMPLATES_MENU_H +#define LMMS_GUI_TEMPLATES_MENU_H #include #include @@ -49,4 +50,4 @@ private slots: } // namespace lmms::gui -#endif // TEMPLATESMENU_H +#endif // LMMS_GUI_TEMPLATES_MENU_H diff --git a/include/TempoSyncKnob.h b/include/TempoSyncKnob.h index 25a3b7e3b..a8e2eeb7e 100644 --- a/include/TempoSyncKnob.h +++ b/include/TempoSyncKnob.h @@ -23,8 +23,8 @@ * */ -#ifndef TEMPO_SYNC_KNOB_H -#define TEMPO_SYNC_KNOB_H +#ifndef LMMS_GUI_TEMPO_SYNC_KNOB_H +#define LMMS_GUI_TEMPO_SYNC_KNOB_H #include #include @@ -84,4 +84,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_TEMPO_SYNC_KNOB_H diff --git a/include/TempoSyncKnobModel.h b/include/TempoSyncKnobModel.h index 1a18486ff..59d7b5dc8 100644 --- a/include/TempoSyncKnobModel.h +++ b/include/TempoSyncKnobModel.h @@ -23,8 +23,8 @@ * */ -#ifndef TEMPO_SYNC_KNOB_MODEL_H -#define TEMPO_SYNC_KNOB_MODEL_H +#ifndef LMMS_TEMPO_SYNC_KNOB_MODEL_H +#define LMMS_TEMPO_SYNC_KNOB_MODEL_H #include "MeterModel.h" @@ -115,4 +115,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_TEMPO_SYNC_KNOB_MODEL_H diff --git a/include/TextFloat.h b/include/TextFloat.h index 9fdabc06b..f37544997 100644 --- a/include/TextFloat.h +++ b/include/TextFloat.h @@ -22,15 +22,15 @@ * */ - -#ifndef TEXT_FLOAT_H -#define TEXT_FLOAT_H +#ifndef LMMS_GUI_TEXT_FLOAT_H +#define LMMS_GUI_TEXT_FLOAT_H #include -#include #include "lmms_export.h" +class QLabel; + namespace lmms::gui { @@ -41,45 +41,38 @@ public: TextFloat(); ~TextFloat() override = default; - void setTitle( const QString & _title ); - void setText( const QString & _text ); - void setPixmap( const QPixmap & _pixmap ); + void setTitle(const QString & title); + void setText(const QString & text); + void setPixmap(const QPixmap & pixmap); - void setVisibilityTimeOut( int _msecs ); + void setVisibilityTimeOut(int msecs); + static TextFloat * displayMessage(const QString & title, + const QString & msg, + const QPixmap & pixmap = QPixmap(), + int timeout = 2000, + QWidget * parent = nullptr); - static TextFloat * displayMessage( const QString & _msg, - int _timeout = 2000, - QWidget * _parent = nullptr, - int _add_y_margin = 0 ); - static TextFloat * displayMessage( const QString & _title, - const QString & _msg, - const QPixmap & _pixmap = - QPixmap(), - int _timeout = 2000, - QWidget * _parent = nullptr ); - - void moveGlobal( QWidget * _w, const QPoint & _offset ) + void moveGlobal(QWidget * w, const QPoint & offset) { - move( _w->mapToGlobal( QPoint( 0, 0 ) )+_offset ); + move(w->mapToGlobal(QPoint(0, 0)) + offset); } protected: - void paintEvent( QPaintEvent * _me ) override; - void mousePressEvent( QMouseEvent * _me ) override; + void mousePressEvent(QMouseEvent * me) override; private: - void updateSize(); + TextFloat(const QString & title, const QString & text, const QPixmap & pixmap); - QString m_title; - QString m_text; - QPixmap m_pixmap; + QLabel * m_pixmapLabel; + QLabel * m_titleLabel; + QLabel * m_textLabel; }; } // namespace lmms::gui -#endif +#endif // LMMS_GUI_TEXT_FLOAT_H diff --git a/include/ThreadableJob.h b/include/ThreadableJob.h index 8e714ae19..9d5a0beee 100644 --- a/include/ThreadableJob.h +++ b/include/ThreadableJob.h @@ -22,8 +22,8 @@ * */ -#ifndef THREADABLE_JOB_H -#define THREADABLE_JOB_H +#ifndef LMMS_THREADABLE_JOB_H +#define LMMS_THREADABLE_JOB_H #include "lmms_basics.h" @@ -90,4 +90,4 @@ protected: } // namespace lmms -#endif +#endif // LMMS_THREADABLE_JOB_H diff --git a/include/TimeDisplayWidget.h b/include/TimeDisplayWidget.h index 894666970..9e74b57aa 100644 --- a/include/TimeDisplayWidget.h +++ b/include/TimeDisplayWidget.h @@ -23,8 +23,8 @@ * */ -#ifndef TIME_DISPLAY_WIDGET_H -#define TIME_DISPLAY_WIDGET_H +#ifndef LMMS_GUI_TIME_DISPLAY_WIDGET_H +#define LMMS_GUI_TIME_DISPLAY_WIDGET_H #include #include @@ -71,4 +71,4 @@ private: } // namespace lmms::gui -#endif // TIME_DISPLAY_WIDGET_H +#endif // LMMS_GUI_TIME_DISPLAY_WIDGET_H diff --git a/include/TimeLineWidget.h b/include/TimeLineWidget.h index bada25640..061a31081 100644 --- a/include/TimeLineWidget.h +++ b/include/TimeLineWidget.h @@ -22,9 +22,8 @@ * */ - -#ifndef TIMELINE_H -#define TIMELINE_H +#ifndef LMMS_GUI_TIMELINE_WIDGET_H +#define LMMS_GUI_TIMELINE_WIDGET_H #include @@ -122,6 +121,11 @@ public: return m_behaviourAtStop; } + void setBehaviourAtStop (int state) + { + emit loadBehaviourAtStop (state); + } + bool loopPointsEnabled() const { return m_loopPoints == LoopPointsEnabled; @@ -262,4 +266,4 @@ signals: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_TIMELINE_WIDGET_H diff --git a/include/TimePos.h b/include/TimePos.h index 808eede25..b86d8eb0f 100644 --- a/include/TimePos.h +++ b/include/TimePos.h @@ -23,10 +23,8 @@ * */ - -#ifndef TIME_POS_H -#define TIME_POS_H - +#ifndef LMMS_TIME_POS_H +#define LMMS_TIME_POS_H #include "lmms_export.h" #include "lmms_basics.h" @@ -118,4 +116,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_TIME_POS_H diff --git a/include/ToolButton.h b/include/ToolButton.h index c173a9052..6d947f7ad 100644 --- a/include/ToolButton.h +++ b/include/ToolButton.h @@ -22,9 +22,8 @@ * */ - -#ifndef TOOL_BUTTON_H -#define TOOL_BUTTON_H +#ifndef LMMS_GUI_TOOL_BUTTON_H +#define LMMS_GUI_TOOL_BUTTON_H #include @@ -49,5 +48,4 @@ public: } // namespace lmms::gui -#endif - +#endif // LMMS_GUI_TOOL_BUTTON_H diff --git a/include/ToolPlugin.h b/include/ToolPlugin.h index 38f4d87b1..e64afd055 100644 --- a/include/ToolPlugin.h +++ b/include/ToolPlugin.h @@ -24,8 +24,8 @@ * */ -#ifndef TOOL_PLUGIN_H -#define TOOL_PLUGIN_H +#ifndef LMMS_TOOL_PLUGIN_H +#define LMMS_TOOL_PLUGIN_H #include "Plugin.h" @@ -50,4 +50,4 @@ public: } // namespace lmms -#endif +#endif // LMMS_TOOL_PLUGIN_H diff --git a/include/ToolPluginView.h b/include/ToolPluginView.h index 0b702fd1b..b0654f125 100644 --- a/include/ToolPluginView.h +++ b/include/ToolPluginView.h @@ -23,8 +23,8 @@ * */ -#ifndef TOOL_PLUGIN_VIEW_H -#define TOOL_PLUGIN_VIEW_H +#ifndef LMMS_GUI_TOOL_PLUGIN_VIEW_H +#define LMMS_GUI_TOOL_PLUGIN_VIEW_H #include "PluginView.h" @@ -49,4 +49,4 @@ public: } // namespace lmms -#endif +#endif // LMMS_GUI_TOOL_PLUGIN_VIEW_H diff --git a/include/Track.h b/include/Track.h index 8d756c914..ff3c1ae00 100644 --- a/include/Track.h +++ b/include/Track.h @@ -22,9 +22,8 @@ * */ -#ifndef TRACK_H -#define TRACK_H - +#ifndef LMMS_TRACK_H +#define LMMS_TRACK_H #include #include @@ -257,4 +256,4 @@ signals: } // namespace lmms -#endif +#endif // LMMS_TRACK_H diff --git a/include/TrackContainer.h b/include/TrackContainer.h index d947094f7..f99273ba2 100644 --- a/include/TrackContainer.h +++ b/include/TrackContainer.h @@ -23,8 +23,8 @@ * */ -#ifndef TRACK_CONTAINER_H -#define TRACK_CONTAINER_H +#ifndef LMMS_TRACK_CONTAINER_H +#define LMMS_TRACK_CONTAINER_H #include @@ -63,12 +63,6 @@ public: void loadSettings( const QDomElement & _this ) override; - - virtual AutomationClip * tempoAutomationClip() - { - return nullptr; - } - int countTracks( Track::TrackTypes _tt = Track::NumTrackTypes ) const; @@ -124,4 +118,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_TRACK_CONTAINER_H diff --git a/include/TrackContainerView.h b/include/TrackContainerView.h index 444420d98..d53291c33 100644 --- a/include/TrackContainerView.h +++ b/include/TrackContainerView.h @@ -22,9 +22,8 @@ * */ - -#ifndef TRACK_CONTAINER_VIEW_H -#define TRACK_CONTAINER_VIEW_H +#ifndef LMMS_GUI_TRACK_CONTAINER_VIEW_H +#define LMMS_GUI_TRACK_CONTAINER_VIEW_H #include #include @@ -219,4 +218,4 @@ signals: } // namespace lmms -#endif +#endif // LMMS_GUI_TRACK_CONTAINER_VIEW_H diff --git a/include/TrackContentWidget.h b/include/TrackContentWidget.h index f4a44d2a6..1a3e14a0e 100644 --- a/include/TrackContentWidget.h +++ b/include/TrackContentWidget.h @@ -22,8 +22,8 @@ * */ -#ifndef TRACK_CONTENT_WIDGET_H -#define TRACK_CONTENT_WIDGET_H +#ifndef LMMS_GUI_TRACK_CONTENT_WIDGET_H +#define LMMS_GUI_TRACK_CONTENT_WIDGET_H #include @@ -149,4 +149,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_GUI_TRACK_CONTENT_WIDGET_H diff --git a/include/TrackLabelButton.h b/include/TrackLabelButton.h index 1a8d05e71..0d1c6e163 100644 --- a/include/TrackLabelButton.h +++ b/include/TrackLabelButton.h @@ -22,9 +22,8 @@ * */ - -#ifndef TRACK_LABEL_BUTTON_H -#define TRACK_LABEL_BUTTON_H +#ifndef LMMS_GUI_TRACK_LABEL_BUTTON_H +#define LMMS_GUI_TRACK_LABEL_BUTTON_H #include @@ -72,4 +71,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_TRACK_LABEL_BUTTON_H diff --git a/include/TrackOperationsWidget.h b/include/TrackOperationsWidget.h index edd9796ac..4dbb5353c 100644 --- a/include/TrackOperationsWidget.h +++ b/include/TrackOperationsWidget.h @@ -22,8 +22,8 @@ * */ -#ifndef TRACK_OPERATIONS_WIDGET_H -#define TRACK_OPERATIONS_WIDGET_H +#ifndef LMMS_GUI_TRACK_OPERATIONS_WIDGET_H +#define LMMS_GUI_TRACK_OPERATIONS_WIDGET_H #include @@ -80,4 +80,4 @@ signals: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_TRACK_OPERATIONS_WIDGET_H diff --git a/include/TrackRenameLineEdit.h b/include/TrackRenameLineEdit.h index 4b13ff9b7..2f6a1f4fb 100644 --- a/include/TrackRenameLineEdit.h +++ b/include/TrackRenameLineEdit.h @@ -23,9 +23,8 @@ * */ - -#ifndef TRACK_RENAME_LINE_EDIT_H -#define TRACK_RENAME_LINE_EDIT_H +#ifndef LMMS_GUI_TRACK_RENAME_LINE_EDIT_H +#define LMMS_GUI_TRACK_RENAME_LINE_EDIT_H #include @@ -48,4 +47,4 @@ private: } // namespace lmms::gui -#endif +#endif // LMMS_GUI_TRACK_RENAME_LINE_EDIT_H diff --git a/include/TrackView.h b/include/TrackView.h index 4b02c8015..efa4f4a0a 100644 --- a/include/TrackView.h +++ b/include/TrackView.h @@ -22,10 +22,8 @@ * */ - - -#ifndef TRACK_VIEW_H -#define TRACK_VIEW_H +#ifndef LMMS_GUI_TRACK_VIEW_H +#define LMMS_GUI_TRACK_VIEW_H #include @@ -34,7 +32,6 @@ #include "TrackContentWidget.h" #include "TrackOperationsWidget.h" - class QMenu; namespace lmms @@ -179,4 +176,4 @@ private slots: } // namespace lmms -#endif +#endif // LMMS_GUI_TRACK_VIEW_H diff --git a/include/ValueBuffer.h b/include/ValueBuffer.h index 950ad06f0..683d17fb1 100644 --- a/include/ValueBuffer.h +++ b/include/ValueBuffer.h @@ -23,8 +23,8 @@ * */ -#ifndef VALUE_BUFFER_H -#define VALUE_BUFFER_H +#ifndef LMMS_VALUE_BUFFER_H +#define LMMS_VALUE_BUFFER_H #include @@ -57,4 +57,4 @@ public: } // namespace lmms -#endif +#endif // LMMS_VALUE_BUFFER_H diff --git a/include/VersionedSaveDialog.h b/include/VersionedSaveDialog.h index 79ab516b0..6d707cd51 100644 --- a/include/VersionedSaveDialog.h +++ b/include/VersionedSaveDialog.h @@ -24,9 +24,8 @@ * */ - -#ifndef VERSIONEDSAVEDIALOG_H -#define VERSIONEDSAVEDIALOG_H +#ifndef LMMS_GUI_VERSIONED_SAVE_DIALOG_H +#define LMMS_GUI_VERSIONED_SAVE_DIALOG_H #include "FileDialog.h" #include "Song.h" @@ -69,4 +68,4 @@ public slots: } // namespace lmms::gui -#endif // VERSIONEDSAVEDIALOG_H +#endif // LMMS_GUI_VERSIONED_SAVE_DIALOG_H diff --git a/include/VstSyncController.h b/include/VstSyncController.h index c70bc85c8..d3c6af051 100644 --- a/include/VstSyncController.h +++ b/include/VstSyncController.h @@ -23,8 +23,8 @@ * */ -#ifndef VST_SYNC_CONTROLLER_H -#define VST_SYNC_CONTROLLER_H +#ifndef LMMS_VST_SYNC_CONTROLLER_H +#define LMMS_VST_SYNC_CONTROLLER_H #include @@ -62,4 +62,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_VST_SYNC_CONTROLLER_H diff --git a/include/VstSyncData.h b/include/VstSyncData.h index baf3fa7a8..480bc7fb4 100644 --- a/include/VstSyncData.h +++ b/include/VstSyncData.h @@ -23,8 +23,8 @@ * */ -#ifndef VST_SYNC_DATA_H -#define VST_SYNC_DATA_H +#ifndef LMMS_VST_SYNC_DATA_H +#define LMMS_VST_SYNC_DATA_H namespace lmms { @@ -61,4 +61,4 @@ struct VstSyncData } // namespace lmms -#endif +#endif // LMMS_VST_SYNC_DATA_H diff --git a/include/aeffectx.h b/include/aeffectx.h index a06567ba7..2c69464cc 100644 --- a/include/aeffectx.h +++ b/include/aeffectx.h @@ -22,7 +22,6 @@ * */ - #ifndef AEFFECTX_H #define AEFFECTX_H @@ -298,4 +297,4 @@ public: using audioMasterCallback = intptr_t (VST_CALL_CONV*)(AEffect*, int32_t, int32_t, intptr_t, void*, float); -#endif +#endif // AEFFECTX_H diff --git a/include/base64.h b/include/base64.h index f52d90d13..42066d564 100644 --- a/include/base64.h +++ b/include/base64.h @@ -23,8 +23,8 @@ * */ -#ifndef _BASE64_H -#define _BASE64_H +#ifndef LMMS_BASE64_H +#define LMMS_BASE64_H #include #include @@ -53,4 +53,4 @@ namespace lmms::base64 } // namespace lmms::base64 -#endif +#endif // LMMS_BASE64_H diff --git a/include/debug.h b/include/debug.h index f2ea29cc1..7cf51acaa 100644 --- a/include/debug.h +++ b/include/debug.h @@ -22,9 +22,8 @@ * */ - -#ifndef DEBUG_H -#define DEBUG_H +#ifndef LMMS_DEBUG_H +#define LMMS_DEBUG_H #include "lmmsconfig.h" @@ -39,4 +38,4 @@ #include -#endif +#endif // LMMS_DEBUG_H diff --git a/include/denormals.h b/include/denormals.h index e99e767a3..92b84c7dd 100644 --- a/include/denormals.h +++ b/include/denormals.h @@ -1,8 +1,8 @@ -// Denormals stripping. +// Denormals stripping. // These snippets should be common enough to be considered public domain. -#ifndef DENORMALS_H -#define DENORMALS_H +#ifndef LMMS_DENORMALS_H +#define LMMS_DENORMALS_H #ifdef __SSE__ #include @@ -35,7 +35,7 @@ int inline can_we_daz() #endif // __SSE__ -// Set denormal protection for this thread. +// Set denormal protection for this thread. void inline disable_denormals() { #ifdef __SSE__ @@ -50,5 +50,4 @@ void inline disable_denormals() } // namespace lmms -#endif // DENORMALS_H - +#endif // LMMS_DENORMALS_H diff --git a/include/embed.h b/include/embed.h index 03d767b43..7d69f7c7d 100644 --- a/include/embed.h +++ b/include/embed.h @@ -22,8 +22,8 @@ * */ -#ifndef EMBED_H -#define EMBED_H +#ifndef LMMS_EMBED_H +#define LMMS_EMBED_H #include #include @@ -139,4 +139,4 @@ public: } // namespace lmms -#endif +#endif // LMMS_EMBED_H diff --git a/include/endian_handling.h b/include/endian_handling.h index b3d122fa3..7ddb22f22 100644 --- a/include/endian_handling.h +++ b/include/endian_handling.h @@ -22,8 +22,8 @@ * */ -#ifndef ENDIAN_HANDLING_H -#define ENDIAN_HANDLING_H +#ifndef LMMS_ENDIAN_HANDLING_H +#define LMMS_ENDIAN_HANDLING_H #include @@ -57,4 +57,4 @@ inline int32_t swap32IfBE( int32_t i ) } // namespace lmms -#endif +#endif // LMMS_ENDIAN_HANDLING_H diff --git a/include/fenv.h b/include/fenv.h index c9cc508f5..665d88155 100644 --- a/include/fenv.h +++ b/include/fenv.h @@ -45,4 +45,4 @@ inline int fedisableexcept(unsigned int excepts) return fesetenv(&fenv) ? -1 : old_excepts; } -#endif +#endif // defined(__APPLE__) && defined(__MACH__) diff --git a/include/fft_helpers.h b/include/fft_helpers.h index 8ba0fc7a0..2d2a8d19e 100644 --- a/include/fft_helpers.h +++ b/include/fft_helpers.h @@ -23,9 +23,8 @@ * */ - -#ifndef FFT_HELPERS_H -#define FFT_HELPERS_H +#ifndef LMMS_FFT_HELPERS_H +#define LMMS_FFT_HELPERS_H #include "lmms_export.h" @@ -109,4 +108,4 @@ int LMMS_EXPORT compressbands(const float * _absspec_buffer, float * _compressed } // namespace lmms -#endif +#endif // LMMS_FFT_HELPERS_H diff --git a/include/gui_templates.h b/include/gui_templates.h index ee0ccdbf6..c0afbdfc0 100644 --- a/include/gui_templates.h +++ b/include/gui_templates.h @@ -22,9 +22,8 @@ * */ - -#ifndef GUI_TEMPLATES_H -#define GUI_TEMPLATES_H +#ifndef LMMS_GUI_TEMPLATES_H +#define LMMS_GUI_TEMPLATES_H #include "lmmsconfig.h" @@ -69,4 +68,4 @@ inline QFont pointSizeF( QFont _f, float SIZE ) } // namespace lmms -#endif +#endif // LMMS_GUI_TEMPLATES_H diff --git a/include/interpolation.h b/include/interpolation.h index 3a74334e4..fd2c29a04 100644 --- a/include/interpolation.h +++ b/include/interpolation.h @@ -22,9 +22,8 @@ * */ - -#ifndef INTERPOLATION_H -#define INTERPOLATION_H +#ifndef LMMS_INTERPOLATION_H +#define LMMS_INTERPOLATION_H #ifndef __USE_XOPEN #define __USE_XOPEN @@ -140,4 +139,4 @@ inline float lagrangeInterpolate( float v0, float v1, float v2, float v3, float } // namespace lmms -#endif +#endif // LMMS_INTERPOLATION_H diff --git a/include/lmms_basics.h b/include/lmms_basics.h index 59a6aa359..b566fa781 100644 --- a/include/lmms_basics.h +++ b/include/lmms_basics.h @@ -22,9 +22,8 @@ * */ - -#ifndef TYPES_H -#define TYPES_H +#ifndef LMMS_TYPES_H +#define LMMS_TYPES_H #include #include @@ -146,4 +145,4 @@ constexpr const char* UI_CTRL_KEY = } // namespace lmms -#endif +#endif // LMMS_TYPES_H diff --git a/include/lmms_constants.h b/include/lmms_constants.h index 7796f6bdf..e6fce9f4d 100644 --- a/include/lmms_constants.h +++ b/include/lmms_constants.h @@ -103,4 +103,4 @@ constexpr int ARANGE_SILENT_END = -10; } // namespace lmms -#endif +#endif // LMMS_CONSTANTS_H diff --git a/include/lmms_math.h b/include/lmms_math.h index db4502f1c..1f896a683 100644 --- a/include/lmms_math.h +++ b/include/lmms_math.h @@ -22,7 +22,6 @@ * */ - #ifndef LMMS_MATH_H #define LMMS_MATH_H @@ -329,4 +328,4 @@ static inline T absMin( T a, T b ) } // namespace lmms -#endif +#endif // LMMS_MATH_H diff --git a/include/panning.h b/include/panning.h index 1521ec984..56ca04eee 100644 --- a/include/panning.h +++ b/include/panning.h @@ -23,8 +23,8 @@ * */ -#ifndef PANNING_H -#define PANNING_H +#ifndef LMMS_PANNING_H +#define LMMS_PANNING_H #include "lmms_basics.h" #include "panning_constants.h" @@ -56,4 +56,4 @@ inline int panningToMidi( panning_t _p ) } // namespace lmms -#endif +#endif // LMMS_PANNING_H diff --git a/include/panning_constants.h b/include/panning_constants.h index 00a5c3291..8f40219f8 100644 --- a/include/panning_constants.h +++ b/include/panning_constants.h @@ -23,8 +23,8 @@ * */ -#ifndef PANNING_CONSTANTS_H -#define PANNING_CONSTANTS_H +#ifndef LMMS_PANNING_CONSTANTS_H +#define LMMS_PANNING_CONSTANTS_H namespace lmms { @@ -38,4 +38,4 @@ constexpr panning_t DefaultPanning = PanningCenter; } // namespace lmms -#endif +#endif // LMMS_PANNING_CONSTANTS_H diff --git a/include/shared_object.h b/include/shared_object.h index ac45d6cd7..e9fdb57a3 100644 --- a/include/shared_object.h +++ b/include/shared_object.h @@ -23,8 +23,8 @@ * */ -#ifndef SHARED_OBJECT_H -#define SHARED_OBJECT_H +#ifndef LMMS_SHARED_OBJECT_H +#define LMMS_SHARED_OBJECT_H #include @@ -86,4 +86,4 @@ private: } // namespace lmms -#endif +#endif // LMMS_SHARED_OBJECT_H diff --git a/include/versioninfo.h b/include/versioninfo.h index 29bf3bea9..f224b62c5 100644 --- a/include/versioninfo.h +++ b/include/versioninfo.h @@ -1,5 +1,5 @@ -#ifndef VERSION_INFO_H -#define VERSION_INFO_H +#ifndef LMMS_VERSION_INFO_H +#define LMMS_VERSION_INFO_H #include "lmms_basics.h" @@ -51,4 +51,4 @@ constexpr const char* LMMS_BUILDCONF_PLATFORM = "win32"; constexpr const char* LMMS_BUILDCONF_PLATFORM = "Haiku"; #endif -#endif +#endif // LMMS_VERSION_INFO_H diff --git a/include/volume.h b/include/volume.h index 5223bfa09..382f76780 100644 --- a/include/volume.h +++ b/include/volume.h @@ -23,8 +23,8 @@ * */ -#ifndef VOLUME_H -#define VOLUME_H +#ifndef LMMS_VOLUME_H +#define LMMS_VOLUME_H #include "lmms_basics.h" @@ -43,4 +43,4 @@ struct StereoVolumeVector } // namespace lmms -#endif +#endif // LMMS_VOLUME_H diff --git a/plugins/Amplifier/Amplifier.cpp b/plugins/Amplifier/Amplifier.cpp index 3fb03d3d9..9344807c4 100644 --- a/plugins/Amplifier/Amplifier.cpp +++ b/plugins/Amplifier/Amplifier.cpp @@ -74,7 +74,7 @@ bool AmplifierEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) double outSum = 0.0; const float d = dryLevel(); const float w = wetLevel(); - + const ValueBuffer * volBuf = m_ampControls.m_volumeModel.valueBuffer(); const ValueBuffer * panBuf = m_ampControls.m_panModel.valueBuffer(); const ValueBuffer * leftBuf = m_ampControls.m_leftModel.valueBuffer(); @@ -83,8 +83,8 @@ bool AmplifierEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) for( fpp_t f = 0; f < frames; ++f ) { // qDebug( "offset %d, value %f", f, m_ampControls.m_volumeModel.value( f ) ); - - sample_t s[2] = { buf[f][0], buf[f][1] }; + + auto s = std::array{buf[f][0], buf[f][1]}; // vol knob if( volBuf ) @@ -99,8 +99,8 @@ bool AmplifierEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) } // convert pan values to left/right values - const float pan = panBuf - ? panBuf->value( f ) + const float pan = panBuf + ? panBuf->value( f ) : m_ampControls.m_panModel.value(); const float left1 = pan <= 0 ? 1.0 @@ -111,12 +111,12 @@ bool AmplifierEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) // second stage amplification const float left2 = leftBuf - ? leftBuf->value( f ) + ? leftBuf->value( f ) : m_ampControls.m_leftModel.value(); const float right2 = rightBuf - ? rightBuf->value( f ) + ? rightBuf->value( f ) : m_ampControls.m_rightModel.value(); - + s[0] *= left1 * left2 * 0.01; s[1] *= right1 * right2 * 0.01; diff --git a/plugins/AudioFileProcessor/AudioFileProcessor.cpp b/plugins/AudioFileProcessor/AudioFileProcessor.cpp index 8126d4c08..2e2d7163b 100644 --- a/plugins/AudioFileProcessor/AudioFileProcessor.cpp +++ b/plugins/AudioFileProcessor/AudioFileProcessor.cpp @@ -550,7 +550,7 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, connect( castModel(), SIGNAL( isPlaying( lmms::f_cnt_t ) ), m_waveView, SLOT( isPlaying( lmms::f_cnt_t ) ) ); - qRegisterMetaType( "f_cnt_t" ); + qRegisterMetaType( "lmms::f_cnt_t" ); setAcceptDrops( true ); } @@ -1287,4 +1287,4 @@ PLUGIN_EXPORT Plugin * lmms_plugin_main(Model * model, void *) } -} // namespace lmms \ No newline at end of file +} // namespace lmms diff --git a/plugins/BassBooster/BassBooster.cpp b/plugins/BassBooster/BassBooster.cpp index 77667c121..48e265911 100644 --- a/plugins/BassBooster/BassBooster.cpp +++ b/plugins/BassBooster/BassBooster.cpp @@ -102,7 +102,7 @@ bool BassBoosterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames m_bbFX.leftFX().setGain( gain ); m_bbFX.rightFX().setGain( gain); - sample_t s[2] = { buf[f][0], buf[f][1] }; + auto s = std::array{buf[f][0], buf[f][1]}; m_bbFX.nextSample( s[0], s[1] ); buf[f][0] = d * buf[f][0] + w * s[0]; diff --git a/plugins/Bitcrush/Bitcrush.cpp b/plugins/Bitcrush/Bitcrush.cpp index 68724eccd..963e970db 100644 --- a/plugins/Bitcrush/Bitcrush.cpp +++ b/plugins/Bitcrush/Bitcrush.cpp @@ -35,8 +35,8 @@ const int OS_RATE = 5; const float OS_RATIO = 1.0f / OS_RATE; const float CUTOFF_RATIO = 0.353553391f; const int SILENCEFRAMES = 10; -const float OS_RESAMPLE [5] = { 0.0001490062883964112, 0.1645978376763992, 0.6705063120704088, - 0.1645978376763992, 0.0001490062883964112 }; +const auto OS_RESAMPLE = std::array{0.0001490062883964112f, 0.1645978376763992f, 0.6705063120704088f, + 0.1645978376763992f, 0.0001490062883964112f }; extern "C" { @@ -65,13 +65,13 @@ BitcrushEffect::BitcrushEffect( Model * parent, const Descriptor::SubPluginFeatu m_buffer = MM_ALLOC( Engine::audioEngine()->framesPerPeriod() * OS_RATE ); m_filter.setLowpass( m_sampleRate * ( CUTOFF_RATIO * OS_RATIO ) ); m_needsUpdate = true; - + m_bitCounterL = 0.0f; m_bitCounterR = 0.0f; - + m_left = 0.0f; m_right = 0.0f; - + m_silenceCounter = 0; } @@ -125,7 +125,7 @@ bool BitcrushEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) m_rateCoeffL = ( m_sampleRate * OS_RATE ) / ( rate - diff ); m_rateCoeffR = ( m_sampleRate * OS_RATE ) / ( rate + diff ); - + m_bitCounterL = 0.0f; m_bitCounterR = 0.0f; } @@ -147,9 +147,9 @@ bool BitcrushEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) m_outClip = dbfsToAmp( m_controls.m_outClip.value() ); } m_needsUpdate = false; - + const float noiseAmt = m_controls.m_inNoise.value() * 0.01f; - + // read input buffer and write it to oversampled buffer if( m_rateEnabled ) // rate crushing enabled so do that { @@ -164,15 +164,15 @@ bool BitcrushEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) if( m_bitCounterL > m_rateCoeffL ) { m_bitCounterL -= m_rateCoeffL; - m_left = m_depthEnabled - ? depthCrush( buf[f][0] * m_inGain + noise( buf[f][0] * noiseAmt ) ) + m_left = m_depthEnabled + ? depthCrush( buf[f][0] * m_inGain + noise( buf[f][0] * noiseAmt ) ) : buf[f][0] * m_inGain + noise( buf[f][0] * noiseAmt ); } if( m_bitCounterR > m_rateCoeffR ) { m_bitCounterR -= m_rateCoeffR; - m_right = m_depthEnabled - ? depthCrush( buf[f][1] * m_inGain + noise( buf[f][1] * noiseAmt ) ) + m_right = m_depthEnabled + ? depthCrush( buf[f][1] * m_inGain + noise( buf[f][1] * noiseAmt ) ) : buf[f][1] * m_inGain + noise( buf[f][1] * noiseAmt ); } } @@ -185,17 +185,17 @@ bool BitcrushEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) for( int o = 0; o < OS_RATE; ++o ) { m_buffer[f * OS_RATE + o][0] = m_depthEnabled - ? depthCrush( buf[f][0] * m_inGain + noise( buf[f][0] * noiseAmt ) ) + ? depthCrush( buf[f][0] * m_inGain + noise( buf[f][0] * noiseAmt ) ) : buf[f][0] * m_inGain + noise( buf[f][0] * noiseAmt ); m_buffer[f * OS_RATE + o][1] = m_depthEnabled - ? depthCrush( buf[f][1] * m_inGain + noise( buf[f][1] * noiseAmt ) ) + ? depthCrush( buf[f][1] * m_inGain + noise( buf[f][1] * noiseAmt ) ) : buf[f][1] * m_inGain + noise( buf[f][1] * noiseAmt ); } } } - + // the oversampled buffer is now written, so filter it to reduce aliasing - + for( int f = 0; f < frames * OS_RATE; ++f ) { if( qMax( qAbs( m_buffer[f][0] ), qAbs( m_buffer[f][1] ) ) >= 1.0e-10f ) @@ -218,10 +218,10 @@ bool BitcrushEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) } } } - - + + // now downsample and write it back to main buffer - + double outSum = 0.0; const float d = dryLevel(); const float w = wetLevel(); @@ -238,7 +238,7 @@ bool BitcrushEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) buf[f][1] = d * buf[f][1] + w * qBound( -m_outClip, rsum, m_outClip ) * m_outGain; outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1]; } - + checkGate( outSum / frames ); return isRunning(); diff --git a/plugins/CarlaBase/CMakeLists.txt b/plugins/CarlaBase/CMakeLists.txt index f60804719..d4f7939c9 100644 --- a/plugins/CarlaBase/CMakeLists.txt +++ b/plugins/CarlaBase/CMakeLists.txt @@ -15,14 +15,13 @@ if(LMMS_HAVE_WEAKCARLA) ${CMAKE_CURRENT_SOURCE_DIR}/carla/source/backend ) + # force "lib" prefix IF(LMMS_BUILD_WIN32) - # use carla.dll - SET(CMAKE_SHARED_LIBRARY_PREFIX "") - SET(CARLA_NATIVE_LIB carla) - ELSE() - # use libcarla_native-plugin - SET(CARLA_NATIVE_LIB carla_native-plugin) + SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") ENDIF() + + SET(CARLA_NATIVE_LIB carla_native-plugin) + ADD_LIBRARY(${CARLA_NATIVE_LIB} SHARED DummyCarla.cpp) TARGET_INCLUDE_DIRECTORIES(${CARLA_NATIVE_LIB} PUBLIC ${CARLA_INCLUDE_DIRS}) INSTALL(TARGETS ${CARLA_NATIVE_LIB} diff --git a/plugins/Compressor/Compressor.cpp b/plugins/Compressor/Compressor.cpp index 312a40d3d..92123ffd9 100755 --- a/plugins/Compressor/Compressor.cpp +++ b/plugins/Compressor/Compressor.cpp @@ -276,7 +276,7 @@ bool CompressorEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames) float rOutPeak = 0.0; float lInPeak = 0.0; float rInPeak = 0.0; - + const bool midside = m_compressorControls.m_midsideModel.value(); const bool peakmode = m_compressorControls.m_peakmodeModel.value(); const float inBalance = m_compressorControls.m_inBalanceModel.value(); @@ -292,8 +292,8 @@ bool CompressorEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames) for(fpp_t f = 0; f < frames; ++f) { - sample_t drySignal[2] = {buf[f][0], buf[f][1]}; - sample_t s[2] = {drySignal[0] * m_inGainVal, drySignal[1] * m_inGainVal}; + auto drySignal = std::array{buf[f][0], buf[f][1]}; + auto s = std::array{drySignal[0] * m_inGainVal, drySignal[1] * m_inGainVal}; // Calculate tilt filters, to bias the sidechain to the low or high frequencies if (m_tiltVal) @@ -512,7 +512,7 @@ bool CompressorEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames) m_inputBufLoc = 0; } - const float temp[2] = {drySignal[0], drySignal[1]}; + const auto temp = std::array{drySignal[0], drySignal[1]}; s[0] = m_inputBuf[0][m_inputBufLoc]; s[1] = m_inputBuf[1][m_inputBufLoc]; @@ -525,8 +525,8 @@ bool CompressorEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames) s[1] = drySignal[1]; } - float delayedDrySignal[2] = {s[0], s[1]}; - + auto delayedDrySignal = std::array{s[0], s[1]}; + if (midside)// Convert left/right to mid/side { const float temp = s[0]; diff --git a/plugins/Compressor/CompressorControlDialog.cpp b/plugins/Compressor/CompressorControlDialog.cpp index 2f9fed9c2..8c6f61bec 100755 --- a/plugins/Compressor/CompressorControlDialog.cpp +++ b/plugins/Compressor/CompressorControlDialog.cpp @@ -206,7 +206,7 @@ CompressorControlDialog::CompressorControlDialog(CompressorControls* controls) : peakButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("peak_sel")); peakButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("peak_unsel")); peakButton->setToolTip(tr("Use absolute value of the input")); - + rmsPeakGroup = new automatableButtonGroup(this); rmsPeakGroup->addButton(rmsButton); rmsPeakGroup->addButton(peakButton); @@ -221,7 +221,7 @@ CompressorControlDialog::CompressorControlDialog(CompressorControls* controls) : midSideButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("midside_sel")); midSideButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("midside_unsel")); midSideButton->setToolTip(tr("Compress mid and side audio")); - + leftRightMidSideGroup = new automatableButtonGroup(this); leftRightMidSideGroup->addButton(leftRightButton); leftRightMidSideGroup->addButton(midSideButton); @@ -514,8 +514,8 @@ void CompressorControlDialog::redrawKnee() { m_p.setPen(QPen(m_kneeColor2, 3)); - float prevPoint[2] = {kneePoint1, kneePoint1}; - float newPoint[2] = {0, 0}; + auto prevPoint = std::array{kneePoint1, kneePoint1}; + auto newPoint = std::array{0.f, 0.f}; // Draw knee curve using many straight lines. for (int i = 0; i < COMP_KNEE_LINES; ++i) @@ -542,7 +542,7 @@ void CompressorControlDialog::redrawKnee() m_p.end(); m_p.begin(&m_kneePixmap2); - + m_p.setCompositionMode(QPainter::CompositionMode_Source); m_p.fillRect(0, 0, m_windowSizeX, m_kneeWindowSizeY, QColor("transparent")); m_p.setCompositionMode(QPainter::CompositionMode_SourceOver); diff --git a/plugins/Delay/DelayEffect.cpp b/plugins/Delay/DelayEffect.cpp index 1c6a74b86..6db2f38e3 100644 --- a/plugins/Delay/DelayEffect.cpp +++ b/plugins/Delay/DelayEffect.cpp @@ -91,7 +91,7 @@ bool DelayEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) const float sr = Engine::audioEngine()->processingSampleRate(); const float d = dryLevel(); const float w = wetLevel(); - sample_t dryS[2]; + auto dryS = std::array{}; float lPeak = 0.0; float rPeak = 0.0; float length = m_delayControls.m_delayTimeModel.value(); diff --git a/plugins/Dispersion/CMakeLists.txt b/plugins/Dispersion/CMakeLists.txt new file mode 100644 index 000000000..a40e04b80 --- /dev/null +++ b/plugins/Dispersion/CMakeLists.txt @@ -0,0 +1,3 @@ +INCLUDE(BuildPlugin) + +BUILD_PLUGIN(dispersion Dispersion.cpp DispersionControls.cpp DispersionControlDialog.cpp MOCFILES DispersionControls.h DispersionControlDialog.h EMBEDDED_RESOURCES *.png) diff --git a/plugins/Dispersion/Dispersion.cpp b/plugins/Dispersion/Dispersion.cpp new file mode 100644 index 000000000..9b98877e5 --- /dev/null +++ b/plugins/Dispersion/Dispersion.cpp @@ -0,0 +1,162 @@ +/* + * Dispersion.cpp + * + * Copyright (c) 2023 Lost Robot + * + * 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. + * + */ + +#include "Dispersion.h" + +#include "embed.h" +#include "plugin_export.h" + +namespace lmms +{ + +extern "C" +{ + +Plugin::Descriptor PLUGIN_EXPORT dispersion_plugin_descriptor = +{ + LMMS_STRINGIFY(PLUGIN_NAME), + "Dispersion", + QT_TRANSLATE_NOOP("PluginBrowser", "An all-pass filter allowing for extremely high orders."), + "Lost Robot ", + 0x0100, + Plugin::Effect, + new PluginPixmapLoader("logo"), + nullptr, + nullptr +}; + +} + + +DispersionEffect::DispersionEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key) : + Effect(&dispersion_plugin_descriptor, parent, key), + m_dispersionControls(this), + m_sampleRate(Engine::audioEngine()->processingSampleRate()), + m_amountVal(0) +{ +} + + +bool DispersionEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames) +{ + if (!isEnabled() || !isRunning()) + { + return false; + } + + double outSum = 0.0; + const float d = dryLevel(); + const float w = wetLevel(); + + const int amount = m_dispersionControls.m_amountModel.value(); + const float freq = m_dispersionControls.m_freqModel.value(); + const float reso = m_dispersionControls.m_resoModel.value(); + float feedback = m_dispersionControls.m_feedbackModel.value(); + const bool dc = m_dispersionControls.m_dcModel.value(); + + // All-pass coefficient calculation + const float w0 = (F_2PI / m_sampleRate) * freq; + const float a0 = 1 + (std::sin(w0) / (reso * 2.f)); + float apCoeff1 = (1 - (a0 - 1)) / a0; + float apCoeff2 = (-2 * std::cos(w0)) / a0; + + float dcCoeff = 0.001 * (44100.f / m_sampleRate); + + if (amount != m_amountVal) + { + if (amount < m_amountVal) + { + // Flush filter buffers when they're no longer in use + for (int i = amount * 2; i < m_amountVal * 2; ++i) + { + m_state.x0[i] = m_state.x1[i] = m_state.y0[i] = m_state.y1[i] = 0; + } + } + m_amountVal = amount; + } + + if (amount == 0) + { + feedback = 0; + m_feedbackVal[0] = m_feedbackVal[1] = 0; + } + + for (fpp_t f = 0; f < frames; ++f) + { + std::array s = { buf[f][0] + m_feedbackVal[0], buf[f][1] + m_feedbackVal[1] }; + + runDispersionAP(m_amountVal, apCoeff1, apCoeff2, s); + m_feedbackVal[0] = s[0] * feedback; + m_feedbackVal[1] = s[1] * feedback; + + if (dc) + { + // DC offset removal + for (int i = 0; i < 2; ++i) + { + m_integrator[i] = m_integrator[i] * (1.f - dcCoeff) + s[i] * dcCoeff; + s[i] -= m_integrator[i]; + } + } + + buf[f][0] = d * buf[f][0] + w * s[0]; + buf[f][1] = d * buf[f][1] + w * s[1]; + outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1]; + } + + checkGate(outSum / frames); + return isRunning(); +} + + +void DispersionEffect::runDispersionAP(const int filtNum, const float apCoeff1, const float apCoeff2, std::array &put) +{ + for (int i = 0; i < filtNum * 2; ++i) + { + const int channel = i % 2; + const sample_t currentInput = put[channel]; + const sample_t filterOutput = apCoeff1 * (currentInput - m_state.y1[i]) + + apCoeff2 * (m_state.x0[i] - m_state.y0[i]) + m_state.x1[i]; + m_state.x1[i] = m_state.x0[i]; + m_state.x0[i] = currentInput; + m_state.y1[i] = m_state.y0[i]; + m_state.y0[i] = filterOutput; + + put[channel] = filterOutput; + } +} + + +extern "C" +{ + +// necessary for getting instance out of shared lib +PLUGIN_EXPORT Plugin * lmms_plugin_main(Model* parent, void* data) +{ + return new DispersionEffect(parent, static_cast(data)); +} + +} + +} // namespace lmms diff --git a/plugins/Dispersion/Dispersion.h b/plugins/Dispersion/Dispersion.h new file mode 100644 index 000000000..9e2014baf --- /dev/null +++ b/plugins/Dispersion/Dispersion.h @@ -0,0 +1,78 @@ +/* + * Dispersion.h + * + * Copyright (c) 2023 Lost Robot + * + * 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 LMMS_DISPERSION_H +#define LMMS_DISPERSION_H + +#include "DispersionControls.h" +#include "Effect.h" + +#include "lmms_math.h" + +namespace lmms +{ + +constexpr inline int MAX_DISPERSION_FILTERS = 999; + +class DispersionEffect : public Effect +{ +public: + DispersionEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key); + ~DispersionEffect() override = default; + bool processAudioBuffer(sampleFrame* buf, const fpp_t frames) override; + + EffectControls* controls() override + { + return &m_dispersionControls; + } + + void runDispersionAP(const int filtNum, const float apCoeff1, const float apCoeff2, std::array &put); + +private: + DispersionControls m_dispersionControls; + + float m_sampleRate; + + int m_amountVal; + + using Filter = std::array; + struct FilterState { + Filter x0{}; + Filter x1{}; + Filter y0{}; + Filter y1{}; + }; + FilterState m_state = {}; + + std::array m_feedbackVal{}; + std::array m_integrator{}; + + friend class DispersionControls; +}; + + +} // namespace lmms + +#endif // LMMS_DISPERSION_H diff --git a/plugins/Dispersion/DispersionControlDialog.cpp b/plugins/Dispersion/DispersionControlDialog.cpp new file mode 100644 index 000000000..b9f04baa2 --- /dev/null +++ b/plugins/Dispersion/DispersionControlDialog.cpp @@ -0,0 +1,82 @@ +/* + * DispersionControlDialog.cpp + * + * Copyright (c) 2023 Lost Robot + * + * 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. + * + */ + + +#include "DispersionControlDialog.h" +#include "DispersionControls.h" + +#include "embed.h" +#include "Knob.h" +#include "LcdSpinBox.h" +#include "PixmapButton.h" + + +namespace lmms::gui +{ + + +DispersionControlDialog::DispersionControlDialog(DispersionControls* controls) : + EffectControlDialog(controls) +{ + setAutoFillBackground(true); + QPalette pal; + pal.setBrush(backgroundRole(), PLUGIN_NAME::getIconPixmap("artwork")); + setPalette(pal); + setFixedSize(207, 50); + + LcdSpinBox * m_amountBox = new LcdSpinBox(3, this, "Amount"); + m_amountBox->setModel(&controls->m_amountModel); + m_amountBox->move(5, 10); + m_amountBox->setLabel(tr("AMOUNT")); + m_amountBox->setToolTip(tr("Number of all-pass filters")); + + Knob * freqKnob = new Knob(knobBright_26, this); + freqKnob->move(59, 8); + freqKnob->setModel(&controls->m_freqModel); + freqKnob->setLabel(tr("FREQ")); + freqKnob->setHintText(tr("Frequency:") , " Hz"); + + Knob * resoKnob = new Knob(knobBright_26, this); + resoKnob->move(99, 8); + resoKnob->setModel(&controls->m_resoModel); + resoKnob->setLabel(tr("RESO")); + resoKnob->setHintText(tr("Resonance:") , " octaves"); + + Knob * feedbackKnob = new Knob(knobBright_26, this); + feedbackKnob->move(139, 8); + feedbackKnob->setModel(&controls->m_feedbackModel); + feedbackKnob->setLabel(tr("FEED")); + feedbackKnob->setHintText(tr("Feedback:") , ""); + + PixmapButton * dcButton = new PixmapButton(this, tr("DC Offset Removal")); + dcButton->move(176, 16); + dcButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("dc_active")); + dcButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("dc_inactive")); + dcButton->setCheckable(true); + dcButton->setModel(&controls->m_dcModel); + dcButton->setToolTip(tr("Remove DC Offset")); +} + + +} // namespace lmms::gui diff --git a/plugins/Dispersion/DispersionControlDialog.h b/plugins/Dispersion/DispersionControlDialog.h new file mode 100644 index 000000000..0d55678bd --- /dev/null +++ b/plugins/Dispersion/DispersionControlDialog.h @@ -0,0 +1,52 @@ +/* + * DispersionControlDialog.h + * + * Copyright (c) 2023 Lost Robot + * + * 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 LMMS_GUI_DISPERSION_CONTROL_DIALOG_H +#define LMMS_GUI_DISPERSION_CONTROL_DIALOG_H + +#include "EffectControlDialog.h" + +namespace lmms +{ + +class DispersionControls; + + +namespace gui +{ + +class DispersionControlDialog : public EffectControlDialog +{ + Q_OBJECT +public: + DispersionControlDialog(DispersionControls* controls); + ~DispersionControlDialog() override = default; +}; + + +} // namespace gui + +} // namespace lmms + +#endif // LMMS_GUI_DISPERSION_CONTROL_DIALOG_H diff --git a/plugins/Dispersion/DispersionControls.cpp b/plugins/Dispersion/DispersionControls.cpp new file mode 100644 index 000000000..771ffb89d --- /dev/null +++ b/plugins/Dispersion/DispersionControls.cpp @@ -0,0 +1,73 @@ +/* + * DispersionControls.cpp + * + * Copyright (c) 2023 Lost Robot + * + * 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. + * + */ + + +#include "DispersionControls.h" +#include "Dispersion.h" + +#include + +namespace lmms +{ + +DispersionControls::DispersionControls(DispersionEffect* effect) : + EffectControls(effect), + m_effect(effect), + m_amountModel(0, 0, MAX_DISPERSION_FILTERS, this, tr("Amount")), + m_freqModel(200, 20, 20000, 0.001, this, tr("Frequency")), + m_resoModel(0.707, 0.01, 8, 0.0001, this, tr("Resonance")), + m_feedbackModel(0.f, -1.f, 1.f, 0.0001, this, tr("Feedback")), + m_dcModel(false, this, tr("DC Offset Removal")) +{ + m_freqModel.setScaleLogarithmic(true); + m_resoModel.setScaleLogarithmic(true); +} + + + +void DispersionControls::loadSettings(const QDomElement& parent) +{ + m_amountModel.loadSettings(parent, "amount"); + m_freqModel.loadSettings(parent, "freq"); + m_resoModel.loadSettings(parent, "reso"); + m_feedbackModel.loadSettings(parent, "feedback"); + m_dcModel.loadSettings(parent, "dc"); +} + + + + +void DispersionControls::saveSettings(QDomDocument& doc, QDomElement& parent) +{ + m_amountModel.saveSettings(doc, parent, "amount"); + m_freqModel.saveSettings(doc, parent, "freq"); + m_resoModel.saveSettings(doc, parent, "reso"); + m_feedbackModel.saveSettings(doc, parent, "feedback"); + m_dcModel.saveSettings(doc, parent, "dc"); +} + + +} // namespace lmms + + diff --git a/plugins/Dispersion/DispersionControls.h b/plugins/Dispersion/DispersionControls.h new file mode 100644 index 000000000..e815e1115 --- /dev/null +++ b/plugins/Dispersion/DispersionControls.h @@ -0,0 +1,81 @@ +/* + * DispersionControls.h + * + * Copyright (c) 2023 Lost Robot + * + * 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 LMMS_DISPERSION_CONTROLS_H +#define LMMS_DISPERSION_CONTROLS_H + +#include "DispersionControlDialog.h" +#include "EffectControls.h" + +namespace lmms +{ + +class DispersionEffect; + +namespace gui +{ +class DispersionControlDialog; +} + + +class DispersionControls : public EffectControls +{ + Q_OBJECT +public: + DispersionControls(DispersionEffect* effect); + ~DispersionControls() override = default; + + void saveSettings(QDomDocument & doc, QDomElement & parent) override; + void loadSettings(const QDomElement & parent) override; + inline QString nodeName() const override + { + return "DispersionControls"; + } + + int controlCount() override + { + return 5; + } + + gui::EffectControlDialog* createView() override + { + return new gui::DispersionControlDialog(this); + } + +private: + DispersionEffect* m_effect; + IntModel m_amountModel; + FloatModel m_freqModel; + FloatModel m_resoModel; + FloatModel m_feedbackModel; + BoolModel m_dcModel; + + friend class gui::DispersionControlDialog; + friend class DispersionEffect; +}; + + +} // namespace lmms + +#endif // LMMS_DISPERSION_CONTROLS_H diff --git a/plugins/Dispersion/artwork.png b/plugins/Dispersion/artwork.png new file mode 100644 index 000000000..17e3b9a11 Binary files /dev/null and b/plugins/Dispersion/artwork.png differ diff --git a/plugins/Dispersion/dc_active.png b/plugins/Dispersion/dc_active.png new file mode 100644 index 000000000..d9c8c9378 Binary files /dev/null and b/plugins/Dispersion/dc_active.png differ diff --git a/plugins/Dispersion/dc_inactive.png b/plugins/Dispersion/dc_inactive.png new file mode 100644 index 000000000..9a0ee0693 Binary files /dev/null and b/plugins/Dispersion/dc_inactive.png differ diff --git a/plugins/Dispersion/logo.png b/plugins/Dispersion/logo.png new file mode 100644 index 000000000..9340da708 Binary files /dev/null and b/plugins/Dispersion/logo.png differ diff --git a/plugins/DualFilter/DualFilter.cpp b/plugins/DualFilter/DualFilter.cpp index 75a2ab532..e510109e9 100644 --- a/plugins/DualFilter/DualFilter.cpp +++ b/plugins/DualFilter/DualFilter.cpp @@ -134,8 +134,8 @@ bool DualFilterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames const bool enabled1 = m_dfControls.m_enabled1Model.value(); const bool enabled2 = m_dfControls.m_enabled2Model.value(); - - + + // buffer processing loop for( fpp_t f = 0; f < frames; ++f ) @@ -145,9 +145,9 @@ bool DualFilterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames const float mix1 = 1.0f - mix2; const float gain1 = *gain1Ptr * 0.01f; const float gain2 = *gain2Ptr * 0.01f; - sample_t s[2] = { 0.0f, 0.0f }; // mix - sample_t s1[2] = { buf[f][0], buf[f][1] }; // filter 1 - sample_t s2[2] = { buf[f][0], buf[f][1] }; // filter 2 + auto s = std::array{0.0f, 0.0f}; // mix + auto s1 = std::array{buf[f][0], buf[f][1]}; // filter 1 + auto s2 = std::array{buf[f][0], buf[f][1]}; // filter 2 // update filter 1 if( enabled1 ) diff --git a/plugins/DynamicsProcessor/DynamicsProcessor.cpp b/plugins/DynamicsProcessor/DynamicsProcessor.cpp index c8ad9a029..54f1f0c50 100644 --- a/plugins/DynamicsProcessor/DynamicsProcessor.cpp +++ b/plugins/DynamicsProcessor/DynamicsProcessor.cpp @@ -105,17 +105,17 @@ bool DynProcEffect::processAudioBuffer( sampleFrame * _buf, // variables for effect int i = 0; - float sm_peak[2] = { 0.0f, 0.0f }; + auto sm_peak = std::array{0.0f, 0.0f}; float gain; double out_sum = 0.0; const float d = dryLevel(); const float w = wetLevel(); - + const int stereoMode = m_dpControls.m_stereomodeModel.value(); const float inputGain = m_dpControls.m_inputModel.value(); const float outputGain = m_dpControls.m_outputModel.value(); - + const float * samples = m_dpControls.m_wavegraphModel.samples(); // debug code @@ -143,7 +143,7 @@ bool DynProcEffect::processAudioBuffer( sampleFrame * _buf, for( fpp_t f = 0; f < _frames; ++f ) { - double s[2] = { _buf[f][0], _buf[f][1] }; + auto s = std::array{_buf[f][0], _buf[f][1]}; // apply input gain s[0] *= inputGain; @@ -211,7 +211,7 @@ bool DynProcEffect::processAudioBuffer( sampleFrame * _buf, gain = samples[199]; }; - s[i] *= gain; + s[i] *= gain; s[i] /= sm_peak[i]; } } diff --git a/plugins/DynamicsProcessor/DynamicsProcessorControls.cpp b/plugins/DynamicsProcessor/DynamicsProcessorControls.cpp index f4bd8c77a..541031a3f 100644 --- a/plugins/DynamicsProcessor/DynamicsProcessorControls.cpp +++ b/plugins/DynamicsProcessor/DynamicsProcessorControls.cpp @@ -116,7 +116,7 @@ void DynProcControls::saveSettings( QDomDocument & _doc, void DynProcControls::setDefaultShape() { - float shp [200] = { }; + auto shp = std::array{}; for ( int i = 0; i<200; i++) { shp[i] = ((float)i + 1.0f) / 200.0f; diff --git a/plugins/Eq/EqControls.cpp b/plugins/Eq/EqControls.cpp index ad1ffa2ac..04fb9bd3a 100644 --- a/plugins/Eq/EqControls.cpp +++ b/plugins/Eq/EqControls.cpp @@ -46,12 +46,12 @@ EqControls::EqControls( EqEffect *effect ) : m_para4GainModel( 0.0 , -18, 18, 0.001, this, tr( "Peak 4 gain" ) ), m_highShelfGainModel( 0.0 , -18, 18, 0.001, this, tr( "High-shelf gain" ) ), m_hpResModel( 0.707,0.003, 10.0 , 0.001, this, tr( "HP res" ) ), - m_lowShelfResModel( 1.4,0.55, 10.0 , 0.001, this , tr( "Low-shelf res" ) ), + m_lowShelfResModel( 0.707, 0.55, 10.0 , 0.001, this , tr( "Low-shelf res" ) ), m_para1BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 1 BW" ) ), m_para2BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 2 BW" ) ), m_para3BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 3 BW" ) ), m_para4BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 4 BW" ) ), - m_highShelfResModel( 1.4, 0.55, 10.0 , 0.001, this , tr( "High-shelf res" ) ), + m_highShelfResModel( 0.707, 0.55, 10.0 , 0.001, this , tr( "High-shelf res" ) ), m_lpResModel( 0.707,0.003, 10.0 , 0.001, this , tr( "LP res" ) ), m_hpFeqModel( 31.0, 20.0, 20000, 0.001, this , tr( "HP freq" ) ), m_lowShelfFreqModel( 80.0, 20.0, 20000, 0.001, this , tr( "Low-shelf freq" ) ), diff --git a/plugins/Eq/EqCurve.cpp b/plugins/Eq/EqCurve.cpp index 704231284..b9fa3f519 100644 --- a/plugins/Eq/EqCurve.cpp +++ b/plugins/Eq/EqCurve.cpp @@ -316,8 +316,7 @@ float EqHandle::getLowCutCurve( float x ) double c = cosf( w0 ); double s = sinf( w0 ); double resonance = getResonance(); - double A = pow( 10, yPixelToGain( EqHandle::y(), m_heigth, m_pixelsPerUnitHeight ) / 20); - double alpha = s / 2 * sqrt ( ( A +1/A ) * ( 1 / resonance -1 ) +2 ); + double alpha = s / (2 * resonance); double a0, a1, a2, b0, b1, b2; // coeffs to calculate b0 = ( 1 + c ) * 0.5; @@ -360,8 +359,7 @@ float EqHandle::getHighCutCurve( float x ) double c = cosf( w0 ); double s = sinf( w0 ); double resonance = getResonance(); - double A = pow( 10, yPixelToGain( EqHandle::y(), m_heigth, m_pixelsPerUnitHeight ) / 20 ); - double alpha = s / 2 * sqrt ( ( A + 1 / A ) * ( 1 / resonance -1 ) +2 ); + double alpha = s / (2 * resonance); double a0, a1, a2, b0, b1, b2; // coeffs to calculate b0 = ( 1 - c ) * 0.5; diff --git a/plugins/Eq/EqEffect.cpp b/plugins/Eq/EqEffect.cpp index be74defba..eb168a9f9 100644 --- a/plugins/Eq/EqEffect.cpp +++ b/plugins/Eq/EqEffect.cpp @@ -71,7 +71,7 @@ bool EqEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames ) //wet/dry controls const float dry = dryLevel(); const float wet = wetLevel(); - sample_t dryS[2]; + auto dryS = std::array{}; // setup sample exact controls float hpRes = m_eqControls.m_hpResModel.value(); float lowShelfRes = m_eqControls.m_lowShelfResModel.value(); diff --git a/plugins/Flanger/FlangerEffect.cpp b/plugins/Flanger/FlangerEffect.cpp index 982702ebe..9f7200f0e 100644 --- a/plugins/Flanger/FlangerEffect.cpp +++ b/plugins/Flanger/FlangerEffect.cpp @@ -24,6 +24,9 @@ #include "FlangerEffect.h" #include "Engine.h" +#include "MonoDelay.h" +#include "Noise.h" +#include "QuadratureLfo.h" #include "embed.h" #include "plugin_export.h" @@ -104,7 +107,7 @@ bool FlangerEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames ) m_lfo->setOffset( m_flangerControls.m_lfoPhaseModel.value() / 180 * D_PI ); m_lDelay->setFeedback( m_flangerControls.m_feedbackModel.value() ); m_rDelay->setFeedback( m_flangerControls.m_feedbackModel.value() ); - sample_t dryS[2]; + auto dryS = std::array{}; float leftLfo; float rightLfo; for( fpp_t f = 0; f < frames; ++f ) diff --git a/plugins/Flanger/FlangerEffect.h b/plugins/Flanger/FlangerEffect.h index 45dd5cafd..8428d89a3 100644 --- a/plugins/Flanger/FlangerEffect.h +++ b/plugins/Flanger/FlangerEffect.h @@ -28,17 +28,14 @@ #include "Effect.h" #include "FlangerControls.h" -#include "MonoDelay.h" -#include "Noise.h" -#include "QuadratureLfo.h" + +namespace lmms +{ class MonoDelay; class Noise; class QuadratureLfo; -namespace lmms -{ - class FlangerEffect : public Effect { diff --git a/plugins/FreeBoy/CMakeLists.txt b/plugins/FreeBoy/CMakeLists.txt index fb5093ee0..485ed3cc2 100644 --- a/plugins/FreeBoy/CMakeLists.txt +++ b/plugins/FreeBoy/CMakeLists.txt @@ -4,8 +4,8 @@ INCLUDE_DIRECTORIES(game-music-emu/gme) BUILD_PLUGIN(freeboy FreeBoy.cpp FreeBoy.h - Gb_Apu_Buffer.cpp - Gb_Apu_Buffer.h + GbApuWrapper.cpp + GbApuWrapper.h game-music-emu/gme/Gb_Apu.cpp game-music-emu/gme/Gb_Apu.h game-music-emu/gme/Gb_Oscs.cpp diff --git a/plugins/FreeBoy/FreeBoy.cpp b/plugins/FreeBoy/FreeBoy.cpp index e5ded87ee..1fd3f2513 100644 --- a/plugins/FreeBoy/FreeBoy.cpp +++ b/plugins/FreeBoy/FreeBoy.cpp @@ -2,7 +2,7 @@ * FreeBoy.cpp - GameBoy papu based instrument * * Copyright (c) 2008 Attila Herman - * Csaba Hruska + * Csaba Hruska * * This file is part of LMMS - https://lmms.io * @@ -23,11 +23,12 @@ * */ -#include - -#include #include "FreeBoy.h" -#include "Gb_Apu_Buffer.h" + +#include +#include + +#include "GbApuWrapper.h" #include "base64.h" #include "InstrumentTrack.h" #include "Knob.h" @@ -45,8 +46,11 @@ namespace lmms { -const blip_time_t FRAME_LENGTH = 70224; -const long CLOCK_RATE = 4194304; +namespace +{ +constexpr blip_time_t FRAME_LENGTH = 70224; +constexpr long CLOCK_RATE = 4194304; +} extern "C" { @@ -118,9 +122,7 @@ FreeBoyInstrument::FreeBoyInstrument( InstrumentTrack * _instrument_track ) : m_trebleModel( -20.0f, -100.0f, 200.0f, 1.0f, this, tr( "Treble" ) ), m_bassModel( 461.0f, -1.0f, 600.0f, 1.0f, this, tr( "Bass" ) ), - m_graphModel( 0, 15, 32, this, false, 1 ), - - m_time(0) + m_graphModel( 0, 15, 32, this, false, 1 ) { } @@ -238,189 +240,193 @@ f_cnt_t FreeBoyInstrument::desiredReleaseFrames() const -void FreeBoyInstrument::playNote( NotePlayHandle * _n, - sampleFrame * _working_buffer ) +void FreeBoyInstrument::playNote(NotePlayHandle* nph, sampleFrame* workingBuffer) { - const f_cnt_t tfp = _n->totalFramesPlayed(); + const f_cnt_t tfp = nph->totalFramesPlayed(); const int samplerate = Engine::audioEngine()->processingSampleRate(); - const fpp_t frames = _n->framesLeftForCurrentPeriod(); - const f_cnt_t offset = _n->noteOffset(); + const fpp_t frames = nph->framesLeftForCurrentPeriod(); + const f_cnt_t offset = nph->noteOffset(); int data = 0; - int freq = _n->frequency(); + int freq = nph->frequency(); if ( tfp == 0 ) { - auto papu = new Gb_Apu_Buffer(); - papu->set_sample_rate( samplerate, CLOCK_RATE ); + auto papu = new GbApuWrapper{}; + papu->setSampleRate(samplerate, CLOCK_RATE); // Master sound circuitry power control - papu->write_register( fakeClock(), 0xff26, 0x80 ); + papu->writeRegister(0xff26, 0x80); data = m_ch1VolumeModel.value(); - data = data<<1; + data = data << 1; data += m_ch1VolSweepDirModel.value(); - data = data<<3; + data = data << 3; data += m_ch1SweepStepLengthModel.value(); - papu->write_register( fakeClock(), 0xff12, data ); + papu->writeRegister(0xff12, data); data = m_ch2VolumeModel.value(); - data = data<<1; + data = data << 1; data += m_ch2VolSweepDirModel.value(); - data = data<<3; + data = data << 3; data += m_ch2SweepStepLengthModel.value(); - papu->write_register( fakeClock(), 0xff17, data ); + papu->writeRegister(0xff17, data); //channel 4 - noise data = m_ch4VolumeModel.value(); - data = data<<1; + data = data << 1; data += m_ch4VolSweepDirModel.value(); - data = data<<3; + data = data << 3; data += m_ch4SweepStepLengthModel.value(); - papu->write_register( fakeClock(), 0xff21, data ); + papu->writeRegister(0xff21, data); - _n->m_pluginData = papu; + nph->m_pluginData = papu; } - auto papu = static_cast(_n->m_pluginData); + auto papu = static_cast(nph->m_pluginData); - papu->treble_eq( m_trebleModel.value() ); - papu->bass_freq( m_bassModel.value() ); + papu->trebleEq(m_trebleModel.value()); + papu->bassFreq(m_bassModel.value()); //channel 1 - square data = m_ch1SweepTimeModel.value(); - data = data<<1; + data = data << 1; data += m_ch1SweepDirModel.value(); data = data << 3; data += m_ch1SweepRtShiftModel.value(); - papu->write_register( fakeClock(), 0xff10, data ); + papu->writeRegister(0xff10, data); data = m_ch1WavePatternDutyModel.value(); - data = data<<6; - papu->write_register( fakeClock(), 0xff11, data ); - + data = data << 6; + papu->writeRegister(0xff11, data); //channel 2 - square data = m_ch2WavePatternDutyModel.value(); - data = data<<6; - papu->write_register( fakeClock(), 0xff16, data ); - + data = data << 6; + papu->writeRegister(0xff16, data); //channel 3 - wave - //data = m_ch3OnModel.value()?128:0; + //data = m_ch3OnModel.value() ? 128 : 0; data = 128; - papu->write_register( fakeClock(), 0xff1a, data ); + papu->writeRegister(0xff1a, data); - int ch3voldata[4] = { 0, 3, 2, 1 }; + auto ch3voldata = std::array{0, 3, 2, 1}; data = ch3voldata[(int)m_ch3VolumeModel.value()]; - data = data<<5; - papu->write_register( fakeClock(), 0xff1c, data ); - + data = data << 5; + papu->writeRegister(0xff1c, data); //controls data = m_so1VolumeModel.value(); - data = data<<4; + data = data << 4; data += m_so2VolumeModel.value(); - papu->write_register( fakeClock(), 0xff24, data ); + papu->writeRegister(0xff24, data); - data = m_ch4So2Model.value()?128:0; - data += m_ch3So2Model.value()?64:0; - data += m_ch2So2Model.value()?32:0; - data += m_ch1So2Model.value()?16:0; - data += m_ch4So1Model.value()?8:0; - data += m_ch3So1Model.value()?4:0; - data += m_ch2So1Model.value()?2:0; - data += m_ch1So1Model.value()?1:0; - papu->write_register( fakeClock(), 0xff25, data ); + data = m_ch4So2Model.value() ? 128 : 0; + data += m_ch3So2Model.value() ? 64 : 0; + data += m_ch2So2Model.value() ? 32 : 0; + data += m_ch1So2Model.value() ? 16 : 0; + data += m_ch4So1Model.value() ? 8 : 0; + data += m_ch3So1Model.value() ? 4 : 0; + data += m_ch2So1Model.value() ? 2 : 0; + data += m_ch1So1Model.value() ? 1 : 0; + papu->writeRegister(0xff25, data); - const float * wpm = m_graphModel.samples(); + const float* wpm = m_graphModel.samples(); - for( char i=0; i<16; i++ ) + for (char i = 0; i < 16; ++i) { - data = (int)floor(wpm[i*2]) << 4; - data += (int)floor(wpm[i*2+1]); - papu->write_register( fakeClock(), 0xff30 + i, data ); + data = static_cast(std::floor(wpm[i * 2])) << 4; + data += static_cast(std::floor(wpm[(i * 2) + 1])); + papu->writeRegister(0xff30 + i, data); } - if( ( freq >= 65 ) && ( freq <=4000 ) ) + if ((freq >= 65) && (freq <= 4000)) { - int initflag = (tfp==0)?128:0; - // Hz = 4194304 / ( ( 2048 - ( 11-bit-freq ) ) << 5 ) - data = 2048 - ( ( 4194304 / freq )>>5 ); - if( tfp==0 ) + int initFlag = (tfp == 0) ? 128 : 0; + // Hz = 4194304 / ((2048 - (11-bit-freq)) << 5) + data = 2048 - ((4194304 / freq) >> 5); + if (tfp == 0) { - papu->write_register( fakeClock(), 0xff13, data & 0xff ); - papu->write_register( fakeClock(), 0xff14, (data>>8) | initflag ); + papu->writeRegister(0xff13, data & 0xff); + papu->writeRegister(0xff14, (data >> 8) | initFlag); } - papu->write_register( fakeClock(), 0xff18, data & 0xff ); - papu->write_register( fakeClock(), 0xff19, (data>>8) | initflag ); - papu->write_register( fakeClock(), 0xff1d, data & 0xff ); - papu->write_register( fakeClock(), 0xff1e, (data>>8) | initflag ); + papu->writeRegister(0xff18, data & 0xff); + papu->writeRegister(0xff19, (data >> 8) | initFlag); + papu->writeRegister(0xff1d, data & 0xff); + papu->writeRegister(0xff1e, (data >> 8) | initFlag); } - if( tfp == 0 ) + if (tfp == 0) { - //PRNG Frequency = (1048576 Hz / (ratio + 1)) / 2 ^ (shiftclockfreq + 1) - char sopt=0; - char ropt=1; - float fopt = 524288.0 / ( ropt * pow( 2.0, sopt + 1.0 ) ); - float f; - for ( char s=0; s<16; s++ ) - for ( char r=0; r<8; r++ ) { - f = 524288.0 / ( r * pow( 2.0, s + 1.0 ) ); - if( fabs( freq-fopt ) > fabs( freq-f ) ) { - fopt = f; - ropt = r; - sopt = s; + // Initialize noise channel... + // PRNG Frequency = (1048576 Hz / (ratio + 1)) / 2 ^ (shiftclockfreq + 1) + // When div_ratio = 0 the ratio should be 0.5. Since s = 0 is the only case where r = 0 gives + // a unique frequency, we can start by guessing s = r = 0 here and then skip r = 0 in the loop. + char clock_freq = 0; + char div_ratio = 0; + float closest_freq = 524288.0 / (0.5 * std::pow(2.0, clock_freq + 1.0)); + // This nested for loop iterates over all possible combinations of clock frequency and dividing + // ratio and chooses the combination whose resulting frequency is closest to the note frequency + for (char s = 0; s < 16; ++s) + { + for (char r = 1; r < 8; ++r) + { + float f = 524288.0 / (r * std::pow(2.0, s + 1.0)); + if (std::fabs(freq - closest_freq) > std::fabs(freq - f)) + { + closest_freq = f; + div_ratio = r; + clock_freq = s; + } } } - data = sopt; + + data = clock_freq; data = data << 1; data += m_ch4ShiftRegWidthModel.value(); data = data << 3; - data += ropt; - papu->write_register( fakeClock(), 0xff22, data ); + data += div_ratio; + papu->writeRegister(0xff22, data); //channel 4 init - papu->write_register( fakeClock(), 0xff23, 128 ); + papu->writeRegister(0xff23, 128); } - int const buf_size = 2048; - int framesleft = frames; - int datalen = 0; - blip_sample_t buf [buf_size*2]; - while( framesleft > 0 ) + constexpr int bufSize = 2048; + int framesLeft = frames; + int dataLen = 0; + auto buf = std::array{}; + while (framesLeft > 0) { - int avail = papu->samples_avail(); - if( avail <= 0 ) + int avail = papu->samplesAvail(); + if (avail <= 0) { - m_time = 0; - papu->end_frame(FRAME_LENGTH); - avail = papu->samples_avail(); + papu->endFrame(FRAME_LENGTH); + avail = papu->samplesAvail(); } - datalen = framesleft>avail?avail:framesleft; - datalen = datalen>buf_size?buf_size:datalen; + dataLen = framesLeft > avail ? avail : framesLeft; + dataLen = dataLen > bufSize ? bufSize : dataLen; - long count = papu->read_samples( buf, datalen*2)/2; + long count = papu->readSamples(buf.data(), dataLen * 2) / 2; - for( fpp_t frame = 0; frame < count; ++frame ) + for (fpp_t frame = 0; frame < count; ++frame) { - for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch ) + for (ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch) { - sample_t s = float(buf[frame*2+ch])/32768.0; - _working_buffer[frames-framesleft+frame+offset][ch] = s; + sample_t s = static_cast(buf[(frame * 2) + ch]) / 32768.0f; + workingBuffer[frames - framesLeft + frame + offset][ch] = s; } } - framesleft -= count; + framesLeft -= count; } - instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n ); + instrumentTrack()->processAudioBuffer(workingBuffer, frames + offset, nph); } -void FreeBoyInstrument::deleteNotePluginData( NotePlayHandle * _n ) +void FreeBoyInstrument::deleteNotePluginData(NotePlayHandle* nph) { - delete static_cast( _n->m_pluginData ); + delete static_cast(nph->m_pluginData); } @@ -736,4 +742,4 @@ PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * ) } -} // namespace lmms \ No newline at end of file +} // namespace lmms diff --git a/plugins/FreeBoy/FreeBoy.h b/plugins/FreeBoy/FreeBoy.h index aecd2b188..747305414 100644 --- a/plugins/FreeBoy/FreeBoy.h +++ b/plugins/FreeBoy/FreeBoy.h @@ -1,8 +1,8 @@ /* - * FreeBoyInstrument.h - GameBoy papu based instrument + * FreeBoy.h - GameBoy papu based instrument * - * Copyright (c) 2008 - * Csaba Hruska + * Copyright (c) 2008 Attila Herman + * Csaba Hruska * * This file is part of LMMS - https://lmms.io * @@ -23,8 +23,8 @@ * */ -#ifndef FREEBOY_H -#define FREEBOY_H +#ifndef LMMS_FREEBOY_H +#define LMMS_FREEBOY_H #include "AutomatableModel.h" #include "Blip_Buffer.h" @@ -54,10 +54,8 @@ public: FreeBoyInstrument( InstrumentTrack * _instrument_track ); ~FreeBoyInstrument() override = default; - void playNote( NotePlayHandle * _n, - sampleFrame * _working_buffer ) override; - void deleteNotePluginData( NotePlayHandle * _n ) override; - + void playNote(NotePlayHandle* nph, sampleFrame* workingBuffer) override; + void deleteNotePluginData(NotePlayHandle* nph) override; void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override; void loadSettings( const QDomElement & _this ) override; @@ -112,12 +110,8 @@ private: graphModel m_graphModel; - // Fake CPU timing - blip_time_t m_time; - blip_time_t fakeClock() { return m_time += 4; } - friend class gui::FreeBoyInstrumentView; -} ; +}; namespace gui @@ -172,11 +166,11 @@ private: /*protected slots: void updateKnobHint(); void updateKnobToolTip();*/ -} ; +}; } // namespace gui } // namespace lmms -#endif +#endif // LMMS_FREEBOY_H diff --git a/plugins/FreeBoy/Gb_Apu_Buffer.cpp b/plugins/FreeBoy/GbApuWrapper.cpp similarity index 57% rename from plugins/FreeBoy/Gb_Apu_Buffer.cpp rename to plugins/FreeBoy/GbApuWrapper.cpp index ec1a36479..790cf96e2 100644 --- a/plugins/FreeBoy/Gb_Apu_Buffer.cpp +++ b/plugins/FreeBoy/GbApuWrapper.cpp @@ -1,7 +1,7 @@ /* - * Gb_Apu_Buffer.cpp - Gb_Apu subclass which allows direct buffer access + * GbApuWrapper.cpp - Gb_Apu subclass which allows direct buffer access * Copyright (c) 2017 Tres Finocchiaro - * + * * This file is part of LMMS - https://lmms.io * * This program is free software; you can redistribute it and/or @@ -20,37 +20,45 @@ * Boston, MA 02110-1301 USA. * */ -#include "Gb_Apu_Buffer.h" + +#include "GbApuWrapper.h" namespace lmms { -void Gb_Apu_Buffer::end_frame(blip_time_t end_time) { - Gb_Apu::end_frame(end_time); - m_buf.end_frame(end_time); +// Sets specified sample rate and clock rate in Stereo_Buffer +blargg_err_t GbApuWrapper::setSampleRate(long sampleRate, long clockRate) +{ + Gb_Apu::output(m_buf.center(), m_buf.left(), m_buf.right()); + m_buf.clock_rate(clockRate); + return m_buf.set_sample_rate(sampleRate); } -// Sets specified sample rate and clock rate in Multi_Buffer -blargg_err_t Gb_Apu_Buffer::set_sample_rate(long sample_rate, long clock_rate) { - Gb_Apu_Buffer::output(m_buf.center(), m_buf.left(), m_buf.right()); - m_buf.clock_rate(clock_rate); - return m_buf.set_sample_rate(sample_rate); -} - -// Wrap Multi_Buffer::samples_avail() -long Gb_Apu_Buffer::samples_avail() const { +// Wrap Stereo_Buffer::samples_avail() +long GbApuWrapper::samplesAvail() const +{ return m_buf.samples_avail(); } -// Wrap Multi_Buffer::read_samples(...) -long Gb_Apu_Buffer::read_samples(sample_t* out, long count) { +// Wrap Stereo_Buffer::read_samples(...) +long GbApuWrapper::readSamples(blip_sample_t* out, long count) +{ return m_buf.read_samples(out, count); } -void Gb_Apu_Buffer::bass_freq(int freq) { +// Wrap Stereo_Buffer::bass_freq(...) +void GbApuWrapper::bassFreq(int freq) +{ m_buf.bass_freq(freq); } +void GbApuWrapper::endFrame(blip_time_t endTime) +{ + m_time = 0; + Gb_Apu::end_frame(endTime); + m_buf.end_frame(endTime); +} + } // namespace lmms diff --git a/plugins/FreeBoy/Gb_Apu_Buffer.h b/plugins/FreeBoy/GbApuWrapper.h similarity index 59% rename from plugins/FreeBoy/Gb_Apu_Buffer.h rename to plugins/FreeBoy/GbApuWrapper.h index 760e0920d..493a28731 100644 --- a/plugins/FreeBoy/Gb_Apu_Buffer.h +++ b/plugins/FreeBoy/GbApuWrapper.h @@ -1,7 +1,7 @@ /* - * Gb_Apu_Buffer.cpp - Gb_Apu subclass which allows direct buffer access + * GbApuWrapper.h - Gb_Apu subclass which allows direct buffer access * Copyright (c) 2017 Tres Finocchiaro - * + * * This file is part of LMMS - https://lmms.io * * This program is free software; you can redistribute it and/or @@ -20,8 +20,9 @@ * Boston, MA 02110-1301 USA. * */ -#ifndef GB_APU_BUFFER_H -#define GB_APU_BUFFER_H + +#ifndef LMMS_GB_APU_WRAPPER_H +#define LMMS_GB_APU_WRAPPER_H #include "Gb_Apu.h" #include "Multi_Buffer.h" @@ -31,25 +32,30 @@ namespace lmms { -class Gb_Apu_Buffer : public Gb_Apu { +class GbApuWrapper : private Gb_Apu +{ MM_OPERATORS public: - Gb_Apu_Buffer() = default; - ~Gb_Apu_Buffer() = default; + GbApuWrapper() = default; + ~GbApuWrapper() = default; - void end_frame(blip_time_t); + blargg_err_t setSampleRate(long sampleRate, long clockRate); + void writeRegister(unsigned addr, int data) { Gb_Apu::write_register(fakeClock(), addr, data); } + long samplesAvail() const; + long readSamples(blip_sample_t* out, long count); + void trebleEq(const blip_eq_t& eq) { Gb_Apu::treble_eq(eq); } + void bassFreq(int freq); + void endFrame(blip_time_t endTime); - blargg_err_t set_sample_rate(long sample_rate, long clock_rate); - long samples_avail() const; - using sample_t = blip_sample_t; - long read_samples(sample_t* out, long count); - void bass_freq(int freq); private: Stereo_Buffer m_buf; + + // Fake CPU timing + blip_time_t fakeClock() { return m_time += 4; } + blip_time_t m_time = 0; }; } // namespace lmms -#endif - +#endif // LMMS_GB_APU_WRAPPER_H diff --git a/plugins/LadspaBrowser/LadspaBrowser.cpp b/plugins/LadspaBrowser/LadspaBrowser.cpp index 714b3887c..09f83ab4e 100644 --- a/plugins/LadspaBrowser/LadspaBrowser.cpp +++ b/plugins/LadspaBrowser/LadspaBrowser.cpp @@ -98,7 +98,7 @@ LadspaBrowserView::LadspaBrowserView( ToolPlugin * _tool ) : { auto hlayout = new QHBoxLayout(this); hlayout->setSpacing( 0 ); - hlayout->setMargin( 0 ); + hlayout->setContentsMargins(0, 0, 0, 0); m_tabBar = new TabBar( this, QBoxLayout::TopToBottom ); m_tabBar->setExclusive( true ); @@ -166,7 +166,7 @@ QWidget * LadspaBrowserView::createTab( QWidget * _parent, const QString & _txt, tab->setFixedSize( 500, 400 ); auto layout = new QVBoxLayout(tab); layout->setSpacing( 0 ); - layout->setMargin( 0 ); + layout->setContentsMargins(0, 0, 0, 0); const QString type = "" + tr( "Type:" ) + " "; auto title = new QLabel(type + _txt, tab); diff --git a/plugins/LadspaBrowser/LadspaDescription.cpp b/plugins/LadspaBrowser/LadspaDescription.cpp index ff4d74867..004505d66 100644 --- a/plugins/LadspaBrowser/LadspaDescription.cpp +++ b/plugins/LadspaBrowser/LadspaDescription.cpp @@ -94,7 +94,7 @@ LadspaDescription::LadspaDescription( QWidget * _parent, auto descriptionBox = new QGroupBox(tr("Description"), this); auto descriptionLayout = new QVBoxLayout(descriptionBox); descriptionLayout->setSpacing( 0 ); - descriptionLayout->setMargin( 0 ); + descriptionLayout->setContentsMargins(0, 0, 0, 0); m_scrollArea = new QScrollArea( descriptionBox ); descriptionLayout->addWidget( m_scrollArea ); @@ -130,7 +130,7 @@ void LadspaDescription::update( const ladspa_key_t & _key ) auto maker = new QWidget(description); auto makerLayout = new QHBoxLayout(maker); - makerLayout->setMargin( 0 ); + makerLayout->setContentsMargins(0, 0, 0, 0); makerLayout->setSpacing( 0 ); layout->addWidget( maker ); @@ -145,7 +145,7 @@ void LadspaDescription::update( const ladspa_key_t & _key ) auto copyright = new QWidget(description); auto copyrightLayout = new QHBoxLayout(copyright); - copyrightLayout->setMargin( 0 ); + copyrightLayout->setContentsMargins(0, 0, 0, 0); copyrightLayout->setSpacing( 0 ); layout->addWidget( copyright ); diff --git a/plugins/LadspaBrowser/LadspaPortDialog.cpp b/plugins/LadspaBrowser/LadspaPortDialog.cpp index 3c0dbabd5..e25679511 100644 --- a/plugins/LadspaBrowser/LadspaPortDialog.cpp +++ b/plugins/LadspaBrowser/LadspaPortDialog.cpp @@ -47,7 +47,7 @@ LadspaPortDialog::LadspaPortDialog( const ladspa_key_t & _key ) auto vlayout = new QVBoxLayout(this); vlayout->setSpacing( 0 ); - vlayout->setMargin( 0 ); + vlayout->setContentsMargins(0, 0, 0, 0); int pc = manager->getPortCount( _key ); diff --git a/plugins/LadspaEffect/LadspaEffect.cpp b/plugins/LadspaEffect/LadspaEffect.cpp index 572d60cd8..e5d1c5d69 100644 --- a/plugins/LadspaEffect/LadspaEffect.cpp +++ b/plugins/LadspaEffect/LadspaEffect.cpp @@ -130,7 +130,7 @@ void LadspaEffect::changeSampleRate() -bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, +bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames ) { m_pluginMutex.lock(); @@ -154,7 +154,7 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, } // Copy the LMMS audio buffer to the LADSPA input buffer and initialize - // the control ports. + // the control ports. ch_cnt_t channel = 0; for( ch_cnt_t proc = 0; proc < processorCount(); ++proc ) { @@ -164,10 +164,10 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, switch( pp->rate ) { case CHANNEL_IN: - for( fpp_t frame = 0; + for( fpp_t frame = 0; frame < frames; ++frame ) { - pp->buffer[frame] = + pp->buffer[frame] = _buf[frame][channel]; } ++channel; @@ -181,15 +181,15 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, } else { - pp->value = static_cast( + pp->value = static_cast( pp->control->value() / pp->scale ); // This only supports control rate ports, so the audio rates are // treated as though they were control rate by setting the // port buffer to all the same value. - for( fpp_t frame = 0; + for( fpp_t frame = 0; frame < frames; ++frame ) { - pp->buffer[frame] = + pp->buffer[frame] = pp->value; } } @@ -200,9 +200,9 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, { break; } - pp->value = static_cast( + pp->value = static_cast( pp->control->value() / pp->scale ); - pp->buffer[0] = + pp->buffer[0] = pp->value; break; case CHANNEL_OUT: @@ -239,7 +239,7 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, case CONTROL_RATE_INPUT: break; case CHANNEL_OUT: - for( fpp_t frame = 0; + for( fpp_t frame = 0; frame < frames; ++frame ) { _buf[frame][channel] = d * _buf[frame][channel] + w * pp->buffer[frame]; @@ -303,7 +303,7 @@ void LadspaEffect::pluginInstantiation() int inputch = 0; int outputch = 0; - LADSPA_Data * inbuf [2]; + std::array inbuf; inbuf[0] = nullptr; inbuf[1] = nullptr; for( ch_cnt_t proc = 0; proc < processorCount(); proc++ ) @@ -463,9 +463,9 @@ void LadspaEffect::pluginInstantiation() ports.append( p ); - // For convenience, keep a separate list of the ports that are used + // For convenience, keep a separate list of the ports that are used // to control the processors. - if( p->rate == AUDIO_RATE_INPUT || + if( p->rate == AUDIO_RATE_INPUT || p->rate == CONTROL_RATE_INPUT ) { p->control_id = m_portControls.count(); @@ -479,7 +479,7 @@ void LadspaEffect::pluginInstantiation() m_descriptor = manager->getDescriptor( m_key ); if( m_descriptor == nullptr ) { - QMessageBox::warning( 0, "Effect", + QMessageBox::warning( 0, "Effect", "Can't get LADSPA descriptor function: " + m_key.second, QMessageBox::Ok, QMessageBox::NoButton ); setOkay( false ); @@ -518,8 +518,8 @@ void LadspaEffect::pluginInstantiation() port, pp->buffer ) ) { - QMessageBox::warning( 0, "Effect", - "Failed to connect port: " + m_key.second, + QMessageBox::warning( 0, "Effect", + "Failed to connect port: " + m_key.second, QMessageBox::Ok, QMessageBox::NoButton ); setDontRun( true ); return; diff --git a/plugins/LadspaEffect/LadspaSubPluginFeatures.cpp b/plugins/LadspaEffect/LadspaSubPluginFeatures.cpp index 8ab50858a..1522d7187 100644 --- a/plugins/LadspaEffect/LadspaSubPluginFeatures.cpp +++ b/plugins/LadspaEffect/LadspaSubPluginFeatures.cpp @@ -71,7 +71,7 @@ void LadspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent, auto maker = new QWidget(_parent); auto l = new QHBoxLayout(maker); - l->setMargin( 0 ); + l->setContentsMargins(0, 0, 0, 0); l->setSpacing( 0 ); auto maker_label = new QLabel(maker); @@ -85,7 +85,7 @@ void LadspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent, auto copyright = new QWidget(_parent); l = new QHBoxLayout( copyright ); - l->setMargin( 0 ); + l->setContentsMargins(0, 0, 0, 0); l->setSpacing( 0 ); copyright->setMinimumWidth( _parent->minimumWidth() ); diff --git a/plugins/Lv2Effect/Lv2Effect.cpp b/plugins/Lv2Effect/Lv2Effect.cpp index 1a25c718a..ec2dc1f48 100644 --- a/plugins/Lv2Effect/Lv2Effect.cpp +++ b/plugins/Lv2Effect/Lv2Effect.cpp @@ -1,7 +1,7 @@ /* * Lv2Effect.cpp - implementation of LV2 effect * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * diff --git a/plugins/Lv2Effect/Lv2Effect.h b/plugins/Lv2Effect/Lv2Effect.h index 521a7df74..3bcded355 100644 --- a/plugins/Lv2Effect/Lv2Effect.h +++ b/plugins/Lv2Effect/Lv2Effect.h @@ -1,7 +1,7 @@ /* * Lv2Effect.h - implementation of LV2 effect * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * diff --git a/plugins/Lv2Effect/Lv2FxControlDialog.cpp b/plugins/Lv2Effect/Lv2FxControlDialog.cpp index d10c01cd4..5265cb181 100644 --- a/plugins/Lv2Effect/Lv2FxControlDialog.cpp +++ b/plugins/Lv2Effect/Lv2FxControlDialog.cpp @@ -1,7 +1,7 @@ /* * Lv2FxControlDialog.cpp - Lv2FxControlDialog implementation * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -38,7 +38,7 @@ Lv2FxControlDialog::Lv2FxControlDialog(Lv2FxControls *controls) : { if (m_reloadPluginButton) { connect(m_reloadPluginButton, &QPushButton::clicked, - this, [this](){ lv2Controls()->reloadPlugin(); }); + this, [this](){ lv2Controls()->reload(); }); } if (m_toggleUIButton) { connect(m_toggleUIButton, &QPushButton::toggled, @@ -67,7 +67,9 @@ Lv2FxControls *Lv2FxControlDialog::lv2Controls() void Lv2FxControlDialog::modelChanged() { Lv2ViewBase::modelChanged(lv2Controls()); + connect(lv2Controls(), &Lv2FxControls::modelChanged, + this, [this](){ this->modelChanged();} ); } -} // namespace lmms::gui \ No newline at end of file +} // namespace lmms::gui diff --git a/plugins/Lv2Effect/Lv2FxControlDialog.h b/plugins/Lv2Effect/Lv2FxControlDialog.h index c749dc124..45c14c2c0 100644 --- a/plugins/Lv2Effect/Lv2FxControlDialog.h +++ b/plugins/Lv2Effect/Lv2FxControlDialog.h @@ -1,7 +1,7 @@ /* * Lv2FxControlDialog.h - Lv2FxControlDialog implementation * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -45,7 +45,7 @@ public: private: Lv2FxControls *lv2Controls(); - void modelChanged() override; + void modelChanged() final; }; diff --git a/plugins/Lv2Effect/Lv2FxControls.cpp b/plugins/Lv2Effect/Lv2FxControls.cpp index a865151dd..3ec7dbe23 100644 --- a/plugins/Lv2Effect/Lv2FxControls.cpp +++ b/plugins/Lv2Effect/Lv2FxControls.cpp @@ -1,7 +1,7 @@ /* * Lv2FxControls.cpp - Lv2FxControls implementation * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -41,13 +41,33 @@ Lv2FxControls::Lv2FxControls(class Lv2Effect *effect, const QString& uri) : if (isValid()) { connect(Engine::audioEngine(), &AudioEngine::sampleRateChanged, - this, [this](){Lv2ControlBase::reloadPlugin();}); + this, [this](){onSampleRateChanged();}); } } +void Lv2FxControls::reload() +{ + Lv2ControlBase::reload(); + emit modelChanged(); +} + + + + +void Lv2FxControls::onSampleRateChanged() +{ + // TODO: once lv2 options are implemented, + // plugins that support it might allow changing their samplerate + // through it instead of reloading + reload(); +} + + + + void Lv2FxControls::saveSettings(QDomDocument &doc, QDomElement &that) { Lv2ControlBase::saveSettings(doc, that); @@ -86,20 +106,4 @@ void Lv2FxControls::changeControl() // TODO: what is that? } - - -DataFile::Types Lv2FxControls::settingsType() -{ - return DataFile::EffectSettings; -} - - - - -void Lv2FxControls::setNameFromFile(const QString &name) -{ - effect()->setDisplayName(name); -} - - } // namespace lmms diff --git a/plugins/Lv2Effect/Lv2FxControls.h b/plugins/Lv2Effect/Lv2FxControls.h index 952e4db6c..9f3736292 100644 --- a/plugins/Lv2Effect/Lv2FxControls.h +++ b/plugins/Lv2Effect/Lv2FxControls.h @@ -1,7 +1,7 @@ /* * Lv2FxControls.h - Lv2FxControls implementation * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -43,8 +43,11 @@ class Lv2FxControlDialog; class Lv2FxControls : public EffectControls, public Lv2ControlBase { Q_OBJECT +signals: + void modelChanged(); public: Lv2FxControls(Lv2Effect *effect, const QString &uri); + void reload(); void saveSettings(QDomDocument &_doc, QDomElement &_parent) override; void loadSettings(const QDomElement &that) override; @@ -60,8 +63,7 @@ private slots: void changeControl(); private: - DataFile::Types settingsType() override; - void setNameFromFile(const QString &name) override; + void onSampleRateChanged(); friend class gui::Lv2FxControlDialog; friend class Lv2Effect; diff --git a/plugins/Lv2Instrument/Lv2Instrument.cpp b/plugins/Lv2Instrument/Lv2Instrument.cpp index ae7e37119..052445844 100644 --- a/plugins/Lv2Instrument/Lv2Instrument.cpp +++ b/plugins/Lv2Instrument/Lv2Instrument.cpp @@ -1,7 +1,7 @@ /* * Lv2Instrument.cpp - implementation of LV2 instrument * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -78,10 +78,12 @@ Lv2Instrument::Lv2Instrument(InstrumentTrack *instrumentTrackArg, { if (Lv2ControlBase::isValid()) { + clearRunningNotes(); + connect(instrumentTrack()->pitchRangeModel(), SIGNAL(dataChanged()), this, SLOT(updatePitchRange()), Qt::DirectConnection); connect(Engine::audioEngine(), &AudioEngine::sampleRateChanged, - this, [this](){Lv2ControlBase::reloadPlugin();}); + this, [this](){onSampleRateChanged();}); // now we need a play-handle which cares for calling play() auto iph = new InstrumentPlayHandle(this, instrumentTrackArg); @@ -101,6 +103,37 @@ Lv2Instrument::~Lv2Instrument() +void Lv2Instrument::reload() +{ + Lv2ControlBase::reload(); + clearRunningNotes(); + emit modelChanged(); +} + + + + +void Lv2Instrument::clearRunningNotes() +{ +#ifdef LV2_INSTRUMENT_USE_MIDI + for (int i = 0; i < NumKeys; ++i) { m_runningNotes[i] = 0; } +#endif +} + + + + +void Lv2Instrument::onSampleRateChanged() +{ + // TODO: once lv2 options are implemented, + // plugins that support it might allow changing their samplerate + // through it instead of reloading + reload(); +} + + + + bool Lv2Instrument::isValid() const { return Lv2ControlBase::isValid(); } @@ -196,25 +229,9 @@ QString Lv2Instrument::nodeName() const -DataFile::Types Lv2Instrument::settingsType() -{ - return DataFile::InstrumentTrackSettings; -} - - - - -void Lv2Instrument::setNameFromFile(const QString &name) -{ - instrumentTrack()->setName(name); -} - - - namespace gui { - /* Lv2InsView */ @@ -227,7 +244,7 @@ Lv2InsView::Lv2InsView(Lv2Instrument *_instrument, QWidget *_parent) : setAutoFillBackground(true); if (m_reloadPluginButton) { connect(m_reloadPluginButton, &QPushButton::clicked, - this, [this](){ this->castModel()->reloadPlugin();} ); + this, [this](){ this->castModel()->reload();} ); } if (m_toggleUIButton) { connect(m_toggleUIButton, &QPushButton::toggled, @@ -283,6 +300,8 @@ void Lv2InsView::dropEvent(QDropEvent *_de) void Lv2InsView::modelChanged() { Lv2ViewBase::modelChanged(castModel()); + connect(castModel(), &Lv2Instrument::modelChanged, + this, [this](){ this->modelChanged();} ); } diff --git a/plugins/Lv2Instrument/Lv2Instrument.h b/plugins/Lv2Instrument/Lv2Instrument.h index e9a6cc2fd..7b521e1b0 100644 --- a/plugins/Lv2Instrument/Lv2Instrument.h +++ b/plugins/Lv2Instrument/Lv2Instrument.h @@ -1,7 +1,7 @@ /* * Lv2Instrument.h - implementation of LV2 instrument * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -50,6 +50,8 @@ class Lv2InsView; class Lv2Instrument : public Instrument, public Lv2ControlBase { Q_OBJECT +signals: + void modelChanged(); public: /* initialization @@ -57,6 +59,8 @@ public: Lv2Instrument(InstrumentTrack *instrumentTrackArg, Descriptor::SubPluginFeatures::Key* key); ~Lv2Instrument() override; + void reload(); + void onSampleRateChanged(); //! Must be checked after ctor or reload bool isValid() const; @@ -97,12 +101,11 @@ private slots: private: QString nodeName() const override; - DataFile::Types settingsType() override; - void setNameFromFile(const QString &name) override; #ifdef LV2_INSTRUMENT_USE_MIDI std::array m_runningNotes = {}; #endif + void clearRunningNotes(); friend class gui::Lv2InsView; }; diff --git a/plugins/MidiExport/MidiExport.cpp b/plugins/MidiExport/MidiExport.cpp index cbbdc0100..0d18d8ae1 100644 --- a/plugins/MidiExport/MidiExport.cpp +++ b/plugins/MidiExport/MidiExport.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2017 Hyunjin Song * * 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 @@ -81,7 +81,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, int nTracks = 0; - uint8_t buffer[BUFFER_SIZE]; + auto buffer = std::array{}; uint32_t size; for (const Track* track : tracks) if (track->type() == Track::InstrumentTrack) nTracks++; @@ -89,8 +89,8 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, // midi header MidiFile::MIDIHeader header(nTracks); - size = header.writeToBuffer(buffer); - midiout.writeRawData((char *)buffer, size); + size = header.writeToBuffer(buffer.data()); + midiout.writeRawData((char *)buffer.data(), size); std::vector>> plists; @@ -139,8 +139,8 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, } processPatternNotes(midiClip, INT_MAX); writeMidiClipToTrack(mtrack, midiClip); - size = mtrack.writeToBuffer(buffer); - midiout.writeRawData((char *)buffer, size); + size = mtrack.writeToBuffer(buffer.data()); + midiout.writeRawData((char *)buffer.data(), size); } if (track->type() == Track::PatternTrack) @@ -254,8 +254,8 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, ++itr; } } - size = mtrack.writeToBuffer(buffer); - midiout.writeRawData((char *)buffer, size); + size = mtrack.writeToBuffer(buffer.data()); + midiout.writeRawData((char *)buffer.data(), size); } return true; diff --git a/plugins/MidiImport/MidiImport.cpp b/plugins/MidiImport/MidiImport.cpp index c669b02b7..6836060f3 100644 --- a/plugins/MidiImport/MidiImport.cpp +++ b/plugins/MidiImport/MidiImport.cpp @@ -4,7 +4,7 @@ * Copyright (c) 2005-2014 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 @@ -152,17 +152,17 @@ public: ap( nullptr ), lastPos( 0 ) { } - + AutomationTrack * at; AutomationClip * ap; TimePos lastPos; - + smfMidiCC & create( TrackContainer* tc, QString tn ) { if( !at ) { - // Keep LMMS responsive, for now the import runs - // in the main thread. This should probably be + // Keep LMMS responsive, for now the import runs + // in the main thread. This should probably be // removed if that ever changes. qApp->processEvents(); at = dynamic_cast( Track::create( Track::AutomationTrack, tc ) ); @@ -195,7 +195,7 @@ public: lastPos = time; time = time - ap->startPosition(); ap->putValue( time, value, false ); - ap->changeLength( TimePos( time.getBar() + 1, 0 ) ); + ap->changeLength( TimePos( time.getBar() + 1, 0 ) ); return *this; } @@ -214,14 +214,14 @@ public: isSF2( false ), hasNotes( false ) { } - + InstrumentTrack * it; MidiClip* p; Instrument * it_inst; - bool isSF2; + bool isSF2; bool hasNotes; QString trackName; - + smfMidiChannel * create( TrackContainer* tc, QString tn ) { if( !it ) { @@ -231,7 +231,7 @@ public: #ifdef LMMS_HAVE_FLUIDSYNTH it_inst = it->loadInstrument( "sf2player" ); - + if( it_inst ) { isSF2 = true; @@ -242,7 +242,7 @@ public: else { it_inst = it->loadInstrument( "patman" ); - } + } #else it_inst = it->loadInstrument( "patman" ); #endif @@ -315,9 +315,9 @@ bool MidiImport::readSMF( TrackContainer* tc ) pd.setMaximum( seq->tracks() + preTrackSteps ); pd.setValue( 1 ); - + // 128 CC + Pitch Bend - smfMidiCC ccs[MIDI_CC_COUNT]; + auto ccs = std::array{}; // channel to CC object for program changes std::unordered_map pcs; @@ -338,9 +338,9 @@ bool MidiImport::readSMF( TrackContainer* tc ) auto timeSigDenominatorPat = new AutomationClip(dt); timeSigDenominatorPat->setDisplayName(tr("Denominator")); timeSigDenominatorPat->addObject(&timeSigMM.denominatorModel()); - + // TODO: adjust these to Time.Sig changes - double beatsPerBar = 4; + double beatsPerBar = 4; double ticksPerBeat = DefaultTicksPerBar / beatsPerBar; // Time-sig changes @@ -358,7 +358,11 @@ bool MidiImport::readSMF( TrackContainer* tc ) pd.setValue( 2 ); // Tempo stuff - AutomationClip * tap = tc->tempoAutomationClip(); + auto tt = dynamic_cast(Track::create(Track::AutomationTrack, Engine::getSong())); + tt->setName(tr("Tempo")); + auto tap = new AutomationClip(tt); + tap->setDisplayName(tr("Tempo")); + tap->addObject(&Engine::getSong()->tempoModel()); if( tap ) { tap->clear(); @@ -389,7 +393,7 @@ bool MidiImport::readSMF( TrackContainer* tc ) if( evt->is_update() ) { - printf("Unhandled SONG update: %d %f %s\n", + printf("Unhandled SONG update: %d %f %s\n", evt->get_type_code(), evt->time, evt->get_attribute() ); } } @@ -451,9 +455,9 @@ bool MidiImport::readSMF( TrackContainer* tc ) noteEvt->get_identifier(), noteEvt->get_loud() * (200.f / 127.f)); // Map from MIDI velocity to LMMS volume ch->addNote( n ); - + } - + else if( evt->is_update() ) { smfMidiChannel * ch = chs[evt->chan].create( tc, trackName ); @@ -499,7 +503,7 @@ bool MidiImport::readSMF( TrackContainer* tc ) double cc = evt->get_real_value(); AutomatableModel * objModel = nullptr; - switch( ccid ) + switch( ccid ) { case 0: if( ch->isSF2 && ch->it_inst ) @@ -540,7 +544,7 @@ bool MidiImport::readSMF( TrackContainer* tc ) if( ccs[ccid].at == nullptr ) { ccs[ccid].create( tc, trackName + " > " + ( objModel != nullptr ? - objModel->displayName() : + objModel->displayName() : QString("CC %1").arg(ccid) ) ); } ccs[ccid].putValue( time, objModel, cc ); @@ -549,7 +553,7 @@ bool MidiImport::readSMF( TrackContainer* tc ) } } else { - printf("Unhandled update: %d %d %f %s\n", (int) evt->chan, + printf("Unhandled update: %d %d %f %s\n", (int) evt->chan, evt->get_type_code(), evt->time, evt->get_attribute() ); } } @@ -557,8 +561,8 @@ bool MidiImport::readSMF( TrackContainer* tc ) } delete seq; - - + + for( auto& c: chs ) { if (c.second.hasNotes) diff --git a/plugins/MidiImport/portsmf/allegro.h b/plugins/MidiImport/portsmf/allegro.h index ca5859aef..6210652e2 100644 --- a/plugins/MidiImport/portsmf/allegro.h +++ b/plugins/MidiImport/portsmf/allegro.h @@ -49,6 +49,7 @@ #ifndef ALLEGRO_H #define ALLEGRO_H #include +#include #include #include #include diff --git a/plugins/Monstro/Monstro.cpp b/plugins/Monstro/Monstro.cpp index 51205c660..3a9737fdb 100644 --- a/plugins/Monstro/Monstro.cpp +++ b/plugins/Monstro/Monstro.cpp @@ -653,8 +653,8 @@ inline void MonstroSynth::updateModulators( float * env1, float * env2, float * // frames played before const f_cnt_t tfp = m_nph->totalFramesPlayed(); - float * lfo [2]; - float * env [2]; + auto lfo = std::array{}; + auto env = std::array{}; lfo[0] = lfo1; lfo[1] = lfo2; env[0] = env1; @@ -1694,8 +1694,8 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) m_lfo2WaveBox -> setGeometry( 127, LFOROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); m_lfo2WaveBox->setFont( pointSize<8>( m_lfo2WaveBox->font() ) ); - maketsknob(m_lfo2AttKnob, LFOCOL4, LFOROW, tr("Attack"), " ms", "lfoKnob") - maketsknob(m_lfo2RateKnob, LFOCOL5, LFOROW, tr("Rate"), " ms", "lfoKnob") + maketsknob(m_lfo2AttKnob, LFOCOL4, LFOROW, tr("Attack"), " ms", "lfoKnob") + maketsknob(m_lfo2RateKnob, LFOCOL5, LFOROW, tr("Rate"), " ms", "lfoKnob") makeknob(m_lfo2PhsKnob, LFOCOL6, LFOROW, tr("Phase"), tr(" deg"), "lfoKnob") maketsknob(m_env1PreKnob, KNOBCOL1, E1ROW, tr("Pre-delay"), " ms", "envKnob") diff --git a/plugins/OpulenZ/OpulenZ.cpp b/plugins/OpulenZ/OpulenZ.cpp index 67349e48b..3a18c1e3f 100644 --- a/plugins/OpulenZ/OpulenZ.cpp +++ b/plugins/OpulenZ/OpulenZ.cpp @@ -92,7 +92,7 @@ PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * ) QMutex OpulenzInstrument::emulatorMutex; // Weird ordering of voice parameters -const unsigned int adlib_opadd[OPL2_VOICES] = {0x00, 0x01, 0x02, 0x08, 0x09, 0x0A, 0x10, 0x11, 0x12}; +const auto adlib_opadd = std::array{0x00, 0x01, 0x02, 0x08, 0x09, 0x0A, 0x10, 0x11, 0x12}; OpulenzInstrument::OpulenzInstrument( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &opulenz_plugin_descriptor ), @@ -371,7 +371,7 @@ bool OpulenzInstrument::handleMidiEvent( const MidiEvent& event, const TimePos& } break; default: -#ifdef LMMS_DEBUG +#ifdef LMMS_DEBUG printf("Midi CC %02x %02x\n", event.controllerNumber(), event.controllerValue() ); #endif break; @@ -534,7 +534,7 @@ void OpulenzInstrument::loadGMPatch() { // Update patch from the models to the chip emulation void OpulenzInstrument::updatePatch() { - unsigned char inst[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + auto inst = std::array{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; inst[0] = ( op1_trem_mdl.value() ? 128 : 0 ) + ( op1_vib_mdl.value() ? 64 : 0 ) + ( op1_perc_mdl.value() ? 0 : 32 ) + // NB. This envelope mode is "perc", not "sus" @@ -583,7 +583,7 @@ void OpulenzInstrument::updatePatch() { #endif - loadPatch(inst); + loadPatch(inst.data()); } // Load an SBI file into the knob models @@ -763,7 +763,7 @@ OpulenzInstrumentView::OpulenzInstrumentView( Instrument * _instrument, setPalette( pal ); } OpulenzInstrumentView::~OpulenzInstrumentView() { - // Knobs are QWidgets and our children, so they're + // Knobs are QWidgets and our children, so they're // destroyed automagically } @@ -782,20 +782,20 @@ void OpulenzInstrumentView::updateKnobHints() { // Envelope times in ms: t[0] = 0, t[n] = ( 1<{ + 0.0, 0.2, 0.4, 0.9, 1.8, 3.7, 7.4, 15.0, 30.0, 60.0, 120.0, 240.0, 480.0, - 950.0, 1900.0, 3800.0 + 950.0, 1900.0, 3800.0 }; - const float dr_times[16] = { - 0.0, 1.2, 2.5, 5.0, 10.0, 20.0, 40.0, - 80.0, 160.0, 320.0, 640.0, 1300.0, 2600.0, - 5200.0, 10000.0, 20000.0 + const auto dr_times = std::array{ + 0.0, 1.2, 2.5, 5.0, 10.0, 20.0, 40.0, + 80.0, 160.0, 320.0, 640.0, 1300.0, 2600.0, + 5200.0, 10000.0, 20000.0 }; - - const int fmultipliers[16] = { - -12, 0, 12, 19, 24, 28, 31, 34, 36, 38, 40, 40, 43, 43, 47, 47 + + const auto fmultipliers = std::array{ + -12, 0, 12, 19, 24, 28, 31, 34, 36, 38, 40, 40, 43, 43, 47, 47 }; auto m = castModel(); @@ -863,11 +863,11 @@ void OpulenzInstrumentView::modelChanged() connect( &m->op1_d_mdl, SIGNAL( dataChanged() ), this, SLOT( updateKnobHints() ) ); connect( &m->op2_d_mdl, SIGNAL( dataChanged() ), this, SLOT( updateKnobHints() ) ); - connect( &m->op1_r_mdl, SIGNAL( dataChanged() ), this, SLOT( updateKnobHints() ) ); - connect( &m->op2_r_mdl, SIGNAL( dataChanged() ), this, SLOT( updateKnobHints() ) ); + connect( &m->op1_r_mdl, SIGNAL( dataChanged() ), this, SLOT( updateKnobHints() ) ); + connect( &m->op2_r_mdl, SIGNAL( dataChanged() ), this, SLOT( updateKnobHints() ) ); - connect( &m->op1_mul_mdl, SIGNAL( dataChanged() ), this, SLOT( updateKnobHints() ) ); - connect( &m->op2_mul_mdl, SIGNAL( dataChanged() ), this, SLOT( updateKnobHints() ) ); + connect( &m->op1_mul_mdl, SIGNAL( dataChanged() ), this, SLOT( updateKnobHints() ) ); + connect( &m->op2_mul_mdl, SIGNAL( dataChanged() ), this, SLOT( updateKnobHints() ) ); updateKnobHints(); diff --git a/plugins/Organic/Organic.cpp b/plugins/Organic/Organic.cpp index cd18fc555..6c2cde773 100644 --- a/plugins/Organic/Organic.cpp +++ b/plugins/Organic/Organic.cpp @@ -2,7 +2,7 @@ * Organic.cpp - additive synthesizer for organ-like sounds * * Copyright (c) 2006-2008 Andreas Brandmaier - * + * * This file is part of LMMS - https://lmms.io * * This program is free software; you can redistribute it and/or @@ -71,7 +71,7 @@ float * OrganicInstrument::s_harmonics = nullptr; * * class OrganicInstrument * -* lmms - plugin +* lmms - plugin * ***********************************************************************/ @@ -90,7 +90,7 @@ OrganicInstrument::OrganicInstrument( InstrumentTrack * _instrument_track ) : m_osc[i] = new OscillatorObject( this, i ); m_osc[i]->m_numOscillators = m_numOscillators; - // Connect events + // Connect events connect( &m_osc[i]->m_oscModel, SIGNAL( dataChanged() ), m_osc[i], SLOT ( oscButtonChanged() ) ); connect( &m_osc[i]->m_harmModel, SIGNAL( dataChanged() ), @@ -114,7 +114,7 @@ OrganicInstrument::OrganicInstrument( InstrumentTrack * _instrument_track ) : m_osc[5]->m_harmonic = log2f( 4.0f ); // . m_osc[6]->m_harmonic = log2f( 5.0f ); // . m_osc[7]->m_harmonic = log2f( 6.0f ); // .*/ - + if( s_harmonics == nullptr ) { s_harmonics = new float[ NUM_HARMONICS ]; @@ -142,10 +142,10 @@ OrganicInstrument::OrganicInstrument( InstrumentTrack * _instrument_track ) : m_osc[i]->updateVolume(); m_osc[i]->updateDetuning(); } - + connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), - this, SLOT( updateAllDetuning() ) ); + this, SLOT( updateAllDetuning() ) ); } @@ -193,7 +193,7 @@ void OrganicInstrument::loadSettings( const QDomElement & _this ) m_osc[i]->m_volModel.loadSettings( _this, "vol" + is ); if( _this.hasAttribute( "detune" + is ) ) { - m_osc[i]->m_detuneModel.setValue( _this.attribute( "detune" ).toInt() * 12 ); + m_osc[i]->m_detuneModel.setValue( _this.attribute( "detune" ).toInt() * 12 ); } else { @@ -201,7 +201,7 @@ void OrganicInstrument::loadSettings( const QDomElement & _this ) } m_osc[i]->m_panModel.loadSettings( _this, "pan" + is ); m_osc[i]->m_oscModel.loadSettings( _this, "wavetype" + is ); - + if( _this.hasAttribute( "newharmonic" + is ) ) { m_osc[i]->m_harmModel.loadSettings( _this, "newharmonic" + is ); @@ -211,7 +211,7 @@ void OrganicInstrument::loadSettings( const QDomElement & _this ) m_osc[i]->m_harmModel.setValue( static_cast( i ) ); } } - + m_volModel.loadSettings( _this, "vol" ); m_fx1Model.loadSettings( _this, "foldback" ); } @@ -230,23 +230,23 @@ void OrganicInstrument::playNote( NotePlayHandle * _n, { const fpp_t frames = _n->framesLeftForCurrentPeriod(); const f_cnt_t offset = _n->noteOffset(); - + if( _n->totalFramesPlayed() == 0 || _n->m_pluginData == nullptr ) { - Oscillator * oscs_l[NUM_OSCILLATORS]; - Oscillator * oscs_r[NUM_OSCILLATORS]; + auto oscs_l = std::array{}; + auto oscs_r = std::array{}; _n->m_pluginData = new oscPtr; for( int i = m_numOscillators - 1; i >= 0; --i ) { - static_cast( _n->m_pluginData )->phaseOffsetLeft[i] + static_cast( _n->m_pluginData )->phaseOffsetLeft[i] = rand() / ( RAND_MAX + 1.0f ); - static_cast( _n->m_pluginData )->phaseOffsetRight[i] + static_cast( _n->m_pluginData )->phaseOffsetRight[i] = rand() / ( RAND_MAX + 1.0f ); - + // initialise ocillators - + if( i == m_numOscillators - 1 ) { // create left oscillator @@ -287,8 +287,8 @@ void OrganicInstrument::playNote( NotePlayHandle * _n, m_osc[i]->m_volumeRight, oscs_r[i + 1] ); } - - + + } static_cast( _n->m_pluginData )->oscLeft = oscs_l[0]; @@ -303,10 +303,10 @@ void OrganicInstrument::playNote( NotePlayHandle * _n, // -- fx section -- - + // fxKnob is [0;1] float t = m_fx1Model.value(); - + for (int i=0 ; i < frames + offset ; i++) { _working_buffer[i][0] = waveshape( _working_buffer[i][0], t ) * @@ -314,7 +314,7 @@ void OrganicInstrument::playNote( NotePlayHandle * _n, _working_buffer[i][1] = waveshape( _working_buffer[i][1], t ) * m_volModel.value() / 100.0f; } - + // -- -- instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n ); @@ -329,7 +329,7 @@ void OrganicInstrument::deleteNotePluginData( NotePlayHandle * _n ) _n->m_pluginData )->oscLeft ); delete static_cast( static_cast( _n->m_pluginData )->oscRight ); - + delete static_cast( _n->m_pluginData ); } @@ -388,7 +388,7 @@ void OrganicInstrument::updateAllDetuning() int OrganicInstrument::intRand( int min, int max ) { -// int randn = min+int((max-min)*rand()/(RAND_MAX + 1.0)); +// int randn = min+int((max-min)*rand()/(RAND_MAX + 1.0)); // cout << randn << endl; int randn = ( rand() % (max - min) ) + min; return( randn ); @@ -452,7 +452,7 @@ OrganicInstrumentView::OrganicInstrumentView( Instrument * _instrument, "randomise_pressed" ) ); m_randBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "randomise" ) ); - + connect( m_randBtn, SIGNAL ( clicked() ), oi, SLOT( randomiseSettings() ) ); @@ -479,10 +479,10 @@ void OrganicInstrumentView::modelChanged() const float y=91.0f; const float rowHeight = 26.0f; const float x=53.0f; - const float colWidth = 24.0f; + const float colWidth = 24.0f; m_numOscillators = oi->m_numOscillators; - + m_fx1Knob->setModel( &oi->m_fx1Model ); m_volKnob->setModel( &oi->m_volModel ); @@ -490,7 +490,7 @@ void OrganicInstrumentView::modelChanged() { delete[] m_oscKnobs; } - + m_oscKnobs = new OscillatorKnobs[ m_numOscillators ]; // Create knobs, now that we know how many to make @@ -502,7 +502,7 @@ void OrganicInstrumentView::modelChanged() harmKnob->setObjectName( "harmKnob" ); connect( &oi->m_osc[i]->m_harmModel, SIGNAL( dataChanged() ), this, SLOT( updateKnobHint() ) ); - + // setup waveform-knob Knob * oscKnob = new OrganicKnob( this ); oscKnob->move( x + i * colWidth, y ); @@ -510,7 +510,7 @@ void OrganicInstrumentView::modelChanged() this, SLOT( updateKnobHint() ) ); oscKnob->setHintText( tr( "Osc %1 waveform:" ).arg( i + 1 ), QString() ); - + // setup volume-knob auto volKnob = new Knob(knobStyled, this); volKnob->setVolumeKnob( true ); @@ -518,13 +518,13 @@ void OrganicInstrumentView::modelChanged() volKnob->setFixedSize( 21, 21 ); volKnob->setHintText( tr( "Osc %1 volume:" ).arg( i + 1 ), "%" ); - + // setup panning-knob Knob * panKnob = new OrganicKnob( this ); panKnob->move( x + i * colWidth, y + rowHeight*2 ); panKnob->setHintText( tr("Osc %1 panning:").arg( i + 1 ), "" ); - + // setup knob for fine-detuning Knob * detuneKnob = new OrganicKnob( this ); detuneKnob->move( x + i * colWidth, y + rowHeight*3 ); @@ -552,7 +552,7 @@ void OrganicInstrumentView::updateKnobHint() { const float harm = oi->m_osc[i]->m_harmModel.value(); const float wave = oi->m_osc[i]->m_oscModel.value(); - + m_oscKnobs[i].m_harmKnob->setHintText( tr( "Osc %1 harmonic:" ).arg( i + 1 ), " (" + HARMONIC_NAMES[ static_cast( harm ) ] + ")" ); m_oscKnobs[i].m_oscKnob->setHintText( tr( "Osc %1 waveform:" ).arg( i + 1 ), " (" + @@ -575,7 +575,7 @@ OscillatorObject::OscillatorObject( Model * _parent, int _index ) : this, tr( "Osc %1 volume" ).arg( _index + 1 ) ), m_panModel( DefaultPanning, PanningLeft, PanningRight, 1.0f, this, tr( "Osc %1 panning" ).arg( _index + 1 ) ), - m_detuneModel( 0.0f, -1200.0f, 1200.0f, 1.0f, + m_detuneModel( 0.0f, -1200.0f, 1200.0f, 1.0f, this, tr( "Osc %1 fine detuning left" ).arg( _index + 1 ) ) { } @@ -586,7 +586,7 @@ OscillatorObject::OscillatorObject( Model * _parent, int _index ) : void OscillatorObject::oscButtonChanged() { - static Oscillator::WaveShapes shapes[] = + static auto shapes = std::array { Oscillator::SineWave, Oscillator::SawWave, @@ -639,12 +639,12 @@ PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * ) /* * some notes & ideas for the future of this plugin: - * + * * - 32.692 Hz in the bass to 5919.85 Hz of treble in a Hammond organ * => implement harmonic foldback - * + * m_osc[i].m_oscModel->setInitValue( 0.0f ); - * - randomize preset + * - randomize preset */ diff --git a/plugins/Patman/Patman.cpp b/plugins/Patman/Patman.cpp index 34545f557..a8f75db60 100644 --- a/plugins/Patman/Patman.cpp +++ b/plugins/Patman/Patman.cpp @@ -225,11 +225,11 @@ PatmanInstrument::LoadErrors PatmanInstrument::loadPatch( return( LoadOpen ); } - unsigned char header[239]; + auto header = std::array{}; - if( fread( header, 1, 239, fd ) != 239 || - ( memcmp( header, "GF1PATCH110\0ID#000002", 22 ) - && memcmp( header, "GF1PATCH100\0ID#000002", 22 ) ) ) + if (fread(header.data(), 1, 239, fd ) != 239 || + (memcmp(header.data(), "GF1PATCH110\0ID#000002", 22) + && memcmp(header.data(), "GF1PATCH100\0ID#000002", 22))) { fclose( fd ); return( LoadNotGUS ); diff --git a/plugins/ReverbSC/ReverbSC.cpp b/plugins/ReverbSC/ReverbSC.cpp index a13f7eee8..e8dec8fd7 100644 --- a/plugins/ReverbSC/ReverbSC.cpp +++ b/plugins/ReverbSC/ReverbSC.cpp @@ -62,7 +62,7 @@ ReverbSCEffect::ReverbSCEffect( Model* parent, const Descriptor::SubPluginFeatur sp_dcblock_create(&dcblk[0]); sp_dcblock_create(&dcblk[1]); - + sp_dcblock_init(sp, dcblk[0], Engine::audioEngine()->currentQualitySettings().sampleRateMultiplier() ); sp_dcblock_init(sp, dcblk[1], Engine::audioEngine()->currentQualitySettings().sampleRateMultiplier() ); } @@ -88,7 +88,7 @@ bool ReverbSCEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) SPFLOAT tmpL, tmpR; SPFLOAT dcblkL, dcblkR; - + ValueBuffer * inGainBuf = m_reverbSCControls.m_inputGainModel.valueBuffer(); ValueBuffer * sizeBuf = m_reverbSCControls.m_sizeModel.valueBuffer(); ValueBuffer * colorBuf = m_reverbSCControls.m_colorModel.valueBuffer(); @@ -96,7 +96,7 @@ bool ReverbSCEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) for( fpp_t f = 0; f < frames; ++f ) { - sample_t s[2] = { buf[f][0], buf[f][1] }; + auto s = std::array{buf[f][0], buf[f][1]}; const auto inGain = (SPFLOAT)DB2LIN((inGainBuf ? inGainBuf->values()[f] : m_reverbSCControls.m_inputGainModel.value())); @@ -105,12 +105,12 @@ bool ReverbSCEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) s[0] *= inGain; s[1] *= inGain; - revsc->feedback = (SPFLOAT)(sizeBuf ? - sizeBuf->values()[f] + revsc->feedback = (SPFLOAT)(sizeBuf ? + sizeBuf->values()[f] : m_reverbSCControls.m_sizeModel.value()); - revsc->lpfreq = (SPFLOAT)(colorBuf ? - colorBuf->values()[f] + revsc->lpfreq = (SPFLOAT)(colorBuf ? + colorBuf->values()[f] : m_reverbSCControls.m_colorModel.value()); @@ -128,7 +128,7 @@ bool ReverbSCEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) return isRunning(); } - + void ReverbSCEffect::changeSampleRate() { // Change sr variable in Soundpipe. does not need to be destroyed @@ -144,7 +144,7 @@ void ReverbSCEffect::changeSampleRate() sp_dcblock_create(&dcblk[0]); sp_dcblock_create(&dcblk[1]); - + sp_dcblock_init(sp, dcblk[0], Engine::audioEngine()->currentQualitySettings().sampleRateMultiplier() ); sp_dcblock_init(sp, dcblk[1], Engine::audioEngine()->currentQualitySettings().sampleRateMultiplier() ); mutex.unlock(); @@ -156,9 +156,9 @@ extern "C" // necessary for getting instance out of shared lib PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data ) { - return new ReverbSCEffect( - parent, - static_cast(data) + return new ReverbSCEffect( + parent, + static_cast(data) ); } diff --git a/plugins/Sf2Player/PatchesDialog.cpp b/plugins/Sf2Player/PatchesDialog.cpp index 9c9a689a0..c3ffe2d29 100644 --- a/plugins/Sf2Player/PatchesDialog.cpp +++ b/plugins/Sf2Player/PatchesDialog.cpp @@ -154,7 +154,7 @@ void PatchesDialog::setup ( fluid_synth_t * pSynth, int iChan, fluid_preset_t preset; fluid_preset_t *pCurPreset = &preset; #else - fluid_preset_t *pCurPreset; + fluid_preset_t *pCurPreset = nullptr; #endif while ((pCurPreset = fluid_sfont_iteration_next_wrapper(pSoundFont, pCurPreset))) { int iBank = fluid_preset_get_banknum(pCurPreset); diff --git a/plugins/Sf2Player/Sf2Player.cpp b/plugins/Sf2Player/Sf2Player.cpp index bd9788bf1..ab3729f7d 100644 --- a/plugins/Sf2Player/Sf2Player.cpp +++ b/plugins/Sf2Player/Sf2Player.cpp @@ -181,6 +181,15 @@ Sf2Instrument::Sf2Instrument( InstrumentTrack * _instrument_track ) : connect( &m_chorusLevel, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); connect( &m_chorusSpeed, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); connect( &m_chorusDepth, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); + + // Microtuning + connect(Engine::getSong(), &Song::scaleListChanged, this, &Sf2Instrument::updateTuning); + connect(Engine::getSong(), &Song::keymapListChanged, this, &Sf2Instrument::updateTuning); + connect(instrumentTrack()->microtuner()->enabledModel(), &Model::dataChanged, this, &Sf2Instrument::updateTuning, Qt::DirectConnection); + connect(instrumentTrack()->microtuner()->scaleModel(), &Model::dataChanged, this, &Sf2Instrument::updateTuning, Qt::DirectConnection); + connect(instrumentTrack()->microtuner()->keymapModel(), &Model::dataChanged, this, &Sf2Instrument::updateTuning, Qt::DirectConnection); + connect(instrumentTrack()->microtuner()->keyRangeImportModel(), &Model::dataChanged, this, &Sf2Instrument::updateTuning, Qt::DirectConnection); + connect(instrumentTrack()->baseNoteModel(), &Model::dataChanged, this, &Sf2Instrument::updateTuning, Qt::DirectConnection); auto iph = new InstrumentPlayHandle(this, _instrument_track); Engine::audioEngine()->addPlayHandle( iph ); @@ -537,6 +546,38 @@ void Sf2Instrument::updateChorus() +void Sf2Instrument::updateTuning() +{ + if (instrumentTrack()->microtuner()->enabledModel()->value()) + { + auto centArray = std::array{}; + double lowestHz = pow(2., -69. / 12.) * 440.;// Frequency of MIDI note 0, which is approximately 8.175798916 Hz + for (int i = 0; i < 128; ++i) + { + // Get desired Hz of note + double noteHz = instrumentTrack()->microtuner()->keyToFreq(i, DefaultBaseKey); + // Convert Hz to cents + centArray[i] = noteHz == 0. ? 0. : 1200. * log2(noteHz / lowestHz); + } + + fluid_synth_activate_key_tuning(m_synth, 0, 0, "", centArray.data(), true); + for (int chan = 0; chan < 16; chan++) + { + fluid_synth_activate_tuning(m_synth, chan, 0, 0, true); + } + } + else + { + fluid_synth_activate_key_tuning(m_synth, 0, 0, "", nullptr, true); + for (int chan = 0; chan < 16; chan++) + { + fluid_synth_activate_tuning(m_synth, chan, 0, 0, true); + } + } +} + + + void Sf2Instrument::reloadSynth() { double tempRate; @@ -604,6 +645,7 @@ void Sf2Instrument::reloadSynth() updateReverbOn(); updateChorusOn(); updateGain(); + updateTuning(); // Reset last MIDI pitch properties, which will be set to the correct values // upon playing the next note @@ -622,18 +664,19 @@ void Sf2Instrument::playNote( NotePlayHandle * _n, sampleFrame * ) } const f_cnt_t tfp = _n->totalFramesPlayed(); + + int masterPitch = instrumentTrack()->useMasterPitchModel()->value() ? Engine::getSong()->masterPitch() : 0; + int baseNote = instrumentTrack()->baseNoteModel()->value(); + int midiNote = _n->midiKey() - baseNote + DefaultBaseKey + masterPitch; - if( tfp == 0 ) + // out of range? + if (midiNote < 0 || midiNote >= 128) { - const float LOG440 = 2.643452676f; + return; + } - int midiNote = (int)floor( 12.0 * ( log2( _n->unpitchedFrequency() ) - LOG440 ) - 4.0 ); - - // out of range? - if( midiNote <= 0 || midiNote >= 128 ) - { - return; - } + if (tfp == 0) + { const int baseVelocity = instrumentTrack()->midiPort()->baseVelocity(); auto pluginData = new Sf2PluginData; diff --git a/plugins/Sf2Player/Sf2Player.h b/plugins/Sf2Player/Sf2Player.h index 7cad284c0..5a88d0f95 100644 --- a/plugins/Sf2Player/Sf2Player.h +++ b/plugins/Sf2Player/Sf2Player.h @@ -111,7 +111,7 @@ public slots: void updateChorusOn(); void updateChorus(); void updateGain(); - + void updateTuning(); private: static QMutex s_fontsMutex; diff --git a/plugins/Sid/SidInstrument.cpp b/plugins/Sid/SidInstrument.cpp index 73c571b72..6e7473492 100644 --- a/plugins/Sid/SidInstrument.cpp +++ b/plugins/Sid/SidInstrument.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 2008 Csaba Hruska * Attila Herman - * + * * This file is part of LMMS - https://lmms.io * * This program is free software; you can redistribute it and/or @@ -52,22 +52,22 @@ namespace lmms #define SIDWRITEDELAY 9 // lda $xxxx,x 4 cycles, sta $d400,x 5 cycles #define SIDWAVEDELAY 4 // and $xxxx,x 4 cycles extra -unsigned char sidorder[] = +auto sidorder = std::array {0x15,0x16,0x18,0x17, 0x05,0x06,0x02,0x03,0x00,0x01,0x04, 0x0c,0x0d,0x09,0x0a,0x07,0x08,0x0b, 0x13,0x14,0x10,0x11,0x0e,0x0f,0x12}; -static const char *attackTime[16] = { "2 ms", "8 ms", "16 ms", "24 ms", +static auto attackTime = std::array{ "2 ms", "8 ms", "16 ms", "24 ms", "38 ms", "56 ms", "68 ms", "80 ms", "100 ms", "250 ms", "500 ms", "800 ms", "1 s", "3 s", "5 s", "8 s" }; -static const char *decRelTime[16] = { "6 ms", "24 ms", "48 ms", "72 ms", +static auto decRelTime = std::array{ "6 ms", "24 ms", "48 ms", "72 ms", "114 ms", "168 ms", "204 ms", "240 ms", "300 ms", "750 ms", "1.5 s", "2.4 s", "3 s", "9 s", "15 s", "24 s" }; // release time time in ms -static const int relTime[16] = { 6, 24, 48, 72, 114, 168, 204, 240, 300, 750, +static const auto relTime = std::array{ 6, 24, 48, 72, 114, 168, 204, 240, 300, 750, 1500, 2400, 3000, 9000, 15000, 24000 }; @@ -118,11 +118,11 @@ VoiceObject::VoiceObject( Model * _parent, int _idx ) : SidInstrument::SidInstrument( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &sid_plugin_descriptor ), - // filter + // filter m_filterFCModel( 1024.0f, 0.0f, 2047.0f, 1.0f, this, tr( "Cutoff frequency" ) ), m_filterResonanceModel( 8.0f, 0.0f, 15.0f, 1.0f, this, tr( "Resonance" ) ), m_filterModeModel( LowPass, 0, NumFilterTypes-1, this, tr( "Filter type" )), - + // misc m_voice3OffModel( false, this, tr( "Voice 3 off" ) ), m_volumeModel( 15.0f, 0.0f, 15.0f, 1.0f, this, tr( "Volume" ) ), @@ -167,11 +167,11 @@ void SidInstrument::saveSettings( QDomDocument & _doc, _doc, _this, "test" + is ); } - // filter + // filter m_filterFCModel.saveSettings( _doc, _this, "filterFC" ); m_filterResonanceModel.saveSettings( _doc, _this, "filterResonance" ); m_filterModeModel.saveSettings( _doc, _this, "filterMode" ); - + // misc m_voice3OffModel.saveSettings( _doc, _this, "voice3Off" ); m_volumeModel.saveSettings( _doc, _this, "volume" ); @@ -200,12 +200,12 @@ void SidInstrument::loadSettings( const QDomElement & _this ) m_voice[i]->m_filteredModel.loadSettings( _this, "filtered" + is ); m_voice[i]->m_testModel.loadSettings( _this, "test" + is ); } - - // filter + + // filter m_filterFCModel.loadSettings( _this, "filterFC" ); m_filterResonanceModel.loadSettings( _this, "filterResonance" ); m_filterModeModel.loadSettings( _this, "filterMode" ); - + // misc m_voice3OffModel.loadSettings( _this, "voice3Off" ); m_volumeModel.loadSettings( _this, "volume" ); @@ -318,7 +318,7 @@ void SidInstrument::playNote( NotePlayHandle * _n, int delta_t = clockrate * frames / samplerate + 4; // avoid variable length array for msvc compat auto buf = reinterpret_cast(_working_buffer + offset); - unsigned char sidreg[NUMSIDREGS]; + auto sidreg = std::array{}; for (auto& reg : sidreg) { @@ -354,7 +354,7 @@ void SidInstrument::playNote( NotePlayHandle * _n, sidreg[base+1] = (data16>>8)&0x00FF; // pw data16 = (int)m_voice[i]->m_pulseWidthModel.value(); - + sidreg[base+2] = data16&0x00FF; sidreg[base+3] = (data16>>8)&0x000F; // control: wave form, (test), ringmod, sync, gate @@ -363,7 +363,7 @@ void SidInstrument::playNote( NotePlayHandle * _n, data8 += m_voice[i]->m_ringModModel.value()?4:0; data8 += m_voice[i]->m_testModel.value()?8:0; switch( m_voice[i]->m_waveFormModel.value() ) - { + { default: break; case VoiceObject::NoiseWave: data8 += 128; break; case VoiceObject::SquareWave: data8 += 64; break; @@ -394,7 +394,7 @@ void SidInstrument::playNote( NotePlayHandle * _n, data16 = (int)m_filterFCModel.value(); sidreg[21] = data16&0x0007; sidreg[22] = (data16>>3)&0x00FF; - + // res, filt ex,3,2,1 data16 = (int)m_filterResonanceModel.value(); data8 = (data16&0x000F)<<4; @@ -409,7 +409,7 @@ void SidInstrument::playNote( NotePlayHandle * _n, data8 += m_voice3OffModel.value()?128:0; switch( m_filterModeModel.value() ) - { + { default: break; case LowPass: data8 += 16; break; case BandPass: data8 += 32; break; @@ -417,8 +417,8 @@ void SidInstrument::playNote( NotePlayHandle * _n, } sidreg[24] = data8&0x00FF; - - int num = sid_fillbuffer(sidreg, sid,delta_t,buf, frames); + + int num = sid_fillbuffer(sidreg.data(), sid, delta_t, buf, frames); if(num!=frames) printf("!!!Not enough samples\n"); @@ -544,7 +544,7 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, m_sidTypeBtnGrp->addButton( mos6581_btn ); m_sidTypeBtnGrp->addButton( mos8580_btn ); - for( int i = 0; i < 3; i++ ) + for( int i = 0; i < 3; i++ ) { Knob *ak = new sidKnob( this ); ak->setHintText( tr("Attack:"), "" ); @@ -674,7 +674,7 @@ void SidInstrumentView::updateKnobHint() m_releaseModel.value()] ) + ")" ); m_voiceKnobs[i].m_relKnob->setToolTip( decRelTime[(int)k->m_voice[i]->m_releaseModel.value()]); - + m_voiceKnobs[i].m_pwKnob->setHintText( tr( "Pulse width:" )+ " ", " (" + QString::number( (double)k->m_voice[i]-> m_pulseWidthModel.value() / 40.95 ) + "%)" ); @@ -758,7 +758,7 @@ void SidInstrumentView::modelChanged() connect(&voice->m_sustainModel, SIGNAL(dataChanged()), this, SLOT(updateKnobToolTip())); connect(&voice->m_coarseModel, SIGNAL(dataChanged()), this, SLOT(updateKnobToolTip())); } - + connect( &k->m_volumeModel, SIGNAL( dataChanged() ), this, SLOT( updateKnobToolTip() ) ); connect( &k->m_filterResonanceModel, SIGNAL( dataChanged() ), diff --git a/plugins/Sid/filter.png b/plugins/Sid/filter.png new file mode 100644 index 000000000..ff5c760db Binary files /dev/null and b/plugins/Sid/filter.png differ diff --git a/plugins/SpectrumAnalyzer/SaControlsDialog.cpp b/plugins/SpectrumAnalyzer/SaControlsDialog.cpp index 4a1cb8a79..c4fc431b1 100644 --- a/plugins/SpectrumAnalyzer/SaControlsDialog.cpp +++ b/plugins/SpectrumAnalyzer/SaControlsDialog.cpp @@ -240,7 +240,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor) envelopeResolutionKnob->setModel(&controls->m_envelopeResolutionModel); envelopeResolutionKnob->setLabel(tr("Envelope res.")); envelopeResolutionKnob->setToolTip(tr("Increase envelope resolution for better details, decrease for better GUI performance.")); - envelopeResolutionKnob->setHintText(tr("Draw at most"), tr(" envelope points per pixel")); + envelopeResolutionKnob->setHintText(tr("Maximum number of envelope points drawn per pixel:"), ""); advanced_layout->addWidget(envelopeResolutionKnob, 0, 0, 1, 1, Qt::AlignCenter); // Spectrum graph resolution @@ -248,7 +248,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor) spectrumResolutionKnob->setModel(&controls->m_spectrumResolutionModel); spectrumResolutionKnob->setLabel(tr("Spectrum res.")); spectrumResolutionKnob->setToolTip(tr("Increase spectrum resolution for better details, decrease for better GUI performance.")); - spectrumResolutionKnob->setHintText(tr("Draw at most"), tr(" spectrum points per pixel")); + spectrumResolutionKnob->setHintText(tr("Maximum number of spectrum points drawn per pixel:"), ""); advanced_layout->addWidget(spectrumResolutionKnob, 1, 0, 1, 1, Qt::AlignCenter); // Peak falloff speed @@ -272,7 +272,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor) waterfallHeightKnob->setModel(&controls->m_waterfallHeightModel); waterfallHeightKnob->setLabel(tr("Waterfall height")); waterfallHeightKnob->setToolTip(tr("Increase to get slower scrolling, decrease to see fast transitions better. Warning: medium CPU usage.")); - waterfallHeightKnob->setHintText(tr("Keep"), tr(" lines")); + waterfallHeightKnob->setHintText(tr("Number of lines to keep:"), ""); advanced_layout->addWidget(waterfallHeightKnob, 0, 2, 1, 1, Qt::AlignCenter); processor->reallocateBuffers(); connect(&controls->m_waterfallHeightModel, &FloatModel::dataChanged, [=] {processor->reallocateBuffers();}); @@ -290,7 +290,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor) windowOverlapKnob->setModel(&controls->m_windowOverlapModel); windowOverlapKnob->setLabel(tr("Window overlap")); windowOverlapKnob->setToolTip(tr("Increase to prevent missing fast transitions arriving near FFT window edges. Warning: high CPU usage.")); - windowOverlapKnob->setHintText(tr("Each sample processed"), tr(" times")); + windowOverlapKnob->setHintText(tr("Number of times each sample is processed:"), ""); advanced_layout->addWidget(windowOverlapKnob, 0, 3, 1, 1, Qt::AlignCenter); // FFT zero padding @@ -365,4 +365,4 @@ QSize SaControlsDialog::sizeHint() const } -} // namespace lmms::gui \ No newline at end of file +} // namespace lmms::gui diff --git a/plugins/SpectrumAnalyzer/SaSpectrumView.cpp b/plugins/SpectrumAnalyzer/SaSpectrumView.cpp index 8c3d7a82d..0d9c2af87 100644 --- a/plugins/SpectrumAnalyzer/SaSpectrumView.cpp +++ b/plugins/SpectrumAnalyzer/SaSpectrumView.cpp @@ -648,8 +648,8 @@ std::vector> SaSpectrumView::makeLogFreqTics(int low { std::vector> result; int i, j; - int a[] = {10, 20, 50}; // sparse series multipliers - int b[] = {14, 30, 70}; // additional (denser) series + auto a = std::array{10, 20, 50}; // sparse series multipliers + auto b = std::array{14, 30, 70}; // additional (denser) series // generate main steps (powers of 10); use the series to specify smaller steps for (i = 1; i <= high; i *= 10) diff --git a/plugins/StereoEnhancer/StereoEnhancer.cpp b/plugins/StereoEnhancer/StereoEnhancer.cpp index 1351ab885..01e55f2de 100644 --- a/plugins/StereoEnhancer/StereoEnhancer.cpp +++ b/plugins/StereoEnhancer/StereoEnhancer.cpp @@ -85,15 +85,15 @@ StereoEnhancerEffect::~StereoEnhancerEffect() bool StereoEnhancerEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames ) { - + // This appears to be used for determining whether or not to continue processing - // audio with this effect + // audio with this effect double out_sum = 0.0; - + float width; int frameIndex = 0; - - + + if( !isEnabled() || !isRunning() ) { return( false ); @@ -104,7 +104,7 @@ bool StereoEnhancerEffect::processAudioBuffer( sampleFrame * _buf, for( fpp_t f = 0; f < _frames; ++f ) { - + // copy samples into the delay buffer m_delayBuffer[m_currFrame][0] = _buf[f][0]; m_delayBuffer[m_currFrame][1] = _buf[f][1]; @@ -122,7 +122,7 @@ bool StereoEnhancerEffect::processAudioBuffer( sampleFrame * _buf, } //sample_t s[2] = { _buf[f][0], _buf[f][1] }; //Vanilla - sample_t s[2] = { _buf[f][0], m_delayBuffer[frameIndex][1] }; //Chocolate + auto s = std::array{_buf[f][0], m_delayBuffer[frameIndex][1]}; //Chocolate m_seFX.nextSample( s[0], s[1] ); diff --git a/plugins/TripleOscillator/TripleOscillator.cpp b/plugins/TripleOscillator/TripleOscillator.cpp index bbc95683b..25baea208 100644 --- a/plugins/TripleOscillator/TripleOscillator.cpp +++ b/plugins/TripleOscillator/TripleOscillator.cpp @@ -21,7 +21,7 @@ * Boston, MA 02110-1301 USA. * */ - + #include @@ -81,10 +81,10 @@ OscillatorObject::OscillatorObject( Model * _parent, int _idx ) : m_fineRightModel( 0.0f, -100.0f, 100.0f, 1.0f, this, tr( "Osc %1 fine detuning right" ).arg( _idx + 1 ) ), m_phaseOffsetModel( 0.0f, 0.0f, 360.0f, 1.0f, this, - tr( "Osc %1 phase-offset" ).arg( _idx+1 ) ), + tr( "Osc %1 phase-offset" ).arg( _idx+1 ) ), m_stereoPhaseDetuningModel( 0.0f, 0.0f, 360.0f, 1.0f, this, tr( "Osc %1 stereo phase-detuning" ).arg( _idx+1 ) ), - m_waveShapeModel( Oscillator::SineWave, 0, + m_waveShapeModel( Oscillator::SineWave, 0, Oscillator::NumWaveShapes-1, this, tr( "Osc %1 wave shape" ).arg( _idx+1 ) ), m_modulationAlgoModel( Oscillator::SignalMix, 0, @@ -220,7 +220,7 @@ void OscillatorObject::updateUseWaveTable() } - + TripleOscillator::TripleOscillator( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &tripleoscillator_plugin_descriptor ) @@ -310,8 +310,8 @@ void TripleOscillator::playNote( NotePlayHandle * _n, { if( _n->totalFramesPlayed() == 0 || _n->m_pluginData == nullptr ) { - Oscillator * oscs_l[NUM_OF_OSCILLATORS]; - Oscillator * oscs_r[NUM_OF_OSCILLATORS]; + auto oscs_l = std::array{}; + auto oscs_r = std::array{}; for( int i = NUM_OF_OSCILLATORS - 1; i >= 0; --i ) { diff --git a/plugins/Vestige/Vestige.cpp b/plugins/Vestige/Vestige.cpp index 593712c14..eab3693b8 100644 --- a/plugins/Vestige/Vestige.cpp +++ b/plugins/Vestige/Vestige.cpp @@ -221,16 +221,16 @@ void VestigeInstrument::loadSettings( const QDomElement & _this ) const QMap & dump = m_plugin->parameterDump(); paramCount = dump.size(); - char paramStr[35]; + auto paramStr = std::array{}; knobFModel = new FloatModel *[ paramCount ]; QStringList s_dumpValues; for( int i = 0; i < paramCount; i++ ) { - sprintf( paramStr, "param%d", i ); - s_dumpValues = dump[ paramStr ].split( ":" ); + sprintf(paramStr.data(), "param%d", i); + s_dumpValues = dump[paramStr.data()].split(":"); knobFModel[i] = new FloatModel( 0.0f, 0.0f, 1.0f, 0.01f, this, QString::number(i) ); - knobFModel[i]->loadSettings( _this, paramStr ); + knobFModel[i]->loadSettings(_this, paramStr.data()); if( !( knobFModel[ i ]->isAutomated() || knobFModel[ i ]->controllerConnection() ) ) { @@ -286,12 +286,12 @@ void VestigeInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this ) if (knobFModel != nullptr) { const QMap & dump = m_plugin->parameterDump(); paramCount = dump.size(); - char paramStr[35]; + auto paramStr = std::array{}; for( int i = 0; i < paramCount; i++ ) { if (knobFModel[i]->isAutomated() || knobFModel[i]->controllerConnection()) { - sprintf( paramStr, "param%d", i); - knobFModel[i]->saveSettings( _doc, _this, paramStr ); + sprintf(paramStr.data(), "param%d", i); + knobFModel[i]->saveSettings(_doc, _this, paramStr.data()); } /* QDomElement me = _doc.createElement( paramStr ); @@ -938,7 +938,7 @@ ManageVestigeInstrumentView::ManageVestigeInstrumentView( Instrument * _instrume using ::operator|; #endif - + m_vi = m_vi2; m_vi->m_scrollArea = new QScrollArea( this ); widget = new QWidget(this); @@ -996,13 +996,13 @@ ManageVestigeInstrumentView::ManageVestigeInstrumentView( Instrument * _instrume hasKnobModel = false; } - char paramStr[35]; + auto paramStr = std::array{}; QStringList s_dumpValues; for( int i = 0; i < m_vi->paramCount; i++ ) { - sprintf( paramStr, "param%d", i); - s_dumpValues = dump[ paramStr ].split( ":" ); + sprintf(paramStr.data(), "param%d", i); + s_dumpValues = dump[paramStr.data()].split(":"); vstKnobs[ i ] = new CustomTextKnob( knobBright_26, this, s_dumpValues.at( 1 ) ); vstKnobs[ i ]->setDescription( s_dumpValues.at( 1 ) + ":" ); @@ -1010,9 +1010,9 @@ ManageVestigeInstrumentView::ManageVestigeInstrumentView( Instrument * _instrume if( !hasKnobModel ) { - sprintf( paramStr, "%d", i); - m_vi->knobFModel[ i ] = new FloatModel( LocaleHelper::toFloat(s_dumpValues.at(2)), - 0.0f, 1.0f, 0.01f, castModel(), paramStr ); + sprintf(paramStr.data(), "%d", i); + m_vi->knobFModel[i] = new FloatModel(LocaleHelper::toFloat(s_dumpValues.at(2)), + 0.0f, 1.0f, 0.01f, castModel(), paramStr.data()); } FloatModel * model = m_vi->knobFModel[i]; @@ -1063,7 +1063,7 @@ void ManageVestigeInstrumentView::closeWindow() void ManageVestigeInstrumentView::syncPlugin( void ) { - char paramStr[35]; + auto paramStr = std::array{}; QStringList s_dumpValues; const QMap & dump = m_vi->m_plugin->parameterDump(); float f_value; @@ -1074,8 +1074,8 @@ void ManageVestigeInstrumentView::syncPlugin( void ) // those auto-setted values are not jurnaled, tracked for undo / redo if( !( m_vi->knobFModel[ i ]->isAutomated() || m_vi->knobFModel[ i ]->controllerConnection() ) ) { - sprintf( paramStr, "param%d", i ); - s_dumpValues = dump[ paramStr ].split( ":" ); + sprintf(paramStr.data(), "param%d", i); + s_dumpValues = dump[paramStr.data()].split(":"); f_value = LocaleHelper::toFloat(s_dumpValues.at(2)); m_vi->knobFModel[ i ]->setAutomatedValue( f_value ); m_vi->knobFModel[ i ]->setInitValue( f_value ); diff --git a/plugins/VstBase/RemoteVstPlugin32.cmake b/plugins/VstBase/RemoteVstPlugin32.cmake index 466752aa5..f39bd93d0 100644 --- a/plugins/VstBase/RemoteVstPlugin32.cmake +++ b/plugins/VstBase/RemoteVstPlugin32.cmake @@ -51,7 +51,7 @@ ELSEIF(LMMS_BUILD_LINUX) INCLUDE(CheckWineGcc) CheckWineGcc(32 "${WINEGCC}" WINEGCC_WORKING) IF(NOT WINEGCC_WORKING) - MESSAGE(WARNING "winegcc fails to complie 32-bit binaries, please make sure you have 32-bit GCC libraries") + MESSAGE(WARNING "winegcc fails to compile 32-bit binaries, please make sure you have 32-bit GCC libraries") RETURN() ENDIF() ExternalProject_Add(RemoteVstPlugin32 diff --git a/plugins/VstBase/VstPlugin.cpp b/plugins/VstBase/VstPlugin.cpp index 488931e6d..c3fe17d72 100644 --- a/plugins/VstBase/VstPlugin.cpp +++ b/plugins/VstBase/VstPlugin.cpp @@ -504,20 +504,14 @@ QWidget *VstPlugin::editor() void VstPlugin::openPreset() { - - gui::FileDialog ofd( nullptr, tr( "Open Preset" ), "", - tr( "Vst Plugin Preset (*.fxp *.fxb)" ) ); - ofd.setFileMode( gui::FileDialog::ExistingFiles ); - if( ofd.exec () == QDialog::Accepted && - !ofd.selectedFiles().isEmpty() ) + gui::FileDialog ofd(nullptr, tr("Open Preset"), "", tr("VST Plugin Preset (*.fxp *.fxb)")); + ofd.setFileMode(gui::FileDialog::ExistingFiles); + if (ofd.exec() == QDialog::Accepted && !ofd.selectedFiles().isEmpty()) { lock(); - sendMessage( message( IdLoadPresetFile ). - addString( - QSTR_TO_STDSTR( - QDir::toNativeSeparators( ofd.selectedFiles()[0] ) ) ) - ); - waitForMessage( IdLoadPresetFile, true ); + sendMessage(message(IdLoadPresetFile).addString(QSTR_TO_STDSTR( + QDir::toNativeSeparators(ofd.selectedFiles()[0])))); + waitForMessage(IdLoadPresetFile, true); unlock(); } } @@ -585,32 +579,32 @@ void VstPlugin::savePreset() QString presName = currentProgramName().isEmpty() ? tr(": default") : currentProgramName(); presName.replace("\"", "'"); // QFileDialog unable to handle double quotes properly - gui::FileDialog sfd( nullptr, tr( "Save Preset" ), presName.section(": ", 1, 1) + tr(".fxp"), - tr( "Vst Plugin Preset (*.fxp *.fxb)" ) ); + gui::FileDialog sfd(nullptr, tr("Save Preset"), presName.section(": ", 1, 1) + tr(".fxp"), + tr("VST Plugin Preset (*.fxp *.fxb)")); - if( p_name != "" ) // remember last directory + if (p_name != "") // remember last directory { - sfd.setDirectory( QFileInfo( p_name ).absolutePath() ); + sfd.setDirectory(QFileInfo(p_name).absolutePath()); } - sfd.setAcceptMode( gui::FileDialog::AcceptSave ); - sfd.setFileMode( gui::FileDialog::AnyFile ); - if( sfd.exec () == QDialog::Accepted && - !sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != "" ) + sfd.setAcceptMode(gui::FileDialog::AcceptSave); + sfd.setFileMode(gui::FileDialog::AnyFile); + if (sfd.exec() == QDialog::Accepted && !sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != "") { QString fns = sfd.selectedFiles()[0]; p_name = fns; if ((fns.toUpper().indexOf(tr(".FXP")) == -1) && (fns.toUpper().indexOf(tr(".FXB")) == -1)) + { fns = fns + tr(".fxb"); - else fns = fns.left(fns.length() - 4) + (fns.right( 4 )).toLower(); + } + else + { + fns = fns.left(fns.length() - 4) + (fns.right(4)).toLower(); + } lock(); - sendMessage( message( IdSavePresetFile ). - addString( - QSTR_TO_STDSTR( - QDir::toNativeSeparators( fns ) ) ) - ); - waitForMessage( IdSavePresetFile, true ); + sendMessage(message(IdSavePresetFile).addString(QSTR_TO_STDSTR(QDir::toNativeSeparators(fns)))); + waitForMessage(IdSavePresetFile, true); unlock(); } } @@ -757,7 +751,7 @@ void VstPlugin::createUI( QWidget * parent ) QHBoxLayout * l = new QHBoxLayout( helper ); QWidget * target = new QWidget( helper ); l->setSpacing( 0 ); - l->setMargin( 0 ); + l->setContentsMargins(0, 0, 0, 0); l->addWidget( target ); // we've to call that for making sure, Qt created the windows @@ -825,4 +819,4 @@ QString VstPlugin::embedMethod() const } -} // namespace lmms \ No newline at end of file +} // namespace lmms diff --git a/plugins/VstEffect/VstEffectControls.cpp b/plugins/VstEffect/VstEffectControls.cpp index f35a1c00d..e73530a09 100644 --- a/plugins/VstEffect/VstEffectControls.cpp +++ b/plugins/VstEffect/VstEffectControls.cpp @@ -83,16 +83,16 @@ void VstEffectControls::loadSettings( const QDomElement & _this ) const QMap & dump = m_effect->m_plugin->parameterDump(); paramCount = dump.size(); - char paramStr[35]; + auto paramStr = std::array{}; knobFModel = new FloatModel *[ paramCount ]; QStringList s_dumpValues; for( int i = 0; i < paramCount; i++ ) { - sprintf( paramStr, "param%d", i ); - s_dumpValues = dump[ paramStr ].split( ":" ); + sprintf(paramStr.data(), "param%d", i); + s_dumpValues = dump[paramStr.data()].split(":"); knobFModel[i] = new FloatModel( 0.0f, 0.0f, 1.0f, 0.01f, this, QString::number(i) ); - knobFModel[i]->loadSettings( _this, paramStr ); + knobFModel[i]->loadSettings(_this, paramStr.data()); if( !( knobFModel[ i ]->isAutomated() || knobFModel[ i ]->controllerConnection() ) ) @@ -134,12 +134,12 @@ void VstEffectControls::saveSettings( QDomDocument & _doc, QDomElement & _this ) if (knobFModel != nullptr) { const QMap & dump = m_effect->m_plugin->parameterDump(); paramCount = dump.size(); - char paramStr[35]; + auto paramStr = std::array{}; for( int i = 0; i < paramCount; i++ ) { if (knobFModel[i]->isAutomated() || knobFModel[i]->controllerConnection()) { - sprintf( paramStr, "param%d", i); - knobFModel[i]->saveSettings( _doc, _this, paramStr ); + sprintf(paramStr.data(), "param%d", i); + knobFModel[i]->saveSettings(_doc, _this, paramStr.data()); } } } @@ -173,7 +173,7 @@ void VstEffectControls::managePlugin() auto tt = new gui::ManageVSTEffectView(m_effect, this); ctrHandle = (QObject *)tt; } else if (m_subWindow != nullptr) { - if (m_subWindow->widget()->isVisible() == false ) { + if (m_subWindow->widget()->isVisible() == false ) { m_scrollArea->show(); m_subWindow->show(); } else { @@ -371,13 +371,13 @@ ManageVSTEffectView::ManageVSTEffectView( VstEffect * _eff, VstEffectControls * hasKnobModel = false; } - char paramStr[35]; + auto paramStr = std::array{}; QStringList s_dumpValues; for( int i = 0; i < m_vi->paramCount; i++ ) { - sprintf( paramStr, "param%d", i); - s_dumpValues = dump[ paramStr ].split( ":" ); + sprintf(paramStr.data(), "param%d", i); + s_dumpValues = dump[paramStr.data()].split(":"); vstKnobs[ i ] = new CustomTextKnob( knobBright_26, widget, s_dumpValues.at( 1 ) ); vstKnobs[ i ]->setDescription( s_dumpValues.at( 1 ) + ":" ); @@ -385,9 +385,9 @@ ManageVSTEffectView::ManageVSTEffectView( VstEffect * _eff, VstEffectControls * if( !hasKnobModel ) { - sprintf( paramStr, "%d", i); - m_vi->knobFModel[ i ] = new FloatModel( LocaleHelper::toFloat(s_dumpValues.at(2)), - 0.0f, 1.0f, 0.01f, _eff, paramStr ); + sprintf(paramStr.data(), "%d", i); + m_vi->knobFModel[i] = new FloatModel(LocaleHelper::toFloat(s_dumpValues.at(2)), + 0.0f, 1.0f, 0.01f, _eff, paramStr.data()); } FloatModel * model = m_vi->knobFModel[i]; @@ -439,7 +439,7 @@ void ManageVSTEffectView::closeWindow() void ManageVSTEffectView::syncPlugin() { - char paramStr[35]; + auto paramStr = std::array{}; QStringList s_dumpValues; const QMap & dump = m_effect->m_plugin->parameterDump(); float f_value; @@ -451,8 +451,8 @@ void ManageVSTEffectView::syncPlugin() if( !( m_vi2->knobFModel[ i ]->isAutomated() || m_vi2->knobFModel[ i ]->controllerConnection() ) ) { - sprintf( paramStr, "param%d", i ); - s_dumpValues = dump[ paramStr ].split( ":" ); + sprintf(paramStr.data(), "param%d", i); + s_dumpValues = dump[paramStr.data()].split(":"); f_value = LocaleHelper::toFloat(s_dumpValues.at(2)); m_vi2->knobFModel[ i ]->setAutomatedValue( f_value ); m_vi2->knobFModel[ i ]->setInitValue( f_value ); @@ -477,7 +477,7 @@ void ManageVSTEffectView::displayAutomatedOnly() { vstKnobs[ i ]->hide(); m_displayAutomatedOnly->setText( "All" ); - } else { + } else { vstKnobs[ i ]->show(); m_displayAutomatedOnly->setText( "Automated" ); } @@ -534,7 +534,7 @@ void ManageVSTEffectView::syncParameterText() ManageVSTEffectView::~ManageVSTEffectView() { if( m_vi2->knobFModel != nullptr ) - { + { for( int i = 0; i < m_vi2->paramCount; i++ ) { delete m_vi2->knobFModel[ i ]; @@ -553,18 +553,18 @@ ManageVSTEffectView::~ManageVSTEffectView() delete [] m_vi2->knobFModel; m_vi2->knobFModel = nullptr; } - + if( m_vi2->m_scrollArea != nullptr ) { delete m_vi2->m_scrollArea; m_vi2->m_scrollArea = nullptr; } - + if( m_vi2->m_subWindow != nullptr ) { m_vi2->m_subWindow->setAttribute( Qt::WA_DeleteOnClose ); m_vi2->m_subWindow->close(); - + if( m_vi2->m_subWindow != nullptr ) { delete m_vi2->m_subWindow; diff --git a/plugins/WaveShaper/WaveShaper.cpp b/plugins/WaveShaper/WaveShaper.cpp index edbcb0ad8..94845e672 100644 --- a/plugins/WaveShaper/WaveShaper.cpp +++ b/plugins/WaveShaper/WaveShaper.cpp @@ -96,7 +96,7 @@ bool WaveShaperEffect::processAudioBuffer( sampleFrame * _buf, for( fpp_t f = 0; f < _frames; ++f ) { - float s[2] = { _buf[f][0], _buf[f][1] }; + auto s = std::array{_buf[f][0], _buf[f][1]}; // apply input gain s[0] *= *inputPtr; @@ -114,7 +114,7 @@ bool WaveShaperEffect::processAudioBuffer( sampleFrame * _buf, for( i=0; i <= 1; ++i ) { const int lookup = static_cast( qAbs( s[i] ) * 200.0f ); - const float frac = fraction( qAbs( s[i] ) * 200.0f ); + const float frac = fraction( qAbs( s[i] ) * 200.0f ); const float posneg = s[i] < 0 ? -1.0f : 1.0f; if( lookup < 1 ) @@ -122,8 +122,8 @@ bool WaveShaperEffect::processAudioBuffer( sampleFrame * _buf, s[i] = frac * samples[0] * posneg; } else if( lookup < 200 ) - { - s[i] = linearInterpolate( samples[ lookup - 1 ], + { + s[i] = linearInterpolate( samples[ lookup - 1 ], samples[ lookup ], frac ) * posneg; } diff --git a/plugins/WaveShaper/WaveShaperControls.cpp b/plugins/WaveShaper/WaveShaperControls.cpp index 40e20055a..a03abc2ef 100644 --- a/plugins/WaveShaper/WaveShaperControls.cpp +++ b/plugins/WaveShaper/WaveShaperControls.cpp @@ -69,7 +69,7 @@ void WaveShaperControls::loadSettings( const QDomElement & _this ) //load input, output knobs m_inputModel.loadSettings( _this, "inputGain" ); m_outputModel.loadSettings( _this, "outputGain" ); - + m_clipModel.loadSettings( _this, "clipInput" ); //load waveshape @@ -105,7 +105,7 @@ void WaveShaperControls::saveSettings( QDomDocument & _doc, void WaveShaperControls::setDefaultShape() { - float shp [200] = { }; + auto shp = std::array{}; for ( int i = 0; i<200; i++) { shp[i] = ((float)i + 1.0f) / 200.0f; diff --git a/plugins/Xpressive/ExprSynth.cpp b/plugins/Xpressive/ExprSynth.cpp index 47b778ae0..991e0d3e6 100644 --- a/plugins/Xpressive/ExprSynth.cpp +++ b/plugins/Xpressive/ExprSynth.cpp @@ -214,7 +214,7 @@ struct WaveValueFunctionInterpolate : public exprtk::ifunction const T *m_vec; const std::size_t m_size; }; -static const unsigned int random_data[257]={ +static const auto random_data = std::array{ 0xd76a33ec, 0x4a767724, 0xb34ebd08 ,0xf4024196, 0x17b426e2, 0x8dc6389a, 0x1b5dcb93 ,0xa771bd3f, 0x078d502e, 0x8980988a, 0x1f64f846 ,0xb5b48ed7, @@ -526,14 +526,14 @@ ExprFront::ExprFront(const char * expr, int last_func_samples) try { m_data = new ExprFrontData(last_func_samples); - + m_data->m_expression_string = expr; m_data->m_symbol_table.add_pi(); - + m_data->m_symbol_table.add_constant("e", F_E); m_data->m_symbol_table.add_constant("seed", SimpleRandom::generator() & max_float_integer_mask); - + m_data->m_symbol_table.add_function("sinew", sin_wave_func); m_data->m_symbol_table.add_function("squarew", square_wave_func); m_data->m_symbol_table.add_function("trianglew", triangle_wave_func); @@ -577,7 +577,7 @@ bool ExprFront::compile() sstore.disable_all_assignment_ops(); sstore.disable_all_control_structures(); parser_t parser(sstore); - + m_valid=parser.compile(m_data->m_expression_string, m_data->m_expression); } catch(...) @@ -600,7 +600,7 @@ float ExprFront::evaluate() WARN_EXPRTK; } return 0; - + } bool ExprFront::add_variable(const char* name, float& ref) { @@ -757,7 +757,7 @@ void ExprSynth::renderOutput(fpp_t frames, sampleFrame *buf) const float new_freq = m_nph->frequency(); const float freq_inc = (new_freq - m_frequency) / frames; const bool is_released = m_nph->isReleased(); - + expression_t *o1_rawExpr = &(m_exprO1->getData()->m_expression); expression_t *o2_rawExpr = &(m_exprO2->getData()->m_expression); LastSampleFunction * last_func1 = &m_exprO1->getData()->m_last_func; @@ -791,7 +791,7 @@ void ExprSynth::renderOutput(fpp_t frames, sampleFrame *buf) } else { - + if (o2_valid) { o1_rawExpr = o2_rawExpr; diff --git a/plugins/Xpressive/exprtk b/plugins/Xpressive/exprtk index 93a9f44f9..f46bffcd6 160000 --- a/plugins/Xpressive/exprtk +++ b/plugins/Xpressive/exprtk @@ -1 +1 @@ -Subproject commit 93a9f44f99b910bfe07cd1e933371e83cea3841c +Subproject commit f46bffcd6966d38a09023fb37ba9335214c9b959 diff --git a/plugins/ZynAddSubFx/CMakeLists.txt b/plugins/ZynAddSubFx/CMakeLists.txt index b184162a3..3369a7938 100644 --- a/plugins/ZynAddSubFx/CMakeLists.txt +++ b/plugins/ZynAddSubFx/CMakeLists.txt @@ -1,5 +1,12 @@ +if(NOT FLTK_FOUND) + return() +endif() + INCLUDE(BuildPlugin) +find_package(Threads REQUIRED) +find_package(ZLIB REQUIRED) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) # definitions for ZynAddSubFX @@ -11,40 +18,20 @@ ELSE() ADD_DEFINITIONS(-DOS_WINDOWS) ENDIF() -# do not conflict with LMMS' Controller class -ADD_DEFINITIONS(-DController=ZynController) - # use asm optimizations when on x86 or x86_64 -IF(LMMS_HOST_X86 OR LMMS_HOST_X86_64) +if(NOT MSVC AND (LMMS_HOST_X86 OR LMMS_HOST_X86_64)) ADD_DEFINITIONS(-DASM_F2I_YES) -ENDIF(LMMS_HOST_X86 OR LMMS_HOST_X86_64) +endif() # build ZynAddSubFX with full optimizations -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wno-write-strings -Wno-deprecated-declarations -fpermissive") +if(NOT MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wno-write-strings -Wno-deprecated-declarations -fpermissive") +endif() IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "6.0.0") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation") ENDIF() -IF(LMMS_BUILD_WIN32) - # link system-libraries - ADD_DEFINITIONS(-DPTW32_STATIC_LIB) - # fix X11 headers errors caused by bug with mingw + c++11 (enable -std=gnu++0x) - SET(CMAKE_CXX_EXTENSIONS ON) -ENDIF(LMMS_BUILD_WIN32) - -SET(FLTK_SKIP_OPENGL TRUE) -SET(FLTK_SKIP_FORMS TRUE) -SET(FLTK_SKIP_IMAGES TRUE) -SET(FLTK_SKIP_MATH TRUE) -IF(MINGW_PREFIX) - SET(FLTK_SKIP_FLUID TRUE) -ENDIF() - -IF(NOT FLTK_FOUND) - RETURN() -ENDIF() - IF(MINGW_PREFIX) SET(FLTK_FLUID_EXECUTABLE "${MINGW_PREFIX}/bin/fluid") ENDIF() @@ -57,13 +44,15 @@ IF(NOT EXISTS ${FLTK_FLUID_EXECUTABLE}) ENDIF() ENDIF() -INCLUDE_DIRECTORIES("${FLTK_INCLUDE_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}" - ${FFTW3F_INCLUDE_DIRS} - "${CMAKE_CURRENT_BINARY_DIR}" - "${CMAKE_BINARY_DIR}") - -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/zynaddsubfx/src/UI) +include_directories( + "${FLTK_INCLUDE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}" + ${FFTW3F_INCLUDE_DIRS} + "${CMAKE_CURRENT_BINARY_DIR}" + "${CMAKE_BINARY_DIR}" + "${CMAKE_SOURCE_DIR}/src/3rdparty/mingw-std-threads" + "${CMAKE_CURRENT_SOURCE_DIR}/zynaddsubfx/src/UI" +) ADD_DEFINITIONS(-DPLUGINVERSION) # removes exit confirmation dialogs etc. in MasterUI.fl add_subdirectory(zynaddsubfx/src/Nio) @@ -116,24 +105,23 @@ SET(zynaddsubfx_core_SRCS zynaddsubfx/src/Synth/PADnote.cpp zynaddsubfx/src/Synth/Resonance.cpp zynaddsubfx/src/Synth/SUBnote.cpp - ) +) +add_library(ZynAddSubFxCoreObjs OBJECT LocalZynAddSubFx.cpp ${zynaddsubfx_core_SRCS}) +add_library(ZynAddSubFxCore INTERFACE) +target_sources(ZynAddSubFxCore INTERFACE + $ + $ +) -IF(LMMS_BUILD_LINUX) - ADD_LIBRARY(ZynAddSubFxCore MODULE LocalZynAddSubFx.cpp ${zynaddsubfx_core_SRCS}) -ELSE() - ADD_LIBRARY(ZynAddSubFxCore SHARED LocalZynAddSubFx.cpp ${zynaddsubfx_core_SRCS}) -ENDIF() -TARGET_LINK_LIBRARIES(ZynAddSubFxCore zynaddsubfx_nio ${FFTW3F_LIBRARIES} ${QT_LIBRARIES} -lz -lpthread) - -TARGET_LINK_LIBRARIES(ZynAddSubFxCore Qt5::Widgets Qt5::Xml) - -IF(LMMS_BUILD_WIN32) - TARGET_LINK_LIBRARIES(ZynAddSubFxCore -lws2_32) - INSTALL(TARGETS ZynAddSubFxCore RUNTIME DESTINATION "${PLUGIN_DIR}") -ELSE(LMMS_BUILD_WIN32) - INSTALL(TARGETS ZynAddSubFxCore LIBRARY DESTINATION "${PLUGIN_DIR}") -ENDIF(LMMS_BUILD_WIN32) +target_link_libraries(ZynAddSubFxCore INTERFACE + ${FFTW3F_LIBRARIES} + ${QT_LIBRARIES} + Qt5::Widgets + Qt5::Xml + Threads::Threads + ZLIB::ZLIB +) LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/..") IF(LMMS_BUILD_LINUX) @@ -144,10 +132,11 @@ ELSE() SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PLUGIN_DIR}") ENDIF() BUILD_PLUGIN(zynaddsubfx ZynAddSubFx.cpp ZynAddSubFx.h MOCFILES ZynAddSubFx.h EMBEDDED_RESOURCES artwork.png logo.png) -TARGET_LINK_LIBRARIES(zynaddsubfx -lZynAddSubFxCore) -ADD_DEPENDENCIES(zynaddsubfx ZynAddSubFxCore) +target_link_libraries(zynaddsubfx ZynAddSubFxCore) -IF(WIN32) +if(MSVC) + set(WINRC "${CMAKE_CURRENT_BINARY_DIR}/zynaddsubfx.rc") +elseif(WIN32) SET(WINRC "${CMAKE_CURRENT_BINARY_DIR}/zynaddsubfxrc.obj") ADD_CUSTOM_COMMAND(OUTPUT "${WINRC}" COMMAND "${CMAKE_RC_COMPILER}" @@ -155,14 +144,19 @@ IF(WIN32) "-o\"${CMAKE_CURRENT_BINARY_DIR}/zynaddsubfxrc.obj\"" "-i\"${CMAKE_CURRENT_BINARY_DIR}/zynaddsubfx.rc\"" DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/zynaddsubfx.rc") -ENDIF(WIN32) +endif() # Use libraries in non-standard directories (e.g., another version of Qt) SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) ADD_SUBDIRECTORY("${LMMS_SOURCE_DIR}/src/common" common) -ADD_EXECUTABLE(RemoteZynAddSubFx RemoteZynAddSubFx.cpp ${LMMS_COMMON_SRCS} "${WINRC}") +add_executable(RemoteZynAddSubFx + RemoteZynAddSubFx.cpp + ${LMMS_COMMON_SRCS} + "${WINRC}" + $ +) INSTALL(TARGETS RemoteZynAddSubFx RUNTIME DESTINATION "${PLUGIN_DIR}") # Needed to deploy dependencies of RemoteZynAddSubFx SET_PROPERTY(GLOBAL APPEND PROPERTY PLUGINS_BUILT "RemoteZynAddSubFx") @@ -182,8 +176,7 @@ IF(FLTK_CONFIG AND NOT (LMMS_BUILD_APPLE OR LMMS_BUILD_WIN32)) STRING(REPLACE " " ";" FLTK_FILTERED_LDFLAGS ${FLTK_FILTERED_LDFLAGS}) LIST(REMOVE_ITEM FLTK_FILTERED_LDFLAGS -lX11) ENDIF() -TARGET_LINK_LIBRARIES(RemoteZynAddSubFx zynaddsubfx_gui -lZynAddSubFxCore ${FLTK_FILTERED_LDFLAGS} -lpthread ) -ADD_DEPENDENCIES(RemoteZynAddSubFx ZynAddSubFxCore) +target_link_libraries(RemoteZynAddSubFx ZynAddSubFxCore ${FLTK_FILTERED_LDFLAGS}) if(LMMS_HAVE_LIBRT) target_link_libraries(RemoteZynAddSubFx rt) @@ -199,13 +192,6 @@ ENDIF(LMMS_BUILD_WIN32) IF(LMMS_BUILD_WIN32) - add_custom_command( - TARGET ZynAddSubFxCore - POST_BUILD - COMMAND "${STRIP_COMMAND}" "$" - VERBATIM - COMMAND_EXPAND_LISTS - ) add_custom_command( TARGET RemoteZynAddSubFx POST_BUILD diff --git a/plugins/ZynAddSubFx/LocalZynAddSubFx.cpp b/plugins/ZynAddSubFx/LocalZynAddSubFx.cpp index f09cb6662..83ef3e9a2 100644 --- a/plugins/ZynAddSubFx/LocalZynAddSubFx.cpp +++ b/plugins/ZynAddSubFx/LocalZynAddSubFx.cpp @@ -22,19 +22,25 @@ * */ -#include +#include "LocalZynAddSubFx.h" -#include "zynaddsubfx/src/Misc/Util.h" -#include #include -#include "LocalZynAddSubFx.h" +#include "lmmsconfig.h" + +#ifdef LMMS_BUILD_WIN32 +# include +# include "IoHelper.h" +#else +# include +#endif #include "MidiEvent.h" #include "zynaddsubfx/src/Nio/NulEngine.h" #include "zynaddsubfx/src/Misc/Master.h" #include "zynaddsubfx/src/Misc/Part.h" +#include "zynaddsubfx/src/Misc/Util.h" // Global variable in zynaddsubfx/src/globals.h SYNTH_T* synth = nullptr; @@ -53,14 +59,6 @@ LocalZynAddSubFx::LocalZynAddSubFx() : { if( s_instanceCount == 0 ) { -#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 // LMMS_BUILD_WIN32 - initConfig(); synth = new SYNTH_T; @@ -143,14 +141,20 @@ void LocalZynAddSubFx::loadXML( const std::string & _filename ) { char * f = strdup( _filename.c_str() ); - pthread_mutex_lock( &m_master->mutex ); - m_master->defaults(); - m_master->loadXML( f ); - pthread_mutex_unlock( &m_master->mutex ); + { + const auto lock = std::lock_guard{m_master->mutex}; + m_master->defaults(); + m_master->loadXML( f ); + } m_master->applyparameters(); +#ifdef LMMS_BUILD_WIN32 + _wunlink(toWString(_filename).c_str()); +#else unlink( f ); +#endif + free( f ); } @@ -161,10 +165,11 @@ void LocalZynAddSubFx::loadPreset( const std::string & _filename, int _part ) { char * f = strdup( _filename.c_str() ); - pthread_mutex_lock( &m_master->mutex ); - m_master->part[_part]->defaultsinstrument(); - m_master->part[_part]->loadXMLinstrument( f ); - pthread_mutex_unlock( &m_master->mutex ); + { + const auto lock = std::lock_guard{m_master->mutex}; + m_master->part[_part]->defaultsinstrument(); + m_master->part[_part]->loadXMLinstrument( f ); + } m_master->applyparameters(); @@ -262,8 +267,13 @@ void LocalZynAddSubFx::processMidiEvent( const MidiEvent& event ) void LocalZynAddSubFx::processAudio( sampleFrame * _out ) { +#ifdef _MSC_VER + const auto outputl = static_cast(_alloca(synth->buffersize * sizeof(float))); + const auto outputr = static_cast(_alloca(synth->buffersize * sizeof(float))); +#else float outputl[synth->buffersize]; float outputr[synth->buffersize]; +#endif m_master->GetAudioOutSamples( synth->buffersize, synth->samplerate, outputl, outputr ); diff --git a/plugins/ZynAddSubFx/RemoteZynAddSubFx.cpp b/plugins/ZynAddSubFx/RemoteZynAddSubFx.cpp index 4c69beed0..c4d6b71a1 100644 --- a/plugins/ZynAddSubFx/RemoteZynAddSubFx.cpp +++ b/plugins/ZynAddSubFx/RemoteZynAddSubFx.cpp @@ -22,17 +22,19 @@ * */ +#include "RemoteZynAddSubFx.h" + #include #ifdef LMMS_BUILD_WIN32 #include #endif #include +#include "ThreadShims.h" #undef CursorShape // is, by mistake, not undefed in FL #include "RemotePluginClient.h" -#include "RemoteZynAddSubFx.h" #include "LocalZynAddSubFx.h" #include "zynaddsubfx/src/Nio/Nio.h" @@ -60,12 +62,12 @@ public: sendMessage( IdInitDone ); waitForMessage( IdInitDone ); - pthread_mutex_init( &m_guiMutex, nullptr ); - pthread_create( &m_messageThreadHandle, nullptr, messageLoop, this ); + m_messageThread = std::thread{&RemoteZynAddSubFx::messageLoop, this}; } ~RemoteZynAddSubFx() override { + m_messageThread.join(); Nio::stop(); } @@ -84,9 +86,8 @@ public: message m; while( ( m = receiveMessage() ).id != IdQuit ) { - pthread_mutex_lock( &m_master->mutex ); + const auto lock = std::lock_guard{m_master->mutex}; processMessage( m ); - pthread_mutex_unlock( &m_master->mutex ); } m_guiExit = true; } @@ -102,9 +103,10 @@ public: case IdHideUI: case IdLoadSettingsFromFile: case IdLoadPresetFile: - pthread_mutex_lock( &m_guiMutex ); - m_guiMessages.push( _m ); - pthread_mutex_unlock( &m_guiMutex ); + { + const auto lock = std::lock_guard{m_guiMutex}; + m_guiMessages.push( _m ); + } break; case IdSaveSettingsToFile: @@ -144,22 +146,13 @@ public: LocalZynAddSubFx::processAudio( _out ); } - static void * messageLoop( void * _arg ) - { - auto _this = static_cast(_arg); - - _this->messageLoop(); - - return nullptr; - } - void guiLoop(); private: const int m_guiSleepTime; - pthread_t m_messageThreadHandle; - pthread_mutex_t m_guiMutex; + std::thread m_messageThread; + std::mutex m_guiMutex; std::queue m_guiMessages; bool m_guiExit; @@ -189,12 +182,11 @@ void RemoteZynAddSubFx::guiLoop() } if( exitProgram == 1 ) { - pthread_mutex_lock( &m_master->mutex ); + const auto lock = std::lock_guard{m_master->mutex}; sendMessage( IdHideUI ); exitProgram = 0; - pthread_mutex_unlock( &m_master->mutex ); } - pthread_mutex_lock( &m_guiMutex ); + const auto lock = std::lock_guard{m_guiMutex}; while( m_guiMessages.size() ) { RemotePluginClient::message m = m_guiMessages.front(); @@ -219,9 +211,8 @@ void RemoteZynAddSubFx::guiLoop() { ui->refresh_master_ui(); } - pthread_mutex_lock( &m_master->mutex ); + const auto lock = std::lock_guard{m_master->mutex}; sendMessage( IdLoadSettingsFromFile ); - pthread_mutex_unlock( &m_master->mutex ); break; } @@ -235,9 +226,8 @@ void RemoteZynAddSubFx::guiLoop() ui->updatepanel(); ui->refresh_master_ui(); } - pthread_mutex_lock( &m_master->mutex ); + const auto lock = std::lock_guard{m_master->mutex}; sendMessage( IdLoadPresetFile ); - pthread_mutex_unlock( &m_master->mutex ); break; } @@ -245,7 +235,6 @@ void RemoteZynAddSubFx::guiLoop() break; } } - pthread_mutex_unlock( &m_guiMutex ); } Fl::flush(); @@ -271,15 +260,6 @@ int main( int _argc, char * * _argv ) const auto pollParentThread = PollParentThread{}; #endif -#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 // LMMS_BUILD_WIN32 - - #ifdef SYNC_WITH_SHM_FIFO RemoteZynAddSubFx * remoteZASF = new RemoteZynAddSubFx( _argv[1], _argv[2] ); @@ -291,14 +271,6 @@ int main( int _argc, char * * _argv ) delete remoteZASF; - -#ifdef LMMS_BUILD_WIN32 -#ifndef __WINPTHREADS_VERSION - pthread_win32_thread_detach_np(); - pthread_win32_process_detach_np(); -#endif -#endif // LMMS_BUILD_WIN32 - return 0; } diff --git a/plugins/ZynAddSubFx/ThreadShims.h b/plugins/ZynAddSubFx/ThreadShims.h new file mode 100644 index 000000000..843b50fb5 --- /dev/null +++ b/plugins/ZynAddSubFx/ThreadShims.h @@ -0,0 +1,9 @@ +#include +#include +#include + +#if defined(__MINGW32__) && !defined(_GLIBCXX_HAS_GTHREADS) +# include +# include +# include +#endif diff --git a/plugins/ZynAddSubFx/zynaddsubfx b/plugins/ZynAddSubFx/zynaddsubfx index b9855dbe1..551e816a6 160000 --- a/plugins/ZynAddSubFx/zynaddsubfx +++ b/plugins/ZynAddSubFx/zynaddsubfx @@ -1 +1 @@ -Subproject commit b9855dbe16424edc528a6796ddbc50b1042482c7 +Subproject commit 551e816a6334fd190c74ce971378063b2757b47b diff --git a/src/3rdparty/CMakeLists.txt b/src/3rdparty/CMakeLists.txt index 24d156095..7a6b88775 100644 --- a/src/3rdparty/CMakeLists.txt +++ b/src/3rdparty/CMakeLists.txt @@ -3,6 +3,7 @@ IF(LMMS_BUILD_LINUX AND WANT_VST) add_subdirectory(qt5-x11embed) ENDIF() +ADD_SUBDIRECTORY(hiir) ADD_SUBDIRECTORY(rpmalloc) ADD_SUBDIRECTORY(weakjack) diff --git a/src/3rdparty/hiir/CMakeLists.txt b/src/3rdparty/hiir/CMakeLists.txt new file mode 100644 index 000000000..e954ff187 --- /dev/null +++ b/src/3rdparty/hiir/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(hiir INTERFACE) +target_include_directories(hiir INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_features(hiir INTERFACE cxx_std_17) diff --git a/src/3rdparty/hiir/hiir b/src/3rdparty/hiir/hiir new file mode 160000 index 000000000..4a9a1e67f --- /dev/null +++ b/src/3rdparty/hiir/hiir @@ -0,0 +1 @@ +Subproject commit 4a9a1e67fa6f8ce7688e1c0c8a2b017cecd206a3 diff --git a/src/core/AutomationClip.cpp b/src/core/AutomationClip.cpp index fb2d7dbb0..c031c5a41 100644 --- a/src/core/AutomationClip.cpp +++ b/src/core/AutomationClip.cpp @@ -857,7 +857,7 @@ void AutomationClip::loadSettings( const QDomElement & _this ) -const QString AutomationClip::name() const +QString AutomationClip::name() const { QMutexLocker m(&m_clipMutex); @@ -1173,4 +1173,4 @@ void AutomationClip::generateTangents(timeMap::iterator it, int numToGenerate) } } -} // namespace lmms \ No newline at end of file +} // namespace lmms diff --git a/src/core/DataFile.cpp b/src/core/DataFile.cpp index 635c4c6a4..2e7b21e8b 100644 --- a/src/core/DataFile.cpp +++ b/src/core/DataFile.cpp @@ -89,19 +89,27 @@ const std::vector DataFile::UPGRADE_VERSIONS = { "1.2.0-rc3" , "1.3.0" }; -DataFile::typeDescStruct - DataFile::s_types[DataFile::TypeCount] = +namespace { - { DataFile::UnknownType, "unknown" }, - { DataFile::SongProject, "song" }, - { DataFile::SongProjectTemplate, "songtemplate" }, - { DataFile::InstrumentTrackSettings, "instrumenttracksettings" }, - { DataFile::DragNDropData, "dnddata" }, - { DataFile::ClipboardData, "clipboard-data" }, - { DataFile::JournalData, "journaldata" }, - { DataFile::EffectSettings, "effectsettings" }, - { DataFile::MidiClip, "midiclip" } -} ; + struct TypeDescStruct + { + DataFile::Type m_type; + QString m_name; + }; + + const auto s_types = std::array + { + TypeDescStruct{ DataFile::UnknownType, "unknown" }, + TypeDescStruct{ DataFile::SongProject, "song" }, + TypeDescStruct{ DataFile::SongProjectTemplate, "songtemplate" }, + TypeDescStruct{ DataFile::InstrumentTrackSettings, "instrumenttracksettings" }, + TypeDescStruct{ DataFile::DragNDropData, "dnddata" }, + TypeDescStruct{ DataFile::ClipboardData, "clipboard-data" }, + TypeDescStruct{ DataFile::JournalData, "journaldata" }, + TypeDescStruct{ DataFile::EffectSettings, "effectsettings" }, + TypeDescStruct{ DataFile::MidiClip, "midiclip" } + }; +} @@ -1314,44 +1322,32 @@ void DataFile::upgrade_1_3_0() // Effect name changes QDomElement attribute = attributes.item( k ).toElement(); - if( attribute.attribute( "name" ) == "file" && - ( attribute.attribute( "value" ) == "calf" || - attribute.attribute( "value" ) == "calf.so" ) ) + const QString attrName = attribute.attribute("name"); + const QString attrVal = attribute.attribute("value"); + const QString plugin = attrName == "plugin" ? attrVal : ""; + + static const std::map pluginNames = { + {"Sidechaincompressor", "SidechainCompressor"}, + {"Sidechaingate", "SidechainGate"}, + {"Multibandcompressor", "MultibandCompressor"}, + {"Multibandgate", "MultibandGate"}, + {"Multibandlimiter", "MultibandLimiter"}, + }; + + if (attrName == "file" && (attrVal == "calf" || attrVal == "calf.so" )) { attribute.setAttribute( "value", "veal" ); } - else if( attribute.attribute( "name" ) == "plugin" && - attribute.attribute( "value" ) == "Sidechaincompressor" ) + + const auto newName = pluginNames.find(plugin); + if (newName != pluginNames.end()) { - attribute.setAttribute( "value", "SidechainCompressor" ); - } - else if( attribute.attribute( "name" ) == "plugin" && - attribute.attribute( "value" ) == "Sidechaingate" ) - { - attribute.setAttribute( "value", "SidechainGate" ); - } - else if( attribute.attribute( "name" ) == "plugin" && - attribute.attribute( "value" ) == "Multibandcompressor" ) - { - attribute.setAttribute( "value", "MultibandCompressor" ); - } - else if( attribute.attribute( "name" ) == "plugin" && - attribute.attribute( "value" ) == "Multibandgate" ) - { - attribute.setAttribute( "value", "MultibandGate" ); - } - else if( attribute.attribute( "name" ) == "plugin" && - attribute.attribute( "value" ) == "Multibandlimiter" ) - { - attribute.setAttribute( "value", "MultibandLimiter" ); + attribute.setAttribute("value", newName->second); } // Handle port changes - if( attribute.attribute( "name" ) == "plugin" && - ( attribute.attribute( "value" ) == "MultibandLimiter" || - attribute.attribute( "value" ) == "MultibandCompressor" || - attribute.attribute( "value" ) == "MultibandGate" ) ) + if (plugin == "MultibandLimiter" || plugin == "MultibandCompressor" || plugin == "MultibandGate") { auto fn = [&](QDomElement& port, int num, QList&, QList& removeList) { @@ -1372,8 +1368,7 @@ void DataFile::upgrade_1_3_0() iterate_ladspa_ports(effect, fn); } - if( attribute.attribute( "name" ) == "plugin" && - ( attribute.attribute( "value" ) == "Pulsator" ) ) + else if (plugin == "Pulsator") { auto fn = [&](QDomElement& port, int num, QList& addList, QList& removeList) { @@ -1416,9 +1411,7 @@ void DataFile::upgrade_1_3_0() iterate_ladspa_ports(effect, fn); } - - if( attribute.attribute( "name" ) == "plugin" && - ( attribute.attribute( "value" ) == "VintageDelay" ) ) + else if (plugin == "VintageDelay") { auto fn = [&](QDomElement& port, int num, QList& addList, QList& ) { @@ -1455,23 +1448,20 @@ void DataFile::upgrade_1_3_0() iterate_ladspa_ports(effect, fn); } - if( attribute.attribute( "name" ) == "plugin" && - ( ( attribute.attribute( "value" ) == "Equalizer5Band" ) - || ( attribute.attribute( "value" ) == "Equalizer8Band" ) - || ( attribute.attribute( "value" ) == "Equalizer12Band" ) ) ) + else if (plugin == "Equalizer5Band" || plugin == "Equalizer8Band" || plugin == "Equalizer12Band") { // NBand equalizers got 4 q nobs inserted. We need to shift everything else... // HOWEVER: 5 band eq has only 2 q nobs inserted (no LS/HS filters) - bool band5 = ( attribute.attribute( "value" ) == "Equalizer5Band" ); + bool band5 = plugin == "Equalizer5Band"; auto fn = [&](QDomElement& port, int num, QList& addList, QList& ) { if(num == 4) { // don't modify port 4, but some other ones: int zoom_port; - if(attribute.attribute( "value" ) == "Equalizer5Band") + if (plugin == "Equalizer5Band") zoom_port = 36; - else if(attribute.attribute( "value" ) == "Equalizer8Band") + else if (plugin == "Equalizer8Band") zoom_port = 48; else // 12 band zoom_port = 64; @@ -1552,8 +1542,7 @@ void DataFile::upgrade_1_3_0() iterate_ladspa_ports(effect, fn); } - if( attribute.attribute( "name" ) == "plugin" && - attribute.attribute( "value" ) == "Saturator" ) + else if (plugin == "Saturator") { auto fn = [&](QDomElement& port, int num, QList&, QList& ) { @@ -1580,8 +1569,7 @@ void DataFile::upgrade_1_3_0() iterate_ladspa_ports(effect, fn); } - if( attribute.attribute( "name" ) == "plugin" && - attribute.attribute( "value" ) == "StereoTools" ) + else if (plugin == "StereoTools") { auto fn = [&](QDomElement& port, int num, QList&, QList& ) { @@ -1597,6 +1585,29 @@ void DataFile::upgrade_1_3_0() }; iterate_ladspa_ports(effect, fn); } + + else if (plugin == "amPitchshift") + { + auto fn = [&](QDomElement& port, int num, QList&, QList& removeList) + { + switch (num) + { + case 0: + port.setTagName("port01"); + break; + case 1: + port.setTagName("port03"); + break; + case 10: + port.setTagName("port11"); + break; + case 11: + port.setTagName("port13"); + break; + } + }; + iterate_ladspa_ports(effect, fn); + } } } } diff --git a/src/core/Instrument.cpp b/src/core/Instrument.cpp index a7d3f73e8..dde260fdc 100644 --- a/src/core/Instrument.cpp +++ b/src/core/Instrument.cpp @@ -90,7 +90,7 @@ bool Instrument::isFromTrack( const Track * _track ) const static int countZeroCrossings(sampleFrame *buf, fpp_t start, fpp_t frames) { // zero point crossing counts of all channels - int zeroCrossings[DEFAULT_CHANNELS] = {0}; + auto zeroCrossings = std::array{}; // maximum zero point crossing of all channels int maxZeroCrossings = 0; diff --git a/src/core/InstrumentFunctions.cpp b/src/core/InstrumentFunctions.cpp index 4a5e29bd7..06e56666c 100644 --- a/src/core/InstrumentFunctions.cpp +++ b/src/core/InstrumentFunctions.cpp @@ -34,9 +34,10 @@ namespace lmms { - -InstrumentFunctionNoteStacking::ChordTable::Init InstrumentFunctionNoteStacking::ChordTable::s_initTable[] = -{ +std::array + InstrumentFunctionNoteStacking::ChordTable::s_initTable = + std::array +{{ { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "octave" ), { 0, -1 } }, { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Major" ), { 0, 4, 7, -1 } }, { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Majb5" ), { 0, 4, 6, -1 } }, @@ -139,7 +140,7 @@ InstrumentFunctionNoteStacking::ChordTable::Init InstrumentFunctionNoteStacking: { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "5" ), { 0, 7, -1 } }, { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Phrygian dominant" ), { 0, 1, 4, 5, 7, 8, 10, -1 } }, { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Persian" ), { 0, 1, 4, 5, 6, 8, 11, -1 } } -} ; +}}; diff --git a/src/core/MixHelpers.cpp b/src/core/MixHelpers.cpp index 2b2b5952f..02f3d8775 100644 --- a/src/core/MixHelpers.cpp +++ b/src/core/MixHelpers.cpp @@ -281,7 +281,7 @@ struct AddMultipliedStereoOp dst[1] += src[1] * m_coeffs[1]; } - float m_coeffs[2]; + std::array m_coeffs; } ; @@ -309,7 +309,7 @@ struct MultiplyAndAddMultipliedOp dst[1] = dst[1]*m_coeffs[0] + src[1]*m_coeffs[1]; } - float m_coeffs[2]; + std::array m_coeffs; } ; diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index 52ce2732c..b2a9f9e3f 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -190,11 +190,11 @@ void MixerChannel::doProcessing() Mixer::Mixer() : Model( nullptr ), JournallingObject(), - m_mixerChannels() + m_mixerChannels(), + m_lastSoloed(-1) { // create master channel createChannel(); - m_lastSoloed = -1; } @@ -224,6 +224,13 @@ int Mixer::createChannel() // reset channel state clearChannel( index ); + // if there is a soloed channel, mute the new track + if (m_lastSoloed != -1 && m_mixerChannels[m_lastSoloed]->m_soloModel.value()) + { + m_mixerChannels[index]->m_muteBeforeSolo = m_mixerChannels[index]->m_muteModel.value(); + m_mixerChannels[index]->m_muteModel.setValue(true); + } + return index; } @@ -825,5 +832,41 @@ void Mixer::validateChannelName( int index, int oldIndex ) } } +bool Mixer::isChannelInUse(int index) +{ + // check if the index mixer channel receives audio from any other channel + if (!m_mixerChannels[index]->m_receives.isEmpty()) + { + return true; + } + + // check if the destination mixer channel on any instrument or sample track is the index mixer channel + TrackContainer::TrackList tracks; + tracks += Engine::getSong()->tracks(); + tracks += Engine::patternStore()->tracks(); + + for (const auto t : tracks) + { + if (t->type() == Track::InstrumentTrack) + { + auto inst = dynamic_cast(t); + if (inst->mixerChannelModel()->value() == index) + { + return true; + } + } + else if (t->type() == Track::SampleTrack) + { + auto strack = dynamic_cast(t); + if (strack->mixerChannelModel()->value() == index) + { + return true; + } + } + } + + return false; +} + } // namespace lmms diff --git a/src/core/Model.cpp b/src/core/Model.cpp index dd277bc4e..634e2fbed 100644 --- a/src/core/Model.cpp +++ b/src/core/Model.cpp @@ -27,22 +27,47 @@ namespace lmms { +Model::Model(Model* parent, QString displayName, bool defaultConstructed) : + QObject(parent), + m_displayName(displayName), + m_defaultConstructed(defaultConstructed) +{ +} + +bool Model::isDefaultConstructed() const +{ + return m_defaultConstructed; +} + +Model* Model::parentModel() const +{ + return dynamic_cast(parent()); +} + +QString Model::displayName() const +{ + return m_displayName; +} + +void Model::setDisplayName(const QString& displayName) +{ + m_displayName = displayName; +} + QString Model::fullDisplayName() const { - const QString & n = displayName(); - if( parentModel() ) + const QString n = displayName(); + + if (parentModel()) { const QString p = parentModel()->fullDisplayName(); - if( n.isEmpty() && p.isEmpty() ) + + if (!p.isEmpty()) { - return QString(); + return p + ">" + n; } - else if( p.isEmpty() ) - { - return n; - } - return p + ">" + n; } + return n; } diff --git a/src/core/Oscillator.cpp b/src/core/Oscillator.cpp index 86a50c814..189dede6e 100644 --- a/src/core/Oscillator.cpp +++ b/src/core/Oscillator.cpp @@ -178,7 +178,7 @@ void Oscillator::generateFromFFT(int bands, sample_t* table) //ifft fftwf_execute(s_ifftPlan); //normalize and copy to result buffer - normalize(s_sampleBuffer, table, OscillatorConstants::WAVETABLE_LENGTH, 2*OscillatorConstants::WAVETABLE_LENGTH + 1); + normalize(s_sampleBuffer.data(), table, OscillatorConstants::WAVETABLE_LENGTH, 2*OscillatorConstants::WAVETABLE_LENGTH + 1); } void Oscillator::generateAntiAliasUserWaveTable(SampleBuffer *sampleBuffer) @@ -205,15 +205,15 @@ sample_t Oscillator::s_waveTables fftwf_plan Oscillator::s_fftPlan; fftwf_plan Oscillator::s_ifftPlan; fftwf_complex * Oscillator::s_specBuf; -float Oscillator::s_sampleBuffer[OscillatorConstants::WAVETABLE_LENGTH]; +std::array Oscillator::s_sampleBuffer; void Oscillator::createFFTPlans() { Oscillator::s_specBuf = ( fftwf_complex * ) fftwf_malloc( ( OscillatorConstants::WAVETABLE_LENGTH * 2 + 1 ) * sizeof( fftwf_complex ) ); - Oscillator::s_fftPlan = fftwf_plan_dft_r2c_1d(OscillatorConstants::WAVETABLE_LENGTH, s_sampleBuffer, s_specBuf, FFTW_MEASURE ); - Oscillator::s_ifftPlan = fftwf_plan_dft_c2r_1d(OscillatorConstants::WAVETABLE_LENGTH, s_specBuf, s_sampleBuffer, FFTW_MEASURE); + Oscillator::s_fftPlan = fftwf_plan_dft_r2c_1d(OscillatorConstants::WAVETABLE_LENGTH, s_sampleBuffer.data(), s_specBuf, FFTW_MEASURE ); + Oscillator::s_ifftPlan = fftwf_plan_dft_c2r_1d(OscillatorConstants::WAVETABLE_LENGTH, s_specBuf, s_sampleBuffer.data(), FFTW_MEASURE); // initialize s_specBuf content to zero, since the values are used in a condition inside generateFromFFT() for (int i = 0; i < OscillatorConstants::WAVETABLE_LENGTH * 2 + 1; i++) { diff --git a/src/core/PathUtil.cpp b/src/core/PathUtil.cpp index 299993673..03ec465a9 100644 --- a/src/core/PathUtil.cpp +++ b/src/core/PathUtil.cpp @@ -9,7 +9,7 @@ namespace lmms::PathUtil { - Base relativeBases[] = { Base::ProjectDir, Base::FactorySample, Base::UserSample, Base::UserVST, Base::Preset, + auto relativeBases = std::array{ Base::ProjectDir, Base::FactorySample, Base::UserSample, Base::UserVST, Base::Preset, Base::UserLADSPA, Base::DefaultLADSPA, Base::UserSoundfont, Base::DefaultSoundfont, Base::UserGIG, Base::DefaultGIG, Base::LocalDir }; @@ -121,7 +121,7 @@ namespace lmms::PathUtil //Check if it's a factory sample QString factoryPath = baseLocation(Base::FactorySample) + input; QFileInfo factoryInfo(factoryPath); - if (factoryInfo.exists()) { assumedBase = Base::FactorySample; } + if (factoryInfo.exists()) { assumedBase = Base::FactorySample; } //Check if it's a VST QString vstPath = baseLocation(Base::UserVST) + input; diff --git a/src/core/PatternClip.cpp b/src/core/PatternClip.cpp index 9af9bda6a..1058da6ba 100644 --- a/src/core/PatternClip.cpp +++ b/src/core/PatternClip.cpp @@ -60,6 +60,7 @@ void PatternClip::saveSettings(QDomDocument& doc, QDomElement& element) element.setAttribute( "pos", startPosition() ); } element.setAttribute( "len", length() ); + element.setAttribute("off", startTimeOffset()); element.setAttribute( "muted", isMuted() ); if( usesCustomClipColor() ) { @@ -78,7 +79,8 @@ void PatternClip::loadSettings(const QDomElement& element) movePosition( element.attribute( "pos" ).toInt() ); } changeLength( element.attribute( "len" ).toInt() ); - if( element.attribute( "muted" ).toInt() != isMuted() ) + setStartTimeOffset(element.attribute("off").toInt()); + if (static_cast(element.attribute("muted").toInt()) != isMuted()) { toggleMute(); } diff --git a/src/core/Piano.cpp b/src/core/Piano.cpp index 21ef7217d..82323526e 100644 --- a/src/core/Piano.cpp +++ b/src/core/Piano.cpp @@ -47,7 +47,7 @@ namespace lmms /*! The black / white order of keys as they appear on the keyboard. */ -static const Piano::KeyTypes KEY_ORDER[] = +static const auto KEY_ORDER = std::array { // C CIS D DIS Piano::WhiteKey, Piano::BlackKey, Piano::WhiteKey, Piano::BlackKey, @@ -62,10 +62,10 @@ static const Piano::KeyTypes KEY_ORDER[] = * * \param _it the InstrumentTrack window to attach to */ -Piano::Piano( InstrumentTrack* track ) : - Model( nullptr ), /*!< base class ctor */ - m_instrumentTrack( track ), - m_midiEvProc( track ) /*!< the InstrumentTrack Model */ +Piano::Piano(InstrumentTrack* track) : + Model(nullptr), /*!< base class ctor */ + m_instrumentTrack(track), + m_midiEvProc(track) /*!< the InstrumentTrack Model */ { } @@ -74,9 +74,9 @@ Piano::Piano( InstrumentTrack* track ) : * \param key the key number to change * \param state the state to set the key to */ -void Piano::setKeyState( int key, bool state ) +void Piano::setKeyState(int key, bool state) { - if( isValidKey( key ) ) + if (isValidKey(key)) { m_pressedKeys[key] = state; @@ -91,15 +91,15 @@ void Piano::setKeyState( int key, bool state ) * * \param key the key being pressed */ -void Piano::handleKeyPress( int key, int midiVelocity ) +void Piano::handleKeyPress(int key, int midiVelocity) { - if( midiVelocity == -1 ) + if (midiVelocity == -1) { midiVelocity = m_instrumentTrack->midiPort()->baseVelocity(); } - if( isValidKey( key ) ) + if (isValidKey(key)) { - m_midiEvProc->processInEvent( MidiEvent( MidiNoteOn, -1, key, midiVelocity ) ); + m_midiEvProc->processInEvent(MidiEvent(MidiNoteOn, -1, key, midiVelocity)); m_pressedKeys[key] = true; } } @@ -112,18 +112,18 @@ void Piano::handleKeyPress( int key, int midiVelocity ) * * \param key the key being releassed */ -void Piano::handleKeyRelease( int key ) +void Piano::handleKeyRelease(int key) { - if( isValidKey( key ) ) + if (isValidKey(key)) { - m_midiEvProc->processInEvent( MidiEvent( MidiNoteOff, -1, key, 0 ) ); + m_midiEvProc->processInEvent(MidiEvent(MidiNoteOff, -1, key, 0)); m_pressedKeys[key] = false; } } -bool Piano::isBlackKey( int key ) +bool Piano::isBlackKey(int key) { int keyCode = key % KeysPerOctave; @@ -131,9 +131,9 @@ bool Piano::isBlackKey( int key ) } -bool Piano::isWhiteKey( int key ) +bool Piano::isWhiteKey(int key) { - return !isBlackKey( key ); + return !isBlackKey(key); } diff --git a/src/core/PluginFactory.cpp b/src/core/PluginFactory.cpp index 81a6122d1..ece589274 100644 --- a/src/core/PluginFactory.cpp +++ b/src/core/PluginFactory.cpp @@ -105,12 +105,12 @@ PluginFactory* getPluginFactory() return PluginFactory::instance(); } -const Plugin::DescriptorList PluginFactory::descriptors() const +Plugin::DescriptorList PluginFactory::descriptors() const { return m_descriptors.values(); } -const Plugin::DescriptorList PluginFactory::descriptors(Plugin::PluginTypes type) const +Plugin::DescriptorList PluginFactory::descriptors(Plugin::PluginTypes type) const { return m_descriptors.values(type); } @@ -120,12 +120,12 @@ const PluginFactory::PluginInfoList& PluginFactory::pluginInfos() const return m_pluginInfos; } -const PluginFactory::PluginInfoAndKey PluginFactory::pluginSupportingExtension(const QString& ext) +PluginFactory::PluginInfoAndKey PluginFactory::pluginSupportingExtension(const QString& ext) { return m_pluginByExt.value(ext, PluginInfoAndKey()); } -const PluginFactory::PluginInfo PluginFactory::pluginInfo(const char* name) const +PluginFactory::PluginInfo PluginFactory::pluginInfo(const char* name) const { for (const PluginInfo& info : m_pluginInfos) { @@ -248,7 +248,7 @@ void PluginFactory::discoverPlugins() -const QString PluginFactory::PluginInfo::name() const +QString PluginFactory::PluginInfo::name() const { return descriptor ? descriptor->name : QString(); } diff --git a/src/core/ProjectRenderer.cpp b/src/core/ProjectRenderer.cpp index ca553003d..da6c729c8 100644 --- a/src/core/ProjectRenderer.cpp +++ b/src/core/ProjectRenderer.cpp @@ -39,18 +39,18 @@ namespace lmms { -const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] = +const std::array ProjectRenderer::fileEncodeDevices { - { ProjectRenderer::WaveFile, + FileEncodeDevice{ ProjectRenderer::WaveFile, QT_TRANSLATE_NOOP( "ProjectRenderer", "WAV (*.wav)" ), ".wav", &AudioFileWave::getInst }, - { ProjectRenderer::FlacFile, + FileEncodeDevice{ ProjectRenderer::FlacFile, QT_TRANSLATE_NOOP("ProjectRenderer", "FLAC (*.flac)"), ".flac", &AudioFileFlac::getInst }, - { ProjectRenderer::OggFile, + FileEncodeDevice{ ProjectRenderer::OggFile, QT_TRANSLATE_NOOP( "ProjectRenderer", "OGG (*.ogg)" ), ".ogg", #ifdef LMMS_HAVE_OGGVORBIS @@ -59,7 +59,7 @@ const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] = nullptr #endif }, - { ProjectRenderer::MP3File, + FileEncodeDevice{ ProjectRenderer::MP3File, QT_TRANSLATE_NOOP( "ProjectRenderer", "MP3 (*.mp3)" ), ".mp3", #ifdef LMMS_HAVE_MP3LAME @@ -71,7 +71,7 @@ const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] = // Insert your own file-encoder infos here. // Maybe one day the user can add own encoders inside the program. - { ProjectRenderer::NumFileFormats, nullptr, nullptr, nullptr } + FileEncodeDevice{ ProjectRenderer::NumFileFormats, nullptr, nullptr, nullptr } } ; @@ -224,8 +224,8 @@ void ProjectRenderer::updateConsoleProgress() { const int cols = 50; static int rot = 0; - char buf[80]; - char prog[cols+1]; + auto buf = std::array{}; + auto prog = std::array{}; for( int i = 0; i < cols; ++i ) { @@ -234,12 +234,12 @@ void ProjectRenderer::updateConsoleProgress() prog[cols] = 0; const auto activity = (const char*)"|/-\\"; - memset( buf, 0, sizeof( buf ) ); - sprintf( buf, "\r|%s| %3d%% %c ", prog, m_progress, + std::fill(buf.begin(), buf.end(), 0); + sprintf(buf.data(), "\r|%s| %3d%% %c ", prog.data(), m_progress, activity[rot] ); rot = ( rot+1 ) % 4; - fprintf( stderr, "%s", buf ); + fprintf( stderr, "%s", buf.data() ); fflush( stderr ); } diff --git a/src/core/SampleBuffer.cpp b/src/core/SampleBuffer.cpp index 92f3e2156..677366fdb 100644 --- a/src/core/SampleBuffer.cpp +++ b/src/core/SampleBuffer.cpp @@ -1067,7 +1067,7 @@ void SampleBuffer::visualize( float maxData = -1; float minData = 1; - float rmsData[2] = {0, 0}; + auto rmsData = std::array{}; // Find maximum and minimum samples within range for (int i = 0; i < fpp && frame + i <= last; ++i) diff --git a/src/core/SampleClip.cpp b/src/core/SampleClip.cpp index 1d173d78e..6396d49f3 100644 --- a/src/core/SampleClip.cpp +++ b/src/core/SampleClip.cpp @@ -292,15 +292,15 @@ void SampleClip::loadSettings( const QDomElement & _this ) if( sampleFile().isEmpty() && _this.hasAttribute( "data" ) ) { m_sampleBuffer->loadFromBase64( _this.attribute( "data" ) ); + if (_this.hasAttribute("sample_rate")) + { + m_sampleBuffer->setSampleRate(_this.attribute("sample_rate").toInt()); + } } changeLength( _this.attribute( "len" ).toInt() ); setMuted( _this.attribute( "muted" ).toInt() ); setStartTimeOffset( _this.attribute( "off" ).toInt() ); - if ( _this.hasAttribute( "sample_rate" ) ) { - m_sampleBuffer->setSampleRate( _this.attribute( "sample_rate" ).toInt() ); - } - if( _this.hasAttribute( "color" ) ) { useCustomClipColor( true ); diff --git a/src/core/Song.cpp b/src/core/Song.cpp index 7ecccf56d..fef66f193 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -116,7 +116,7 @@ Song::Song() : /* connect( &m_masterPitchModel, SIGNAL(dataChanged()), this, SLOT(masterPitchChanged()));*/ - qRegisterMetaType( "Note" ); + qRegisterMetaType( "lmms::Note" ); setType( SongContainer ); for (auto& scale : m_scales) {scale = std::make_shared();} @@ -620,6 +620,7 @@ void Song::togglePause() { m_playing = false; m_paused = true; + Engine::audioEngine()->clear(); } m_vstSyncController.setPlaybackState( m_playing ); @@ -837,14 +838,6 @@ bpm_t Song::getTempo() } - - -AutomationClip * Song::tempoAutomationClip() -{ - return AutomationClip::globalAutomationClip( &m_tempoModel ); -} - - AutomatedValueMap Song::automatedValuesAt(TimePos time, int clipNum) const { return TrackContainer::automatedValuesFromTracks(TrackList{m_globalAutomationTrack} << tracks(), time, clipNum); @@ -1051,7 +1044,12 @@ void Song::loadProject( const QString & fileName ) else { QTextStream(stderr) << tr("Can't load project: " - "Project file contains local paths to plugins.") << endl; + "Project file contains local paths to plugins.") +#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0)) + << Qt::endl; +#else + << endl; +#endif } } } diff --git a/src/core/audio/AudioFileFlac.cpp b/src/core/audio/AudioFileFlac.cpp index 4e40257cd..6af063683 100644 --- a/src/core/audio/AudioFileFlac.cpp +++ b/src/core/audio/AudioFileFlac.cpp @@ -96,7 +96,7 @@ void AudioFileFlac::writeBuffer(surroundSampleFrame const* _ab, fpp_t const fram if (depth == OutputSettings::Depth_24Bit || depth == OutputSettings::Depth_32Bit) // Float encoding { - std::unique_ptr buf{ new sample_t[frames*channels()] }; + auto buf = std::vector(frames * channels()); for(fpp_t frame = 0; frame < frames; ++frame) { for(ch_cnt_t channel=0; channel(buf.get()),frames); + sf_writef_float(m_sf, static_cast(buf.data()), frames); } else // integer PCM encoding { - std::unique_ptr buf{ new int_sample_t[frames*channels()] }; - convertToS16(_ab, frames, master_gain, buf.get(), !isLittleEndian()); - sf_writef_short(m_sf, static_cast(buf.get()), frames); + auto buf = std::vector(frames * channels()); + convertToS16(_ab, frames, master_gain, buf.data(), !isLittleEndian()); + sf_writef_short(m_sf, static_cast(buf.data()), frames); } } diff --git a/src/core/lv2/Lv2ControlBase.cpp b/src/core/lv2/Lv2ControlBase.cpp index 3ab8b278c..3d21474b0 100644 --- a/src/core/lv2/Lv2ControlBase.cpp +++ b/src/core/lv2/Lv2ControlBase.cpp @@ -1,7 +1,7 @@ /* * Lv2ControlBase.cpp - Lv2 control base class * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -54,30 +54,7 @@ Lv2ControlBase::Lv2ControlBase(Model* that, const QString &uri) : { if (m_plugin) { - int channelsLeft = DEFAULT_CHANNELS; // LMMS plugins are stereo - while (channelsLeft > 0) - { - std::unique_ptr newOne = std::make_unique(m_plugin, that); - if (newOne->isValid()) - { - channelsLeft -= std::max( - 1 + static_cast(newOne->inPorts().m_right), - 1 + static_cast(newOne->outPorts().m_right)); - Q_ASSERT(channelsLeft >= 0); - m_procs.push_back(std::move(newOne)); - } - else - { - qCritical() << "Failed instantiating LV2 processor"; - m_valid = false; - channelsLeft = 0; - } - } - if (m_valid) - { - m_channelsPerProc = DEFAULT_CHANNELS / m_procs.size(); - linkAllModels(); - } + init(that); } else { @@ -94,6 +71,53 @@ Lv2ControlBase::~Lv2ControlBase() = default; +void Lv2ControlBase::init(Model* meAsModel) +{ + int channelsLeft = DEFAULT_CHANNELS; // LMMS plugins are stereo + while (channelsLeft > 0) + { + std::unique_ptr newOne = std::make_unique(m_plugin, meAsModel); + if (newOne->isValid()) + { + channelsLeft -= std::max( + 1 + static_cast(newOne->inPorts().m_right), + 1 + static_cast(newOne->outPorts().m_right)); + Q_ASSERT(channelsLeft >= 0); + m_procs.push_back(std::move(newOne)); + } + else + { + qCritical() << "Failed instantiating LV2 processor"; + m_valid = false; + channelsLeft = 0; + } + } + if (m_valid) + { + m_channelsPerProc = DEFAULT_CHANNELS / m_procs.size(); + linkAllModels(); + } +} + + + + +void Lv2ControlBase::shutdown() +{ + // currently nothing to do here +} + + + + +void Lv2ControlBase::reload() +{ + for (const auto& c : m_procs) { c->reload(); } +} + + + + LinkedModelGroup *Lv2ControlBase::getGroup(std::size_t idx) { return (m_procs.size() > idx) ? m_procs[idx].get() : nullptr; @@ -183,14 +207,6 @@ void Lv2ControlBase::loadFile(const QString &file) -void Lv2ControlBase::reloadPlugin() -{ - // TODO -} - - - - std::size_t Lv2ControlBase::controlCount() const { std::size_t res = 0; for (const auto& c : m_procs) { res += c->controlCount(); } diff --git a/src/core/lv2/Lv2Features.cpp b/src/core/lv2/Lv2Features.cpp index be7fb6e28..6e74a8936 100644 --- a/src/core/lv2/Lv2Features.cpp +++ b/src/core/lv2/Lv2Features.cpp @@ -105,6 +105,14 @@ void *&Lv2Features::operator[](const char *featName) } + + +void Lv2Features::clear() +{ + m_featureByUri.clear(); +} + + } // namespace lmms #endif // LMMS_HAVE_LV2 diff --git a/src/core/lv2/Lv2Manager.cpp b/src/core/lv2/Lv2Manager.cpp index b1391b065..cc90f5e05 100644 --- a/src/core/lv2/Lv2Manager.cpp +++ b/src/core/lv2/Lv2Manager.cpp @@ -1,7 +1,7 @@ /* * Lv2Manager.cpp - Implementation of Lv2Manager class * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -60,6 +60,12 @@ const std::set Lv2Manager::pluginBlacklist = "http://calf.sourceforge.net/plugins/TransientDesigner", "http://calf.sourceforge.net/plugins/Vinyl", + // https://gitlab.com/drobilla/blop-lv2/-/issues/3 + "http://drobilla.net/plugins/blop/pulse", + "http://drobilla.net/plugins/blop/sawtooth", + "http://drobilla.net/plugins/blop/square", + "http://drobilla.net/plugins/blop/triangle", + // Visualization, meters, and scopes etc., won't work until we have gui support "http://distrho.sf.net/plugins/ProM", "http://distrho.sf.net/plugins/glBars", diff --git a/src/core/lv2/Lv2Proc.cpp b/src/core/lv2/Lv2Proc.cpp index f319f3b57..31af47a63 100644 --- a/src/core/lv2/Lv2Proc.cpp +++ b/src/core/lv2/Lv2Proc.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "AudioEngine.h" @@ -65,8 +66,8 @@ Plugin::PluginTypes Lv2Proc::check(const LilvPlugin *plugin, { unsigned maxPorts = lilv_plugin_get_num_ports(plugin); enum { inCount, outCount, maxCount }; - unsigned audioChannels[maxCount] = { 0, 0 }; // audio input and output count - unsigned midiChannels[maxCount] = { 0, 0 }; // MIDI input and output count + auto audioChannels = std::array{}; // audio input and output count + auto midiChannels = std::array{}; // MIDI input and output count const char* pluginUri = lilv_node_as_uri(lilv_plugin_get_uri(plugin)); //qDebug() << "Checking plugin" << pluginUri << "..."; @@ -175,6 +176,26 @@ Lv2Proc::~Lv2Proc() { shutdownPlugin(); } +void Lv2Proc::reload() +{ + // save controls, which we want to keep + QDomDocument doc; + QDomElement controls = doc.createElement("controls"); + saveValues(doc, controls); + // backup construction variables + const LilvPlugin* plugin = m_plugin; + Model* parent = Model::parentModel(); + // destroy everything using RAII ... + this->~Lv2Proc(); + // ... and reuse it ("placement new") + new (this) Lv2Proc(plugin, parent); + // reload the controls + loadValues(controls); +} + + + + void Lv2Proc::dumpPorts() { std::size_t num = 0; @@ -247,11 +268,11 @@ void Lv2Proc::copyModelsFromCore() ev.time.frames(Engine::framesPerTick()) + ev.offset; uint32_t type = Engine::getLv2Manager()-> uridCache()[Lv2UridCache::Id::midi_MidiEvent]; - uint8_t buf[4]; - std::size_t bufsize = writeToByteSeq(ev.ev, buf, sizeof(buf)); + auto buf = std::array{}; + std::size_t bufsize = writeToByteSeq(ev.ev, buf.data(), buf.size()); if(bufsize) { - lv2_evbuf_write(&iter, atomStamp, type, bufsize, buf); + lv2_evbuf_write(&iter, atomStamp, type, bufsize, buf.data()); } } } @@ -424,7 +445,10 @@ void Lv2Proc::shutdownPlugin() lilv_instance_deactivate(m_instance); lilv_instance_free(m_instance); m_instance = nullptr; + + m_features.clear(); } + m_valid = true; } diff --git a/src/core/lv2/Lv2SubPluginFeatures.cpp b/src/core/lv2/Lv2SubPluginFeatures.cpp index 4fb377b1c..4e02bc698 100644 --- a/src/core/lv2/Lv2SubPluginFeatures.cpp +++ b/src/core/lv2/Lv2SubPluginFeatures.cpp @@ -3,7 +3,7 @@ * Plugin::Descriptor::SubPluginFeatures for * hosting LV2 plugins * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -81,7 +81,7 @@ void Lv2SubPluginFeatures::fillDescriptionWidget(QWidget *parent, auto maker = new QWidget(parent); auto l = new QHBoxLayout(maker); - l->setMargin(0); + l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); auto maker_label = new QLabel(maker); @@ -98,7 +98,7 @@ void Lv2SubPluginFeatures::fillDescriptionWidget(QWidget *parent, auto copyright = new QWidget(parent); l = new QHBoxLayout(copyright); - l->setMargin(0); + l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); copyright->setMinimumWidth(parent->minimumWidth()); diff --git a/src/core/midi/MidiAlsaRaw.cpp b/src/core/midi/MidiAlsaRaw.cpp index 04ef5c1ce..23364fc01 100644 --- a/src/core/midi/MidiAlsaRaw.cpp +++ b/src/core/midi/MidiAlsaRaw.cpp @@ -105,7 +105,7 @@ void MidiAlsaRaw::sendByte( unsigned char c ) void MidiAlsaRaw::run() { - unsigned char buf[128]; + auto buf = std::array{}; //int cnt = 0; while( m_quit == false ) { @@ -149,7 +149,7 @@ void MidiAlsaRaw::run() { continue; } - err = snd_rawmidi_read( m_input, buf, sizeof( buf ) ); + err = snd_rawmidi_read(m_input, buf.data(), buf.size()); if( err == -EAGAIN ) { continue; diff --git a/src/core/midi/MidiAlsaSeq.cpp b/src/core/midi/MidiAlsaSeq.cpp index b770d914c..760840c77 100644 --- a/src/core/midi/MidiAlsaSeq.cpp +++ b/src/core/midi/MidiAlsaSeq.cpp @@ -241,7 +241,7 @@ void MidiAlsaSeq::applyPortMode( MidiPort * _port ) m_seqMutex.lock(); // determine port-capabilities - unsigned int caps[2] = { 0, 0 }; + auto caps = std::array{}; switch( _port->mode() ) { diff --git a/src/core/midi/MidiClient.cpp b/src/core/midi/MidiClient.cpp index 5b008c54b..78691de6f 100644 --- a/src/core/midi/MidiClient.cpp +++ b/src/core/midi/MidiClient.cpp @@ -105,10 +105,10 @@ void MidiClientRaw::parseData( const unsigned char c ) /* 'Process' system real-time messages */ /*********************************************************************/ /* There are not too many real-time messages that are of interest here. - * They can occur anywhere, even in the middle of a noteon message! + * They can occur anywhere, even in the middle of a noteon message! * Real-time range: 0xF8 .. 0xFF * Note: Real-time does not affect (running) status. - */ + */ if( c >= 0xF8 ) { if( c == MidiSystemReset ) @@ -124,13 +124,13 @@ void MidiClientRaw::parseData( const unsigned char c ) /* 'Process' system common messages (again, just skip them) */ /*********************************************************************/ /* There are no system common messages that are of interest here. - * System common range: 0xF0 .. 0xF7 + * System common range: 0xF0 .. 0xF7 */ if( c > 0xF0 ) { /* MIDI spec say: To ignore a non-real-time message, just discard all * data up to the next status byte. And our parser will ignore data - * that is received without a valid status. + * that is received without a valid status. * Note: system common cancels running status. */ m_midiParseData.m_status = 0; return; @@ -186,14 +186,14 @@ void MidiClientRaw::parseData( const unsigned char c ) /*********************************************************************/ /* Send the event */ /*********************************************************************/ - /* The event is ready-to-go. About 'running status': - * + /* The event is ready-to-go. About 'running status': + * * The MIDI protocol has a built-in compression mechanism. If several * similar events are sent in-a-row, for example note-ons, then the * event type is only sent once. For this case, the last event type * (status) is remembered. * We simply keep the status as it is, just reset the parameter counter. - * If another status byte comes in, it will overwrite the status. + * If another status byte comes in, it will overwrite the status. */ m_midiParseData.m_midiEvent.setType(static_cast(m_midiParseData.m_status)); m_midiParseData.m_midiEvent.setChannel(m_midiParseData.m_channel); @@ -224,7 +224,7 @@ void MidiClientRaw::parseData( const unsigned char c ) m_midiParseData.m_midiEvent.setPitchBend((m_midiParseData.m_buffer[1] * 128) | m_midiParseData.m_buffer[0]); break; - default: + default: // Unlikely return; } @@ -271,7 +271,7 @@ void MidiClientRaw::processOutEvent(const MidiEvent& event, const TimePos&, cons // Taken from Nagano Daisuke's USB-MIDI driver -static const unsigned char REMAINS_F0F6[] = +static const auto REMAINS_F0F6 = std::array { 0, /* 0xF0 */ 2, /* 0XF1 */ @@ -282,7 +282,7 @@ static const unsigned char REMAINS_F0F6[] = 1 /* 0XF6 */ } ; -static const unsigned char REMAINS_80E0[] = +static const auto REMAINS_80E0 = std::array { 3, /* 0x8X Note Off */ 3, /* 0x9X Note On */ diff --git a/src/core/midi/MidiPort.cpp b/src/core/midi/MidiPort.cpp index 63ca817e0..b656d9541 100644 --- a/src/core/midi/MidiPort.cpp +++ b/src/core/midi/MidiPort.cpp @@ -169,6 +169,12 @@ void MidiPort::processOutEvent( const MidiEvent& event, const TimePos& time ) outEvent.setVelocity( fixedOutputVelocity() ); } + if( fixedOutputNote() >= 0 && + ( event.type() == MidiNoteOn || event.type() == MidiNoteOff || event.type() == MidiKeyPressure ) ) + { + outEvent.setKey( fixedOutputNote() ); + } + m_midiClient->processOutEvent( outEvent, time, this ); } } @@ -238,6 +244,7 @@ void MidiPort::loadSettings( const QDomElement& thisElement ) m_outputControllerModel.loadSettings( thisElement, "outputcontroller" ); m_fixedInputVelocityModel.loadSettings( thisElement, "fixedinputvelocity" ); m_fixedOutputVelocityModel.loadSettings( thisElement, "fixedoutputvelocity" ); + m_fixedOutputNoteModel.loadSettings( thisElement, "fixedoutputnote" ); m_outputProgramModel.loadSettings( thisElement, "outputprogram" ); m_baseVelocityModel.loadSettings( thisElement, "basevelocity" ); m_readableModel.loadSettings( thisElement, "readable" ); diff --git a/src/gui/AutomatableModelView.cpp b/src/gui/AutomatableModelView.cpp index 52ee1ed7e..0e364993f 100644 --- a/src/gui/AutomatableModelView.cpp +++ b/src/gui/AutomatableModelView.cpp @@ -176,7 +176,7 @@ void AutomatableModelView::mousePressEvent( QMouseEvent* event ) new gui::StringPairDrag( "automatable_model", QString::number( modelUntyped()->id() ), QPixmap(), widget() ); event->accept(); } - else if( event->button() == Qt::MidButton ) + else if( event->button() == Qt::MiddleButton ) { modelUntyped()->reset(); } diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 7b8f1d0d4..c73ea126b 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -113,6 +113,7 @@ SET(LMMS_SRCS gui/widgets/NStateButton.cpp gui/widgets/Oscilloscope.cpp gui/widgets/PixmapButton.cpp + gui/widgets/SimpleTextFloat.cpp gui/widgets/TabBar.cpp gui/widgets/TabWidget.cpp gui/widgets/TempoSyncKnob.cpp diff --git a/src/gui/EffectRackView.cpp b/src/gui/EffectRackView.cpp index 75cac67dc..aa790d74d 100644 --- a/src/gui/EffectRackView.cpp +++ b/src/gui/EffectRackView.cpp @@ -42,7 +42,7 @@ EffectRackView::EffectRackView( EffectChain* model, QWidget* parent ) : ModelView( nullptr, this ) { auto mainLayout = new QVBoxLayout(this); - mainLayout->setMargin( 5 ); + mainLayout->setContentsMargins(5, 5, 5, 5); m_effectsGroupBox = new GroupBox( tr( "EFFECTS CHAIN" ) ); mainLayout->addWidget( m_effectsGroupBox ); diff --git a/src/gui/EffectView.cpp b/src/gui/EffectView.cpp index fed1ce4e9..f2caaadd5 100644 --- a/src/gui/EffectView.cpp +++ b/src/gui/EffectView.cpp @@ -23,9 +23,11 @@ * */ +#include +#include +#include #include #include -#include #include "EffectView.h" #include "DummyEffect.h" @@ -47,9 +49,10 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : PluginView( _model, _parent ), m_bg( embed::getIconPixmap( "effect_plugin" ) ), m_subWindow( nullptr ), - m_controlView( nullptr ) + m_controlView(nullptr), + m_dragging(false) { - setFixedSize( EffectView::DEFAULT_WIDTH, 60 ); + setFixedSize(EffectView::DEFAULT_WIDTH, EffectView::DEFAULT_HEIGHT); // Disable effects that are of type "DummyEffect" bool isEnabled = !dynamic_cast( effect() ); @@ -116,7 +119,10 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : m_subWindow->hide(); } } - + + m_opacityEffect = new QGraphicsOpacityEffect(this); + m_opacityEffect->setOpacity(1); + setGraphicsEffect(m_opacityEffect); //move above vst effect view creation //setModel( _model ); @@ -208,6 +214,43 @@ void EffectView::contextMenuEvent( QContextMenuEvent * ) +void EffectView::mousePressEvent(QMouseEvent* event) +{ + if (event->button() == Qt::LeftButton) + { + m_dragging = true; + m_opacityEffect->setOpacity(0.3); + QCursor c(Qt::SizeVerCursor); + QApplication::setOverrideCursor(c); + update(); + } +} + +void EffectView::mouseReleaseEvent(QMouseEvent* event) +{ + if (event->button() == Qt::LeftButton) + { + m_dragging = false; + m_opacityEffect->setOpacity(1); + QApplication::restoreOverrideCursor(); + update(); + } +} + +void EffectView::mouseMoveEvent(QMouseEvent* event) +{ + if (!m_dragging) { return; } + if (event->pos().y() < 0) + { + moveUp(); + } + else if (event->pos().y() > EffectView::DEFAULT_HEIGHT) + { + moveDown(); + } +} + + void EffectView::paintEvent( QPaintEvent * ) { diff --git a/src/gui/FileBrowser.cpp b/src/gui/FileBrowser.cpp index 4ef41217d..0672cd347 100644 --- a/src/gui/FileBrowser.cpp +++ b/src/gui/FileBrowser.cpp @@ -76,7 +76,7 @@ void FileBrowser::addContentCheckBox() auto filterWidget = new QWidget(contentParent()); filterWidget->setFixedHeight(15); auto filterWidgetLayout = new QHBoxLayout(filterWidget); - filterWidgetLayout->setMargin(0); + filterWidgetLayout->setContentsMargins(0, 0, 0, 0); filterWidgetLayout->setSpacing(0); auto configCheckBox = [this, &filterWidgetLayout](QCheckBox* box) @@ -119,7 +119,7 @@ FileBrowser::FileBrowser(const QString & directories, const QString & filter, searchWidget->setFixedHeight( 24 ); auto searchWidgetLayout = new QHBoxLayout(searchWidget); - searchWidgetLayout->setMargin( 0 ); + searchWidgetLayout->setContentsMargins(0, 0, 0, 0); searchWidgetLayout->setSpacing( 0 ); m_filterEdit = new QLineEdit( searchWidget ); @@ -229,26 +229,22 @@ void FileBrowser::reloadTree() -void FileBrowser::expandItems( QTreeWidgetItem * item, QList expandedDirs ) +void FileBrowser::expandItems(QTreeWidgetItem* item, QList expandedDirs) { int numChildren = item ? item->childCount() : m_fileBrowserTreeWidget->topLevelItemCount(); for (int i = 0; i < numChildren; ++i) { - QTreeWidgetItem * it = item ? item->child( i ) : m_fileBrowserTreeWidget->topLevelItem(i); - if ( m_recurse ) - { - it->setExpanded( true ); - } + auto it = item ? item->child(i) : m_fileBrowserTreeWidget->topLevelItem(i); auto d = dynamic_cast(it); if (d) { - d->update(); - bool expand = expandedDirs.contains( d->fullName() ); - d->setExpanded( expand ); - } - if (m_recurse && it->childCount()) - { - expandItems(it, expandedDirs); + // Expanding is required when recursive to load in its contents, even if it's collapsed right afterward + if (m_recurse) { d->setExpanded(true); } + d->setExpanded(expandedDirs.contains(d->fullName())); + if (m_recurse && it->childCount()) + { + expandItems(it, expandedDirs); + } } } } @@ -1006,88 +1002,34 @@ void Directory::update() -bool Directory::addItems(const QString & path ) +bool Directory::addItems(const QString& path) { - QDir thisDir( path ); - if( !thisDir.isReadable() ) + QDir thisDir(path); + if (!thisDir.isReadable()) { return false; } + + treeWidget()->setUpdatesEnabled(false); + + QFileInfoList entries = thisDir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot, QDir::LocaleAware | QDir::DirsFirst | QDir::Name); + for (auto& entry : entries) { - return false; - } - - treeWidget()->setUpdatesEnabled( false ); - - bool added_something = false; - - // try to add all directories from file system alphabetically into the tree - QStringList files = thisDir.entryList( QDir::Dirs, QDir::Name ); - for( QStringList::const_iterator it = files.constBegin(); - it != files.constEnd(); ++it ) - { - QString cur_file = *it; - if( cur_file[0] != '.' ) + QString fileName = entry.fileName(); + if (entry.isDir()) { - bool orphan = true; - for( int i = 0; i < childCount(); ++i ) - { - auto d = dynamic_cast(child(i)); - if( d == nullptr || cur_file < d->text( 0 ) ) - { - // insert before item, we're done - insertChild( i, new Directory( cur_file, - path, m_filter ) ); - orphan = false; - m_dirCount++; - break; - } - else if( cur_file == d->text( 0 ) ) - { - // imagine we have top-level subdirs named "TripleOscillator" in - // two directories from FileBrowser::m_directories - // and imagine both have a sub folder named "xyz" - // then only add one tree widget for both - // so we don't add a new Directory - we just - // add the path to the current directory - d->addDirectory( path ); - orphan = false; - break; - } - } - if( orphan ) - { - // it has not yet been added yet, so it's (lexically) - // larger than all other dirs => append it at the bottom - addChild( new Directory( cur_file, path, - m_filter ) ); - m_dirCount++; - } - - added_something = true; + auto dir = new Directory(fileName, path, m_filter); + addChild(dir); + m_dirCount++; + } + else if (entry.isFile() && thisDir.match(m_filter, fileName.toLower())) + { + auto fileItem = new FileItem(fileName, path); + addChild(fileItem); } } - - // sorts the path alphabetically instead of just appending to the bottom (see "orphans") - if (added_something) - sortChildren(0, Qt::AscendingOrder); - - QList items; - files = thisDir.entryList( QDir::Files, QDir::Name ); - files.sort(Qt::CaseInsensitive); - for( QStringList::const_iterator it = files.constBegin(); - it != files.constEnd(); ++it ) - { - QString cur_file = *it; - if( cur_file[0] != '.' && - thisDir.match( m_filter, cur_file.toLower() ) ) - { - items << new FileItem( cur_file, path ); - added_something = true; - } - } - addChildren( items ); - - treeWidget()->setUpdatesEnabled( true ); - - return added_something; + + treeWidget()->setUpdatesEnabled(true); + + // return true if we added any child items + return childCount() > 0; } @@ -1282,4 +1224,4 @@ QString FileItem::extension(const QString & file ) } -} // namespace lmms::gui \ No newline at end of file +} // namespace lmms::gui diff --git a/src/gui/LadspaControlView.cpp b/src/gui/LadspaControlView.cpp index 38ad4a146..46e208d2e 100644 --- a/src/gui/LadspaControlView.cpp +++ b/src/gui/LadspaControlView.cpp @@ -43,7 +43,7 @@ LadspaControlView::LadspaControlView( QWidget * _parent, m_ctl( _ctl ) { auto layout = new QHBoxLayout(this); - layout->setMargin( 0 ); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing( 0 ); LedCheckBox * link = nullptr; diff --git a/src/gui/LfoControllerDialog.cpp b/src/gui/LfoControllerDialog.cpp index 9e58d3e18..64602cd74 100644 --- a/src/gui/LfoControllerDialog.cpp +++ b/src/gui/LfoControllerDialog.cpp @@ -167,31 +167,22 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent m_waveBtnGrp->addButton( m_userWaveBtn ); auto x1 = new PixmapButton(this, nullptr); - x1->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y +7); - x1->setActiveGraphic( embed::getIconPixmap( - "lfo_x1_active" ) ); - x1->setInactiveGraphic( embed::getIconPixmap( - "lfo_x1_inactive" ) ); - x1->setToolTip( - tr( "Mutliply modulation frequency by 1" )); + x1->move(CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y + 7); + x1->setActiveGraphic(embed::getIconPixmap("lfo_x1_active")); + x1->setInactiveGraphic(embed::getIconPixmap("lfo_x1_inactive")); + x1->setToolTip(tr("Multiply modulation frequency by 1")); auto x100 = new PixmapButton(this, nullptr); - x100->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y - 8 ); - x100->setActiveGraphic( embed::getIconPixmap( - "lfo_x100_active" ) ); - x100->setInactiveGraphic( embed::getIconPixmap( - "lfo_x100_inactive" ) ); - x100->setToolTip( - tr( "Mutliply modulation frequency by 100" )); + x100->move(CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y - 8); + x100->setActiveGraphic(embed::getIconPixmap("lfo_x100_active")); + x100->setInactiveGraphic(embed::getIconPixmap("lfo_x100_inactive")); + x100->setToolTip(tr("Multiply modulation frequency by 100")); auto d100 = new PixmapButton(this, nullptr); - d100->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y + 22 ); - d100->setActiveGraphic( embed::getIconPixmap( - "lfo_d100_active" ) ); - d100->setInactiveGraphic( embed::getIconPixmap( - "lfo_d100_inactive" ) ); - d100->setToolTip( - tr( "Divide modulation frequency by 100" )); + d100->move(CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y + 22); + d100->setActiveGraphic(embed::getIconPixmap("lfo_d100_active")); + d100->setInactiveGraphic(embed::getIconPixmap("lfo_d100_inactive")); + d100->setToolTip(tr("Divide modulation frequency by 100")); m_multiplierBtnGrp = new automatableButtonGroup( this ); m_multiplierBtnGrp->addButton( x1 ); diff --git a/src/gui/LmmsPalette.cpp b/src/gui/LmmsPalette.cpp index 48d6de0df..0d135f52c 100644 --- a/src/gui/LmmsPalette.cpp +++ b/src/gui/LmmsPalette.cpp @@ -75,7 +75,7 @@ QPalette LmmsPalette::palette() const { QPalette pal = QApplication::style()->standardPalette(); - pal.setColor( QPalette::Background, background() ); + pal.setColor( QPalette::Window, background() ); pal.setColor( QPalette::WindowText, windowText() ); pal.setColor( QPalette::Base, base() ); pal.setColor( QPalette::ButtonText, buttonText() ); diff --git a/src/gui/LmmsStyle.cpp b/src/gui/LmmsStyle.cpp index 64c1c1614..50a2a9de4 100644 --- a/src/gui/LmmsStyle.cpp +++ b/src/gui/LmmsStyle.cpp @@ -23,6 +23,7 @@ * */ +#include #include #include @@ -71,7 +72,7 @@ QLinearGradient getGradient( const QColor & _col, const QRectF & _rect ) QLinearGradient darken( const QLinearGradient & _gradient ) { QGradientStops stops = _gradient.stops(); - for (auto& stop : stops) + for (auto& stop : stops) { QColor color = stop.second; stop.second = color.lighter(133); @@ -188,7 +189,7 @@ void LmmsStyle::drawComplexControl( ComplexControl control, /* else if( control == CC_ScrollBar ) { painter->fillRect( option->rect, QApplication::palette().color( QPalette::Active, - QPalette::Background ) ); + QPalette::Window ) ); }*/ QProxyStyle::drawComplexControl( control, option, painter, widget ); @@ -216,8 +217,8 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element, int a50 = static_cast( a100 * .6 ); int a25 = static_cast( a100 * .33 ); - QLine lines[4]; - QPoint points[4]; + auto lines = std::array{}; + auto points = std::array{}; // black inside lines // 50% @@ -231,7 +232,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element, rect.left() + 1, rect.bottom() - 2); lines[3] = QLine(rect.right() - 1, rect.top() + 2, rect.right() - 1, rect.bottom() - 2); - painter->drawLines(lines, 4); + painter->drawLines(lines.data(), 4); // black inside dots black.setAlpha(a50); @@ -240,7 +241,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element, points[1] = QPoint(rect.left() + 2, rect.bottom() - 2); points[2] = QPoint(rect.right() - 2, rect.top() + 2); points[3] = QPoint(rect.right() - 2, rect.bottom() - 2); - painter->drawPoints(points, 4); + painter->drawPoints(points.data(), 4); // outside lines - shadow @@ -251,7 +252,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element, rect.right() - 2, rect.top()); lines[1] = QLine(rect.left(), rect.top() + 2, rect.left(), rect.bottom() - 2); - painter->drawLines(lines, 2); + painter->drawLines(lines.data(), 2); // outside corner dots - shadow // 75% @@ -259,7 +260,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element, painter->setPen(QPen(shadow, 0)); points[0] = QPoint(rect.left() + 1, rect.top() + 1); points[1] = QPoint(rect.right() - 1, rect.top() + 1); - painter->drawPoints(points, 2); + painter->drawPoints(points.data(), 2); // outside end dots - shadow // 50% @@ -269,7 +270,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element, points[1] = QPoint(rect.left(), rect.top() + 1); points[2] = QPoint(rect.right() - 1, rect.top()); points[3] = QPoint(rect.left(), rect.bottom() - 1); - painter->drawPoints(points, 4); + painter->drawPoints(points.data(), 4); // outside lines - highlight @@ -280,7 +281,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element, rect.right() - 2, rect.bottom()); lines[1] = QLine(rect.right(), rect.top() + 2, rect.right(), rect.bottom() - 2); - painter->drawLines(lines, 2); + painter->drawLines(lines.data(), 2); // outside corner dots - highlight // 75% @@ -288,7 +289,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element, painter->setPen(QPen(highlight, 0)); points[0] = QPoint(rect.left() + 1, rect.bottom() - 1); points[1] = QPoint(rect.right() - 1, rect.bottom() - 1); - painter->drawPoints(points, 2); + painter->drawPoints(points.data(), 2); // outside end dots - highlight // 50% @@ -298,7 +299,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element, points[1] = QPoint(rect.right(), rect.bottom() - 1); points[2] = QPoint(rect.left() + 1, rect.bottom()); points[3] = QPoint(rect.right(), rect.top() + 1); - painter->drawPoints(points, 4); + painter->drawPoints(points.data(), 4); } else { diff --git a/src/gui/Lv2ViewBase.cpp b/src/gui/Lv2ViewBase.cpp index 4347c37cd..3fd1d44b1 100644 --- a/src/gui/Lv2ViewBase.cpp +++ b/src/gui/Lv2ViewBase.cpp @@ -1,7 +1,7 @@ /* * Lv2ViewBase.cpp - base class for Lv2 plugin views * - * Copyright (c) 2018-2020 Johannes Lorenz + * Copyright (c) 2018-2023 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * diff --git a/src/gui/MainApplication.cpp b/src/gui/MainApplication.cpp index ab45ce304..d33ede4d2 100644 --- a/src/gui/MainApplication.cpp +++ b/src/gui/MainApplication.cpp @@ -39,6 +39,19 @@ MainApplication::MainApplication(int& argc, char** argv) : QApplication(argc, argv), m_queuedFile() { +#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) + // Work around a bug of KXmlGui < 5.55 + // which breaks the recent files menu + // https://bugs.kde.org/show_bug.cgi?id=337491 + for (auto child : children()) + { + if (child->inherits("KCheckAcceleratorsInitializer")) + { + delete child; + } + } +#endif + #if defined(LMMS_BUILD_WIN32) installNativeEventFilter(this); #endif diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 706d63e27..40c8334ba 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include "AboutDialog.h" @@ -78,22 +77,6 @@ namespace lmms::gui { -#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) -//Work around an issue on KDE5 as per https://bugs.kde.org/show_bug.cgi?id=337491#c21 -void disableAutoKeyAccelerators(QWidget* mainWindow) -{ - using DisablerFunc = void(*)(QWidget*); - QLibrary kf5WidgetsAddon("KF5WidgetsAddons", 5); - auto setNoAccelerators - = reinterpret_cast(kf5WidgetsAddon.resolve("_ZN19KAcceleratorManager10setNoAccelEP7QWidget")); - if(setNoAccelerators) - { - setNoAccelerators(mainWindow); - } - kf5WidgetsAddon.unload(); -} -#endif - MainWindow::MainWindow() : m_workspace( nullptr ), @@ -103,20 +86,17 @@ MainWindow::MainWindow() : m_metronomeToggle( 0 ), m_session( Normal ) { -#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) - disableAutoKeyAccelerators(this); -#endif setAttribute( Qt::WA_DeleteOnClose ); auto main_widget = new QWidget(this); auto vbox = new QVBoxLayout(main_widget); vbox->setSpacing( 0 ); - vbox->setMargin( 0 ); + vbox->setContentsMargins(0, 0, 0, 0); auto w = new QWidget(main_widget); auto hbox = new QHBoxLayout(w); hbox->setSpacing( 0 ); - hbox->setMargin( 0 ); + hbox->setContentsMargins(0, 0, 0, 0); auto sideBar = new SideBar(Qt::Vertical, w); @@ -226,7 +206,7 @@ MainWindow::MainWindow() : // add layout for organizing quite complex toolbar-layouting m_toolBarLayout = new QGridLayout( m_toolBar/*, 2, 1*/ ); - m_toolBarLayout->setMargin( 0 ); + m_toolBarLayout->setContentsMargins(0, 0, 0, 0); m_toolBarLayout->setSpacing( 0 ); vbox->addWidget( m_toolBar ); diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 62d4cb7ce..a9582b4e2 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -23,7 +23,9 @@ */ +#include #include +#include #include #include #include @@ -59,7 +61,7 @@ MixerView::MixerView() : m->setHook( this ); //QPalette pal = palette(); - //pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) ); + //pal.setColor( QPalette::Window, QColor( 72, 76, 88 ) ); //setPalette( pal ); setAutoFillBackground( true ); @@ -79,7 +81,7 @@ MixerView::MixerView() : chLayout = new QHBoxLayout( m_channelAreaWidget ); chLayout->setSizeConstraint( QLayout::SetMinimumSize ); chLayout->setSpacing( 0 ); - chLayout->setMargin( 0 ); + chLayout->setContentsMargins(0, 0, 0, 0); m_channelAreaWidget->setLayout(chLayout); // create rack layout before creating the first channel @@ -385,6 +387,12 @@ void MixerView::deleteChannel(int index) // can't delete master if( index == 0 ) return; + // if there is no user confirmation, do nothing + if (!confirmRemoval(index)) + { + return; + } + // remember selected line int selLine = m_currentMixerLine->channelIndex(); @@ -397,7 +405,7 @@ void MixerView::deleteChannel(int index) // delete the view chLayout->removeWidget(m_mixerChannelViews[index]->m_mixerLine); - m_racksLayout->removeWidget( m_mixerChannelViews[index]->m_rackView ); + m_racksLayout->removeWidget(m_mixerChannelViews[index]->m_rackView); delete m_mixerChannelViews[index]->m_fader; delete m_mixerChannelViews[index]->m_muteBtn; delete m_mixerChannelViews[index]->m_soloBtn; @@ -409,56 +417,74 @@ void MixerView::deleteChannel(int index) m_channelAreaWidget->adjustSize(); // make sure every channel knows what index it is - for(int i=index + 1; im_mixerLine->setChannelIndex(i-1); + m_mixerChannelViews[i]->m_mixerLine->setChannelIndex(i - 1); } m_mixerChannelViews.remove(index); // select the next channel - if( selLine >= m_mixerChannelViews.size() ) + if (selLine >= m_mixerChannelViews.size()) { - selLine = m_mixerChannelViews.size()-1; + selLine = m_mixerChannelViews.size() - 1; } setCurrentMixerLine(selLine); updateMaxChannelSelector(); } +bool MixerView::confirmRemoval(int index) +{ + // if config variable is set to false, there is no need for user confirmation + bool needConfirm = ConfigManager::inst()->value("ui", "mixerchanneldeletionwarning", "1").toInt(); + if (!needConfirm) { return true; } + + Mixer* mix = Engine::mixer(); + + if (!mix->isChannelInUse(index)) + { + // is the channel is not in use, there is no need for user confirmation + return true; + } + + QString messageRemoveTrack = tr("This Mixer Channel is being used.\n" + "Are you sure you want to remove this channel?\n\n" + "Warning: This operation can not be undone."); + + QString messageTitleRemoveTrack = tr("Confirm removal"); + QString askAgainText = tr("Don't ask again"); + auto askAgainCheckBox = new QCheckBox(askAgainText, nullptr); + connect(askAgainCheckBox, &QCheckBox::stateChanged, [this](int state) { + // Invert button state, if it's checked we *shouldn't* ask again + ConfigManager::inst()->setValue("ui", "mixerchanneldeletionwarning", state ? "0" : "1"); + }); + + QMessageBox mb(this); + mb.setText(messageRemoveTrack); + mb.setWindowTitle(messageTitleRemoveTrack); + mb.setIcon(QMessageBox::Warning); + mb.addButton(QMessageBox::Cancel); + mb.addButton(QMessageBox::Ok); + mb.setCheckBox(askAgainCheckBox); + mb.setDefaultButton(QMessageBox::Cancel); + + int answer = mb.exec(); + + return answer == QMessageBox::Ok; +} void MixerView::deleteUnusedChannels() { - TrackContainer::TrackList tracks; - tracks += Engine::getSong()->tracks(); - tracks += Engine::patternStore()->tracks(); + Mixer* mix = Engine::mixer(); - std::vector inUse(m_mixerChannelViews.size(), false); - - //Populate inUse by checking the destination channel for every track - for (Track* t: tracks) + // Check all channels except master, delete those with no incoming sends + for (int i = m_mixerChannelViews.size() - 1; i > 0; --i) { - //The channel that this track sends to. Since master channel is always in use, - //setting this to 0 is a safe default (for tracks that don't sent to the mixer). - int channel = 0; - if (t->type() == Track::InstrumentTrack) + if (!mix->isChannelInUse(i)) { - auto inst = dynamic_cast(t); - channel = inst->mixerChannelModel()->value(); + deleteChannel(i); } - else if (t->type() == Track::SampleTrack) - { - auto strack = dynamic_cast(t); - channel = strack->mixerChannelModel()->value(); - } - inUse[channel] = true; - } - - //Check all channels except master, delete those with no incoming sends - for(int i = m_mixerChannelViews.size()-1; i > 0; --i) - { - if (!inUse[i] && Engine::mixer()->mixerChannel(i)->m_receives.isEmpty()) - { deleteChannel(i); } } } diff --git a/src/gui/PluginBrowser.cpp b/src/gui/PluginBrowser.cpp index a19c80df0..b59064f05 100644 --- a/src/gui/PluginBrowser.cpp +++ b/src/gui/PluginBrowser.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -34,7 +35,10 @@ #include "embed.h" #include "Engine.h" +#include "InstrumentTrack.h" +#include "Song.h" #include "StringPairDrag.h" +#include "TrackContainerView.h" #include "PluginFactory.h" namespace lmms::gui @@ -52,7 +56,7 @@ PluginBrowser::PluginBrowser( QWidget * _parent ) : addContentWidget( m_view ); auto view_layout = new QVBoxLayout(m_view); - view_layout->setMargin( 5 ); + view_layout->setContentsMargins(5, 5, 5, 5); view_layout->setSpacing( 5 ); @@ -287,4 +291,24 @@ void PluginDescWidget::mousePressEvent( QMouseEvent * _me ) } +void PluginDescWidget::contextMenuEvent(QContextMenuEvent* e) +{ + QMenu contextMenu(this); + contextMenu.addAction( + tr("Send to new instrument track"), + [=]{ openInNewInstrumentTrack(m_pluginKey.desc->name); } + ); + contextMenu.exec(e->globalPos()); +} + + +void PluginDescWidget::openInNewInstrumentTrack(QString value) +{ + TrackContainer* tc = Engine::getSong(); + auto it = dynamic_cast(Track::create(Track::InstrumentTrack, tc)); + auto ilt = new InstrumentLoaderThread(this, it, value); + ilt->start(); +} + + } // namespace lmms::gui diff --git a/src/gui/SampleTrackWindow.cpp b/src/gui/SampleTrackWindow.cpp index 78b899a09..6fe70bf41 100644 --- a/src/gui/SampleTrackWindow.cpp +++ b/src/gui/SampleTrackWindow.cpp @@ -57,7 +57,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) : // init own layout + widgets setFocusPolicy(Qt::StrongFocus); auto vlayout = new QVBoxLayout(this); - vlayout->setMargin(0); + vlayout->setContentsMargins(0, 0, 0, 0); vlayout->setSpacing(0); auto generalSettingsWidget = new TabWidget(tr("GENERAL SETTINGS"), this); diff --git a/src/gui/SideBarWidget.cpp b/src/gui/SideBarWidget.cpp index cf0233af1..60760ba59 100644 --- a/src/gui/SideBarWidget.cpp +++ b/src/gui/SideBarWidget.cpp @@ -44,7 +44,7 @@ SideBarWidget::SideBarWidget( const QString & _title, const QPixmap & _icon, m_contents = new QWidget( this ); m_layout = new QVBoxLayout( m_contents ); m_layout->setSpacing( 5 ); - m_layout->setMargin( 0 ); + m_layout->setContentsMargins(0, 0, 0, 0); m_closeBtn = new QPushButton(embed::getIconPixmap("close"), QString(), this); m_closeBtn->resize(m_buttonSize); m_closeBtn->setToolTip(tr("Close")); diff --git a/src/gui/clips/ClipView.cpp b/src/gui/clips/ClipView.cpp index e2da11439..8c4f704bc 100644 --- a/src/gui/clips/ClipView.cpp +++ b/src/gui/clips/ClipView.cpp @@ -43,6 +43,8 @@ #include "MidiClip.h" #include "MidiClipView.h" #include "Note.h" +#include "PatternClip.h" +#include "PatternStore.h" #include "SampleClip.h" #include "Song.h" #include "SongEditor.h" @@ -502,10 +504,11 @@ void ClipView::dropEvent( QDropEvent * de ) void ClipView::updateCursor(QMouseEvent * me) { auto sClip = dynamic_cast(m_clip); + auto pClip = dynamic_cast(m_clip); // If we are at the edges, use the resize cursor if (!me->buttons() && !m_clip->getAutoResize() && !isSelected() - && ((me->x() > width() - RESIZE_GRIP_WIDTH) || (me->x() < RESIZE_GRIP_WIDTH && sClip))) + && ((me->x() > width() - RESIZE_GRIP_WIDTH) || (me->x() < RESIZE_GRIP_WIDTH && (sClip || pClip)))) { setCursor(Qt::SizeHorCursor); } @@ -633,6 +636,7 @@ void ClipView::mousePressEvent( QMouseEvent * me ) if( !fixedClips() && me->button() == Qt::LeftButton ) { auto sClip = dynamic_cast(m_clip); + auto pClip = dynamic_cast(m_clip); const bool knifeMode = m_trackView->trackContainerView()->knifeMode(); if ( me->modifiers() & Qt::ControlModifier && !(sClip && knifeMode) ) @@ -677,7 +681,7 @@ void ClipView::mousePressEvent( QMouseEvent * me ) m_action = Resize; setCursor( Qt::SizeHorCursor ); } - else if( me->x() < RESIZE_GRIP_WIDTH && sClip ) + else if( me->x() < RESIZE_GRIP_WIDTH && (sClip || pClip) ) { m_action = ResizeLeft; setCursor( Qt::SizeHorCursor ); @@ -836,7 +840,6 @@ void ClipView::mouseMoveEvent( QMouseEvent * me ) if( m_action == Move ) { TimePos newPos = draggedClipPos( me ); - m_clip->movePosition(newPos); newPos = m_clip->startPosition(); // Get the real position the Clip was dragged to for the label m_trackView->getTrackContentWidget()->changePosition(); @@ -916,7 +919,8 @@ void ClipView::mouseMoveEvent( QMouseEvent * me ) else { auto sClip = dynamic_cast(m_clip); - if( sClip ) + auto pClip = dynamic_cast(m_clip); + if( sClip || pClip ) { const int x = mapToParent( me->pos() ).x() - m_initialMousePos.x(); @@ -948,12 +952,27 @@ void ClipView::mouseMoveEvent( QMouseEvent * me ) t = qMin( m_initialClipEnd - minLength, m_initialClipPos + offset ); } - TimePos oldPos = m_clip->startPosition(); - if( m_clip->length() + ( oldPos - t ) >= 1 ) + TimePos positionOffset = m_clip->startPosition() - t; + if (m_clip->length() + positionOffset >= 1) { - m_clip->movePosition( t ); - m_clip->changeLength( m_clip->length() + ( oldPos - t ) ); - sClip->setStartTimeOffset( sClip->startTimeOffset() + ( oldPos - t ) ); + m_clip->movePosition(t); + m_clip->changeLength(m_clip->length() + positionOffset); + if (sClip) + { + sClip->setStartTimeOffset(sClip->startTimeOffset() + positionOffset); + } + else if (pClip) + { + // Modulus the start time offset as we need it only for offsets + // inside the pattern length. This is done to prevent a value overflow. + // The start time offset may still become larger than the pattern length + // whenever the pattern length decreases without a clip resize following. + // To deal safely with it, always modulus before use. + tick_t patternLength = Engine::patternStore()->lengthOfPattern(pClip->patternIndex()) + * TimePos::ticksPerBar(); + TimePos position = (pClip->startTimeOffset() + positionOffset) % patternLength; + pClip->setStartTimeOffset(position); + } } } } diff --git a/src/gui/clips/PatternClipView.cpp b/src/gui/clips/PatternClipView.cpp index 477a90052..bf12440c7 100644 --- a/src/gui/clips/PatternClipView.cpp +++ b/src/gui/clips/PatternClipView.cpp @@ -115,14 +115,18 @@ void PatternClipView::paintEvent(QPaintEvent*) // bar lines const int lineSize = 3; + int pixelsPerPattern = Engine::patternStore()->lengthOfPattern(m_patternClip->patternIndex()) * pixelsPerBar(); + int offset = static_cast(m_patternClip->startTimeOffset() * (pixelsPerBar() / TimePos::ticksPerBar())) + % pixelsPerPattern; + if (offset < 2) { + offset += pixelsPerPattern; + } + p.setPen( c.darker( 200 ) ); - bar_t t = Engine::patternStore()->lengthOfPattern(m_patternClip->patternIndex()); - if (m_patternClip->length() > TimePos::ticksPerBar() && t > 0) + if (pixelsPerPattern > 0) { - for( int x = static_cast( t * pixelsPerBar() ); - x < width() - 2; - x += static_cast( t * pixelsPerBar() ) ) + for (int x = offset; x < width() - 2; x += pixelsPerPattern) { p.drawLine( x, BORDER_WIDTH, x, BORDER_WIDTH + lineSize ); p.drawLine( x, rect().bottom() - ( BORDER_WIDTH + lineSize ), diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index e296301ec..db56557a4 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -968,8 +968,8 @@ void AutomationEditor::paintEvent(QPaintEvent * pe ) { if( m_y_auto ) { - int y[] = { grid_bottom, TOP_MARGIN + font_height / 2 }; - float level[] = { m_minLevel, m_maxLevel }; + auto y = std::array{grid_bottom, TOP_MARGIN + font_height / 2}; + auto level = std::array{m_minLevel, m_maxLevel}; for( int i = 0; i < 2; ++i ) { const QString & label = m_clip->firstObject() diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 92c5ba72a..adc1997b9 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -66,6 +66,7 @@ #include "PatternStore.h" #include "PianoView.h" #include "PositionLine.h" +#include "SimpleTextFloat.h" #include "SongEditor.h" #include "StepRecorderWidget.h" #include "TextFloat.h" @@ -127,9 +128,9 @@ QPixmap * PianoRoll::s_toolMove = nullptr; QPixmap * PianoRoll::s_toolOpen = nullptr; QPixmap* PianoRoll::s_toolKnife = nullptr; -TextFloat * PianoRoll::s_textFloat = nullptr; +SimpleTextFloat * PianoRoll::s_textFloat = nullptr; -static QString s_noteStrings[12] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"}; +static std::array s_noteStrings {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"}; static QString getNoteString(int key) { @@ -137,7 +138,7 @@ static QString getNoteString(int key) } // used for drawing of piano -PianoRoll::PianoRollKeyTypes PianoRoll::prKeyOrder[] = +std::array PianoRoll::prKeyOrder { PR_WHITE_KEY_SMALL, PR_BLACK_KEY, PR_WHITE_KEY_BIG, PR_BLACK_KEY, PR_WHITE_KEY_SMALL, PR_WHITE_KEY_SMALL, PR_BLACK_KEY, PR_WHITE_KEY_BIG, @@ -290,7 +291,7 @@ PianoRoll::PianoRoll() : // init text-float if( s_textFloat == nullptr ) { - s_textFloat = new TextFloat; + s_textFloat = new SimpleTextFloat; } setAttribute( Qt::WA_OpaquePaintEvent, true ); @@ -369,10 +370,10 @@ PianoRoll::PianoRoll() : // Set up note length model m_noteLenModel.addItem( tr( "Last note" ), std::make_unique( "edit_draw" ) ); - const QString pixmaps[] = { "whole", "half", "quarter", "eighth", + const auto pixmaps = std::array{"whole", "half", "quarter", "eighth", "sixteenth", "thirtysecond", "triplethalf", "tripletquarter", "tripleteighth", - "tripletsixteenth", "tripletthirtysecond" } ; + "tripletsixteenth", "tripletthirtysecond"}; for( int i = 0; i < NUM_EVEN_LENGTHS; ++i ) { @@ -600,7 +601,7 @@ void PianoRoll::markSemiTone(int i, bool fromMenu) const int first = chord->isScale() ? 0 : key; const int last = chord->isScale() ? NumKeys : key + chord->last(); - const int cap = ( chord->isScale() || chord->last() == 0 ) ? KeysPerOctave : chord->last(); + const int cap = (chord->isScale() || chord->last() == 0) ? trackOctaveSize() : chord->last(); for( int i = first; i <= last; i++ ) { @@ -858,8 +859,7 @@ void PianoRoll::setCurrentMidiClip( MidiClip* newMidiClip ) } // force the song-editor to stop playing if it played a MIDI clip before - if( Engine::getSong()->isPlaying() && - Engine::getSong()->playMode() == Song::Mode_PlayMidiClip ) + if (Engine::getSong()->playMode() == Song::Mode_PlayMidiClip) { Engine::getSong()->playMidiClip( nullptr ); } @@ -938,6 +938,15 @@ void PianoRoll::hideMidiClip( MidiClip* clip ) } } + +int PianoRoll::trackOctaveSize() const +{ + if (!m_midiClip) { return KeysPerOctave; } + auto ut = m_midiClip->instrumentTrack()->microtuner(); + return ut->enabled() ? ut->octaveSize() : KeysPerOctave; +} + + void PianoRoll::selectRegionFromPixels( int xStart, int xEnd ) { @@ -3951,7 +3960,8 @@ QList PianoRoll::getAllOctavesForKey( int keyToMirror ) const { QList keys; - for (int i=keyToMirror % KeysPerOctave; i < NumKeys; i += KeysPerOctave) + int trackKeysPerOctave = trackOctaveSize(); + for (int i = keyToMirror % trackKeysPerOctave; i < NumKeys; i += trackKeysPerOctave) { keys.append(i); } @@ -5180,6 +5190,8 @@ void PianoRollWindow::saveSettings( QDomDocument & doc, QDomElement & de ) de.appendChild(markedSemiTonesRoot); } + de.setAttribute("stopbehaviour", m_editor->m_timeLine->behaviourAtStop()); + MainWindow::saveWidgetState( this, de ); } @@ -5193,6 +5205,8 @@ void PianoRollWindow::loadSettings( const QDomElement & de ) MainWindow::restoreWidgetState( this, de ); + m_editor->m_timeLine->setBehaviourAtStop(de.attribute("stopbehaviour").toInt()); + // update margins here because we're later in the startup process // We can't earlier because everything is still starting with the // WHITE_KEY_WIDTH default diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index 40be52319..3e62cc238 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -213,7 +213,7 @@ SongEditor::SongEditor( Song * song ) : // create widget for oscilloscope- and cpu-load-widget auto vc_w = new QWidget(tb); auto vcw_layout = new QVBoxLayout(vc_w); - vcw_layout->setMargin( 0 ); + vcw_layout->setContentsMargins(0, 0, 0, 0); vcw_layout->setSpacing( 0 ); vcw_layout->addStretch(); diff --git a/src/gui/editors/TrackContainerView.cpp b/src/gui/editors/TrackContainerView.cpp index 351fe8295..38a6a36d5 100644 --- a/src/gui/editors/TrackContainerView.cpp +++ b/src/gui/editors/TrackContainerView.cpp @@ -90,13 +90,13 @@ TrackContainerView::TrackContainerView( TrackContainer * _tc ) : //keeps the direction of the widget, undepended on the locale setLayoutDirection( Qt::LeftToRight ); auto layout = new QVBoxLayout(this); - layout->setMargin( 0 ); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing( 0 ); layout->addWidget( m_scrollArea ); auto scrollContent = new QWidget; m_scrollLayout = new QVBoxLayout( scrollContent ); - m_scrollLayout->setMargin( 0 ); + m_scrollLayout->setContentsMargins(0, 0, 0, 0); m_scrollLayout->setSpacing( 0 ); m_scrollLayout->setSizeConstraint( QLayout::SetMinAndMaxSize ); diff --git a/src/gui/instrument/InstrumentFunctionViews.cpp b/src/gui/instrument/InstrumentFunctionViews.cpp index 99c68a5ed..a4f0e670a 100644 --- a/src/gui/instrument/InstrumentFunctionViews.cpp +++ b/src/gui/instrument/InstrumentFunctionViews.cpp @@ -47,7 +47,7 @@ InstrumentFunctionNoteStackingView::InstrumentFunctionNoteStackingView( Instrume m_chordRangeKnob( new Knob( knobBright_26 ) ) { auto topLayout = new QHBoxLayout(this); - topLayout->setMargin( 0 ); + topLayout->setContentsMargins(0, 0, 0, 0); topLayout->addWidget( m_chordsGroupBox ); auto mainLayout = new QGridLayout(m_chordsGroupBox); @@ -109,7 +109,7 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti m_arpModeComboBox( new ComboBox() ) { auto topLayout = new QHBoxLayout(this); - topLayout->setMargin( 0 ); + topLayout->setContentsMargins(0, 0, 0, 0); topLayout->addWidget( m_arpGroupBox ); auto mainLayout = new QGridLayout(m_arpGroupBox); diff --git a/src/gui/instrument/InstrumentMidiIOView.cpp b/src/gui/instrument/InstrumentMidiIOView.cpp index 8d7cf9dda..fd9d6fc54 100644 --- a/src/gui/instrument/InstrumentMidiIOView.cpp +++ b/src/gui/instrument/InstrumentMidiIOView.cpp @@ -48,7 +48,7 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) : m_wpBtn( nullptr ) { auto layout = new QVBoxLayout(this); - layout->setMargin( 5 ); + layout->setContentsMargins(5, 5, 5, 5); m_midiInputGroupBox = new GroupBox( tr( "ENABLE MIDI INPUT" ) ); layout->addWidget( m_midiInputGroupBox ); diff --git a/src/gui/instrument/InstrumentMiscView.cpp b/src/gui/instrument/InstrumentMiscView.cpp index 1b4f82333..514db579c 100644 --- a/src/gui/instrument/InstrumentMiscView.cpp +++ b/src/gui/instrument/InstrumentMiscView.cpp @@ -44,7 +44,7 @@ InstrumentMiscView::InstrumentMiscView(InstrumentTrack *it, QWidget *parent) : QWidget(parent) { auto layout = new QVBoxLayout(this); - layout->setMargin(5); + layout->setContentsMargins(5, 5, 5, 5); // Master pitch toggle m_pitchGroupBox = new GroupBox(tr("GLOBAL TRANSPOSITION")); diff --git a/src/gui/instrument/InstrumentTrackWindow.cpp b/src/gui/instrument/InstrumentTrackWindow.cpp index 70c11976a..1d26dd9dc 100644 --- a/src/gui/instrument/InstrumentTrackWindow.cpp +++ b/src/gui/instrument/InstrumentTrackWindow.cpp @@ -90,7 +90,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // init own layout + widgets setFocusPolicy( Qt::StrongFocus ); auto vlayout = new QVBoxLayout(this); - vlayout->setMargin( 0 ); + vlayout->setContentsMargins(0, 0, 0, 0); vlayout->setSpacing( 0 ); auto generalSettingsWidget = new TabWidget(tr("GENERAL SETTINGS"), this); @@ -246,7 +246,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // FUNC tab auto instrumentFunctions = new QWidget(m_tabWidget); auto instrumentFunctionsLayout = new QVBoxLayout(instrumentFunctions); - instrumentFunctionsLayout->setMargin( 5 ); + instrumentFunctionsLayout->setContentsMargins(5, 5, 5, 5); m_noteStackingView = new InstrumentFunctionNoteStackingView( &m_track->m_noteStacking ); m_arpeggioView = new InstrumentFunctionArpeggioView( &m_track->m_arpeggio ); diff --git a/src/gui/instrument/PianoView.cpp b/src/gui/instrument/PianoView.cpp index a64b22095..a2df50e47 100644 --- a/src/gui/instrument/PianoView.cpp +++ b/src/gui/instrument/PianoView.cpp @@ -62,7 +62,7 @@ namespace lmms::gui /*! The scale of C Major - white keys only. */ -Keys WhiteKeys[] = +auto WhiteKeys = std::array { Key_C, Key_D, Key_E, Key_F, Key_G, Key_A, Key_H } ; @@ -147,7 +147,7 @@ PianoView::PianoView(QWidget *parent) : // create a layout for ourselves auto layout = new QVBoxLayout(this); layout->setSpacing( 0 ); - layout->setMargin( 0 ); + layout->setContentsMargins(0, 0, 0, 0); layout->addSpacing( PIANO_BASE+PW_WHITE_KEY_HEIGHT ); layout->addWidget( m_pianoScroll ); diff --git a/src/gui/modals/ControllerConnectionDialog.cpp b/src/gui/modals/ControllerConnectionDialog.cpp index 149303da8..06f6a5708 100644 --- a/src/gui/modals/ControllerConnectionDialog.cpp +++ b/src/gui/modals/ControllerConnectionDialog.cpp @@ -215,7 +215,7 @@ ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent, auto btn_layout = new QHBoxLayout(buttons); btn_layout->setSpacing( 0 ); - btn_layout->setMargin( 0 ); + btn_layout->setContentsMargins(0, 0, 0, 0); auto select_btn = new QPushButton(embed::getIconPixmap("add"), tr("OK"), buttons); connect( select_btn, SIGNAL(clicked()), diff --git a/src/gui/modals/EffectSelectDialog.cpp b/src/gui/modals/EffectSelectDialog.cpp index 9ce3f90b6..eac5a3783 100644 --- a/src/gui/modals/EffectSelectDialog.cpp +++ b/src/gui/modals/EffectSelectDialog.cpp @@ -213,14 +213,14 @@ void EffectSelectDialog::rowChanged( const QModelIndex & _idx, hbox->addWidget(textualInfoWidget); auto textWidgetLayout = new QVBoxLayout(textualInfoWidget); - textWidgetLayout->setMargin( 4 ); + textWidgetLayout->setContentsMargins(4, 4, 4, 4); textWidgetLayout->setSpacing( 0 ); if ( m_currentSelection.desc->subPluginFeatures ) { auto subWidget = new QWidget(textualInfoWidget); auto subLayout = new QVBoxLayout(subWidget); - subLayout->setMargin( 4 ); + subLayout->setContentsMargins(4, 4, 4, 4); subLayout->setSpacing( 0 ); m_currentSelection.desc->subPluginFeatures-> fillDescriptionWidget( subWidget, &m_currentSelection ); diff --git a/src/gui/modals/ExportProjectDialog.cpp b/src/gui/modals/ExportProjectDialog.cpp index 7671e031e..1f937c374 100644 --- a/src/gui/modals/ExportProjectDialog.cpp +++ b/src/gui/modals/ExportProjectDialog.cpp @@ -79,14 +79,14 @@ ExportProjectDialog::ExportProjectDialog( const QString & _file_name, cbIndex++; } } - + int const MAX_LEVEL=8; for(int i=0; i<=MAX_LEVEL; ++i) { QString info=""; if ( i==0 ){ info = tr( "( Fastest - biggest )" ); } else if ( i==MAX_LEVEL ){ info = tr( "( Slowest - smallest )" ); } - + compLevelCB->addItem( QString::number(i)+" "+info, QVariant(i/static_cast(MAX_LEVEL)) @@ -159,8 +159,8 @@ void ExportProjectDialog::startExport() static_cast(interpolationCB->currentIndex()), static_cast(oversamplingCB->currentIndex()) ); - const int samplerates[5] = { 44100, 48000, 88200, 96000, 192000 }; - const bitrate_t bitrates[6] = { 64, 128, 160, 192, 256, 320 }; + const auto samplerates = std::array{44100, 48000, 88200, 96000, 192000}; + const auto bitrates = std::array{64, 128, 160, 192, 256, 320}; bool useVariableBitRate = checkBoxVariableBitRate->isChecked(); diff --git a/src/gui/modals/SetupDialog.cpp b/src/gui/modals/SetupDialog.cpp index 5140a63b5..33505c399 100644 --- a/src/gui/modals/SetupDialog.cpp +++ b/src/gui/modals/SetupDialog.cpp @@ -112,6 +112,8 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : "app", "sololegacybehavior", "0").toInt()), m_trackDeletionWarning(ConfigManager::inst()->value( "ui", "trackdeletionwarning", "1").toInt()), + m_mixerChannelDeletionWarning(ConfigManager::inst()->value( + "ui", "mixerchanneldeletionwarning", "1").toInt()), m_MMPZ(!ConfigManager::inst()->value( "app", "nommpz").toInt()), m_disableBackup(!ConfigManager::inst()->value( @@ -175,12 +177,12 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : // Vertical layout. auto vlayout = new QVBoxLayout(this); vlayout->setSpacing(0); - vlayout->setMargin(0); + vlayout->setContentsMargins(0, 0, 0, 0); // Horizontal layout. auto hlayout = new QHBoxLayout(main_w); hlayout->setSpacing(0); - hlayout->setMargin(0); + hlayout->setContentsMargins(0, 0, 0, 0); // Tab bar for the main tabs. m_tabBar = new TabBar(main_w, QBoxLayout::TopToBottom); @@ -195,9 +197,21 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : auto general_w = new QWidget(settings_w); auto general_layout = new QVBoxLayout(general_w); general_layout->setSpacing(10); - general_layout->setMargin(0); + general_layout->setContentsMargins(0, 0, 0, 0); labelWidget(general_w, tr("General")); + // General scroll area. + auto generalScroll = new QScrollArea(general_w); + generalScroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + generalScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + + // General controls widget. + auto generalControls = new QWidget(general_w); + + // Path selectors layout. + auto generalControlsLayout = new QVBoxLayout; + generalControlsLayout->setSpacing(10); + auto addLedCheckBox = [&XDelta, &YDelta, this](const QString& ledText, TabWidget* tw, int& counter, bool initialState, const char* toggledSlot, bool showRestartWarning) { auto checkBox = new LedCheckBox(ledText, tw); @@ -214,7 +228,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : int counter = 0; // GUI tab. - auto gui_tw = new TabWidget(tr("Graphical user interface (GUI)"), general_w); + auto gui_tw = new TabWidget(tr("Graphical user interface (GUI)"), generalControls); addLedCheckBox(tr("Display volume as dBFS "), gui_tw, counter, m_displaydBFS, SLOT(toggleDisplaydBFS(bool)), true); @@ -236,14 +250,19 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : m_soloLegacyBehavior, SLOT(toggleSoloLegacyBehavior(bool)), false); addLedCheckBox(tr("Show warning when deleting tracks"), gui_tw, counter, m_trackDeletionWarning, SLOT(toggleTrackDeletionWarning(bool)), false); + addLedCheckBox(tr("Show warning when deleting a mixer channel that is in use"), gui_tw, counter, + m_mixerChannelDeletionWarning, SLOT(toggleMixerChannelDeletionWarning(bool)), false); gui_tw->setFixedHeight(YDelta + YDelta * counter); + generalControlsLayout->addWidget(gui_tw); + generalControlsLayout->addSpacing(10); + counter = 0; // Projects tab. - auto projects_tw = new TabWidget(tr("Projects"), general_w); + auto projects_tw = new TabWidget(tr("Projects"), generalControls); addLedCheckBox(tr("Compress project files by default"), projects_tw, counter, m_MMPZ, SLOT(toggleMMPZ(bool)), true); @@ -254,8 +273,12 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : projects_tw->setFixedHeight(YDelta + YDelta * counter); + generalControlsLayout->addWidget(projects_tw); + generalControlsLayout->addSpacing(10); + + // Language tab. - auto lang_tw = new TabWidget(tr("Language"), general_w); + auto lang_tw = new TabWidget(tr("Language"), generalControls); lang_tw->setFixedHeight(48); auto changeLang = new QComboBox(lang_tw); changeLang->move(XDelta, 20); @@ -310,11 +333,15 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : connect(changeLang, SIGNAL(currentIndexChanged(int)), this, SLOT(showRestartWarning())); + generalControlsLayout->addWidget(lang_tw); + generalControlsLayout->addSpacing(10); // General layout ordering. - general_layout->addWidget(gui_tw); - general_layout->addWidget(projects_tw); - general_layout->addWidget(lang_tw); + generalControlsLayout->addStretch(); + generalControls->setLayout(generalControlsLayout); + generalScroll->setWidget(generalControls); + generalScroll->setWidgetResizable(true); + general_layout->addWidget(generalScroll); general_layout->addStretch(); @@ -324,7 +351,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : auto performance_w = new QWidget(settings_w); auto performance_layout = new QVBoxLayout(performance_w); performance_layout->setSpacing(10); - performance_layout->setMargin(0); + performance_layout->setContentsMargins(0, 0, 0, 0); labelWidget(performance_w, tr("Performance")); @@ -442,7 +469,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : auto audio_w = new QWidget(settings_w); auto audio_layout = new QVBoxLayout(audio_w); audio_layout->setSpacing(10); - audio_layout->setMargin(0); + audio_layout->setContentsMargins(0, 0, 0, 0); labelWidget(audio_w, tr("Audio")); @@ -460,7 +487,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : auto as_w_layout = new QHBoxLayout(as_w); as_w_layout->setSpacing(0); - as_w_layout->setMargin(0); + as_w_layout->setContentsMargins(0, 0, 0, 0); #ifdef LMMS_HAVE_JACK m_audioIfaceSetupWidgets[AudioJack::name()] = @@ -592,7 +619,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : auto midi_w = new QWidget(settings_w); auto midi_layout = new QVBoxLayout(midi_w); midi_layout->setSpacing(10); - midi_layout->setMargin(0); + midi_layout->setContentsMargins(0, 0, 0, 0); labelWidget(midi_w, tr("MIDI")); @@ -609,7 +636,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : auto ms_w_layout = new QHBoxLayout(ms_w); ms_w_layout->setSpacing(0); - ms_w_layout->setMargin(0); + ms_w_layout->setContentsMargins(0, 0, 0, 0); #ifdef LMMS_HAVE_ALSA m_midiIfaceSetupWidgets[MidiAlsaSeq::name()] = @@ -709,7 +736,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : auto paths_layout = new QVBoxLayout(paths_w); paths_layout->setSpacing(10); - paths_layout->setMargin(0); + paths_layout->setContentsMargins(0, 0, 0, 0); labelWidget(paths_w, tr("Paths")); @@ -823,7 +850,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) : auto extras_w = new QWidget(this); auto extras_layout = new QHBoxLayout(extras_w); extras_layout->setSpacing(0); - extras_layout->setMargin(0); + extras_layout->setContentsMargins(0, 0, 0, 0); // Restart warning label. restartWarningLbl = new QLabel( @@ -896,6 +923,8 @@ void SetupDialog::accept() QString::number(m_soloLegacyBehavior)); ConfigManager::inst()->setValue("ui", "trackdeletionwarning", QString::number(m_trackDeletionWarning)); + ConfigManager::inst()->setValue("ui", "mixerchanneldeletionwarning", + QString::number(m_mixerChannelDeletionWarning)); ConfigManager::inst()->setValue("app", "nommpz", QString::number(!m_MMPZ)); ConfigManager::inst()->setValue("app", "disablebackup", @@ -1017,6 +1046,11 @@ void SetupDialog::toggleTrackDeletionWarning(bool enabled) m_trackDeletionWarning = enabled; } +void SetupDialog::toggleMixerChannelDeletionWarning(bool enabled) +{ + m_mixerChannelDeletionWarning = enabled; +} + void SetupDialog::toggleMMPZ(bool enabled) { diff --git a/src/gui/tracks/InstrumentTrackView.cpp b/src/gui/tracks/InstrumentTrackView.cpp index 5daa51381..17adc99a6 100644 --- a/src/gui/tracks/InstrumentTrackView.cpp +++ b/src/gui/tracks/InstrumentTrackView.cpp @@ -211,7 +211,7 @@ InstrumentTrackWindow * InstrumentTrackView::topLevelInstrumentTrackWindow() getGUI()->mainWindow()->workspace()->subWindowList( QMdiArea::ActivationHistoryOrder ) ) { - if( sw->isVisible() && sw->widget()->inherits( "InstrumentTrackWindow" ) ) + if( sw->isVisible() && sw->widget()->inherits( "lmms::gui::InstrumentTrackWindow" ) ) { w = qobject_cast( sw->widget() ); } diff --git a/src/gui/tracks/SampleTrackView.cpp b/src/gui/tracks/SampleTrackView.cpp index 08ddee863..fbdd41ded 100644 --- a/src/gui/tracks/SampleTrackView.cpp +++ b/src/gui/tracks/SampleTrackView.cpp @@ -82,7 +82,7 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) : m_panningKnob->show(); m_activityIndicator = new FadeButton( - QApplication::palette().color(QPalette::Active, QPalette::Background), + QApplication::palette().color(QPalette::Active, QPalette::Window), QApplication::palette().color(QPalette::Active, QPalette::BrightText), QApplication::palette().color(QPalette::Active, QPalette::BrightText).darker(), getTrackSettingsWidget() diff --git a/src/gui/tracks/TrackLabelButton.cpp b/src/gui/tracks/TrackLabelButton.cpp index b82c8cf6e..3f1b45871 100644 --- a/src/gui/tracks/TrackLabelButton.cpp +++ b/src/gui/tracks/TrackLabelButton.cpp @@ -105,6 +105,7 @@ void TrackLabelButton::renameFinished() { if( !( ConfigManager::inst()->value( "ui", "compacttrackbuttons" ).toInt() ) ) { + m_renameLineEdit->clearFocus(); m_renameLineEdit->hide(); if( m_renameLineEdit->text() != "" ) { diff --git a/src/gui/tracks/TrackView.cpp b/src/gui/tracks/TrackView.cpp index 0aabc705d..3e9257a0d 100644 --- a/src/gui/tracks/TrackView.cpp +++ b/src/gui/tracks/TrackView.cpp @@ -75,7 +75,7 @@ TrackView::TrackView( Track * track, TrackContainerView * tcv ) : m_trackSettingsWidget.setAutoFillBackground( true ); auto layout = new QHBoxLayout(this); - layout->setMargin( 0 ); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing( 0 ); layout->addWidget( &m_trackOperationsWidget ); layout->addWidget( &m_trackSettingsWidget ); diff --git a/src/gui/widgets/CustomTextKnob.cpp b/src/gui/widgets/CustomTextKnob.cpp index 9f6e19b90..ce880608c 100644 --- a/src/gui/widgets/CustomTextKnob.cpp +++ b/src/gui/widgets/CustomTextKnob.cpp @@ -1,3 +1,27 @@ +/* + * CustomTextKnob.cpp + * + * Copyright (c) 2020 Ibuki Sugiyama
+ * + * 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. + * + */ + #include "CustomTextKnob.h" namespace lmms::gui diff --git a/src/gui/widgets/Fader.cpp b/src/gui/widgets/Fader.cpp index f853ff707..dcf648c37 100644 --- a/src/gui/widgets/Fader.cpp +++ b/src/gui/widgets/Fader.cpp @@ -54,13 +54,13 @@ #include "embed.h" #include "CaptionMenu.h" #include "ConfigManager.h" -#include "TextFloat.h" +#include "SimpleTextFloat.h" namespace lmms::gui { -TextFloat * Fader::s_textFloat = nullptr; +SimpleTextFloat * Fader::s_textFloat = nullptr; QPixmap * Fader::s_back = nullptr; QPixmap * Fader::s_leds = nullptr; QPixmap * Fader::s_knob = nullptr; @@ -83,7 +83,7 @@ Fader::Fader( FloatModel * _model, const QString & _name, QWidget * _parent ) : { if( s_textFloat == nullptr ) { - s_textFloat = new TextFloat; + s_textFloat = new SimpleTextFloat; } if( ! s_back ) { @@ -125,7 +125,7 @@ Fader::Fader( FloatModel * model, const QString & name, QWidget * parent, QPixma { if( s_textFloat == nullptr ) { - s_textFloat = new TextFloat; + s_textFloat = new SimpleTextFloat; } m_back = back; @@ -328,7 +328,8 @@ void Fader::updateTextFloat() { s_textFloat->setText( m_description + " " + QString("%1 ").arg( model()->value() * m_conversionFactor ) + " " + m_unit ); } - s_textFloat->moveGlobal( this, QPoint( width() - ( *m_knob ).width() - 5, knobPosY() - 46 ) ); + + s_textFloat->moveGlobal(this, QPoint(width() + 2, knobPosY() - s_textFloat->height() / 2)); } @@ -483,4 +484,4 @@ void Fader::setPeakYellow( const QColor & c ) } -} // namespace lmms::gui \ No newline at end of file +} // namespace lmms::gui diff --git a/src/gui/widgets/Knob.cpp b/src/gui/widgets/Knob.cpp index 049a86be1..8640bb81d 100644 --- a/src/gui/widgets/Knob.cpp +++ b/src/gui/widgets/Knob.cpp @@ -45,14 +45,14 @@ #include "LocaleHelper.h" #include "MainWindow.h" #include "ProjectJournal.h" +#include "SimpleTextFloat.h" #include "StringPairDrag.h" -#include "TextFloat.h" namespace lmms::gui { -TextFloat * Knob::s_textFloat = nullptr; +SimpleTextFloat * Knob::s_textFloat = nullptr; @@ -86,7 +86,7 @@ void Knob::initUi( const QString & _name ) { if( s_textFloat == nullptr ) { - s_textFloat = new TextFloat; + s_textFloat = new SimpleTextFloat; } setWindowTitle( _name ); diff --git a/src/gui/widgets/LcdFloatSpinBox.cpp b/src/gui/widgets/LcdFloatSpinBox.cpp index e57012e10..6391f314a 100644 --- a/src/gui/widgets/LcdFloatSpinBox.cpp +++ b/src/gui/widgets/LcdFloatSpinBox.cpp @@ -38,6 +38,7 @@ #include #include "CaptionMenu.h" +#include "DeprecationHelper.h" #include "embed.h" #include "GuiApplication.h" #include "gui_templates.h" @@ -179,7 +180,7 @@ void LcdFloatSpinBox::mouseReleaseEvent(QMouseEvent*) void LcdFloatSpinBox::wheelEvent(QWheelEvent *event) { // switch between integer and fractional step based on cursor position - if (event->x() < m_wholeDisplay.width()) { m_intStep = true; } + if (position(event).x() < m_wholeDisplay.width()) { m_intStep = true; } else { m_intStep = false; } event->accept(); @@ -239,9 +240,9 @@ void LcdFloatSpinBox::paintEvent(QPaintEvent*) { p.setFont(pointSizeF(p.font(), 6.5)); p.setPen(m_wholeDisplay.textShadowColor()); - p.drawText(width() / 2 - p.fontMetrics().width(m_label) / 2 + 1, height(), m_label); + p.drawText(width() / 2 - horizontalAdvance(p.fontMetrics(), m_label) / 2 + 1, height(), m_label); p.setPen(m_wholeDisplay.textColor()); - p.drawText(width() / 2 - p.fontMetrics().width(m_label) / 2, height() - 1, m_label); + p.drawText(width() / 2 - horizontalAdvance(p.fontMetrics(), m_label) / 2, height() - 1, m_label); } } diff --git a/src/gui/widgets/LedCheckBox.cpp b/src/gui/widgets/LedCheckBox.cpp index f31d03b2c..1be072815 100644 --- a/src/gui/widgets/LedCheckBox.cpp +++ b/src/gui/widgets/LedCheckBox.cpp @@ -35,7 +35,7 @@ namespace lmms::gui { -static const QString names[LedCheckBox::NumColors] = +static const auto names = std::array { "led_yellow", "led_green", "led_red" } ; diff --git a/src/gui/widgets/MeterDialog.cpp b/src/gui/widgets/MeterDialog.cpp index 938177dce..ced08382e 100644 --- a/src/gui/widgets/MeterDialog.cpp +++ b/src/gui/widgets/MeterDialog.cpp @@ -43,12 +43,12 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) : { auto vlayout = new QVBoxLayout(this); vlayout->setSpacing( 0 ); - vlayout->setMargin( 0 ); + vlayout->setContentsMargins(0, 0, 0, 0); auto num = new QWidget(this); auto num_layout = new QHBoxLayout(num); num_layout->setSpacing( 0 ); - num_layout->setMargin( 0 ); + num_layout->setContentsMargins(0, 0, 0, 0); m_numerator = new LcdSpinBox( 2, num, tr( "Meter Numerator" ) ); @@ -69,7 +69,7 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) : auto den = new QWidget(this); auto den_layout = new QHBoxLayout(den); den_layout->setSpacing( 0 ); - den_layout->setMargin( 0 ); + den_layout->setContentsMargins(0, 0, 0, 0); m_denominator = new LcdSpinBox( 2, den, tr( "Meter Denominator" ) ); m_denominator->setToolTip(tr("Meter denominator")); diff --git a/src/gui/widgets/SimpleTextFloat.cpp b/src/gui/widgets/SimpleTextFloat.cpp new file mode 100644 index 000000000..d1f490b5e --- /dev/null +++ b/src/gui/widgets/SimpleTextFloat.cpp @@ -0,0 +1,62 @@ +/* + * TextFloat.cpp - class textFloat, a floating text-label + * + * Copyright (c) LMMS team + * + * 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. + * + */ + +#include "SimpleTextFloat.h" + +#include +#include +#include +#include + +#include "GuiApplication.h" +#include "MainWindow.h" + +namespace lmms::gui +{ + + +SimpleTextFloat::SimpleTextFloat() : + QWidget(getGUI()->mainWindow(), Qt::ToolTip) +{ + QHBoxLayout * layout = new QHBoxLayout(this); + layout->setMargin(3); + setLayout(layout); + + m_textLabel = new QLabel(this); + layout->addWidget(m_textLabel); +} + +void SimpleTextFloat::setText(const QString & text) +{ + m_textLabel->setText(text); +} + + +void SimpleTextFloat::setVisibilityTimeOut(int msecs) +{ + QTimer::singleShot(msecs, this, SLOT(hide())); + show(); +} + +} // namespace lmms::gui diff --git a/src/gui/widgets/TabBar.cpp b/src/gui/widgets/TabBar.cpp index d3c1fa0c5..806a93252 100644 --- a/src/gui/widgets/TabBar.cpp +++ b/src/gui/widgets/TabBar.cpp @@ -37,7 +37,7 @@ TabBar::TabBar( QWidget * _parent, QBoxLayout::Direction _dir ) : m_layout( new QBoxLayout( _dir, this ) ), m_exclusive( false ) { - m_layout->setMargin( 8 ); + m_layout->setContentsMargins(8, 8, 8, 8); m_layout->setSpacing( 0 ); setLayout( m_layout ); diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 106387e42..5ab56fee7 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -60,9 +60,9 @@ TabWidget::TabWidget(const QString & caption, QWidget * parent, bool usePixmap, setFont( pointSize<8>( font() ) ); setAutoFillBackground( true ); - QColor bg_color = QApplication::palette().color( QPalette::Active, QPalette::Background ). darker( 132 ); + QColor bg_color = QApplication::palette().color( QPalette::Active, QPalette::Window ). darker( 132 ); QPalette pal = palette(); - pal.setColor( QPalette::Background, bg_color ); + pal.setColor( QPalette::Window, bg_color ); setPalette( pal ); } diff --git a/src/gui/widgets/TextFloat.cpp b/src/gui/widgets/TextFloat.cpp index 99eb5531f..4eb14bd50 100644 --- a/src/gui/widgets/TextFloat.cpp +++ b/src/gui/widgets/TextFloat.cpp @@ -22,12 +22,15 @@ * */ +#include "TextFloat.h" + #include #include #include +#include +#include +#include -#include "TextFloat.h" -#include "gui_templates.h" #include "GuiApplication.h" #include "MainWindow.h" @@ -36,170 +39,97 @@ namespace lmms::gui TextFloat::TextFloat() : - QWidget( getGUI()->mainWindow(), Qt::ToolTip ), - m_title(), - m_text(), - m_pixmap() + TextFloat("", "", QPixmap()) { - resize( 20, 20 ); - hide(); - - setAttribute( Qt::WA_TranslucentBackground, true ); - setStyle( QApplication::style() ); - setFont( pointSize<8>( font() ) ); } - - - -void TextFloat::setTitle( const QString & _title ) +TextFloat::TextFloat(const QString & title, const QString & text, const QPixmap & pixmap) : + QWidget(getGUI()->mainWindow(), Qt::ToolTip) { - m_title = _title; - updateSize(); + QHBoxLayout * mainLayout = new QHBoxLayout(); + setLayout(mainLayout); + + // Create the label that displays the pixmap + m_pixmapLabel = new QLabel(this); + mainLayout->addWidget(m_pixmapLabel); + + // Create the widget that displays the title and the text + QWidget * titleAndTextWidget = new QWidget(this); + QVBoxLayout * titleAndTextLayout = new QVBoxLayout(); + titleAndTextWidget->setLayout(titleAndTextLayout); + + m_titleLabel = new QLabel(titleAndTextWidget); + m_titleLabel->setStyleSheet("font-weight: bold;"); + titleAndTextLayout->addWidget(m_titleLabel); + + m_textLabel = new QLabel(titleAndTextWidget); + titleAndTextLayout->addWidget(m_textLabel); + + mainLayout->addWidget(titleAndTextWidget); + + // Call the setters so that the hidden state is updated + setTitle(title); + setText(text); + setPixmap(pixmap); } - - - -void TextFloat::setText( const QString & _text ) +void TextFloat::setTitle(const QString & title) { - m_text = _text; - updateSize(); + m_titleLabel->setText(title); + m_titleLabel->setHidden(title.isEmpty()); } - - - -void TextFloat::setPixmap( const QPixmap & _pixmap ) +void TextFloat::setText(const QString & text) { - m_pixmap = _pixmap; - updateSize(); + m_textLabel->setText(text); + m_textLabel->setHidden(text.isEmpty()); } - - - -void TextFloat::setVisibilityTimeOut( int _msecs ) +void TextFloat::setPixmap(const QPixmap & pixmap) { - QTimer::singleShot( _msecs, this, SLOT(hide())); + m_pixmapLabel->setPixmap(pixmap); + m_pixmapLabel->setHidden(pixmap.isNull()); +} + +void TextFloat::setVisibilityTimeOut(int msecs) +{ + QTimer::singleShot(msecs, this, SLOT(hide())); show(); } - - - -TextFloat * TextFloat::displayMessage( const QString & _msg, int _timeout, - QWidget * _parent, int _add_y_margin ) +TextFloat * TextFloat::displayMessage(const QString & title, + const QString & msg, + const QPixmap & pixmap, + int timeout, QWidget * parent) { - QWidget * mw = getGUI()->mainWindow(); - auto tf = new TextFloat; - if( _parent != nullptr ) - { - tf->moveGlobal( _parent, QPoint( _parent->width() + 2, 0 ) ); - } - else - { - tf->moveGlobal( mw, QPoint( 32, mw->height() - tf->height() - 8 - _add_y_margin ) ); - } - tf->setText( _msg ); + auto tf = new TextFloat(title, msg, pixmap); + + // Show the widget so that the correct height is calculated in the code that follows tf->show(); - if( _timeout > 0 ) + + if(parent != nullptr) { - tf->setAttribute( Qt::WA_DeleteOnClose, true ); - QTimer::singleShot( _timeout, tf, SLOT(close())); - } - return( tf ); -} - - - - -TextFloat * TextFloat::displayMessage( const QString & _title, - const QString & _msg, - const QPixmap & _pixmap, - int _timeout, QWidget * _parent ) -{ - TextFloat * tf = displayMessage( _msg, _timeout, _parent, 16 ); - tf->setTitle( _title ); - tf->setPixmap( _pixmap ); - return( tf ); -} - - - - -void TextFloat::paintEvent( QPaintEvent * _pe ) -{ - QStyleOption opt; - opt.init( this ); - QPainter p( this ); - p.fillRect( 0, 0, width(), height(), QColor( 0, 0, 0, 0 ) ); - -/* p.setPen( p.pen().brush().color() ); - p.setBrush( p.background() );*/ - - p.setFont( pointSize<8>( p.font() ) ); - - style()->drawPrimitive( QStyle::PE_Widget, &opt, &p, this ); - -/* p.drawRect( 0, 0, rect().right(), rect().bottom() );*/ - - if( m_title.isEmpty() ) - { - p.drawText( opt.rect, Qt::AlignCenter, m_text ); + tf->moveGlobal(parent, QPoint(parent->width() + 2, 0)); } else { - int text_x = opt.rect.left() + 2; - int text_y = opt.rect.top() + 12; - if( m_pixmap.isNull() == false ) - { - p.drawPixmap( opt.rect.topLeft() + QPoint( 5, 5 ), m_pixmap ); - text_x += m_pixmap.width() + 8; - } - p.drawText( text_x, text_y + 16, m_text ); - QFont f = p.font(); - f.setBold( true ); - p.setFont( f ); - p.drawText( text_x, text_y, m_title ); + // If no parent is given move the window to the lower left area of the main window + QWidget * mw = getGUI()->mainWindow(); + tf->moveGlobal(mw, QPoint(32, mw->height() - tf->height() - 8)); } + + if (timeout > 0) + { + tf->setAttribute(Qt::WA_DeleteOnClose, true); + QTimer::singleShot(timeout, tf, SLOT(close())); + } + + return tf; } - - - -void TextFloat::mousePressEvent( QMouseEvent * ) +void TextFloat::mousePressEvent(QMouseEvent *) { close(); } - - - -void TextFloat::updateSize() -{ - QFontMetrics metrics( pointSize<8>( font() ) ); - QRect textBound = metrics.boundingRect( m_text ); - if( !m_title.isEmpty() ) - { - QFont f = pointSize<8>( font() ); - f.setBold( true ); - int title_w = QFontMetrics( f ).boundingRect( m_title ).width(); - if( title_w > textBound.width() ) - { - textBound.setWidth( title_w ); - } - textBound.setHeight( textBound.height() * 2 + 8 ); - } - if( m_pixmap.isNull() == false ) - { - textBound.setWidth( textBound.width() + m_pixmap.width() + 10 ); - } - resize( textBound.width() + 5, textBound.height()+2 ); - //move( QPoint( parentWidget()->width() + 5, 5 ) ); - update(); -} - - - } // namespace lmms::gui diff --git a/src/gui/widgets/TimeDisplayWidget.cpp b/src/gui/widgets/TimeDisplayWidget.cpp index cefa0fa8f..cf139d4a8 100644 --- a/src/gui/widgets/TimeDisplayWidget.cpp +++ b/src/gui/widgets/TimeDisplayWidget.cpp @@ -43,7 +43,7 @@ TimeDisplayWidget::TimeDisplayWidget() : m_milliSecondsLCD( 3, this ) { m_spinBoxesLayout.setSpacing( 0 ); - m_spinBoxesLayout.setMargin( 0 ); + m_spinBoxesLayout.setContentsMargins(0, 0, 0, 0); m_spinBoxesLayout.addWidget( &m_majorLCD ); m_spinBoxesLayout.addWidget( &m_minorLCD ); m_spinBoxesLayout.addWidget( &m_milliSecondsLCD ); diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 0e75c990a..7eb6bba11 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -609,8 +609,6 @@ void InstrumentTrack::setName( const QString & _new_name ) Track::setName( _new_name ); m_midiPort.setName( name() ); m_audioPort.setName( name() ); - - emit nameChanged(); } diff --git a/src/tracks/MidiClip.cpp b/src/tracks/MidiClip.cpp index e5bff8b6f..08e76ae59 100644 --- a/src/tracks/MidiClip.cpp +++ b/src/tracks/MidiClip.cpp @@ -424,7 +424,7 @@ void MidiClip::loadSettings( const QDomElement & _this ) { movePosition( _this.attribute( "pos" ).toInt() ); } - if( _this.attribute( "muted" ).toInt() != isMuted() ) + if (static_cast(_this.attribute("muted").toInt()) != isMuted()) { toggleMute(); } diff --git a/src/tracks/PatternTrack.cpp b/src/tracks/PatternTrack.cpp index 9fcc2c831..cdcd108ff 100644 --- a/src/tracks/PatternTrack.cpp +++ b/src/tracks/PatternTrack.cpp @@ -108,19 +108,27 @@ bool PatternTrack::play( const TimePos & _start, const fpp_t _frames, } TimePos lastPosition; - TimePos lastLen; + TimePos lastLength; + tick_t lastOffset = 0; for (const auto& clip : clips) { if (!clip->isMuted() && clip->startPosition() >= lastPosition) { lastPosition = clip->startPosition(); - lastLen = clip->length(); + lastLength = clip->length(); + tick_t patternLength = Engine::patternStore()->lengthOfPattern(static_cast(clip)->patternIndex()) + * TimePos::ticksPerBar(); + lastOffset = patternLength - (clip->startTimeOffset() % patternLength); + if (lastOffset == patternLength) + { + lastOffset = 0; + } } } - if( _start - lastPosition < lastLen ) + if( _start - lastPosition < lastLength ) { - return Engine::patternStore()->play(_start - lastPosition, _frames, _offset, s_infoMap[this]); + return Engine::patternStore()->play(_start - lastPosition + lastOffset, _frames, _offset, s_infoMap[this]); } return false; } @@ -240,4 +248,4 @@ void PatternTrack::swapPatternTracks(Track* track1, Track* track2) } -} // namespace lmms \ No newline at end of file +} // namespace lmms diff --git a/tests/scripted/check-namespace b/tests/scripted/check-namespace index 5f71505b2..a816f0d7b 100755 --- a/tests/scripted/check-namespace +++ b/tests/scripted/check-namespace @@ -77,7 +77,9 @@ exclude_files = re.compile( 'plugins/MidiExport/MidiFile.hpp|' 'plugins/ReverbSC/[a-z]|' 'plugins/Sf2Player/fluidsynthshims.h|' - '/portsmf/' + '/portsmf/|' + # only forward to headers that are not ours: + 'plugins/ZynAddSubFx/ThreadShims.h' ) files = [Path(f) for f in result.stdout.splitlines() if not exclude_files.search(f)] @@ -131,7 +133,7 @@ for cur_file in files: if cur_file.is_file(): cur_text = cur_file.read_text(errors='replace') - if str(cur_file) not in known_no_namespace_lmms: + if cur_file.as_posix() not in known_no_namespace_lmms: namespace_pattern.search(cur_text) or error(cur_file, None, f'File has no namespace lmms') header_guard = str(cur_file).endswith('.h')